BAPI Salesorder

Hi,
I'm looking for an example for bapi BAPI_SALESORDER_CREATEFROMDAT2 of BAPI_SALESORDER_CHANGE with the configuration tables filled.
Does anyone know how I can fill these tables:
ORDER_CFGS_REF
ORDER_CFGS_INST
ORDER_CFGS_PART_OF
ORDER_CFGS_VALUE
ORDER_CFGS_BLOB
ORDER_CFGS_VK
ORDER_CFGS_REFINST
Help will be appreciated.
Bert

Have a look this code
DATA: RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
DATA: ORDER_HEADER_IN LIKE BAPISDHD1 ,
ORDER_HEADER_INX LIKE BAPISDHD1X,
ORDER_ITEMS_IN LIKE BAPISDITM OCCURS 0 WITH HEADER LINE,
ORDER_ITEMS_INX LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE,
ORDER_SCHEDULES_IN LIKE BAPISCHDL OCCURS 0 WITH HEADER LINE,
ORDER_SCHEDULES_INX LIKE BAPISCHDLX OCCURS 0 WITH HEADER LINE,
ORDER_PARTNERS LIKE BAPIPARNR OCCURS 0 WITH HEADER LINE.
ORDER_HEADER_INX-UPDATEFLAG = 'X'..
ORDER_HEADER_INX-DOC_TYPE = 'X'.
ORDER_HEADER_INX-SALES_ORG = 'X'.
ORDER_HEADER_INX-DISTR_CHAN = 'X'.
ORDER_HEADER_INX-DIVISION = 'X'.
ORDER_HEADER_INX-PURCH_NO_C = 'X'.
ORDER_HEADER_INX-REF_DOC_L = 'X'.
ORDER_ITEMS_INX-UPDATEFLAG = 'X'.
ORDER_ITEMS_INX-ITM_NUMBER = '000010'.
ORDER_ITEMS_INX-MATERIAL = 'X'.
ORDER_ITEMS_INX-PLANT = 'X'.
ORDER_ITEMS_INX-TARGET_QTY = 'X'.
ORDER_SCHEDULES_INX-UPDATEFLAG = 'X'.
ORDER_SCHEDULES_INX-ITM_NUMBER = ORDER_ITEMS_IN-ITM_NUMBER.
ORDER_SCHEDULES_INX-REQ_QTY = 'X'.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
SALESDOCUMENTIN ORDER_HEADER_IN = wa_header
ORDER_HEADER_INX * SENDER * BINARY_RELATIONSHIPTYPE * INT_NUMBER_ASSIGNMENT * BEHAVE_WHEN_ERROR * LOGIC_SWITCH * TESTRUN * CONVERT = ' '
IMPORTING
SALESDOCUMENT = sorder
TABLES
RETURN ORDER_ITEMS_IN = i_item
ORDER_ITEMS_INX ORDER_PARTNERS = i_partner
ORDER_SCHEDULES_IN = i_schedule
ORDER_SCHEDULES_INX * ORDER_CONDITIONS_IN = i_cond.

Similar Messages

  • UPADATE PARTNER IN BAPI SALESORDER

    Hi All,
    I have a doubt on BAPI SALESORDER Partner change..
    As per my requirement I need to change sold to party or ship  to party for header level and item level(i.e bill to party and payer and etc).
    BAPI_SALESORDER_CHANGE Used this BAPI. But Iam unable to get the result.I have read some blogs also.
    Thank you
    Mithuunn

    Couple of things:
    <u>First</u>
    Message V1-383 says 'Enter a material or an item category'.
    I don't know how you linked this message as related to partners.
    <u>Second</u>
    When you used 'BAPISDORDER_GETDETAILEDLIST', did you get the ORDER_PARTNERS_OUT records with partner function value in internal format or external format? Check your entries in ORDER_PARTNERS_OUT in debugging and see if the partner function is in internal format or external format. If it is in external format, then you need use 'SH' instead of 'WE' in your read statement.
    <u>Third</u>
    When you create one SD document referencing another SD document, what gets copied from source to destination document is controlled by copy control config. Are you sure your copy control allows copying all the partner functions? May be it just copies the AG(sold-to) and leaves the others to be entered.
    Please post the relevant code.
    Srinivas

  • Partner Roles for Ship-To/Bill-To in BAPI SalesOrder

    Hi,
    I am currently developing a .NET web application that is using BO SalesOrder (e.g. BAPI Bapi_Salesorder_Simulate).
    My problem is that I need to list all defined partner roles of a customer (debitor) to give an appropriate selection for the BAPIPARTNR as a SalesOrder parameter
    e.g. (specify a Ship-To Address)
    [BAPIPARTNR].Partn_Role = "WE"
    [BAPIPARTNR].Partn_Numb = "<SAPCustomerNr>"
    In the web application I want to list all pre-definied partner roles for "WE" of the given customer to be able to set it as "<SAPCustomerNr>" in the BAPI parameter.
    This seemed like a standard requirement to me, but I could not find any BAPIs/RFCs to realize this. Does anybody have a suggestion ?
    Thanks for a short reply,
    Andreas Koschinsky

    Hi again Andreas,
    I get the hint, I have included the source together with the corrections you would need to make to get it working in your system (no warranty calls please!).
    FUNCTION CUSTOMER_PARTNERFS_GET.
    *"*"Local interface:
    *"       IMPORTING
    *"             VALUE(IV_KUNNR) LIKE  KNA1-KUNNR
    *"             VALUE(IV_VKORG) LIKE  E1KNVVM-VKORG
    *"             VALUE(IV_VTWEG) LIKE  E1KNVVM-VTWEG
    *"             VALUE(IV_SPART) LIKE  E1KNVVM-SPART
    *"       TABLES
    *"              ET_E1KNVPM STRUCTURE  E1KNVPM
      DATA  LV_ACCOUNT_GROUP               LIKE KNA1-KTOKD.
      DATA  LS_E1KNVPM                     LIKE E1KNVPM.
      DATA  LT_E1KNVPM                     LIKE E1KNVPM OCCURS 0.
      DATA  LT_KNVP                        LIKE KNVP OCCURS 0.
      DATA  LS_KNVP                        LIKE KNVP.
    >>> BW Omit this section <<<
    *     Get account group of the current customer
      SELECT SINGLE KTOKD FROM KNA1 INTO LV_ACCOUNT_GROUP
                          WHERE KUNNR = IV_KUNNR.
      IF SY-SUBRC NE 0.
    *     The customer is new so prepare to create roles.
        PERFORM CUSTOMER_CREATE_R3FUNCTIONS TABLES LT_E1KNVPM
                                            USING  IV_KUNNR
                                                   LV_ACCOUNT_GROUP.
      ELSE.
    >>> Up to here <<<
    *     The customer exists and has an account group.
    *     so read the knvp to get all available functions.
        SELECT * FROM KNVP INTO TABLE LT_KNVP
                           WHERE KUNNR = IV_KUNNR
                             AND VKORG = IV_VKORG
                             AND VTWEG = IV_VTWEG
                             AND SPART = IV_SPART.
        IF SY-SUBRC = 0.
    *     data available so read them
          LOOP AT LT_KNVP INTO LS_KNVP.
            MOVE-CORRESPONDING LS_KNVP TO LS_E1KNVPM.
            PERFORM PARTNER_NUMBER_EXTRACT(SAPLVV01) USING LS_KNVP
            CHANGING LS_E1KNVPM-KUNN2 .
            APPEND LS_E1KNVPM TO LT_E1KNVPM.
            CLEAR LS_KNVP.
          ENDLOOP.
    >>> BW Omit this section <<<
        ELSE.
    *      create new roles according to the delivered salesarea
          PERFORM CUSTOMER_CREATE_R3FUNCTIONS TABLES LT_E1KNVPM
                                              USING  IV_KUNNR
                                                     LV_ACCOUNT_GROUP.
        ENDIF.
    >>> Up to here <<<   <<< - moved this line in change
      ENDIF.
      ET_E1KNVPM[] = LT_E1KNVPM[].
    ENDFUNCTION.
    That should get you going.
    Cheers,
    Brad
    Oops! Just made a small change to ensure that the if statement was correctly closed.
    Message was edited by: Brad Williams

  • Bapi-salesorder creation error in  creating document

    hai friends..
      iam doing creation of sales order using bapi .-structures..
      but error in creating doucment ....
    can u send me some example .. abt sales order .creation ..
    once u check my code ...
    DATA: BEGIN OF HEADER OCCURS 0,
           VBELN LIKE BAPIVBELN-VBELN,
           AUART LIKE VBAK-AUART,
           VKORG LIKE VBAK-VKORG,
           VTWEG LIKE VBAK-VTWEG ,
           SPART LIKE VBAK-SPART,
           VKBUR LIKE VBAK-VKBUR,
           KUNNR LIKE BAPIPARNR-PARTN_NUMB ,"vbak-kunnr,
        END OF HEADER.
    DATA: BEGIN OF ITEM OCCURS 0,
           VBELN LIKE BAPIVBELN-VBELN,
           POSNR LIKE BAPISDITM-ITM_NUMBER ,"vbap-posnr,
           MATNR LIKE VBAP-MATNR,
          NETWR LIKE VBAP-NETWR,
           KWMENGE LIKE VBAP-KWMENG,
          WERKS LIKE VBAP-WERKS,
          NETPR LIKE VBAP-NETPR,
       END OF ITEM.
    DATA:  ORDER_HEADER_IN LIKE BAPISDHD1,
           ORDER_HEADER_INX LIKE BAPISDHD1X.
    DATA: ITAB_HEAD likE order_header_in,
          ITAB_HEADX likE ORDER_HEADER_INX.
    DATA: ITAB_ITEM  TYPE STANDARD TABLE OF  BAPISDITM WITH HEADER LINE,
          ITAB_ITEMX TYPE STANDARD TABLE OF  BAPISDITMX WITH HEADER LINE.
    DATA: KUST TYPE STANDARD TABLE OF  BAPIPARNR WITH HEADER LINE,
           RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
    DATA: VNO  LIKE BAPIVBELN-VBELN,
          VCNT LIKE VBAP-POSNR.
    LOOP AT HEADER.
        VCNT = 10.
        CLEAR ITAB_HEAD.
       ORDER_HEADER_IN-REFOBJTYPE = 'OR'.
       ORDER_HEADER_IN-REFOBJKEY = 'OR'.
       ORDER_HEADER_IN-REFDOCTYPE = 'OR'.
       ORDER_HEADER_IN-DOC_TYPE = HEADER-AUART.
        ITAB_HEAD-DOC_TYPE = HEADER-AUART.
        ITAB_HEAD-SALES_ORG = HEADER-VKORG.
        ITAB_HEAD-DISTR_CHAN = HEADER-VTWEG.
        ITAB_HEAD-DIVISION = HEADER-SPART.
        ITAB_HEAD-SALES_OFF = HEADER-VKBUR.
        KUST-PARTN_NUMB = HEADER-KUNNR.
         ITAB_HEADX-DOC_TYPE = 'X'.
         ITAB_HEADX-SALES_ORG = 'X'.
        ITAB_HEADX-DISTR_CHAN = 'X'.
        ITAB_HEADX-DIVISION = 'X'.
        ITAB_HEADX-SALES_OFF = 'X'.
        LOOP AT ITEM WHERE VBELN = HEADER-VBELN.
          REFRESH RETURN.
          ITAB_ITEM-ITM_NUMBER = VCNT.
          ITAB_ITEM-MATERIAL = ITEM-MATNR.
          ITAB_ITEM-NET_WEIGHT = ITEM-KWMENGE.
          APPEND ITAB_ITEM.
          ITAB_ITEMX-ITM_NUMBER = VCNT.
          ITAB_ITEMX-MATERIAL = 'X'.
          ITAB_ITEMX-NET_WEIGHT = 'X'.
          APPEND ITAB_ITEMX.
          VCNT  = VCNT + 10 .
        ENDLOOP.
        CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
          EXPORTING
        SALESDOCUMENTIN               = SALESORDER
            ORDER_HEADER_IN              = ITAB_HEAD
         ORDER_HEADER_INX              = ITAB_HEADX
        SENDER                        =
        BINARY_RELATIONSHIPTYPE       =
        INT_NUMBER_ASSIGNMENT         =
        BEHAVE_WHEN_ERROR             =
        LOGIC_SWITCH                  =
        TESTRUN                       =
        CONVERT                       = ' '
         IMPORTING
           SALESDOCUMENT                 = VNO
          TABLES
           RETURN                        = RETURN
           ORDER_ITEMS_IN                = ITAB_ITEM
           ORDER_ITEMS_INX               = ITAB_ITEMX
            ORDER_PARTNERS                = KUST.
       CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
            EXPORTING
              WAIT          = 'X'.
             IMPORTING
               RETURN        = RETURN.
    LOOP AT return WHERE type = 'E' OR type = 'A'.
    EXIT.
    ENDLOOP.
    IF sy-subrc = 0.
    WRITE: / 'Error in creating document'.
    ELSE.
    COMMIT WORK AND WAIT.
    ENDIF.
        WRITE: / '   Sales Order NO  IS: ', VNO.
        WRITE: / SPACE.
        CLEAR VNO.
        WRITE SY-ULINE.
      ENDLOOP.
    my HEader  is    123    OR  1000 30 10 SATYA.
    ITem  2  IS     123   10  HAI   15
    once u check it ......

    Hi Satya,
    just check this
    REPORT  Z_STANDARD_SALES_ORDER no standard page heading.
    DATA DECLARATION
    CONSTANTS : C_X VALUE 'X'.
    Structures to hold Sales order header data
    DATA : HEADER LIKE BAPISDHD1," OCCURS 0 WITH HEADER LINE,
           HEADERX LIKE BAPISDHD1X." OCCURS 0 WITH HEADER LINE.
    Internal Tables to hold Sales order ITEM DATA
    DATA : ITEM LIKE BAPISDITM OCCURS 0 WITH HEADER LINE,
           ITEMX LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE.
    Internal Tables to hold Partners ITEM DATA
    DATA : PART LIKE BAPIPARNR OCCURS 0 WITH HEADER LINE.
    Internal Tables to hold Partners SCHEDULE DATA
    DATA: SCHEDULE LIKE BAPISCHDL OCCURS 0 WITH HEADER LINE,
          SCHEDULEX LIKE BAPISCHDLX OCCURS 0 WITH HEADER LINE.
    Internal table to hold messages from BAPI call
    DATA: RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
    DATA  W_MSG(150).
    *DATA: begin of wa_MESSAGE,
         message(150),
         end of wa_message.
    *DATA: itab_msg like table of wa_message with header line.
    Data: Begin of Record occurs 0,
          Control type i,
          DOC_TYPE like HEADER-DOC_TYPE,
          SALES_ORG like HEADER-SALES_ORG,
          DISTR_CHAN like HEADER-SALES_ORG,
          DIVISION like HEADER-DIVISION,
          PURCH_NO_C like HEADER-PURCH_NO_C,
          PARTN_NUMB like PART-PARTN_NUMB ,
          PARTN_ROLE like PART-PARTN_ROLE ,
          ITM_NUMBER like ITEM-ITM_NUMBER,
          MATERIAL like ITEM-MATERIAL,
         TARGET_QTY like item-TARGET_QTY,
          REQ_QTY LIKE BAPISCHDL-REQ_QTY,
          TARGET_QU like item-TARGET_QU,
          PLANT like ITEM-PLANT,
          PMNTTRMS like header-PMNTTRMS,
          End of record.
    data: itab like ALSMEX_TABLINE occurs 0,
          wa like ALSMEX_TABLINE.
    data: SO like BAPIVBELN-VBELN.
    Selection Screen
    selection-screen begin of block b1 with frame title text-001.
    PARAMETERS: P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.
    selection-screen end of block b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
      PERFORM GET_FILE USING P_FILE.
    Start of Selection
    start-of-selection.
      DATA: xl type string.
      xl = '*.xls'.
      IF not P_FILE CP xl.
        Message 'Wrong input file format' type 'E'.
      ENDIF.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          FILENAME                      = P_FILE
          I_BEGIN_COL                   = 1
          I_BEGIN_ROW                   = 1
          I_END_COL                     = 13
          I_END_ROW                     = 3000
        TABLES
          INTERN                        = itab
    EXCEPTIONS
      INCONSISTENT_PARAMETERS       = 1
      UPLOAD_OLE                    = 2
      OTHERS                        = 3
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    DATA POPULATION
      loop at itab into wa.
        if wa-col = '0001'.
          record-Control = wa-value.
        elseif wa-col = '0002'.
          record-DOC_TYPE = wa-value.
        elseif wa-col = '0003'.
          record-SALES_ORG = wa-value.
        elseif wa-col = '0004'.
          record-DISTR_CHAN = wa-value.
        elseif wa-col = '0005'.
          record-DIVISION = wa-value.
        elseif wa-col = '0006'.
          record-PURCH_NO_C = wa-value.
        elseif wa-col = '0007'.
          record-PARTN_NUMB = wa-value.
        elseif wa-col = '0008'.
          record-PARTN_ROLE = wa-value.
        elseif wa-col = '0009'.
          record-PMNTTRMS = wa-value.
        elseif wa-col = '0010'.
          record-ITM_NUMBER = wa-value.
        elseif wa-col = '0011'.
          record-MATERIAL = wa-value.
        elseif wa-col = '0012'.
          record-REQ_QTY = wa-value.
        elseif wa-col = '0013'.
          record-TARGET_QU = wa-value.
        elseif wa-col = '0014'.
          record-PLANT = wa-value.
        endif.
        AT END OF row.
          APPEND record.
          CLEAR: wa, record.
        ENDAT.
      endloop.
      DATA: tot_lines type i,
            tot_po type i,
            index type i.
      describe table record lines tot_lines.
      read table record index tot_lines.
      tot_po = record-control.
      DO tot_po times.
        index = index + 1.
        clear: HEADER,HEADERX,ITEM[],ITEMX[],RETURN,RETURN[],SCHEDULE[],SCHEDULEX[], PART[],PART.
        refresh: ITEM[],ITEMX[],RETURN[],SCHEDULE[],SCHEDULEX[],PART[] .
    POPULATE HEADER FLAG.
        HEADERX-UPDATEFLAG = c_x.
        HEADERX-doc_type = c_x.
        HEADERX-SALES_ORG = c_x.
        HEADERX-DISTR_CHAN = c_x.
        HEADERX-DIVISION = c_x.
        HEADERX-PURCH_NO_C = c_X.
        HEADERX-PMNTTRMS = c_X.
        loop at record where control = index.
    POPULATE HEADER DATA FOR PO
          HEADER-DOC_TYPE = record-DOC_TYPE.
          HEADER-SALES_ORG = record-SALES_ORG.
          HEADER-DISTR_CHAN = record-DISTR_CHAN.
          HEADER-DIVISION = record-DIVISION.
          HEADER-PURCH_NO_C = record-PURCH_NO_C.
          HEADER-PMNTTRMS = record-PMNTTRMS.
    *POPULATE ITEM DATA.
          ITEM-ITM_NUMBER = record-ITM_NUMBER.
          ITEM-MATERIAL = record-material.
         ITEM-TARGET_QTY = record-TARGET_QTY.
          ITEM-TARGET_QU = record-TARGET_QU.
          ITEM-PLANT  = record-PLANT .
          APPEND ITEM.
    *POPULATE ITEM FLAG TABLE
          ITEMX-ITM_NUMBER = record-ITM_NUMBER.
          ITEMX-UPDATEFLAG = C_X.
         ITEMX-TARGET_QTY = C_X.
          ITEMX-PLANT = C_X .
          ITEMX-MATERIAL = C_X .
          ITEMX-TARGET_QU = C_X .
          APPEND ITEMX.
    *POPULATE SCHEDULE  TABLE
          SCHEDULE-ITM_NUMBER = RECORD-ITM_NUMBER.
          SCHEDULE-REQ_QTY = RECORD-REQ_QTY.
          APPEND SCHEDULE.
    *POPULATE SCHEDULE  TABLE
          SCHEDULEX-ITM_NUMBER = RECORD-ITM_NUMBER.
          SCHEDULEX-REQ_QTY = C_X.
          APPEND SCHEDULEX.
        endloop.
    *POPULATE PARTNER  TABLE
        PART-PARTN_NUMB = record-PARTN_NUMB.
        PART-PARTN_ROLE = record-PARTN_ROLE.
        APPEND PART.
    *BAPI CALL
        CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
              EXPORTING
               ORDER_HEADER_IN               = HEADER
               ORDER_HEADER_INX              = HEADERX
      SENDER                        =
      BINARY_RELATIONSHIPTYPE       =
      INT_NUMBER_ASSIGNMENT         =
      BEHAVE_WHEN_ERROR             =
      LOGIC_SWITCH                  =
      TESTRUN                       =
      CONVERT                       = ' '
              IMPORTING
               SALESDOCUMENT                 = SO
              TABLES
               RETURN                        = RETURN
               ORDER_ITEMS_IN                = ITEM
               ORDER_ITEMS_INX               = ITEMX
               ORDER_PARTNERS                = PART
               ORDER_SCHEDULES_IN            = SCHEDULE
               ORDER_SCHEDULES_INX           = SCHEDULEX
      ORDER_CONDITIONS_IN           =
      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              =
        loop at return where type = 'E' and ID NE 'MEPO' and ID NE 'BAPI'.
          WRITE:/ Return-message.
        endloop.
    *Confirm the document creation by calling database COMMIT
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            WAIT = 'X'.
    *Messages
        loop at return where type = 'S' and number ne '233'.
         WRITE:/ Return-message.
          CALL FUNCTION 'FORMAT_MESSAGE'
            EXPORTING
              ID        = return-ID
              LANG      = SY-LANGU
              NO        = return-NUMBER
            IMPORTING
              MSG       = W_MSG
            EXCEPTIONS
              NOT_FOUND = 1
              OTHERS    = 2.
          WRITE W_MSG.
         itab_msg-message = w_msg.
         append itab_msg.
          clear: W_MSG.
        ENDLOOP.
      enddo.
         -->P_W_FILE  text
    FORM GET_FILE  USING    P_W_FILE.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        CHANGING
          FILE_NAME     = P_W_FILE
        EXCEPTIONS
          MASK_TOO_LONG = 1
          OTHERS        = 2.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.     "GET_FILE
    Regards,
    Sachin

  • BAPI salesorder - VAT registration number

    Hi,
      for creating sales orders I use BAPI_SALESORDER_CREATEFROMDAT2 because of EXTENSIONIN.
      But I need to get VAT registration number into VBPA-STCEG by using some bapi.
      Can you suggest me something to do it ?
      Thanx.

    I don't understand yout question
    I found out bapi_salesorder_createfromdat1 uses an other structure for partner (BAPIPARTNR) like bapi_salesorder_createfromdat2 and in this structure is a field I need (VAT_REG_NO).
      But I must use bapi...dat2 because of extensionin.

  • Runtime Error Using BAPI SALESORDER CHANGE

    Hi,
    I was trying to use the BAPI_SALESORDER_CHANGE to change 'Material Group 1' field. When executing the program, it kept on failing with this runtime error 'CALL_FUNCTION_CONFLICT_LENG'. Below is my codes and also the error analysis found in ST22.
    Kindly please let me know my program errors.
    Thanks much.
    CODES :-
    DATA: l_vbeln TYPE bapivbeln-vbeln,
    l_hx LIKE bapisdhead1x,
    l_r TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE,
    l_i TYPE STANDARD TABLE OF bapisditem WITH HEADER LINE,
    l_ix TYPE STANDARD TABLE OF bapisditemx WITH HEADER LINE,
    l_success(1) TYPE c VALUE 'Y'.
    l_vbeln = '0000707671'.
    l_hx-updateflag = 'U'.
    l_i-itm_number = '000010'.
    l_i-prc_group1 = 'Y'.
    APPEND l_i.
    l_ix-itm_number = '000010'.
    l_ix-updateflag = 'U'.
    l_ix-prc_group1 = 'X'.
    APPEND l_ix.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    salesdocument = l_vbeln
    ORDER_HEADER_IN =
    order_header_inx = l_hx
    SIMULATION =
    BEHAVE_WHEN_ERROR = ' '
    INT_NUMBER_ASSIGNMENT = ' '
    LOGIC_SWITCH =
    NO_STATUS_BUF_INIT = ' '
    TABLES
    return = l_r
    order_item_in = l_i
    order_item_inx = l_ix
    PARTNERS =
    PARTNERCHANGES =
    PARTNERADDRESSES =
    ORDER_CFGS_REF =
    ORDER_CFGS_INST =
    ORDER_CFGS_PART_OF =
    ORDER_CFGS_VALUE =
    ORDER_CFGS_BLOB =
    ORDER_CFGS_VK =
    ORDER_CFGS_REFINST =
    SCHEDULE_LINES =
    SCHEDULE_LINESX =
    ORDER_TEXT =
    ORDER_KEYS =
    CONDITIONS_IN =
    CONDITIONS_INX =
    EXTENSIONIN =
    NFMETALLITMS =
    LOOP AT l_r.
    IF l_r-type <> 'S'.
    l_success = 'N'.
    EXIT.
    ENDIF.
    CLEAR l_r.
    ENDLOOP.
    IF l_success = 'Y'.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    WAIT =
    IMPORTING
    RETURN =
    WRITE: / 'Update successful'.
    ELSE.
    WRITE: / 'Update fail'.
    ENDIF.
    Error analysis
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was
    not caught and
    therefore caused a runtime error.
    The reason for the exception is:
    The call to the function module "BAPI_SALESORDER_CHANGE" is incorrect:
    In the function module interface, you can specify only
    fields of a specific type and length under "ORDER_HEADER_INX".
    Although the currently specified field
    "L_HX" is the correct type, its length is incorrect.

    Thanks ALL. Here is the amended program that works fine :-
    DATA: l_vbeln TYPE bapivbeln-vbeln,
          l_hx TYPE bapisdh1x,
          l_r TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE,
          l_i TYPE STANDARD TABLE OF bapisditm WITH HEADER LINE,
          l_ix TYPE STANDARD TABLE OF bapisditmx WITH HEADER LINE,
          l_success(1) TYPE c VALUE 'Y'.
    l_vbeln = '0000707671'.
    l_hx-updateflag = 'U'.
    l_i-itm_number = '000010'.
    l_i-prc_group1 = 'Y'.
    APPEND l_i.
    l_ix-itm_number = '000010'.
    l_ix-updateflag = 'U'.
    l_ix-prc_group1 = 'X'.
    APPEND l_ix.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        salesdocument               = l_vbeln
      ORDER_HEADER_IN             =
        order_header_inx            = l_hx
      SIMULATION                  =
      BEHAVE_WHEN_ERROR           = ' '
      INT_NUMBER_ASSIGNMENT       = ' '
      LOGIC_SWITCH                =
      NO_STATUS_BUF_INIT          = ' '
      TABLES
        return                      = l_r
        order_item_in               = l_i
        order_item_inx              = l_ix
      PARTNERS                    =
      PARTNERCHANGES              =
      PARTNERADDRESSES            =
      ORDER_CFGS_REF              =
      ORDER_CFGS_INST             =
      ORDER_CFGS_PART_OF          =
      ORDER_CFGS_VALUE            =
      ORDER_CFGS_BLOB             =
      ORDER_CFGS_VK               =
      ORDER_CFGS_REFINST          =
      SCHEDULE_LINES              =
      SCHEDULE_LINESX             =
      ORDER_TEXT                  =
      ORDER_KEYS                  =
      CONDITIONS_IN               =
      CONDITIONS_INX              =
      EXTENSIONIN                 =
      NFMETALLITMS                =
    LOOP AT l_r.
      IF l_r-type <> 'S'.
        l_success = 'N'.
        EXIT.
      ENDIF.
      CLEAR l_r.
    ENDLOOP.
    IF l_success = 'Y'.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        WAIT          =
      IMPORTING
        RETURN        =
      WRITE: / 'Update successful'.
    ELSE.
      WRITE: / 'Update fail'.
    ENDIF.

  • BAPI/IDOC to cancel the sales order ?

    Hi folks,
    What is BAPI /IDOC to cancel the sales order in ECC via PI .
    Thanks.,
    Shiva

    Hi Shiva,
    To my thinking you can use the BAPI for canceling and updating the sales order.
    For further reference you can have a look on the below link:
    BAPI SALESORDER CHANGE
    In this link you will find the values to be filled for performing different function for the BAPI.
    Regards
    Ravi Anand

  • RFCs / BAPIs for complex use case - offer and account receivable

    Hello,
    a scenario for testing purposes requires me to make remote function calls.
    I found almost everything I need in the IDES system I am accessing.
    What I am still missing, are RFCs or BAPIs to do the following
    - after selecting materials to be sold and after providing a pricing I would like to create an offer, proposal, or quote
    - after creating a bill, I would like to create and later close an account receivable item
    Can anybody help me on finding appropriate remote functions or BAPIs?
    Thanks in advanced
    Stefan
    PS: If you need more context, here is what I got so far
    - create and lookup customers using BAPI Customer
    - material availability and price check using BAPI Material
    - create a sales order using BAPI SalesOrder
    - create a shipment using BAPI Shipment
    - create a bill using BAPI ItCustBillingDoc
    hope that makes sence

    Hi Stefan,
    To find the BAPIs you need, use transaction BAPI in R3.  Creating the quotation, for example, can be found in Sales>Customer Quotation>Create From Data which gives the function "BAPI_QUOTATION_CREATEFROMDATA".  Using the same found General Accounting>Accounting Interface>AccntgBilling-->Post(etc) leading to "BAPI_ACC_BILLING_POST".
    Regards
    Gareth

  • Userexit in BAPI sales order creation

    HI all,
      My requirement is one SERIALNUMBER field add BAPI salesorder creation.
    That field not existed in satndard BAPI structures.BAPI input XML file.
    Salesorder>extras(menu)>Technical object->serialmumber[RIPW0SERNR).
    please give any enhancement serial number  BAPI sales order creation.
    Thanks.
    Edited by: sreddy GPs on Sep 23, 2008 5:59 AM

    Hello,
             Whatever the Structure that you are refering to in the BAPI for Sales Order Creation, use an Append Structure to add the SERIALNUMBER field to the existing Standard BAPI Structure.
    For your information, the following are the BAPIs that can be used for Sales Order Creation.
    BAPI_SALESORDER_CREATEFROMDAT1
    BAPI_SALESORDER_CREATEFROMDAT2
    BAPI_SALESORDER_CREATEFROMDATA
    BAPI_SALESORDER_CREATEBOS
    Hope it would serve your purpose.
    Thanks and Regards,
    Venkat Phani Prasad Konduri

  • Sales order creation using LSMW

    Hi All,
    I am creating open sales order (VA01) using LSMW where I am using BAPI: BUS2032 and Method CREATEFROMDAT2.
    I need to pass multiple line items for the same Header data, but the LSMW is creating multiple sales orders with a single line item every time.
    I tried giving "on_change_transfer_record" after Header record but that doesn't work.
    Can anyone suggest any suitable solution for this using BAPI only other than BDC, report program etc.
    Thanks in Advance
    Asif Ali Khan

    Hi Asif Khan,
    Please check this link
    BAPI_SALESORDER_CREATEFROMDAT2 - Sales Order Create
    http://sap-img.com/abap/bapi-salesorder-createfromdat2.htm
    Best regards,
    raam

  • BAP_SALES_ORDER_CREATE_WITH_REFERENCE - Document flow

    Hi, I have a problem with the bapi for create sales order with reference, When the line items be created, the Update indicator for flow table(VBAP-UPFLU) be created whit the value 'X'(Create document flow records).
    If the sales order is manual, the value of the Indicator for flow table is '2'(Create document flow records except for delivery/goods issue/billing documents), acording to the configuration, but, the bapi assing 'X' for the same reference document.
    Then, when change positions of outbound delivery or billing document the performance of the system is afected because the "Document number of the reference document" have to many reference, and read all the flow document of the contrat.
    I think that maibe need indicate someting aditional to the bapi at position level.
    Thanks a lot for your help.
    Regards,
    Fernando Jiménez.
    Edited by: Julius Bussche on Jul 24, 2009 9:54 PM

    http://www.sap-img.com/abap/bapi-salesorder-createfromdat2.htm

  • Different types of function module

    hi,
    When we create a function module : in one of the tabs we can find
      1 general function module
      2. remote function module
    3. update function module.
    What is meant by update function module and remote function module. can anyone explain me with an example and when shd we opt for 2 and 3.
    thanxs
    hari

    Function Modules:
    Function modules allow you to encapsulate and reuse global functions in the R/3 System.
    They are stored in a central library. The R/3 System contains a wide range of predefined
    function modules that you can call from any ABAP program.
    Unlike subroutines, you do not define function modules in the source code of your program.
    Instead, you use the Function Builder. The actual ABAP interface definition remains hidden
    from the programmer. You can define the input parameters of a function module as optional.
    You can also assign default values to them. Function modules also support exception handling.
    This allows you to catch certain errors while the function module is running. You can test
    function modules without having to include them in a program using the Function Builder.
    Function Groups:
    Function groups are containers for function modules. You cannot execute a function group.
    When you call a function module, the system loads the whole of its function group into the
    internal session of the calling program.
    Calling Function Modules in ABAP:
    To call a function module, use the CALL FUNCTION statement:
    CALL FUNCTION <module>
    [EXPORTING f1 = a 1.... f n = a n]
    [IMPORTING f1 = a 1.... f n = a n]
    [CHANGING f1 = a 1.... f n = a n]
    [TABLES f1 = a 1.... f n = a n]
    [EXCEPTIONS e1 = r 1.... e n = r n [ERROR_MESSAGE = r E]
    [OTHERS = ro]].
    You can specify the name of the function module <module> either as a literal or a variable.
    Each interface parameter <fi> is explicitly assigned to an actual parameter <a i>. You can
    assign a return value <r i> to each exception <e i>. The assignment always takes the form
    <interface parameter> = <actual parameter>. The equals sign is not an assignment operator
    in this context.
    • After EXPORTING, you must supply all non-optional import parameters with values
    appropriate to their type. You can supply values to optional import parameters if you
    wish.
    [email protected]
    34
    • After IMPORTING, you can receive the export parameters from the function module by
    assigning them to variables of the appropriate type.
    • After CHANGING or TABLES, you must supply values to all of the non-optional
    changing or tables parameters. When the function module has finished running, the
    changed values are passed back to the actual parameters. You can supply values to
    optional changing or tables parameters if you wish.
    You can use the EXCEPTIONS option to handle the exceptions of the function module. If an
    exception <e i > is raised while the function module is running, the system terminates the
    function module and does not pass any values from the function module to the program,
    except those that were passed by reference. If <e i > is specified in the EXCEPTION option,
    the calling program handles the exception by assigning <r i > to SY-SUBRC. <r i > must be a
    numeric literal.
    If you specify of ERROR_MESSAGE in the exception list you can influence the message
    handling of function modules. Normally, you should only call messages in function modules
    using the MESSAGE ... RAISING statement. With ERROR_MESSAGE you can force the system
    to treat messages that are called without the RAISING option in a function module as follows
    for various FM's
    http://www.erpgenie.com/abap/functions.htm
    Calling Function Modules
    http://help.sap.com/saphelp_46c/helpdata/en/9f/db98ef35c111d1829f0000e829fbfe/content.htm
    remote enabled fm's are BAPI's
    refer
    Introduction to BAPIs:
    Definition
    The SAP Business Objects held in the Business Object Repository (BOR) encapsulate their data
    and processes. External access to the data and processes is only possible by means of specific
    methods - BAPIs (Business Application Program Interfaces).
    A BAPI is defined as a method of a SAP Business Object.
    For example, the functionality that is implemented with the SAP Business Object type
    "Material" includes a check for the material’s availability. Thus, the Business Object type
    "Material" offers a BAPI called "Material.CheckAvailability".
    Use
    To use a BAPI method, an application program only needs to know how to call the method;
    that is, it needs to know the method’s interface definition. Therefore, when including a BAPI
    invocation in your application program, you only need to supply the appropriate interface
    information.
    A BAPI interface is defined by:
    • Import parameters, which contain data to be transferred from the calling program to
    the BAPI
    • Export parameters, which contain data to be transferred from the BAPI back to the
    calling program
    • Import/export (table) parameters for both importing and exporting data
    Structure
    The BAPIs in the R/3 System are currently implemented as function modules, all of which are
    held in the Function Builder. Each function module underlying a BAPI:
    • Supports the Remote Function Call (RFC) protocol
    • Has been assigned as a method to an SAP Business Object in the BOR
    • Is processed without returning any screen dialogs to the calling application
    Integration
    The architecture enables SAP to change the details of a BAPI’s implementation without
    affecting external applications, which are using the BAPI.
    Advantages of Using BAPIs
    BAPIs are standardized methods of SAP Business Objects that enable customers and third
    parties to integrate their software components with the R/3 System and the Business
    Framework.
    Business Standard
    SAP Business Objects and their BAPIs provide a business content standard, rather than a
    technical interoperability standard; that is, they enable the integration of R/3 and other
    software components on a business level, not on a technical level.
    [email protected]
    97
    Standards Conformance
    BAPIs are being developed as part of the SAP joint initiative with customers, partners, and
    leading standards organizations. BAPIs are becoming a communication standard between
    business systems.
    You can access SAP Business Objects and their BAPIs by using object-oriented interfacing
    technologies such as Microsoft’s COM/DCOM (Component Object Model/Distributed Component
    Object Model).
    The SAP Business Objects already comply with the Open Applications Group (OAG)
    specifications, and, in conjunction with ObjectBridge from VisualEdge, conform to the Object
    Management Group’s CORBA (Common Object Request Broker Architecture) guidelines.
    Stability and Downward Compatibility
    Once a BAPI is implemented and released by SAP, its interface definition and parameters
    remain stable in the long term, thus ensuring that your application program remains
    unaffected by any changes to the underlying R/3 software and data.
    SAP can make any necessary extensions to the BAPIs, for example, additional optional
    parameters, without destabilizing the operation of existing applications and, at the same time,
    can offer the enhanced functionality to new applications.
    Object Orientation
    As methods of the SAP Business Objects, BAPIs provide access to R/3 data and processes
    following an object-oriented programming model. BAPIs can be called using object-oriented
    interfacing technologies, such as COM/DCOM, thus enabling software components from SAP
    and third parties to interact freely.
    Openness
    You can access BAPIs from all development platforms that support the SAP Remote Function
    Call (RFC) protocol.
    BAPI Definition
    A Business Application Programming Interface (BAPI) is a precisely defined interface providing
    access to processes and data in business application systems such as R/3. BAPIs are defined
    as API methods of SAP Business Objects. These business objects and their BAPIs are described
    and stored in the Business Object Repository (BOR).
    A BAPI is implemented, however, as a function module, that is stored and described in the
    Function Builder.
    BAPIs can be called within the R/3 System from external application systems and other
    programs. BAPIs are the communication standard for business applications. BAPI interface
    technology forms the basis for the following developments:
    • R/3 satellite systems
    • Isolating components within the R/3 System in the context of Business Framework
    • Distributed R/3 scenarios using Application Link Enabling (ALE)
    • Connecting R/3 Systems to the Internet using Internet Application Components (IACs)
    • Visual Basic programs as front-end to R/3 Systems
    • Workflow applications that extend beyond system boundaries
    • Customers’ and partners’ own developments
    • Connections to non-SAP software
    • Connections to legacy systems
    [email protected]
    98
    Standardized BAPIs
    Some BAPIs and methods provide basic functions and can be used for most SAP Business
    Objects. Such BAPIs are known as "standardized" BAPIs.
    Using the descriptions below as a guide, verify whether you can implement the BAPI as a
    standardized BAPI.
    Features
    BAPIs for Reading Data
    The following BAPIs provide you with read-only access to data in the associated business
    object:
    • GetList
    With this BAPI you can select a range of object key values, for example, company
    codes and material numbers. To specify appropriate selection requirements the calling
    program must pass the relevant parameters to the interface. The key values selected
    by the BAPI GetList are returned to the calling program in a table, together with other
    useful information, for example, short texts. The key values can then be passed on to
    another BAPI for further processing, for example, the BAPI GetDetail, as listed below.
    • GetDetail
    The BAPI GetDetail uses a key to retrieve details about an instance(s specific
    occurrence) of a business object and returns this data to the calling program.
    • GetStatus
    The BAPI GetStatus is used to query the status of an SAP Business Object, for
    example, to display the processing status of a sales order. This BAPI is used only for
    displaying the status of an object and does not retrieve full details like the BAPI
    GetDetail.
    • ExistenceCheck
    The BAPI ExistenceCheck checks, whether an entry exists for an SAP Business Object,
    for example, whether the customer master has been created. You should implement
    this method as a workflow method and not as a BAPI (RFC capable function module).
    The method CompanyCode.ExistenceCheck of the business object CompanyCode
    (BUS0002) is an example of this. This workflow method is indirectly invoked when the
    calling program instantiates an object, for example, by using
    GetSAPObject("CompanyCode") from within Visual Basic.
    BAPIs for Creating or Changing Data
    The following BAPIs can create, change or delete instances of a business object: If required,
    you can implement these BAPIs so that, several instances of a business object can be created,
    deleted or modified simultaneously in the same call. In such cases "multiple" is added to the
    method name, for example ChangeMultiple.
    BAPIs that can create, change or delete instances are:
    • Create or CreateFromData
    The BAPI Create or CreateFromData creates an instance of an SAP Business Object,
    for example, a sales order. Create is the preferred name for this BAPI. Use the name
    CreateFromData only when a workflow method called Create already exists for the
    business object in question.
    [email protected]
    99
    • Change
    The BAPI Change changes an existing instance of a SAP Business Object, for example,
    a sales order.
    • Delete
    The BAPI Delete deletes an instance of a SAP Business Object, for example, sales
    order.
    BAPIs for Replicating Business Object Instances
    The BAPIs below can be implemented as methods of business objects that can be replicated.
    They enable specific instances of an object type to be copied to one or more different systems.
    These BAPIs are used mainly to transfer data between distributed systems within the context
    of Application Link Enabling (ALE).
    The method below must be implemented for each business object to be replicated.
    • Replicate
    The BAPI Replicate is called in the system, which contains the originals of the business
    object instances to be replicated. It is used to:
    • Identify the business objects to be replicated and to organize the required data.
    • Call the clone methods described below in the receiving system
    Moreover, at least one of the clone methods below must be implemented for each business
    object to be replicated.
    • Clone
    The BAPI Clone is used by a system to replicate one business object on another
    system or to modify one business object that has already been cloned.
    • CloneMultiple
    The BAPI CloneMultiple is used by a system to replicate several business objects on
    another system or to modify several business objects that have already been cloned.
    Defining and Implementing the BAPI
    Purpose
    Various components of the ABAP Workbench are used when you define and implement a BAPI.
    A BAPI is an API method of a business object and is defined as such in the Business Object
    Repository (BOR). However, a BAPI is implemented as an RFC capable function module, which
    is maintained in the Function Builder. The definitions and descriptions of the data structures
    used by the BAPI are stored in the ABAP Dictionary.
    For function modules that implement BAPIs, certain standards and rules must be adhered to
    over and above the standard programming rules for function modules. For example, COMMIT
    WORK commands must not be used in the function modules that a BAPI is based on.
    The following sections guide you through the steps involved in developing a BAPI. The sections
    contain information about the guidelines and conventions that you should adhere to when
    defining and implementing a BAPI. When implementing BAPIs follow the requirements below
    to ensure you achieve consistent behavior and representation of BAPIs as object oriented
    methods of SAP Business Objects.
    [email protected]
    100
    BAPI Programming
    BAPI Definition
    A Business Application Programming Interface (BAPI) is a precisely defined interface providing
    access to processes and data in business application systems such as R/3.
    BAPIs are defined as API methods of SAP Objects. These objects and their BAPIs are described
    and stored in the BOR (BOR).
    Use
    BAPIs can be called within the R/3 System from external application systems and other
    programs. A BAPI call can either be made as an object oriented method call or as a remote
    function call (RFC).
    BAPIs are a global communication standard for business applications.
    Examples of what BAPIs can be used for include:
    • R/3 satellite systems
    • Distributed R/3 scenarios using Application Link Enabling (ALE)
    • Connecting R/3 Systems to the Internet using Internet application components (IACs)
    • Visual Basic programs as front-end to R/3 Systems
    • Workflow applications that extend beyond system boundaries
    • Customers’ and partners’ own developments
    • Connections to non-SAP software
    • Connections to legacy systems
    BOR Definition
    The Business Object Repository (BOR) is the object-oriented repository in the R/3 System. It
    contains, among other objects, SAP Business Objects and their methods. In the BOR a
    Business Application Programming Interface (BAPI) is defined as an API method of an SAP
    Business Object. Thus defined, the BAPIs become standard with full stability guarantees as
    regards their content and interface.
    Use
    With regard to SAP Business Objects and their BAPIs, the BOR has the following functions:
    • Provides an object-oriented view of R/3 System data and processes.
    R/3 application functions are accessed using methods (BAPIs) of SAP Business
    Objects. Implementation information is encapsulated; only the interface functionality
    of the method is visible to the user.
    • Arranges the various interfaces in accordance with the component hierarchy, enabling
    functions to be searched and retrieved quickly and simply.
    • Manages BAPIs in release updates.
    BAPI interface enhancements made by adding parameters are recorded in the BOR.
    Previous interface versions can thus be reconstructed at any time. When a BAPI is
    created the release version of the new BAPI is recorded in the BOR. The same applies
    when any interface parameter is created.
    The version control of the function module that a BAPI is based on is managed in the
    Function Builder.
    • Ensures interface stability.
    Any interface changes that are carried out in the BOR, are automatically checked for
    syntax compatibility against the associated development objects in the ABAP
    Dictionary.
    [email protected]
    101
    Integration
    You should only define a BAPI as a SAP Business Object method in the BOR if the function
    module that the BAPI is based on has been fully implemented. Full access to the BOR is
    restricted to the persons responsible for the objects involved and for quality control.
    BOR-BAPI Wizard
    The BOR-BAPI Wizard assists with creating new BAPI methods in the BOR. It takes you
    through the creation process step by step.
    Transaction Model for Developing BAPIs Purpose
    The transaction model in which BAPIs are used determines how you have to program BAPIs.
    The transaction model described here has been used to develop BAPIs for R/3 Releases 3.1
    and 4.0A.
    Logical Unit of Work (LUW) and Statelessness
    Within the context of this transaction model a transaction represents one processing step or
    one logical unit of work (LUW). When a transaction is called, database operations are either
    fully executed or not at all. The whole transaction must be programmed to be stateless.
    This transaction model requires that:
    • No data is imported that may indirectly affect the result. If a transaction is called more
    than once, each call must have the same result. For BAPIs this means, for example,
    that Set or Get parameters cannot be used. However, you can keep Customizing data
    in a global memory, as this data remains unchanged even if transaction calls are
    repeated.
    • There must be no functional dependencies between two transactions.
    • Either all relevant data has to be changed in the database or none at all.
    Determining the SAP Business Object and Its Key Fields
    You have to identify the relevant SAP Business Object in the Business Object Repository (BOR)
    and determine whether the key fields of the Business Object are relevant for your BAPI.
    A key is defined in the BOR for most SAP Business Objects. This key can consist of several key
    fields. The content of these key fields uniquely identifies one individual instance of an SAP
    Business Object.
    You can differentiate between instance-dependent and instance-independent BAPI methods.
    Unlike instance-independent methods, instance-dependent methods relate to one instance
    (one specific occurrence) of an SAP Business Object type, for example to one specific sales
    order.
    In the case of instance-dependent BAPIs, the key fields of the corresponding SAP Business
    Object must be used as parameters in the function module the BAPI is based on so that the
    associated object instance can be identified. The names of the key fields in the SAP Business
    Object and the corresponding parameters in the BAPI function module must be the same,
    because the name links the key fields to the parameters.
    All the key fields defined in the BOR for the SAP Business Object in question must be used as
    the parameters in the function module.
    Example
    SAP Business Object Creditor has a key field named CreditorId.
    This key field must be defined as a parameter with the name CREDITORID in the function
    modules of the instant-dependent BAPIs for this Business Object.
    [email protected]
    102
    To display the Business Object and its key fields follow the steps below:
    1. Select Tools -> ABAP Workbench -> Overview -> Business Object Browser . The
    business objects are displayed in the order of the R/3 application hierarchy.
    2. Select the required SAP Business Object in the application hierarchy and double click it
    to open it.
    3. To display the Business Object’s key fields, expand the node Key fields.
    Defining the Interface Structure of the BAPI
    In this step you are going to define the BAPI interface, that is, the individual import, export
    and table parameters required for calling the BAPI.
    Caution
    You cannot use Changing and Exception parameters in a function module which implements a
    BAPI.
    Process Flow
    To define the interface parameters, proceed as follows:
    1. Check whether the key fields of the SAP Business Object are required in the interface. The
    key fields of the SAP Business Object are some of the most important BAPI parameters.
    If a key value is to be passed to the BAPI by the calling program, the key field must be set as
    an import parameter in the function module of the BAPI. That way a specific instance of the
    Business Object is identified.
    For example, this could be a customer number (CustomerNo) in the BAPIs Customer.GetDetail
    and Customer.CheckPassword, or the number of a sales document in the BAPI
    SalesOrder.GetStatus.
    For BAPIs that generate instances, for example, the BAPIs Create or CreateFromData, the key
    field of the Business Object should be set as an export parameter in the BAPI function module.
    These BAPIs return one key value, for example, an order number in the BAPI
    SalesOrder.CreateFromData.
    For BAPIs that are class methods a key field is neither set as an import nor as an export
    parameter in the BAPI function module. Class methods are instance-independent and are
    called without the use of key values. Usually they return a table with a selection of key values.
    2. Specify what other data is relevant as import, export or table parameters for the BAPI.
    Every BAPI must have an Export parameter return that reports messages back to the calling
    program.
    Example
    The BAPI to be developed is to read data from the SAP Business Object Creditor. To read
    creditor details, the calling program has to pass the ID of the creditor and the company code.
    The creditor data returned is to include general details, specific details and bank details.
    To map these requirements onto the BAPI interface, the following parameters must be set in
    the function module which the BAPI is based on:
    • The key field CreditorID of the SAP Business Object as an import parameter
    • An import parameter for the company code
    • A Return parameter that reports messages back to the calling program
    • A parameter for general details of the creditor
    • A parameter for specific details of the creditor
    • A parameter for bank details of the creditor
    for BAPI list
    refer www.sapbapi.com
    for FM's refer www.se37.com
    regards
    srinivas
    <b>*reward for useful answers*</b>

  • Table Parameter IX_BAPIADDR1 of FM SD_ORDER_CREATE

    Hi,
    i used the FM SD_ORDER_CREATE to create sales orders. i want to change the addresses from master data for the partners.
    can i use the table parameter IX_BAPIADDR1 of FM SD_ORDER_CREATE ? if it is possible, how can i fill up this table for fm?
    can somebody help me please?
    thanks.
    best regards.

    You can use the bapi BAPI_SALESORDER_CHANGE
    please check the links below if you need further info search forum
    Re: BAPI_SALESORDER_CHANGE
    Re: BAPI SALESORDER CHANGE
    change customer address in sales order
    Help with BAPI_SALESORDER_CHANGE
    Regards
    Satish Boguda

  • Condition types in Sales order creation process

    Hi Friends...
    While creating the sales order with BAPI,
    What is the condition type i have to pass for pricing procedure...
    There many condition types for my pricing procedure, which one o have to select...
    Some of them are mannual, and other reuired, which one I have to pass?
    I want the information related to this condition types.., as here no SD consultant availble for me.
    Sales order creation, Line item error
    Thanks,
    Naveen.I

    Hi Friends...
       Please let me know is it mandatory to give condtion type while creating the sales order...?
    I am using BAPI_SALESORDER_CREATEFROMDAT2  to create my sales order...
    http://www.sap-img.com/abap/bapi-salesorder-createfromdat2.htm
    Thanks,
    Naveen.I

  • FM 'BAPI_SALESORDER_CREATEFROMDAT2'

    Hi,
      I am using the FM BAPI_SALESORDER_CREATEFROMDAT2 to create the sales order.
    Can anyone let me know in which structure we need to pass the Partner details and Pricing details.
    Regards,
    SP

    Hi,
    The structure of Partner Details is ORDER_PARTNERS.
    Please check this sample code related to it.
    http://www.sap-img.com/abap/bapi-salesorder-createfromdat2.htm
    And for Pricing the structure is ORDER_CONDITIONS_IN
    Please check this link for sample code
    http://www.sapnet.ru/viewtopic.php?t=376
    Hope this would help you.
    Good luck
    Narin

Maybe you are looking for

  • How can I get Adobe Bridge to show XMP metadata using Adobe Drive 4 CMIS Connector?

    I have successfully connected to an Alfresco Enterprise Edition 4.1.0 repository, using the Adobe Drive 4, created a test folder and uploaded a jpeg file containing XMP metadata into it. When I view the image's metadata (using Adobe Bridge), I observ

  • Business Explorer (BEX) Query open Error

    Hi When opening  BEX(Business Explorer) Queries from Excel  ,  it asks for System to choose. But business doesn't want to see this option. It should go directly to open query selection for the system it has logged in. Say , it has logged in BIQ  , it

  • Can you call external code from XE?

    Hi, I have an application that uses external code, called via extproc. During a standard Oracle installation, I need to modify the listener configuration to allow it to do so. This is done by modifying listener.ora like follows: SID_LIST_LISTENER = (

  • Compatible Hard Disc for MacBook Pro

    hi , i am planning to change my hard disc in MacBook Pro 2011 model, due to issues with the existing disc. Saw this SSHD in amazon. Would this be compatible with mAcbook pro ? This is the URL : http://www.amazon.com/Seagate-Laptop-2-5-Inch-Internal-S

  • Safari not loading pages/Crashing at launch

    Hey there! I have been using Safari as my default internet browser since I got my Mac almost 3 years ago, and have never encountered this problem. Every time I try to open up Safari and load my homepage, it begins to load, and then freezes, freezing