sap will automatically copy the append fields of vbap to vbrp.(assume the append fields name in vbap and vbrp are just the same ).
if you want to copy customer fields from lips to vbrp,
you should make change the userexit_fill_vbrk_vbrp. (LV60AA93 Line No.476 : the last line of LV60AA93)
2018年12月19日星期三
add customer append items(BAPI_DELIVERYPROCESSING_EXEC)
1. Add append Items to structure (LESHP_DELIVERY_CREATE,SHP_VORGABE_DATEN)
2. BAPI_DELIVERYPROCESSING_EXEC (Line:186 OR Line:211)
if not gi_bapi_dlvexec_ex is initial.
call badi gi_bapi_dlvexec_ex->process_extensions
exporting
it_request = request[]
it_partner_addr = partner_addr[]
it_partner = partner[]
it_bapiextc = extension1[]
it_bapiext = extension2[]
it_extensionin = extensionin[]
changing
ct_package_to_deliver = lt_package_to_deliver
ct_delivery_extend = ls_delivery_extend
cs_control = ls_control
ct_interface_internal = lt_interface_internal.
endif.
perform userexit_prepare_001 tables
request
extension1
extension2
using
techn_control "n_711530
delivery_extend
changing
ls_delivery_extend
ls_control
lt_interface_internal
lt_package_to_deliver
lf_subrc.
USERExit Sample:
userexit_prepare_001
DATA:
l_tbl_interface_internal TYPE STANDARD TABLE OF leshp_delivery_create,
l_rec_extension2 LIKE LINE OF it_extension2,
l_field TYPE string.
FIELD-SYMBOLS:
<lfs_interface_internal> LIKE LINE OF ct_interface_internal,
<lfs_field> TYPE any.
APPEND LINES OF ct_interface_internal TO l_tbl_interface_internal.
LOOP AT it_extension2 INTO l_rec_extension2.
* READ Interface table
READ TABLE l_tbl_interface_internal
ASSIGNING <lfs_interface_internal>
INDEX l_rec_extension2-row.
IF sy-subrc IS INITIAL.
* Field assign
CONCATENATE '<lfs_interface_internal>-'
l_rec_extension2-field
INTO l_field.
ASSIGN (l_field) TO <lfs_field>.
IF sy-subrc IS INITIAL.
MOVE:
l_rec_extension2-value TO <lfs_field>.
ENDIF.
ENDIF.
ENDLOOP.
CLEAR ct_interface_internal.
INSERT LINES OF l_tbl_interface_internal INTO TABLE ct_interface_internal.
3.LV50R_CREAF34 (Line.13)
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form userexit_prepare_002
*&---------------------------------------------------------------------*
FORM userexit_prepare_002
USING is_create_interface TYPE leshp_delivery_create
CHANGING cs_vorgabe_daten TYPE shp_vorgabe_daten.
CALL CUSTOMER-FUNCTION '002'
EXPORTING is_interface_internal = is_create_interface
CHANGING cs_vorgabe_daten = cs_vorgabe_daten.
ENDFORM. " userexit_prepare_002
For Example:
MOVE:
is_interface_internal-yyXXX TO cs_vorgabe_daten-yyXXX,
is_interface_internal-yyXXX2 TO cs_vorgabe_daten-yyXXXX2,
is_interface_internal-yyXXXX TO cs_vorgabe_daten-yyXXXX.
4.LV50R_CREAF34 (Line.33)
*&---------------------------------------------------------------------*
*& Form userexit_prepare_003
*&---------------------------------------------------------------------*
FORM userexit_prepare_003
USING is_create_interface TYPE leshp_delivery_create
CHANGING cs_komdlgn TYPE komdlgn.
CALL CUSTOMER-FUNCTION '003'
EXPORTING is_interface_internal = is_create_interface
CHANGING cs_komdlgn = cs_komdlgn.
ENDFORM. " userexit_prepare_003
For Example:
MOVE:
is_interface_internal-yyXXX TO cs_komdlgn-yyXXXX,
is_interface_internal-yyXXXX2 TO cs_komdlgn-yyXXXX2,
is_interface_internal-yyXXXX TO cs_komdlgn-yyXXXX.
5.MV50AFZ1 (Line77)
FORM USEREXIT_MOVE_FIELD_TO_LIPS.
* LIPS-zzfield = xxxx-zzfield2.
*{ INSERT FFDK905325 1
DATA:
l_rec_cvbap LIKE LINE OF CVBAP.
* SD Create Delivery
IF gs_vorgabe_daten IS NOT INITIAL.
* Read CVBAP
READ TABLE cvbap INTO l_rec_cvbap
WITH KEY vbeln = lips-vgbel
posnr = lips-vgpos.
IF SY-SUBRC IS INITIAL.
* Field Copy
MOVE:
l_rec_cvbap-yyXXXX TO lips-yyXXXX,
l_rec_cvbap-yyXXXX2 TO lips-yyXXXX2.
ENDIF.
* Field Copy
MOVE:
gs_vorgabe_daten-yyXXXXX TO lips-yyXXXX.
ENDIF.
* MM Create Delivery
IF gs_komdlgn IS NOT INITIAL.
* Field Copy
MOVE:
gs_komdlgn-yyXXXX TO lips-yyXXX,
gs_komdlgn-yyXXXX2 TO lips-yyXXXX2,
gs_komdlgn-yyXXXXX TO lips-yyXXXX.
ENDIF.
*} INSERT
ENDFORM.
2. BAPI_DELIVERYPROCESSING_EXEC (Line:186 OR Line:211)
if not gi_bapi_dlvexec_ex is initial.
call badi gi_bapi_dlvexec_ex->process_extensions
exporting
it_request = request[]
it_partner_addr = partner_addr[]
it_partner = partner[]
it_bapiextc = extension1[]
it_bapiext = extension2[]
it_extensionin = extensionin[]
changing
ct_package_to_deliver = lt_package_to_deliver
ct_delivery_extend = ls_delivery_extend
cs_control = ls_control
ct_interface_internal = lt_interface_internal.
endif.
perform userexit_prepare_001 tables
request
extension1
extension2
using
techn_control "n_711530
delivery_extend
changing
ls_delivery_extend
ls_control
lt_interface_internal
lt_package_to_deliver
lf_subrc.
USERExit Sample:
userexit_prepare_001
DATA:
l_tbl_interface_internal TYPE STANDARD TABLE OF leshp_delivery_create,
l_rec_extension2 LIKE LINE OF it_extension2,
l_field TYPE string.
FIELD-SYMBOLS:
<lfs_interface_internal> LIKE LINE OF ct_interface_internal,
<lfs_field> TYPE any.
APPEND LINES OF ct_interface_internal TO l_tbl_interface_internal.
LOOP AT it_extension2 INTO l_rec_extension2.
* READ Interface table
READ TABLE l_tbl_interface_internal
ASSIGNING <lfs_interface_internal>
INDEX l_rec_extension2-row.
IF sy-subrc IS INITIAL.
* Field assign
CONCATENATE '<lfs_interface_internal>-'
l_rec_extension2-field
INTO l_field.
ASSIGN (l_field) TO <lfs_field>.
IF sy-subrc IS INITIAL.
MOVE:
l_rec_extension2-value TO <lfs_field>.
ENDIF.
ENDIF.
ENDLOOP.
CLEAR ct_interface_internal.
INSERT LINES OF l_tbl_interface_internal INTO TABLE ct_interface_internal.
3.LV50R_CREAF34 (Line.13)
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form userexit_prepare_002
*&---------------------------------------------------------------------*
FORM userexit_prepare_002
USING is_create_interface TYPE leshp_delivery_create
CHANGING cs_vorgabe_daten TYPE shp_vorgabe_daten.
CALL CUSTOMER-FUNCTION '002'
EXPORTING is_interface_internal = is_create_interface
CHANGING cs_vorgabe_daten = cs_vorgabe_daten.
ENDFORM. " userexit_prepare_002
For Example:
MOVE:
is_interface_internal-yyXXX TO cs_vorgabe_daten-yyXXX,
is_interface_internal-yyXXX2 TO cs_vorgabe_daten-yyXXXX2,
is_interface_internal-yyXXXX TO cs_vorgabe_daten-yyXXXX.
4.LV50R_CREAF34 (Line.33)
*&---------------------------------------------------------------------*
*& Form userexit_prepare_003
*&---------------------------------------------------------------------*
FORM userexit_prepare_003
USING is_create_interface TYPE leshp_delivery_create
CHANGING cs_komdlgn TYPE komdlgn.
CALL CUSTOMER-FUNCTION '003'
EXPORTING is_interface_internal = is_create_interface
CHANGING cs_komdlgn = cs_komdlgn.
ENDFORM. " userexit_prepare_003
For Example:
MOVE:
is_interface_internal-yyXXX TO cs_komdlgn-yyXXXX,
is_interface_internal-yyXXXX2 TO cs_komdlgn-yyXXXX2,
is_interface_internal-yyXXXX TO cs_komdlgn-yyXXXX.
5.MV50AFZ1 (Line77)
FORM USEREXIT_MOVE_FIELD_TO_LIPS.
* LIPS-zzfield = xxxx-zzfield2.
*{ INSERT FFDK905325 1
DATA:
l_rec_cvbap LIKE LINE OF CVBAP.
* SD Create Delivery
IF gs_vorgabe_daten IS NOT INITIAL.
* Read CVBAP
READ TABLE cvbap INTO l_rec_cvbap
WITH KEY vbeln = lips-vgbel
posnr = lips-vgpos.
IF SY-SUBRC IS INITIAL.
* Field Copy
MOVE:
l_rec_cvbap-yyXXXX TO lips-yyXXXX,
l_rec_cvbap-yyXXXX2 TO lips-yyXXXX2.
ENDIF.
* Field Copy
MOVE:
gs_vorgabe_daten-yyXXXXX TO lips-yyXXXX.
ENDIF.
* MM Create Delivery
IF gs_komdlgn IS NOT INITIAL.
* Field Copy
MOVE:
gs_komdlgn-yyXXXX TO lips-yyXXX,
gs_komdlgn-yyXXXX2 TO lips-yyXXXX2,
gs_komdlgn-yyXXXXX TO lips-yyXXXX.
ENDIF.
*} INSERT
ENDFORM.
BAPI_GOODSMVT_CREATE(ADD CUSTOMER FIELD )
HEADER: ADD Customer Fields to structure of IMKPF and BAPI_TE_XMKPF.
Items: ADD Customer Fields to structure of IMSEG and BAPI_TE_XMSEG.
Implements the Badi:
Line 417 of Function BAPI_GOODSMVT_CREATE .
TRY.
call badi lo_mb_bapi_goodsmvt_create->extensionin_to_matdoc
EXPORTING
EXTENSION_IN = EXTENSIONIN[]
CHANGING
CS_IMKPF = S_IMKPF
CT_IMSEG = T_IMSEG[]
CT_RETURN = return.
CATCH cx_badi_initial_reference. "#EC NO_HANDLER
ENDTRY.
METHOD IF_EX_MB_BAPI_GOODSMVT_CREATE~EXTENSIONIN_TO_MATDOC.
DATA:
c_lenstruc TYPE i VALUE 30,
wa_bapi_mb_header TYPE bapi_te_xmkpf,
wa_bapi_mb_item TYPE bapi_te_xmseg,
wa_extension_in TYPE bapiparex.
FIELD-SYMBOLS:
<fs_imseg> TYPE imseg.
CHECK NOT extension_in[] IS INITIAL.
* Analyze IMSEG for document structure and assign LINE_IDs if necessary
CALL METHOD cl_mmim_line_id_manager=>analyze_mb_create
CHANGING
ct_imseg = ct_imseg[]
EXCEPTIONS
duplicate_line_id = 1
OTHERS = 2.
LOOP AT extension_in INTO wa_extension_in.
CASE wa_extension_in-structure.
* extension of MKPF
WHEN 'BAPI_TE_XMKPF'.
MOVE wa_extension_in+c_lenstruc TO wa_bapi_mb_header.
MOVE-CORRESPONDING wa_bapi_mb_header TO cs_imkpf.
* extension of MSEG
WHEN 'BAPI_TE_XMSEG'.
MOVE wa_extension_in+c_lenstruc TO wa_bapi_mb_item.
READ TABLE ct_imseg
WITH KEY line_id = wa_bapi_mb_item-matdoc_itm
ASSIGNING <fs_imseg>.
IF sy-subrc EQ 0.
MOVE-CORRESPONDING wa_bapi_mb_item TO <fs_imseg>.
ENDIF.
ENDCASE.
ENDLOOP.
ENDMETHOD.
Items: ADD Customer Fields to structure of IMSEG and BAPI_TE_XMSEG.
Implements the Badi:
Line 417 of Function BAPI_GOODSMVT_CREATE .
TRY.
call badi lo_mb_bapi_goodsmvt_create->extensionin_to_matdoc
EXPORTING
EXTENSION_IN = EXTENSIONIN[]
CHANGING
CS_IMKPF = S_IMKPF
CT_IMSEG = T_IMSEG[]
CT_RETURN = return.
CATCH cx_badi_initial_reference. "#EC NO_HANDLER
ENDTRY.
METHOD IF_EX_MB_BAPI_GOODSMVT_CREATE~EXTENSIONIN_TO_MATDOC.
DATA:
c_lenstruc TYPE i VALUE 30,
wa_bapi_mb_header TYPE bapi_te_xmkpf,
wa_bapi_mb_item TYPE bapi_te_xmseg,
wa_extension_in TYPE bapiparex.
FIELD-SYMBOLS:
<fs_imseg> TYPE imseg.
CHECK NOT extension_in[] IS INITIAL.
* Analyze IMSEG for document structure and assign LINE_IDs if necessary
CALL METHOD cl_mmim_line_id_manager=>analyze_mb_create
CHANGING
ct_imseg = ct_imseg[]
EXCEPTIONS
duplicate_line_id = 1
OTHERS = 2.
LOOP AT extension_in INTO wa_extension_in.
CASE wa_extension_in-structure.
* extension of MKPF
WHEN 'BAPI_TE_XMKPF'.
MOVE wa_extension_in+c_lenstruc TO wa_bapi_mb_header.
MOVE-CORRESPONDING wa_bapi_mb_header TO cs_imkpf.
* extension of MSEG
WHEN 'BAPI_TE_XMSEG'.
MOVE wa_extension_in+c_lenstruc TO wa_bapi_mb_item.
READ TABLE ct_imseg
WITH KEY line_id = wa_bapi_mb_item-matdoc_itm
ASSIGNING <fs_imseg>.
IF sy-subrc EQ 0.
MOVE-CORRESPONDING wa_bapi_mb_item TO <fs_imseg>.
ENDIF.
ENDCASE.
ENDLOOP.
ENDMETHOD.
订阅:
博文 (Atom)
Customer Characteristic
Characteristic Descriptions are stored in the table - CABNT - Language - SPRAS - Characteristic description - ATBEZ Characteristic Values ...
-
REPORT ZBPADD2 . DATA : L_PARTN_CAT TYPE BAPIBUS1006_HEAD - PARTN_CAT , LS_CENTRAL TYPE BAPIBUS1006_CENTRAL , ...
-
HEADER: ADD Customer Fields to structure of IMKPF and BAPI_TE_XMKPF. Items: ADD Customer Fields to structure of IMSEG and BAPI_TE_XMSEG....
-
FUNCTION:SD_SALESDOCUMENT_CREATE Append fiels to Structure below. BAPE_VBAP BAPE_VBAPX VBAPKOZ VBAPKOZX No need to append fields to Struc...