货铺QQ群号:834508274
REPORT ZLM_PR_CHANGE.
PARAMETERS : P_BANFN TYPE VBEP-BANFN OBLIGATORY.
DATA:
LS_PRHEADER LIKE BAPIMEREQHEADER, "
LS_PRHEADERX LIKE BAPIMEREQHEADERX, "
TESTRUN TYPE BAPIFLAG-BAPIFLAG, "
WITH HEADER LINE, "
LT_PRITEM LIKE TABLE OF BAPIMEREQITEM WITH HEADER LINE, "
LIKE TABLE OF BAPIMEREQITEMX WITH HEADER LINE, "
LS_PRITEMX TYPE BAPIMEREQITEMX,
IV_BANFN TYPE EBAN-BANFN. "OK
DATA: LT_PRITEM1 TYPE TABLE OF BAPIMEREQITEMIMP WITH HEADER LINE. "
DATA: LS_PRITEM TYPE BAPIMEREQITEM.
DATA: LV_LINECNT TYPE N.
IV_BANFN = P_BANFN.
CALL FUNCTION 'BAPI_PR_GETDETAIL' EXPORTING NUMBER = IV_BANFN ACCOUNT_ASSIGNMENT = 'X' ITEM_TEXT = 'X' HEADER_TEXT = 'X' DELIVERY_ADDRESS = 'X' VERSION = 'X' "version IMPORTING PRHEADER = LS_PRHEADERTABLES PRITEM = LT_PRITEMRETURNEXCEPTIONS0.
CLEAR
LOOP AT LT_PRITEM INTO
MOVE-CORRESPONDING LS_PRITEM TO
APPEND LT_PRITEM1.
CLEAR
ENDLOOP.
LS_PRHEADERX-PREQ_NO = 'X'.
LS_PRHEADERX-ITEM_INTVL = 'X'.
READ TABLE LT_PRITEM INTO LS_PRITEM INDEX 1.
MOVE-CORRESPONDING LS_PRITEM TO
LT_PRITEM1-PREQ_ITEM = 20.
APPEND LT_PRITEM1.
LS_PRITEMX-PREQ_ITEM = LV_LINECNT + 10.
LS_PRITEMX-PREQ_ITEMX = 'X'.
LS_PRITEMX-MATERIAL = 'X'.
LS_PRITEMX-PLANT = 'X'.
LS_PRITEMX-STORE_LOC = 'X'.
LS_PRITEMX-PUR_GROUP = 'X'.
LS_PRITEMX-QUANTITY = 'X'.
LS_PRITEMX-UNIT = 'X'.
LS_PRITEMX-DEL_DATCAT_EXT = 'X'.
LS_PRITEMX-DELIV_DATE = 'X'.
LS_PRITEMX-FIXED_VEND = 'X'.
LS_PRITEMX-PREQ_PRICE = 'X'.
LS_PRITEMX-PRICE_UNIT = 'X'.
LS_PRITEMX-PURCH_ORG = 'X'.
LS_PRITEMX-VEND_MAT = 'X'.
APPEND LS_PRITEMX TO
CALL FUNCTION 'BAPI_PR_CHANGE' EXPORTINGNUMBER* PRHEADER = ls_PRHEADER* PRHEADERX = ls_PRHEADERX* testrun = testrun*IMPORTING* PRHEADEREXP = ls_PRHEADEREXPTABLES PRITEMX = LT_PRITEMX PRITEM = LT_PRITEM1RETURNEXCEPTIONS01.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTINGWAIT = 'X'.