SAP ABAP 创建标准销售订单 BAPI_CUSTOMERRETURN_CREATE
FORM frm_call_bapi USING u_data TYPE zcmt0002.
DATA:lv_salesdocument TYPE bapivbeln-vbeln, "so
ls_sales_header_in TYPE bapisdhd1,
ls_sales_header_inx TYPE bapisdhd1x.
DATA:lt_return TYPE STANDARD TABLE OF bapiret2,
ls_return TYPE bapiret2,
ls_sales_schedules_in TYPE bapischdl,
lt_sales_schedules_in TYPE STANDARD TABLE OF bapischdl,
ls_sales_schedules_inx TYPE bapischdlx,
lt_sales_schedules_inx TYPE STANDARD TABLE OF bapischdlx,
lt_sales_conditions_in TYPE STANDARD TABLE OF bapicond,
ls_sales_conditions_in TYPE bapicond,
ls_sales_conditions_inx TYPE bapicondx,
lt_sales_conditions_inx TYPE STANDARD TABLE OF bapicondx,
ls_sales_items_in TYPE bapisditm,
lt_sales_items_in TYPE STANDARD TABLE OF bapisditm,
ls_sales_items_inx TYPE bapisditmx,
lt_sales_items_inx TYPE STANDARD TABLE OF bapisditmx,
ls_sales_partners TYPE bapiparnr,
lt_sales_partners TYPE STANDARD TABLE OF bapiparnr,
ls_extensionin TYPE bapiparex,
lt_extensionin TYPE STANDARD TABLE OF bapiparex,
lt_textheaders_ex TYPE TABLE OF bapisdtehd,
ls_textheaders_ex TYPE bapisdtehd,
lt_textlines_ex TYPE TABLE OF bapitextli,
ls_textlines_ex TYPE bapitextli,
lt_schedule_ex TYPE TABLE OF bapisdhedu,
ls_schedule_ex TYPE bapisdhedu,
lt_items_ex LIKE TABLE OF bapisdit,
ls_items_ex LIKE bapisdit.
DATA:lv_kunag TYPE vbak-kunnr,
lv_posnr TYPE vbap-posnr,
lv_str TYPE string,
lv_dwerk TYPE mvke-dwerk,
lv_matnr TYPE mvke-matnr,
lv_spart TYPE mara-spart,
lv_waers TYPE knvv-waers,
lv_num TYPE i.
DATA:lv_tdname TYPE thead-tdname, "
lt_tline TYPE TABLE OF tline, "
ls_tline TYPE tline.
READ TABLE gt_docs INTO DATA(ls_docs) WITH KEY bstkd = u_data-key_value01 .
IF sy-subrc = 0.
CLEAR:lv_salesdocument,ls_sales_header_in,ls_sales_header_inx,lt_item,
lt_return,lt_sales_schedules_in,lt_sales_schedules_inx,lt_sales_conditions_in,
lt_sales_conditions_inx,lt_sales_items_in ,lt_sales_items_inx,lt_sales_partners,
lt_extensionin, lt_textheaders_ex,ls_textheaders_ex,lt_textlines_ex,ls_textlines_ex ,
lt_schedule_ex ,ls_schedule_ex,lt_items_ex ,ls_items_ex,lv_kunag,lv_posnr,lv_str,
lv_matnr,lv_spart,lv_waers,lv_num.