销售订单增强字段 bapi更新
如果增强字段在销售订单抬头(vbak)上,则要将增强字段一并append到如下四个表/结构中:
- VBAKKOZ
- VBAKKOZX
- BAPE_VBAK
- BAPE_VBAKX
在行项目(vbap)上:
- VBAPKOZ
- VBAPKOZX
- BAPE_VBAP
- BAPE_VBAPX
在运货计划行(VBEP)上:
- VBEPKOZ
- BEPKOZX
- BAPE_VBEP
- BAPE_VBEPX
下面介绍如何向bapi中extensionin参数赋值数据,具体代码如
* 接口调用日志
DATA: LT_LOG TYPE STANDARD TABLE OF ZZT_INFLOG,
LW_LOG TYPE ZZT_INFLOG.
DATA: ORDER_HEADER_INX LIKE BAPISDH1X,
SCHEDULE_LINES LIKE BAPISCHDL OCCURS 0 WITH HEADER LINE,
SCHEDULE_LINESX LIKE BAPISCHDLX OCCURS 0 WITH HEADER LINE,
ORDER_ITEM_IN LIKE BAPISDITM OCCURS 0 WITH HEADER LINE,
ORDER_ITEM_INX LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE,
RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
DATA: LWA_BAPE_VBAK TYPE BAPE_VBAK,
LWA_BAPE_VBAKX TYPE BAPE_VBAKX,
LWA_BAPE_VBAP TYPE BAPE_VBAP,
LWA_BAPE_VBAPX TYPE BAPE_VBAPX,
LWA_VALUEPART(240),
LIT_PAREX LIKE TABLE OF BAPIPAREX WITH HEADER LINE.
DATA: BEGIN OF IT_TAB OCCURS 0,
VBELN TYPE VBELN,
POSNR TYPE POSNR,
ETENR TYPE ETENR,
LIFSP TYPE LIFSP_EP,
END OF IT_TAB.
RANGES: R_VBELN FOR VBAP-VBELN,
R_POSNR FOR VBAP-POSNR.
IF SALESDOCUMENT IS INITIAL.
E_STATU = 'E'.
E_MESS = '单号为空!'.
EXIT.
ENDIF.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = SALESDOCUMENT
IMPORTING
OUTPUT = SALESDOCUMENT.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = SALESPOSNR
IMPORTING
OUTPUT = SALESPOSNR.
IF SALESDOCUMENT IS NOT INITIAL.
R_VBELN-SIGN = 'I'.
R_VBELN-OPTION = 'EQ'.
R_VBELN-LOW = SALESDOCUMENT.
APPEND R_VBELN.
ENDIF.
IF SALESPOSNR IS NOT INITIAL.
R_POSNR-SIGN = 'I'.
R_POSNR-OPTION = 'EQ'.
R_POSNR-LOW = SALESPOSNR.
APPEND R_POSNR.
ENDIF.
***获得计划行号
SELECT VBELN POSNR ETENR LIFSP
INTO TABLE IT_TAB
FROM VBEP
WHERE VBELN IN R_VBELN
AND POSNR IN R_POSNR
AND ETENR = '0001'.
IF IT_TAB[] IS INITIAL.
E_STATU = 'E'.
E_MESS = '订单项的计划行数据不存在!'.
EXIT.
ENDIF.
ORDER_HEADER_INX-UPDATEFLAG = 'U'.
LOOP AT IT_TAB.
SCHEDULE_LINES-ITM_NUMBER = IT_TAB-POSNR.
SCHEDULE_LINES-SCHED_LINE = IT_TAB-ETENR.
SCHEDULE_LINES-REQ_DLV_BL = REQ_DLV_BL. " Q1/Q2
IF REQ_DATE IS NOT INITIAL.
SCHEDULE_LINES-REQ_DATE