Register Login

BAPI to create Sales Order with reference to Scheduling Agreement

Updated May 19, 2018

Hello, 

I am trying to create Sales Order with reference to Scheduling Agreement, but although the order gets created, it does not contain reference document information.
The BAPI I am using is BAPI_SALESORDER_CREATEFROMDAT2.
Would someone know which parameters I have to papulate,or have any other suggestion

how to accomplish my task?

Thank you so much,

 


Comments

  • 13 Oct 2011 9:03 am rekha
    Try using
    ORDER_HEADER_IN-REFDOCTYPE = Your Sch. Agreement No. (Please Check) and
    ORDER_HEADER_IN-SD_DOC_CAT = 'E'.
  • 13 Oct 2011 9:05 am rekha
    Here are the parameters I am populating (including the once you have mentioned).
    Unfortunately, the order gets created with out Scheduling Agreement reference.

    Any idea why?

    Thank you,

    ************** CODE **************************************
    * local data
    DATA: HEADER LIKE BAPISDHD1.
    DATA: I_PARTNERS LIKE BAPIPARNR OCCURS 1 WITH HEADER LINE.
    DATA: I_ITEM LIKE BAPISDITM OCCURS 10 WITH HEADER LINE.
    DATA: I_SCHEDULE LIKE BAPISCHDL OCCURS 10 WITH HEADER LINE.
    DATA: RETURN LIKE BAPIRET2 OCCURS 1 WITH HEADER LINE.

    * order header values
    HEADER-DOC_TYPE = 'ZSED'.
    HEADER-SALES_ORG = ZCONSGAGRMWK-VKORG.
    HEADER-DISTR_CHAN = ZCONSGAGRMWK-VTWEG.
    HEADER-DIVISION = ZCONSGAGRMWK-SPART.
    HEADER-PURCH_DATE = ZCONSGACTVSV-TRNACTDAT.
    HEADER-PURCH_NO_C = ZCONSGACTVWK-PONUM.
    HEADER-REF_DOC = ZCONSGAGRMSV-SCHDAGRM.
    HEADER-REFDOC_CAT = 'E'.
    HEADER-ASS_NUMBER = ZCONSGACTVSV-HUBREFNUM.

    * order item level data
    I_ITEM-ITM_NUMBER = '000010'.
    I_ITEM-MATERIAL = ZCONSGACTVSV-MLXPART.
    I_ITEM-ROUTE = CON-ROUTE.

    IF NOT ZCONSGAGRMSV-CHARG IS INITIAL.
    I_ITEM-BATCH = ZCONSGAGRMSV-CHARG.
    ELSE.
    I_ITEM-BATCH = '1'.
    ENDIF.

    I_SCHEDULE-ITM_NUMBER = '000010'.
    I_SCHEDULE-REQ_QTY = ZCONSGACTVWK-QTY.

    I_PARTNERS-PARTN_ROLE = 'AG'. " Soldto
    I_PARTNERS-PARTN_NUMB = ZCONSGAGRMSV-SOLDTO.

    APPEND: I_ITEM,
    I_SCHEDULE,
    I_PARTNERS.

    CLEAR: I_ITEM,
    I_SCHEDULE,
    I_PARTNERS.

    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
    EXPORTING
    * SALESDOCUMENTIN =
    ORDER_HEADER_IN = HEADER
    * ORDER_HEADER_INX =
    * SENDER =
    * BINARY_RELATIONSHIPTYPE =
    * INT_NUMBER_ASSIGNMENT =
    * BEHAVE_WHEN_ERROR =
    * LOGIC_SWITCH =
    * TESTRUN =
    * CONVERT = ' '
    IMPORTING
    SALESDOCUMENT = ORDER
    TABLES
    RETURN = RETURN
    ORDER_ITEMS_IN = I_ITEM
    * ORDER_ITEMS_INX =
    ORDER_PARTNERS = I_PARTNERS
    ORDER_SCHEDULES_IN = I_SCHEDULE
    * ORDER_SCHEDULES_INX =
    * ORDER_CONDITIONS_IN =
    * ORDER_CFGS_REF =
    * ORDER_CFGS_INST =
    * ORDER_CFGS_PART_OF =
    * ORDER_CFGS_VALUE =
    * ORDER_CFGS_BLOB =
    * ORDER_CFGS_VK =
    * ORDER_CFGS_REFINST =
    * ORDER_CCARD =
    * ORDER_TEXT =
    * ORDER_KEYS =
    * EXTENSIONIN =
    * PARTNERADDRESSES =
  • 13 Oct 2011 9:05 am rekha
    FM BAPI_SALESDOCUMENT_COPY is what you are looking for. Don't know when SAP
    released this one, but its not there is 4.0B and is available in rel 4.6C

×