Sunteți pe pagina 1din 1

METHOD if_ex_me_bapi_po_create_02~inbound.

IF im_aktyp = 'VER'. " Create mode i;e ME21n VER = chnage mode ME22N
*based on the CH_POHEADER-VENDOR select vendor type from LFA1 append structure
*select single zzvendor_type
**
from LFA1
**
into lv_vendor_type
**
where lifnr = CH_POHEADER-VENDOR
*if lv_vendor_type = 'ZFSV'.

FIELD-SYMBOLS <fs_sch> TYPE bapimeposchedule.


FIELD-SYMBOLS <fs_schx> TYPE bapimeposchedulx.
LOOP AT ch_schedule ASSIGNING <fs_sch>.
DATA: lv_date TYPE dats.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external
= <fs_sch>-delivery_date
ACCEPT_INITIAL_DATE
=
IMPORTING
date_internal
= lv_date
EXCEPTIONS
date_external_is_invalid
= 1
OTHERS
= 2
.
IF sy-subrc IS INITIAL.
lv_date = lv_date - 10.
WRITE lv_date TO <fs_sch>-delivery_date.
ENDIF.

ENDLOOP.
*Also update extenson flags
LOOP AT ch_schedulex ASSIGNING <fs_schx>.
<fs_schx>-delivery_date = 'X'.
ENDLOOP.
ENDIF.
FIELD-SYMBOLS :
<fs_item> TYPE bapimepoitem,
<fs_itemx> TYPE bapimepoitemx.
*Chnage the incoterms at header level
ch_poheader-incoterms1 = 'FOB'.
*Update the incoterms at header level extension
ch_poheaderx-incoterms1 = 'X'.
*Chnage the incoterms at header level
LOOP AT ch_item ASSIGNING <fs_item>.
<fs_item>-incoterms1 = 'FOB'.
ENDLOOP.
*Update the incoterms at header level extension
*Chnage the incoterms at header level
LOOP AT ch_itemx ASSIGNING <fs_itemx>.
<fs_itemx>-incoterms1 = 'X'.
ENDLOOP.
ENDMETHOD.

S-ar putea să vă placă și