Skip to Content
0
Feb 26, 2021 at 03:47 AM

#CoE#ST01 How to set DOCUMENTPROCESSINGMODE in CREATE Model in the logic of the BAdI

60 Views

Hi all, How to set my custom Logic effective only in creation mode
here is my custom Logic

-----------------

* This method can be used to set values to sales document header extension fields.
* Example:
*
* First of all assign existing extension field values to output parameter:
* salesdocument_extension_out = salesdocument_extension_in.
*
* Then change further values:
* if salesdocument-salesdocumenttype = 'TA'.
* salesdocument_extension_out-yy1_field_sdh = 'ABC'.
* endif.

DATA result_tab TYPE match_result_tab.

FIND ALL OCCURRENCES OF regex '^450.*' IN salesdocument-PurchaseOrderByCustomer RESULTS result_tab.
IF result_tab IS NOT INITIAL.
SELECT SINGLE YY1_PO_DeliveryWay_PDH,YY1_PO_ShipName_PDH,YY1_PO_ShipContact_PDH,YY1_PO_ShipPhone_PDH,YY1_PO_ShipAddress_PDH,YY1_FPurExplanation_PDH,YY1_PSubContractBillNO_PDH,YY1_FCustomerID_PDH,YY1_PO_CustomerDate_PDH
INTO (@salesdocument_extension_out-yy1_deliveryway_sdh,@salesdocument_extension_out-yy1_shipcustomername_sdh,@salesdocument_extension_out-yy1_shipcustomercontac_sdh,
@salesdocument_extension_out-yy1_shipcustomerphone_sdh,@salesdocument_extension_out-yy1_shipcustomeraddres_sdh,@salesdocument_extension_out-yy1_fexplanation_sdh,
@salesdocument_extension_out-yy1_subcontractbillno_sdh,@salesdocument_extension_out-yy1_customerid_sdh,@salesdocument_extension_out-yy1_customerdate_sdh)
FROM I_PurchaseOrderAPI01
WHERE PurchaseOrder = @salesdocument-PurchaseOrderByCustomer.
endif.

--------------

I've know

DOCUMENTPROCESSINGMODE: Contains information on whether the document is currently in one of the following processing modes: CREATE, CHANGE, or DISPLAY

But I don't know how to add this to my custom Logic