關於BAPI擴充套件欄位賦值
例項一: t_extensionin-structure = 'BAPI_TE_MARA'. wa_temara-material = gw_data-matnr. wa_temara-bismt = gw_data-bismt. CALL METHOD cl_abap_container_utilities=>fill_container_c EXPORTING im_value = wa_temara+0(36) IMPORTING ex_container = t_extensionin-valuepart1. APPEND t_extensionin. t_extensioninx-structure = 'BAPI_TE_MARAX'. wa_temarax-material = gw_data-matnr. wa_temarax-bismt = 'X'. CALL METHOD cl_abap_container_utilities=>fill_container_c EXPORTING im_value = wa_temarax+0(19) IMPORTING ex_container = t_extensionin-valuepart1. APPEND t_extensioninx. CLEAR: wa_temara, wa_temarax, t_extensioninx, t_extensionin. 例項二: CLEAR lw_exten. lw_exten-vsart = gw_data-vsart. "裝運型別 lw_exten-zcchm = gw_data-zcchm . "車(船)號 lw_exten-zsjxm = gw_data-zsjxm . "司機姓名 lw_exten-zshfzh = gw_data-zshfzh . "身份證號 lw_exten-zdhhm = gw_data-zdhhm . "電話 lw_exten-zbz = gw_data-zbz . "備註 IF lw_exten IS NOT INITIAL. PERFORM frm_extension TABLES lt_extension_in USING 'ZSSD003_EXTENSION' lw_exten . ENDIF. *&---------------------------------------------------------------------*
*& Form FRM_EXTENSION
&---------------------------------------------------------------------
-
text
----------------------------------------------------------------------
-
-->PT_EXTENSION_IN text
-
-->PV_STRUCTURE text
-
-->PW_EXTENSION text
----------------------------------------------------------------------
FORM frm_extension TABLES pt_extension_in
USING pv_structure
pw_extension
.
DATA: lw_extension_in TYPE bapiparex,
lv_len TYPE i,
lv_begin TYPE i.
"通過測試長度,自動填加四個附加結構欄位,
"欄位增加多少,都不能再對欄位長度,
"但不能超960
CLEAR: lv_len.
CLEAR lw_extension_in.
lv_len = strlen( pw_extension ).
lw_extension_in-structure = pv_structure.
CALL METHOD cl_abap_container_utilities=>fill_container_c
EXPORTING
im_value = pw_extension
IMPORTING
ex_container = lw_extension_in-valuepart1.
IF lv_len > 240.
lv_begin = 240.
CALL METHOD cl_abap_container_utilities=>fill_container_c
EXPORTING
im_value = pw_extension+lv_begin
IMPORTING
ex_container = lw_extension_in-valuepart2.
ENDIF.
IF lv_len > 480.
lv_begin = 480.
CALL METHOD cl_abap_container_utilities=>fill_container_c
EXPORTING
im_value = pw_extension+lv_begin
IMPORTING
ex_container = lw_extension_in-valuepart3.
ENDIF.
IF lv_len > 720.
lv_begin = 720.
CALL METHOD cl_abap_container_utilities=>fill_container_c
EXPORTING
im_value = pw_extension+lv_begin
IMPORTING
ex_container = lw_extension_in-valuepart4.
ENDIF.
APPEND lw_extension_in TO pt_extension_in.
ENDFORM.