How to create an inbound delivery using BAPI/FM?

Hello,
I am looking for a BAPI/FM to create only Inbound delivery. Pleace help me on this.
Thanks and appreciate your help
Thanks,
Amrutha.

Hi,
We succeeded to do something similar.
We needed to create an inbound based on invoice data, with refference to items from multiple PO.
We used FM BBP_INB_DELIVERY_CREATE, combined with enhancement of ME_CONFIRMATION_VIA_EDI for using MARA- MATNR instead of
mara-ematn (standard logic of SAP for vendor ASN).
In this enhancement we filled also fields:
t_kom-vornu = t_data-belnr. "invoice number as precendent document
t_kom-bolnr = t_data-bolnr. "bill of ladding
t_kom-traty = t_data-trans_cat. "transport type.
Also we had to use customizing to not display warning related to different delivery date.
Kind regards,
Valentina

Similar Messages

  • How to create the sales order using BAPI's ....?

    Hi Guru's,
    could you please provide how to create the sales order using BAPI's .....i need step by step process and please provide the details from scratch....basically  i don't have basic knowledge on this....please provide required inputs ....:)
    thanks in advance
    Srinivas......

    Hi Guru's thanks for your inouts and your valuble time...
    please find the program logic below...
    *& Report  ZAREPAS30
    REPORT  zarepas30.
    DATA : gs_vbeln                   TYPE  vbak-vbeln,
           gs_order_header_in         TYPE  bapisdhd1,
           gs_order_header_inx        TYPE  bapisdhd1x,
           gt_order_items_in          TYPE  STANDARD TABLE OF bapisditm,
           gwa_itab1                  TYPE  bapisditm,
           gt_order_items_inx         TYPE  STANDARD TABLE OF bapisditmx,
           gwa_itab2                  TYPE  bapisditmx,
           gt_order_partners          TYPE  STANDARD TABLE OF bapiparnr,
           gwa_itab3                  TYPE  bapiparnr,
           gt_return                  TYPE  STANDARD TABLE OF bapiret2,
           gwa_itab4                  TYPE  bapiret2.
    Sales document type
      PARAMETERS: p_auart TYPE auart OBLIGATORY.
    Sales organization
      PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
    Distribution channel
      PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
    Division.
      PARAMETERS: p_spart TYPE spart OBLIGATORY.
    Requested Delivery Date
      PARAMETERS: p_edatu  TYPE edatu OBLIGATORY.
    Sold-to
      PARAMETERS: p_sold  TYPE kunnr OBLIGATORY.
    Ship-to
      PARAMETERS: p_ship  TYPE kunnr OBLIGATORY.
    Material
      PARAMETERS: p_matnr TYPE matnr   OBLIGATORY.
    Quantity.
      PARAMETERS: p_menge TYPE kwmeng  OBLIGATORY.
    Plant
      PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
    Start-of-selection.
      START-OF-SELECTION.
    Header data
    Sales document type
      gs_order_header_in-doc_type = p_auart.
      gs_order_header_inx-doc_type = 'X'.
    Sales organization
      gs_order_header_in-sales_org = p_vkorg.
      gs_order_header_inx-sales_org = 'X'.
    Distribution channel
      gs_order_header_in-distr_chan  = p_vtweg.
      gs_order_header_inx-distr_chan = 'X'.
    Division
      gs_order_header_in-division = p_spart.
      gs_order_header_inx-division = 'X'.
    Reguested Delivery Date
      gs_order_header_in-req_date_h = p_edatu.
      gs_order_header_inx-req_date_h = 'X'.
      gs_order_header_inx-updateflag = 'I'.
    Partner data
    Sold to
      gwa_itab3-partn_role = 'AG'.
      gwa_itab3-partn_numb = p_sold.
      APPEND gwa_itab3 TO  gt_order_partners .
    ship to
      gwa_itab3-partn_role = 'WE'.
      gwa_itab3-partn_numb = p_ship.
      APPEND gwa_itab3 TO  gt_order_partners .
    ITEM DATA
      gwa_itab2-updateflag = 'I'.
    Line item number.
      gwa_itab1-itm_number = '000010'.
      gwa_itab2-itm_number = 'X'.
    Material
      gwa_itab1-material = p_matnr.
      gwa_itab2-material = 'X'.
    Plant
      gwa_itab1-plant    = p_plant.
      gwa_itab2-plant   = 'X'.
    Quantity
      gwa_itab1-target_qty = p_menge.
      gwa_itab2-target_qty = 'X'.
      APPEND gwa_itab1 TO gt_order_items_in.
      APPEND gwa_itab2 TO gt_order_items_inx.
    Line item number.
      gwa_itab1-itm_number = '000020'.
      gwa_itab2-itm_number = 'X'.
    Material
      gwa_itab1-material = p_matnr.
      gwa_itab2-material = 'X'.
    Plant
      gwa_itab1-plant    = p_plant.
      gwa_itab2-plant   = 'X'.
    Quantity
      gwa_itab1-target_qty = p_menge.
      gwa_itab2-target_qty = 'X'.
      APPEND gwa_itab1 TO gt_order_items_in.
      APPEND gwa_itab2 TO gt_order_items_inx.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
      EXPORTING
        order_header_in               = gs_order_header_in
        ORDER_HEADER_INX              = gs_order_header_inx
      IMPORTING
        SALESDOCUMENT                 = gs_vbeln
      tables
        RETURN                        = gt_return
        ORDER_ITEMS_IN                = gt_order_items_in
        ORDER_ITEMS_INX               = gt_order_items_inx
        order_partners                = gt_order_partners.
    Check the return table.
      LOOP AT gt_return into gwa_itab4 WHERE type = 'E' OR type = 'A'.
        EXIT.
      ENDLOOP.
      IF sy-subrc = 0.
        WRITE: / 'Error occured while creating sales order '.
      ELSE.
    Commit the work.
      CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
        WRITE: / 'Document ', gs_vbeln, ' created'.
      ENDIF.

  • How to create one inbound delivery for multiple purchase order?

    Hi Experts,
    Please let me know how can I create one inbound delivery for multiple purchasing documents(PO or SA)? 
    Is there a configuration needed for this?  If yes, please let me know the configuration to make this happen.
    Appreciate your help on this.  Right answers will be rewarded.
    Thank you.
    with regards,
    Muthu Ganapathy.

    Hi,
    my situation is:
    - a WM managed warehouse, society A;
    - a HU managed warehouse (without WM), society B;
    - a purchasing process of HU from society A towards society B.
    Society B have a scheduling agreement; when a delivery schedule appears, in society A born a sales order and a delivery. After the registration of the delivery good issue, an idoc transfer information for inbound delivery creation.
    This process is ok without WM, but with a WM managed warehouse the idoc has the following problem:
    "V51VP - item was not found - process cancelled".
    Can you help me to transfer these HU?

  • How to create a sales order using bapi

    hi
        i need to create a sales order using bapi.
    can any one help me

    Do NOT USE BAPI_SALESORDER_CREATEFROMDATA, that FM is obsolete!
    Use BAPI_SALESORDER_CREATEFROMDAT1 .
    To build a reference to your contract you have to supply ORDER_HEADER_IN.
    Here´s a sample:
    MOVE:
    gs_vbak-vbeln TO ls_bapisdhd1-refobjkey,
    gs_vbak-vbeln TO ls_bapisdhd1-ref_doc,
    gs_vbak-vbtyp TO ls_bapisdhd1-refdoc_cat,
    gs_vbak-auart TO ls_bapisdhd1-refdoctype.
    also gothrouh the links
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abap%2b-%2bsimple%2bprogram%2bto%2bcreate%2bsales%2border%2busing%2bbapi

  • How to create open sales order using BAPI....?

    Hi Guru's,
    please help me how to create open sales order and which BAPI i have to use for open sales order.
    please provide any program logic related to this or step by step process.....
    that would be helpful to me.
    thanks in advance...
    Srinivas....

    Hi sreenu,
    Open PO or Open sales order means that the complete cycle is not complete. That means the Sales order is not completely delievered or is not billed or is not paid for. Only once the cycle is completed the order status shows as complete untill then its Open.
    You can use VA05 to find open sales orders.
    Similarlry open PO's are those PO's whos inbound delivery is not complete or whos goods receipt is not complete and whos payment is not done to the vendor
    U cannot directly find the open PO and open SO from any table.
    That u have to calculate from the status of the PO and SO and then check wheteher that is complete or not.
    U have table VBUP for SO status.Check out the fields in that table
    pls see the below link.
    http://abaplovers.blogspot.com/2008/02/bapi-sales-order-create-code.html
    http://msdn.microsoft.com/en-us/library/cc185190.aspx
    thjanks
    karthik

  • How to create service PO while using BAPI

    Dear Experts
    I am getting error while creating Service PO using BAPI
    E 518
    No account assignment exists for service line 0000000010
    E 518
    No account assignment exists for service line 0000000010
    TYPES : BEGIN OF ty_header,
            po_no(10)   TYPE n,
            purch_org   TYPE bapimepoheader-purch_org,
            pur_group   TYPE bapimepoheader-pur_group,
            doc_type    TYPE bapimepoheader-doc_type,
            vendor      TYPE bapimepoheader-vendor,
            doc_date    TYPE bapimepoheader-doc_date,
            currency    TYPE bapimepoheader-currency,
            comp_code   TYPE bapimepoheader-comp_code,
            END OF ty_header,
            BEGIN OF ty_item,
            po_no(10)   TYPE n,                             " Internal Use
            po_item     TYPE bapimepoitem-po_item,
            acctasscat  TYPE bapimepoitem-acctasscat,
            short_text  TYPE bapimepoitem-short_text,
            plant       TYPE bapimepoitem-plant,
            pckg_no     TYPE bapimepoitem-pckg_no,
            stge_loc    TYPE bapimepoitem-stge_loc,
            quantity    TYPE bapimepoitem-quantity,
            po_unit     TYPE bapimepoitem-po_unit,
            po_price    TYPE bapimepoitem-po_price,
            net_price   TYPE bapimepoitem-net_price,
            price_unit  TYPE bapimepoitem-price_unit,
            orderpr_un  TYPE bapimepoitem-orderpr_un,
            delivery_date TYPE bapimeposchedule-delivery_date,              " bapimeposchedule
            matl_group  TYPE bapimepoitem-matl_group,
            tax_code    TYPE bapimepoitem-tax_code,
            END OF ty_item,
            BEGIN OF ty_service,
            po_no(10)   TYPE  n,                            " Internal Use
            po_item     TYPE  bapimepoitem-po_item,         " Internal Use
            pckg_no     TYPE  bapiesllc-pckg_no,
            line_no     TYPE  bapiesllc-line_no,
            ext_line    TYPE  bapiesllc-ext_line,
            outl_ind    TYPE  bapiesllc-outl_ind,
            subpckg_no  TYPE  bapiesllc-subpckg_no,
            serial_no   TYPE  bapiesklc-serial_no,           " bapiesklc
            short_text  TYPE  bapiesllc-short_text,
            quantity    TYPE  bapiesllc-quantity,
            base_uom    TYPE  bapiesllc-base_uom,
            gr_price    TYPE  bapiesllc-gr_price,
            matl_group  TYPE  bapiesllc-matl_group,
            END OF ty_service,
            BEGIN OF ty_poaccount,
            po_no(10)   TYPE n,                             " Internal Use
            po_item      TYPE bapimepoaccount-po_item,
            serial_no    TYPE bapimepoaccount-serial_no,
            gl_account   TYPE bapimepoaccount-gl_account,
            costcenter   TYPE bapimepoaccount-costcenter,
            asset_no     TYPE bapimepoaccount-asset_no,
            orderid      TYPE bapimepoaccount-orderid,
            END OF ty_poaccount.
    DATA : it_header TYPE TABLE OF ty_header,
           wa_header TYPE ty_header,
           it_item   TYPE TABLE OF ty_item,
           wa_item   TYPE ty_item,
           it_service TYPE TABLE OF ty_service,
           wa_service TYPE ty_service,
           it_account TYPE TABLE OF ty_poaccount,
           wa_account TYPE ty_poaccount.
    DATA : it_excel1 TYPE TABLE OF alsmex_tabline,
           wa_excel1 TYPE alsmex_tabline,
           it_excel2 TYPE TABLE OF alsmex_tabline,
           wa_excel2 TYPE alsmex_tabline,
           it_excel3 TYPE TABLE OF alsmex_tabline,
           wa_excel3 TYPE alsmex_tabline,
           it_excel4 TYPE TABLE OF alsmex_tabline,
           wa_excel4 TYPE alsmex_tabline.
    DATA : number TYPE string,
           number1 TYPE string.
    ********** BAPI**************
    CONSTANTS : c_x VALUE 'X'.
    *Structures to hold PO header data
    DATA : header LIKE bapimepoheader ,
           headerx LIKE bapimepoheaderx .
    *Internal Tables to hold PO ITEM DATA
    DATA : item LIKE bapimepoitem OCCURS 0 WITH HEADER LINE,
           itemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE.
    *Structures to hold PO schedule data
    DATA : itemschedule LIKE bapimeposchedule OCCURS 0 WITH HEADER LINE ,
           itemschedulex LIKE bapimeposchedulx OCCURS 0 WITH HEADER LINE .
    *Structures to hold PO services data
    DATA : services LIKE bapiesllc OCCURS 0 WITH HEADER LINE .
    *Structures to hold PO (distrib.imputac.lín.servicios) data
    DATA : posrvaccessvalues LIKE bapiesklc OCCURS 0 WITH HEADER LINE .
    *Structures to hold PO account data
    DATA : account  LIKE bapimepoaccount OCCURS 0 WITH HEADER LINE ,
           accountx LIKE bapimepoaccountx OCCURS 0 WITH HEADER LINE .
    *Internal table to hold messages from BAPI call
    DATA : return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
           purchaseorder LIKE bapimepoheader-po_number.
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS : p_file1 TYPE rlgrap-filename OBLIGATORY,
                 p_brow1 TYPE i,
                 p_erow1 TYPE i.
    SELECTION-SCREEN : END OF BLOCK b1.
    SELECTION-SCREEN : BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS : p_file2 TYPE rlgrap-filename OBLIGATORY,
                 p_brow2 TYPE i,
                 p_erow2 TYPE i.
    SELECTION-SCREEN : END OF BLOCK b2.
    SELECTION-SCREEN : BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
    PARAMETERS : p_file3 TYPE rlgrap-filename OBLIGATORY,
                 p_brow3 TYPE i,
                 p_erow3 TYPE i.
    SELECTION-SCREEN : END OF BLOCK b3.
    SELECTION-SCREEN : BEGIN OF BLOCK b4 WITH FRAME TITLE text-004.
    PARAMETERS : p_file4 TYPE rlgrap-filename OBLIGATORY,
                 p_brow4 TYPE i,
                 p_erow4 TYPE i.
    SELECTION-SCREEN : END OF BLOCK b4.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
          field_name    = ' '
        IMPORTING
          file_name     = p_file1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file2.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
          field_name    = ' '
        IMPORTING
          file_name     = p_file2.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file3.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
          field_name    = ' '
        IMPORTING
          file_name     = p_file3.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file4.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
          field_name    = ' '
        IMPORTING
          file_name     = p_file4.
    START-OF-SELECTION.
      PERFORM excel_to_itab.
      PERFORM get_final.
    *&      Form  excel_to_itab
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM excel_to_itab .
    ************** Excel 1
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                      = p_file1
          i_begin_col                   = '1'
          i_begin_row                   = p_brow1
          i_end_col                     = '08'
          i_end_row                     = p_erow1
        TABLES
          intern                        = it_excel1
    * 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.
      LOOP AT it_excel1  INTO wa_excel1.
        CASE wa_excel1-col.
          WHEN '0001'.
            wa_header-po_no = wa_excel1-value.
          WHEN '0002'.
            wa_header-purch_org = wa_excel1-value.
          WHEN '0003'.
            wa_header-pur_group = wa_excel1-value.
          WHEN '0004'.
            wa_header-doc_type = wa_excel1-value.
          WHEN '0005'.
            wa_header-vendor = wa_excel1-value.
          WHEN '0006'.
            wa_header-doc_date = wa_excel1-value.
          WHEN '0007'.
            wa_header-currency = wa_excel1-value.
          WHEN '0008'.
            wa_header-comp_code = wa_excel1-value.
        ENDCASE.
        AT END OF row.
          APPEND wa_header TO it_header.
          CLEAR wa_header.
        ENDAT.
      ENDLOOP.
    ************** Excel 2
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
          EXPORTING
            filename                      = p_file2
            i_begin_col                   = '1'
            i_begin_row                   = p_brow2
            i_end_col                     = '16'
            i_end_row                     = p_erow2
          TABLES
            intern                        = it_excel2
    * 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.
      LOOP AT it_excel2 INTO wa_excel2.
        CASE wa_excel2-col.
          WHEN '0001'.
            wa_item-po_no = wa_excel2-value.
          WHEN '0002'.
            wa_item-po_item = wa_excel2-value.
          WHEN '0003'.
            wa_item-acctasscat = wa_excel2-value.
          WHEN '0004'.
            wa_item-short_text = wa_excel2-value.
          WHEN '0005'.
            wa_item-plant = wa_excel2-value.
          WHEN '0006'.
            wa_item-pckg_no  = wa_excel2-value.
          WHEN '0007'.
            wa_item-stge_loc = wa_excel2-value.
          WHEN '0008'.
            wa_item-quantity = wa_excel2-value.
          WHEN '0009'.
            wa_item-po_unit = wa_excel2-value.
          WHEN '0010'.
            wa_item-po_price = wa_excel2-value.
          WHEN '0011'.
            wa_item-net_price = wa_excel2-value.
          WHEN '0012'.
            wa_item-price_unit = wa_excel2-value.
          WHEN '0013'.
            wa_item-orderpr_un = wa_excel2-value.
          WHEN '0014'.
            wa_item-delivery_date  = wa_excel2-value.
          WHEN '0015'.
            wa_item-matl_group = wa_excel2-value.
          WHEN '0016'.
            wa_item-tax_code  = wa_excel2-value.
        ENDCASE.
        AT END OF row.
          APPEND wa_item TO it_item.
          CLEAR wa_item.
        ENDAT.
      ENDLOOP.
    ************** Excel 3
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
          EXPORTING
            filename                      = p_file3
            i_begin_col                   = '1'
            i_begin_row                   = p_brow3
            i_end_col                     = '13'
            i_end_row                     = p_erow3
          TABLES
            intern                        = it_excel3
    * 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.
      LOOP AT it_excel3 INTO wa_excel3.
        CASE wa_excel3-col.
          WHEN '0001'.
            wa_service-po_no = wa_excel3-value.
          WHEN '0002'.
            wa_service-po_item = wa_excel3-value.
          WHEN '0003'.
            wa_service-pckg_no = wa_excel3-value.
          WHEN '0004'.
            wa_service-line_no = wa_excel3-value.
          WHEN '0005'.
            wa_service-ext_line = wa_excel3-value.
          WHEN '0006'.
            wa_service-outl_ind = wa_excel3-value.
          WHEN '0007'.
            wa_service-subpckg_no = wa_excel3-value.
          WHEN '0008'.
            wa_service-serial_no = wa_excel3-value.
          WHEN '0009'.
            wa_service-short_text = wa_excel3-value.
          WHEN '0010'.
            wa_service-quantity = wa_excel3-value.
          WHEN '0011'.
            wa_service-base_uom = wa_excel3-value.
          WHEN '0012'.
            wa_service-gr_price = wa_excel3-value.
          WHEN '0013'.
            wa_service-matl_group = wa_excel3-value.
        ENDCASE.
        AT END OF row.
          APPEND wa_service TO it_service.
          CLEAR wa_service.
        ENDAT.
      ENDLOOP.
    ************** Excel 3
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
          EXPORTING
            filename                      = p_file4
            i_begin_col                   = '1'
            i_begin_row                   = p_brow4
            i_end_col                     = '07'
            i_end_row                     = p_erow4
          TABLES
            intern                        = it_excel4
    * 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.
      LOOP AT it_excel4 INTO wa_excel4.
        CASE wa_excel4-col.
          WHEN '0001'.
            wa_account-po_no  = wa_excel4-value.
          WHEN '0002'.
            wa_account-po_item  = wa_excel4-value.
          WHEN '0003'.
            wa_account-serial_no = wa_excel4-value.
          WHEN '0004'.
            wa_account-gl_account = wa_excel4-value.
          WHEN '0005'.
            wa_account-costcenter = wa_excel4-value.
          WHEN '0006'.
            wa_account-asset_no = wa_excel4-value.
          WHEN '0007'.
            wa_account-orderid  = wa_excel4-value.
        ENDCASE.
        AT END OF row.
          APPEND wa_account TO it_account.
          CLEAR wa_account.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " excel_to_itab
    *&      Form  GET_FINAL
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM get_final .
      LOOP AT it_header INTO wa_header.
    *  BAPI HEADER
        header-purch_org  = wa_header-purch_org.
        header-pur_group  = wa_header-pur_group.
        header-doc_type   = wa_header-doc_type.
        header-vendor     = wa_header-vendor.
        header-doc_date   = wa_header-doc_date.
        header-currency   = wa_header-currency.
        header-comp_code  = wa_header-comp_code.
    * BAPI HEADERX
        headerx-comp_code = c_x.
        headerx-doc_type = c_x.
        headerx-vendor = c_x.
        headerx-creat_date = c_x.
        headerx-created_by = c_x.
        headerx-purch_org = c_x.
        headerx-pur_group = c_x.
        headerx-langu = c_x.
        headerx-sales_pers = c_x.
        headerx-currency = c_x.
        headerx-doc_date = c_x.           " Added
        LOOP AT it_item INTO wa_item WHERE po_no = wa_header-po_no.
          CALL FUNCTION 'NUMBER_GET_NEXT'
             EXPORTING
               nr_range_nr                   = '01'
               object                        = 'SERVICE'
    *   quantity                      = '1'
    *   SUBOBJECT                     = ' '
    *   TOYEAR                        = '0000'
    *   IGNORE_BUFFER                 = ' '
              IMPORTING
              number                        =    number
    *   QUANTITY                      =
    *   RETURNCODE                    =
    * EXCEPTIONS
    *   INTERVAL_NOT_FOUND            = 1
    *   NUMBER_RANGE_NOT_INTERN       = 2
    *   OBJECT_NOT_FOUND              = 3
    *   QUANTITY_IS_0                 = 4
    *   QUANTITY_IS_NOT_1             = 5
    *   INTERVAL_OVERFLOW             = 6
    *   BUFFER_OVERFLOW               = 7
    *   OTHERS                        = 8
          IF sy-subrc <> 0.
    * Implement suitable error handling here
          ENDIF.
          item-po_item        =     wa_item-po_item.
          item-acctasscat     =     wa_item-acctasscat.
          item-item_cat       =     '9'.
          item-short_text     =     wa_item-short_text.
          item-plant          =     wa_item-plant.
          item-pckg_no        =     number.
          item-stge_loc       =     wa_item-stge_loc.
          item-quantity       =     wa_item-quantity.
          item-po_unit        =     wa_item-po_unit.
          item-po_price       =     wa_item-po_price.
          item-net_price      =     wa_item-net_price.
          item-price_unit     =     wa_item-price_unit.
          item-orderpr_un     =     wa_item-orderpr_un.
          item-matl_group     =     wa_item-matl_group.
          item-tax_code       =     wa_item-tax_code.
          APPEND item.
          CLEAR item.
          itemx-po_item = wa_item-po_item.
          itemx-item_cat =  c_x.
          itemx-po_itemx = c_x.
          itemx-short_text = c_x.
          itemx-quantity = c_x.
          itemx-tax_code = c_x.
          itemx-acctasscat = c_x.
          itemx-item_cat = c_x.
          itemx-matl_group = c_x.
          itemx-plant = c_x.
          itemx-trackingno = c_x.
          itemx-agreement = c_x.
          itemx-agmt_item = c_x.
          itemx-stge_loc = c_x.
          itemx-quantity = c_x.
          itemx-po_unit = c_x.
          itemx-conv_num1 = c_x.
          itemx-conv_den1 = c_x.
          itemx-net_price = c_x.
          itemx-price_unit = c_x.
          itemx-gr_pr_time = c_x.
          itemx-prnt_price = c_x.
          itemx-unlimited_dlv = c_x.
          itemx-gr_ind = c_x .
          itemx-ir_ind = c_x .
          itemx-gr_basediv = c_x .
          itemx-pckg_no = c_x.
          itemx-po_price = c_x.         " Added
          itemx-orderpr_un = c_x.         " Added
          APPEND itemx.
          CLEAR itemx.
          itemschedule-po_item = wa_item-po_item.
          itemschedule-del_datcat_ext = 'D'.
          itemschedule-delivery_date =  wa_item-delivery_date.
          APPEND itemschedule.
          CLEAR itemschedule.
          itemschedulex-po_item = wa_item-po_item.
          itemschedulex-po_itemx = c_x .
          itemschedulex-del_datcat_ext = c_x.
          itemschedulex-delivery_date = c_x .
          APPEND itemschedulex.
          CLEAR itemschedulex.
          LOOP AT  it_service INTO wa_service WHERE po_no = wa_item-po_no AND po_item = wa_item-po_item.
            IF  wa_service-outl_ind IS INITIAL.
    IF number1 IS INITIAL.
              CALL FUNCTION 'NUMBER_GET_NEXT'
                EXPORTING
                  nr_range_nr                   = '01'
                  object                        = 'SERVICE'
    *   quantity                      = '1'
    *   SUBOBJECT                     = ' '
    *   TOYEAR                        = '0000'
    *   IGNORE_BUFFER                 = ' '
                 IMPORTING
                 number                        =    number1
    *   QUANTITY                      =
    *   RETURNCODE                    =
    * EXCEPTIONS
    *   INTERVAL_NOT_FOUND            = 1
    *   NUMBER_RANGE_NOT_INTERN       = 2
    *   OBJECT_NOT_FOUND              = 3
    *   QUANTITY_IS_0                 = 4
    *   QUANTITY_IS_NOT_1             = 5
    *   INTERVAL_OVERFLOW             = 6
    *   BUFFER_OVERFLOW               = 7
    *   OTHERS                        = 8
              IF sy-subrc <> 0.
    * Implement suitable error handling here
              ENDIF.
              services-pckg_no      =  number.
              services-line_no      =  '1'.
              services-ext_line     =  '0'.
              services-outl_ind     =  'X'.
              services-subpckg_no   =  number1.
    *          services-short_text   =  wa_service-short_text.
    *          services-quantity     =  wa_service-quantity.
    *          services-base_uom     =  wa_service-base_uom.
    *          services-gr_price     =  wa_service-gr_price.
    *          services-matl_group   =  wa_service-matl_group.
              APPEND  services.
              CLEAR services.
    ENDIF.
    *        ELSE.
              services-pckg_no      =  number1.
              services-line_no      =  wa_service-line_no.
              services-ext_line     =  wa_service-ext_line.
    *          services-outl_ind     =  wa_service-outl_ind.
              services-subpckg_no   =  '0'.
              services-short_text   =  wa_service-short_text.
              services-quantity     =  wa_service-quantity.
              services-base_uom     =  wa_service-base_uom.
              services-gr_price     =  wa_service-gr_price.
              services-matl_group   =  wa_service-matl_group.
              APPEND  services.
              CLEAR services.
            ENDIF.
            IF wa_service-outl_ind IS INITIAL.
              posrvaccessvalues-pckg_no =  number1.
              posrvaccessvalues-line_no = wa_service-line_no.
              posrvaccessvalues-serno_line = '01'.
              posrvaccessvalues-serial_no = wa_service-serial_no.
    *          posrvaccessvalues-percentage = '100'.
              APPEND posrvaccessvalues . CLEAR posrvaccessvalues.
            ENDIF.
          ENDLOOP.
          LOOP AT it_account INTO wa_account WHERE po_no = wa_item-po_no AND po_item = wa_item-po_item.
            account-po_item         =       wa_account-po_item.
            account-serial_no       =       wa_account-serial_no.
            account-gl_account      =       wa_account-gl_account.
            account-costcenter      =       wa_account-costcenter.
            account-asset_no        =       wa_account-asset_no.
            account-orderid         =       wa_account-orderid.
            APPEND account.
            CLEAR account.
            accountx-po_item = wa_account-po_item.
            accountx-po_itemx = c_x .
            accountx-serial_no = wa_account-serial_no.
            accountx-serial_nox = c_x .
    *        accountx-creat_date = c_x .
            accountx-costcenter = c_x .
            accountx-gl_account = c_x .
    *        accountx-co_area = c_x .
    *        accountx-tax_code = c_x .
    *        accountx-asset_no        = c_x .   " Added
    *        accountx-orderid         = c_x .   " Added
            APPEND accountx. CLEAR accountx.
          ENDLOOP.
        ENDLOOP.
        CALL FUNCTION 'BAPI_PO_CREATE1'
          EXPORTING
            poheader          = header
            poheaderx         = headerx
    *       POADDRVENDOR      =
    *       TESTRUN           =
          IMPORTING
            exppurchaseorder  = purchaseorder
    *       EXPHEADER         =
    *       EXPPOEXPIMPHEADER =
          TABLES
            return            = return
            poitem            = item
            poitemx           = itemx
            poschedule        = itemschedule
            poschedulex       = itemschedulex
            poaccount         = account
            poaccountx        = accountx
            poservices        = services.
        posrvaccessvalues = posrvaccessvalues.
        IF purchaseorder IS NOT INITIAL.
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
            EXPORTING
              wait = 'X'.
        ENDIF.
        LOOP AT return.
          WRITE : / return-type, return-number, return-message.
        ENDLOOP.
      ENDLOOP.
    ENDFORM.                    " GET_FINAL

    Hi ganesh,
    Please look at the SAP note 376424 - BAPI_PO_CREATE1: Error messages for parked POs.
    Sap recommends to install the support service pack. Take a look at the note for detailed understanding.
    Also take a look at SAP NOte
    767284 - SE518 occurs although account assignment is supplied to BAPI (this requires Note 552114 must be applied as a prerequisite)
    Consider contacting basis team after your analysis about the issue.
    Regards,
    Sivaganesh

  • How to create a Inbound delivery type for a special  purchase order type

    Hi,
    I try to create a special Inbound delivery type for a special purchase order type (a transfer purchase order).
    In SD module, I can créate a special outbound delivery and precise the sale order type, but I don't manage to do it for a Inbound delivery type.
    Do you know if i can do it without specifiq?
    Regards,
    Roselyne

    Hi Roselyne,
    What you experienced is standard system behavior. Inbound delivery type is uniquely assigned to confirmation control key. You can only specify confirmation control key on item level in PO. The assignment of Delivery type can be seen in the following table:
    T163D
    IBTYP EBTYP LFART  RETDLV
    1        AB                      X
    2        LA        EL           X
    3        GW       EG
    The field T163D-IBTYP is checked in different programms. For example in programm RM06ENAB (TA: ME92F). If you insist to customize the determination of delivery type by PO type, I strongly suggest you discuss with the Application consultants before making the modifications to ensure it won't impact other areas.

  • How to create Incoming Email Activity using BAPI or Function module

    To create an Incoming Email Activity using BAPI 'BAPI_ACTIVITYCRM_CREATEMULTI' or using 'CRM_ORDER_MAINTAIN' . what parameters i need to pass to a bapi.
    Suggest me with a solution.
    Regards,
    Sanjani

    For activity you must fill the following structures of 'CRM_ORDER_MAINTAIN'...
      CALL FUNCTION 'CRM_ORDER_MAINTAIN'
        EXPORTING
          it_activity_h             = t_activity_h
          iv_collect_exceptions = ''
        CHANGING
          ct_orderadm_h         = t_orderadm_h
          ct_input_fields       = t_input_fields
        EXCEPTIONS
          error_occurred        = 1
          document_locked       = 2
          no_change_allowed     = 3
          no_authority          = 4
          OTHERS                = 5.
    And at the end you must use also 'CRM_ORDER_SAVE' to performe the save.
    Regards.

  • Change inbound delivery using /SPE/IDOC_INPUT_DESADV1

    Hello -
    We are creating an inbound delivery using the idoc function module /SPE/IDOC_INPUT_DESADV1.  I have need to be able to change an existing delivery via idoc processing, so we are populating and mapping an E1EDL18 segment with the qualifier 'CHG'.  However, in /SPE/IDOC_INPUT_DESADV1, it does not appear to handle CHG.  I have debugged down into the code and in method PARSE_AND_HANDLE_IDOC_DELVRY03, when the segment is E1EDL18, there is a case statement that looks at the qualifier, and CHG is not dealt with. 
    Any ideas how to handle this?  Or is this a legitimate bug I should report to SAP?
    Thanks for any help!
    Sharon McClure

    Sharon McClure wrote:
    Or is this a legitimate bug I should report to SAP?
    Hard to say. Why not just report it? The worst they can do is say it's a consulting issue.
    Rob

  • Creating a sales document using BAPI in web dynpro by uploading a file

    Hi ALL,
    Can some one help me how to create a sales document using  BAPI by uploading a file as input...Can someone  provide me a sample program....
    Thanks n Regards,
    Praveenn.
    Edited by: praveenn on Aug 23, 2011 12:42 PM

    Hi Sri,
    Thx for the response...
    Here is the code that i followed for creating a BAPI_SALESORDER_CREATE1 by uploading a text file as input.
    Just create a Attribute  in the VIEW CONTEXT of type String.
    method ONACTIONCREATE_SO .
    types : Begin of ty_data,
             sales_org  type vkorg,
             doc_type   type AUART,
             DISTR_CHAN type VTWEG,
             DIVISION   type spart,
             material   type matnr,
             partn_role type PARVW,
             PARTN_NUMB type kunnr,
           end of ty_data.
      DATA  :it_table TYPE  TABLE OF ty_data,
             i_data   TYPE  TABLE OF string,
             l_string TYPE string,
             wa_table TYPE ty_Data,
             l_xstring TYPE xstring,
             fields TYPE string_table,
             lv_field TYPE string.
    DATA: wa_order_header_in TYPE BAPISDHD1,
          it_order_items_in  TYPE TABLE OF BAPISDITM,
          wa_order_items_in  TYPE BAPISDITM,
          it_order_partners  TYPE TABLE OF BAPIPARNR,
          wa_order_partners  TYPE BAPIPARNR,
          it_return TYPE TABLE OF BAPIRET2,
          wa_return TYPE BAPIRET2.
    DATA : sales_doc type bapivbeln-vbeln.
    DATA:
       node_zfinal_node  TYPE REF TO if_wd_context_node,
       elem_zfinal_node  TYPE REF TO if_wd_context_element,
       stru_zfinal_node  TYPE if_main_view=>element_zfinal_node .
    get single attribute
      wd_context->get_attribute(
      EXPORTING
      name =  'DATASOURCE'
      IMPORTING
      value = l_xstring ).
      CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
        EXPORTING
          in_xstring = l_xstring
        IMPORTING
          out_string = l_string.
    SPLIT l_string  AT cl_abap_char_utilities=>newline INTO TABLE i_data.
      LOOP AT i_data INTO l_string.
       SPLIT l_string AT cl_abap_char_utilities=>horizontal_tab INTO TABLE fields.
        READ TABLE fields INTO lv_field INDEX 1.
        wa_table-sales_org = lv_field.
        READ TABLE fields INTO lv_field INDEX 2.
        wa_table-doc_type = lv_field.
        READ TABLE fields INTO lv_field INDEX 3.
        wa_table-DISTR_CHAN = lv_field.
        READ TABLE fields INTO lv_field INDEX 4.
        wa_table-DIVISION = lv_field.
        READ TABLE fields INTO lv_field INDEX 5.
        wa_table-material  = lv_field.
        READ TABLE fields INTO lv_field INDEX 6.
        wa_table-partn_role  = lv_field.
        READ TABLE fields INTO lv_field INDEX 7.
        wa_table-partn_numb  = lv_field.
    APPEND wa_table TO it_table.
      ENDLOOP.
    loop at it_table into wa_table.
    clear : wa_order_header_in.
    wa_order_header_in-sales_org   = wa_table-sales_org.
    wa_order_header_in-doc_type    = wa_table-doc_type.
    wa_order_header_in-distr_chan  = wa_table-distr_chan.
    wa_order_header_in-division    = wa_table-division.
    clear : wa_order_items_in.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input         = wa_table-material
    IMPORTING
       OUTPUT        = wa_order_items_in-material.
    *wa_order_items_in-req_qty  = wa_table-req_qty.
    append wa_order_items_in to it_order_items_in.
    clear : wa_order_partners.
    wa_order_partners-partn_role = wa_table-partn_role.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input         = wa_table-partn_numb
    IMPORTING
       OUTPUT        = wa_order_partners-partn_numb
    *wa_order_partners-partn_numb = wa_table-partn_numb.
    append wa_order_partners to it_order_partners.
    endloop.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
      EXPORTING
      SALESDOCUMENTIN               =
        order_header_in               = wa_order_header_in
      ORDER_HEADER_INX              =
      SENDER                        =
      BINARY_RELATIONSHIPTYPE       =
      INT_NUMBER_ASSIGNMENT         =
      BEHAVE_WHEN_ERROR             =
      LOGIC_SWITCH                  =
      TESTRUN                       =
      CONVERT                       = ' '
    IMPORTING
       SALESDOCUMENT                 = sales_doc
      tables
       RETURN                        = it_return
       ORDER_ITEMS_IN                = it_order_items_in
      ORDER_ITEMS_INX               =
        order_partners                = it_order_partners.
      ORDER_SCHEDULES_IN            =
    get message manager
    DATA: l_current_controller TYPE REF TO if_wd_controller,
           l_message_manager    TYPE REF TO if_wd_message_manager.
           l_current_controller ?= wd_this->wd_get_api( ).
    DATA:  v_message_text TYPE string.
    When Sales Order is created commit the data
    IF NOT sales_doc IS INITIAL.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
       EXPORTING wait = 'X'.
      CONCATENATE 'Sales Document' sales_doc 'has been created.' INTO v_message_text SEPARATED BY space.
    Report Success message
      CALL METHOD l_message_manager->report_success
      EXPORTING
      message_text = v_message_text.
      ELSE.
      v_message_text = 'Error Creating Sales Order'.
    Report Error message
    CALL METHOD l_message_manager->report_error_message
    EXPORTING
    message_text = v_message_text.
    ENDIF.
    endmethod.
    Edited by: praveenn on Aug 30, 2011 2:41 PM

  • Inbound Delivery by BAPI

    Hi,
    When a create an inbound delivery by BAPI INBDELIVERY_SAVEREPLICA the system doesn't allow delete it. The reclycle bin button (delete function) isn't disponible in the transaction VL32N. The fields VERURSYS, KZWAB and VLSTK are differents when they are saved by VL31N or BAPI:
    Values saved by VL31N
    VERURSYS = blanks
    KZWAB = I
    VLSTK = blanks
    Values saved by BAPI
    VERURSYS = System Info
    KZWAB = D
    VLSTK = A
    I think that this problem, but we don't get do the BAPI save these values.
    Can you help me??
    Thanks,
    Tatiane,

    Dear Tatiane,
    Is this a decentralized WM? If it is, this is standard system behaviour: The replicate of an inbound delivery originally created in the central ERP system cannot be deleted in the decentralized WMS to prevent inconsistencies between the two systems.
    Best regards,
    Christiane

  • Bapi for inbound delivery using PO

    Hi experts,
    I want to create a bapi for inbound delivery using PO.
    which bapi or FM should i use and can you send me the code for that.
    Thanks,
    Rajiv

    Hi Rajiv,
    Please check this FM --> BAPI_DELIVERYPROCESSING_EXEC
    Please check these threads
    Bapi to create inbound delivery
    BAPI to create inbound delivery
    Hope this would help you.
    Good luck
    Narin

  • How to create a new material using a BAPI?

    Dear friends,
    How to create a new material using a BAPI? I mean without knowing the material no., how to just create a new one using function modules(BAPI)?
    Thanks a lot!

    Dear,
    New material can be created by using a BAPI_MATERIAL_SAVEDATA.
    More over their are lots of threads available on SDN on the question you raised so kindly search the SDN before posting any thread .
    Cheers
    fareed

  • Creating Outbound Delivery using BAPI

    Hi All,
    Can anyone advice is there any way to create Oubound Delivery using BAPI.
    If you have come accross with such developments or idea, can you please share your idea?.
    Thanks,
    Muruganand.K

    Hi,
    Use BAPI_DELIVERYPROCESSING_EXEC - Create Delivery from Delivery Due List
    BAPI_OUTB_DELIVERY_CONFIRM_DEC  BAPI for Outbound Delivery Confirmation from a Decentralized System
    BAPI_OUTB_DELIVERY_SPLIT_DEC   BAPI for Subsequent Outbound-Delivery Split from a Decentralized System
    BAPI_OUTB_DELIVERY_CHANGE
    BAPI_OUTB_DELIVERY_CREATENOREF
    BAPI_OUTB_DELIVERY_CREATE_SLS
    BAPI_OUTB_DELIVERY_CREATE_STO
    BAPI_OUTB_DELIVERY_SAVEREPLICA
    Also check
    BAPI for Outbound Delivery Creation with reference to Sales Order - VL01N
    BAPI / FM for Create Outbound Delivery for PO
    Outbound  Delivery User Exits
    EXIT_SAPLV50I_003              User Exit BAPI Outbound Delivery Replication
    EXIT_SAPLV50I_004              User Exit BAPI Outbound Delivery Confirmation
    EXIT_SAPLV50K_007              User Exit BAPI Outbound Delivery Replication (Outbound from Sender System)
    Function module: OIJ_EL_DOCG_CREATE_DELIVERY - Create outbound delivery

  • What is the BAPI for creating an inbound delivery without reference.

    Hi Experts,
    What is the BAPI for creating an inbound delivery without reference.
    Points will be rewarded

    BAPI_DELIVERYPROCESSING_EXEC
    cheers
    Aveek

Maybe you are looking for

  • Flash player not working in Google Reader

    My flash installation appears to be fine since youtube works perfectly along with any other website that uses flash. Here is my issue: When read an article that has an enclosed (embedded) mp3 the typical flash player that google reader uses is not sh

  • IMac Firewire 800 port not supplying power

    Hi, The FW800 port on my iMac suddenly stopped supplying power to bus-powered drives. The same drives work/mount when I use an AC adapter. Have thoroughly trouble-shot (shooted?) the hard drives/cables on a different computer. Tried the SMC reset (un

  • I mistakenly uninstalled firefox after getting a double version of 15.0 on my computer..after redownloading it .. I lost ALL my bookmarks, passwords, tabs. HELP

    Like i earlier stated .. after my update of the latest firefox [15.0.1] i found two of thesame versions of it on my program features so i decided to delete one. unluckily for my it cleaned out both and after reinstalling firefox i realised all my TAB

  • Applying effect turns clip black

    I've got 26 students working on their first projects, and this has popped up twice now. Start with a clip on the timeline. Select it. Go to video effects. Choose an effect. Watch the preview. Click "apply." Wait for the render to complete. POOF! What

  • ITunes 11.1.5 No album covers anymore?

    Hi, I upgraded my iTunes recently and I was negatively surprised that it changed the iTunes Media's location without my agreement.  After that I changed again the location and I consolidated all my music.  Fortunately everything is in the right place