标签:
分类: Linux
MethodSalesOrder.ChangeFromData |
|
Change Sales Order | |
FunctionalityYou can use this method to change or delete sales orders. You can change header, item, schedule line and configuration data. In general, note that you should:
|
*****************************************************************************
贴一段程序帮助编写bapi
* BAPI Logic for sales order creation
*---------------------------------------------------------------
* Header data
PERFORM FILL_ORDER_HEADER_CHANGE USING ORDER_HEADER_IN
ORDER_HEADER_INX
LS_SORDER.
* Partner
PERFORM FILL_PARTNER_CHANGE TABLES PARTNERCHANGES
PT_ITEMS
USING LS_SORDER.
* Items
PERFORM FILL_ORDER_ITEM_CHANGE TABLES ORDER_ITEMS_IN
ORDER_ITEMS_INX
PT_ITEMS.
* Price condition
IF PS_SORDER-MIG_FLG = ‘ ‘.
PERFORM FILL_CONDITIONS_CHANGE TABLES CONDITIONS_IN
CONDITIONS_INX
PT_ITEMS
USING LS_SORDER.
ELSE.
CONDITIONS_IN[] = PT_CONDTION[].
CONDITIONS_INX[] = PT_CONDTIONX[].
ENDIF.
CALL FUNCTION ‘BAPI_SALESORDER_CHANGE‘
EXPORTING
SALESDOCUMENT = LS_SORDER-VBELN
ORDER_HEADER_IN = ORDER_HEADER_IN (抬头数据)
ORDER_HEADER_INX = ORDER_HEADER_INX
TABLES
RETURN = PT_RETURN
ORDER_ITEM_IN = ORDER_ITEMS_IN
ORDER_ITEM_INX = ORDER_ITEMS_INX
CONDITIONS_IN = CONDITIONS_IN
CONDITIONS_INX = CONDITIONS_INX
PARTNERCHANGES = PARTNERCHANGES.
READ TABLE PT_RETURN WITH KEY TYPE = ‘S‘
ID = ‘V1‘
NUMBER = ‘311‘.
IF SY-SUBRC EQ 0.
CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT‘
EXPORTING
WAIT = ‘X‘.
ELSE.
CALL FUNCTION ‘BAPI_TRANSACTION_ROLLBACK‘.
ENDIF.
**************************************************************
更改订单文本信息的bapi
lt_order_header_inx-updateflag = ‘U‘.
APPEND lt_order_header_inx.
CONDENSE gt_out-headtext.
lt_order_text-doc_number = lt_salesdocument.
lt_order_text-text_id = ‘Z002‘.
lt_order_text-langu = 1.
lt_order_text-text_line = gt_out-headtext.
APPEND lt_order_text.
CALL FUNCTION ‘BAPI_SALESORDER_CHANGE‘
EXPORTING
salesdocument = lt_salesdocument
order_header_inx = lt_order_header_inx
TABLES
return = lt_return
order_text = lt_order_text.
CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT‘
EXPORTING
wait = ‘X‘.
*****************************************************************************
tcode对应的bapi
Transaction BAPI
MM01 BAPI_MATERIAL_SAVEDATA
MM02 BAPI_MATERIAL_SAVEDATA
VA01 BAPI_SALESORDER_CREATEFROMDAT2
VA02 BAPI_SALESORDER_CHANGE
ME21/ME21n BAPI_PO_CREATE1
ME22/ME22n BAPI_PO_CHANGE
ME51 BAPI_REQUISITION_CREATE
AS01 BAPI_FIXEDASSET_CREATE1
AS02 BAPI_FIXEDASSET_CHANGE
Transaction | BAPI |
---|---|
MM01 | BAPI_MATERIAL_SAVEDATA |
MM02 | BAPI_MATERIAL_SAVEDATA |
VA01 | BAPI_SALESORDER_CREATEFROMDAT2 |
VA02 | BAPI_SALESORDER_CHANGE |
ME21/ME21n | BAPI_PO_CREATE1 |
ME22/ME22n | BAPI_PO_CHANGE |
ME51 | BAPI_REQUISITION_CREATE |
AS01 | BAPI_FIXEDASSET_CREATE1 |
AS02 | BAPI_FIXEDASSET_CHANGE |
BAPI 修改销售订单的方法 ‘BAPI_SALESORDER_CHANGE’
标签:
原文地址:http://www.cnblogs.com/lojamm/p/4793412.html