Skip to Content

Require to change the value in VA01 pricing condition

Hi All,

Through file records, using BDC in the program, the sales orders are creating in the VA01 t-code, the requirement is on the condition tab in the sales order, for the condition type ZFFI, the amount is coming from the VK12, the amount should be replaced by the manually calculated value, which are coming from two values of the sheet, the calculation will be done in the BDC program, and should be passed through BDC, but here the question is how can we capture the condition type ZFFI, through BDC, is it possible to caputure the condition through BDC or if i should proceed through routine, how i can proceed with the requirement.

IF BDC_CURSORKOMV-KSCHL = 'ZFFI'.

'KOMV-KBETR(02)' WA_FILE-KBETR.

or we have to proceed for the routine.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • May 09 at 06:20 AM

    Hi Pannala Satish,

    You can try creating Sale Order by using BAPI.

    BAPI Function Module used : BAPI_SALESORDER_CREATEFROMDAT2


    (You can upload the excel spreadsheet to use your own CONDITION TYPE .)

    I have also attached the screen-shot of the excel spreadsheet for your reference.

    Below is the Logic Code:

    LOOP AT IT_MAIN INTO WA_MAIN.
    *HEADER
        WA_ORDER_HEADER_IN-DOC_TYPE   = WA_MAIN-DOC_TYPE.
        WA_ORDER_HEADER_IN-SALES_ORG  = WA_MAIN-SALES_ORG.
        WA_ORDER_HEADER_IN-DISTR_CHAN = WA_MAIN-DISTR_CHAN.
        WA_ORDER_HEADER_IN-DIVISION   = WA_MAIN-DIVISION.
        WA_ORDER_HEADER_INX-DOC_TYPE   = 'X'.
        WA_ORDER_HEADER_INX-SALES_ORG  = 'X'.
        WA_ORDER_HEADER_INX-DISTR_CHAN = 'X'.
        WA_ORDER_HEADER_INX-DIVISION   = 'X'.
    
        WA_ORDER_PARTNERS-PARTN_ROLE  = WA_MAIN-PARTN_ROLE.
    
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            INPUT  = WA_MAIN-PARTN_NUMB
          IMPORTING
            OUTPUT = WA_MAIN-PARTN_NUMB.
    
        WA_ORDER_PARTNERS-PARTN_NUMB  = WA_MAIN-PARTN_NUMB.
    
        APPEND WA_ORDER_PARTNERS TO  IT_ORDER_PARTNERS.
    
        WA_ORDER_PARTNERS-PARTN_ROLE  = WA_MAIN-PARTN1_ROLE.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            INPUT  = WA_MAIN-PARTN1_NUMB
          IMPORTING
            OUTPUT = WA_MAIN-PARTN1_NUMB.
    
        WA_ORDER_PARTNERS-PARTN_NUMB  = WA_MAIN-PARTN1_NUMB.
    
        APPEND WA_ORDER_PARTNERS TO IT_ORDER_PARTNERS.
    
        WA_ORDER_HEADER_IN-PURCH_NO_C = WA_MAIN-PURCH_NO_C.
        WA_ORDER_HEADER_IN-PURCH_DATE = WA_MAIN-PURCH_DATE.
    
        WA_ORDER_HEADER_INX-PURCH_NO_C = 'X'.
        WA_ORDER_HEADER_INX-PURCH_DATE = 'X'.
    
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            INPUT  = WA_MAIN-ORD_REASON
          IMPORTING
            OUTPUT = WA_MAIN-ORD_REASON.
    
        WA_ORDER_HEADER_IN-ORD_REASON   = WA_MAIN-ORD_REASON.
    
        LOOP AT IT_ITEM INTO WA_ITEM WHERE SLNO = WA_MAIN-SLNO.
    *ITEMS
          WA_ORDER_ITEMS_IN-ITM_NUMBER  = WA_ITEM-ITM_NUMBER.
          WA_ORDER_ITEMS_IN-MATERIAL    = WA_ITEM-MATERIAL.
          WA_ORDER_ITEMS_IN-TARGET_QTY  = WA_ITEM-TARGET_QTY.
    
          WA_ORDER_ITEMS_INX-ITM_NUMBER = WA_ITEM-ITM_NUMBER.
          WA_ORDER_ITEMS_INX-MATERIAL   = 'X'.
          WA_ORDER_ITEMS_INX-TARGET_QTY = 'X'.
    
          WA_ORDER_CONDITIONS_IN-ITM_NUMBER = WA_ITEM-ITM_NUMBER.
          WA_ORDER_CONDITIONS_IN-COND_TYPE  = WA_ITEM-COND_TYPE.         "CONDITION TYPE
          WA_ORDER_CONDITIONS_IN-COND_VALUE = WA_ITEM-COND_VALUE / 10.
    
          WA_ORDER_CONDITIONS_INX-ITM_NUMBER = WA_ITEM-ITM_NUMBER.
          WA_ORDER_CONDITIONS_INX-COND_TYPE  = 'X'.
          WA_ORDER_CONDITIONS_INX-COND_VALUE = 'X'.
    
          APPEND WA_ORDER_ITEMS_IN       TO  IT_ORDER_ITEMS_IN.
          APPEND WA_ORDER_ITEMS_INX      TO  IT_ORDER_ITEMS_INX.
          APPEND WA_ORDER_CONDITIONS_IN  TO  IT_ORDER_CONDITIONS_IN.
          APPEND WA_ORDER_CONDITIONS_INX TO  IT_ORDER_CONDITIONS_INX.
    
        ENDLOOP.
    
          APPEND WA_ORDER_HEADER_IN      TO  IT_ORDER_HEADER_IN.
          APPEND WA_ORDER_HEADER_INX      TO  IT_ORDER_HEADER_INX.
    
        CLEAR : WA_MAIN,
                WA_ITEM.
    
        CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
          EXPORTING
    *     SALESDOCUMENTIN               =
          ORDER_HEADER_IN               = WA_ORDER_HEADER_IN
          ORDER_HEADER_INX              = WA_ORDER_HEADER_INX
    *     SENDER                        =
    *     BINARY_RELATIONSHIPTYPE       =
    *     INT_NUMBER_ASSIGNMENT         =
    *     BEHAVE_WHEN_ERROR             =
    *     LOGIC_SWITCH                  =
    *     TESTRUN                       =
    *     CONVERT                       = ' '
        IMPORTING
          SALESDOCUMENT                 = WA_SALEORD
        TABLES
          RETURN                        = IT_RETURN[]
          ORDER_ITEMS_IN                = IT_ORDER_ITEMS_IN[]
          ORDER_ITEMS_INX               = IT_ORDER_ITEMS_INX[]
          ORDER_PARTNERS                = IT_ORDER_PARTNERS[]
    *     ORDER_SCHEDULES_IN            =
    *     ORDER_SCHEDULES_INX           =
          ORDER_CONDITIONS_IN           = IT_ORDER_CONDITIONS_IN[]
          ORDER_CONDITIONS_INX          = IT_ORDER_CONDITIONS_INX[]
    *     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              =
                  .
    
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
         EXPORTING
           WAIT          = 'X'
    *   IMPORTING
    *     RETURN        =
                 .
    
    Hope this helps you.
    
    
    Thanks & Regards,
    Niyas
    Add comment
    10|10000 characters needed characters exceeded

  • May 02 at 12:19 PM

    There are better ways to create Sales Orders in batch than BDC. BDC is 20+ years old so not the most updated technology. Would suggest idoc technology (even though this is also old technology) or BAPI functions. These options also make it easier to include manual condition values. It is worth looking into.

    Thanks

    Phil Cooley

    Add comment
    10|10000 characters needed characters exceeded