Here we will see - "How to enable BAPI to update the custom fields".




CONSTANTS : lc_ext TYPE te_struc VALUE 'BAPI_TE_MEPOITEM',
lc_extx TYPE te_struc VALUE 'BAPI_TE_MEPOITEMX'.
DATA : ls_ext TYPE bapi_te_mepoitem,
ls_extx TYPE bapi_te_mepoitemx.
* get codepage handler
DATA(lo_parex) = cl_mmpur_bapi_po=>get_codepage_handler( ).
* perform conversion from container to structure
IF poitem IS SUPPLIED AND poitem-ebelp IS NOT INITIAL.
LOOP AT extensionin REFERENCE INTO DATA(lr_parex).
CLEAR ls_ext.
CHECK lr_parex->structure EQ lc_ext.
TRY.
lo_parex->cont_to_struc( EXPORTING cont = lr_parex->*+30
langu = sy-langu
IMPORTING struc = ls_ext ).
CHECK poitem-ebelp EQ ls_ext-po_item.
* Fill the custom fields :
poitem-<fieldname> = ls_ext-<fieldname>.
EXIT.
CATCH cx_sy_conversion_codepage.
CONTINUE.
CATCH cx_parameter_invalid_range.
CONTINUE.
ENDTRY.
ENDLOOP.
ENDIF.
IF poitemx IS SUPPLIED AND poitemx-ebelp_key IS NOT INITIAL.
LOOP AT extensionin REFERENCE INTO lr_parex.
CLEAR ls_extx.
CHECK lr_parex->structure EQ lc_extx.
TRY.
lo_parex->cont_to_struc( EXPORTING cont = lr_parex->*+30
langu = sy-langu
IMPORTING struc = ls_extx ).
CHECK poitemx-ebelp_key EQ ls_extx-po_item.
* Fill the custom fields X flags :
poitemx-<fieldname> = ls_extx-<fieldname>.
EXIT.
CATCH cx_sy_conversion_codepage.
CONTINUE.
CATCH cx_parameter_invalid_range.
CONTINUE.
ENDTRY.
ENDLOOP.
ENDIF.You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 13 | |
| 12 | |
| 9 | |
| 6 | |
| 6 | |
| 5 | |
| 5 | |
| 4 | |
| 4 | |
| 4 |