How to use the bapi   BAPI_PO_CREATE1

HI,
CAN ANY ONE TELL ME HOW TO GET THIS FM WORK TO CREATE A PURCHASE ORDER.

Hi Preeti,
Refer sample code:
*& Report  YDM_PO_CREATE                                               *
REPORT  ydm_po_create.
*-- Input File Declaration
TYPES: BEGIN OF ty_input_file,
       column1 TYPE char50,
       column2 TYPE char50,
       column3 TYPE char50,
       column4 TYPE char50,
       column5 TYPE char50,
       column6 TYPE char50,
       column7 TYPE char50,
       column8 TYPE char50,
       column9 TYPE char50,
       column10 TYPE char50,
       column11 TYPE char50,
       column12 TYPE char50,
       column13 TYPE char50,
       column14 TYPE char50,
       column15 TYPE char50,
       column16 TYPE char50,
       column17 TYPE char50,
       column18 TYPE char50,
END OF ty_input_file.
DATA: i_input_file  TYPE STANDARD TABLE OF ty_input_file,
      wa_input_file TYPE ty_input_file.
CONSTANTS: c_path     TYPE char20 VALUE 'C:\',
           c_mask     TYPE char9  VALUE ',*.*,*.*.',
           c_mode     TYPE char1  VALUE 'O',
           c_filetype TYPE char10 VALUE 'ASC',
           c_x        TYPE char01 VALUE 'X'.
PARAMETERS : p_fname   LIKE rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
*-- Browse Presentation Server
  PERFORM f4_presentation_file.
START-OF-SELECTION..
*-- Read presentation server file
  PERFORM f1003_upload_file.
  IF NOT i_input_file[] IS INITIAL.
    PERFORM split_data.
  ENDIF.
*&                  Form  f4_presentation_file
*&                F4 Help for presentation server
FORM f4_presentation_file .
  CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
      def_path         = c_path
      mask             = c_mask
      mode             = c_mode
      title            = text-001
    IMPORTING
      filename         = p_fname
    EXCEPTIONS
      inv_winsys       = 1
      no_batch         = 2
      selection_cancel = 3
      selection_error  = 4
      OTHERS           = 5.
  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.                    " f4_presentation_file
*&                      Form  f1003_upload_file
*&                         Upload File
FORM f1003_upload_file .
  DATA: lcl_filename TYPE string.
  lcl_filename = p_fname.
  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename                = lcl_filename
      filetype                = c_filetype
      has_field_separator     = c_x
    TABLES
      data_tab                = i_input_file
    EXCEPTIONS
      file_open_error         = 1
      file_read_error         = 2
      no_batch                = 3
      gui_refuse_filetransfer = 4
      invalid_type            = 5
      no_authority            = 6
      unknown_error           = 7
      bad_data_format         = 8
      header_not_allowed      = 9
      separator_not_allowed   = 10
      header_too_long         = 11
      unknown_dp_error        = 12
      access_denied           = 13
      dp_out_of_memory        = 14
      disk_full               = 15
      dp_timeout              = 16
      OTHERS                  = 17.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    EXIT.
  ENDIF.
ENDFORM.                    " f1003_upload_file
*&      Form  split_data
      Collect data for creating Purchase Order
FORM split_data .
  DATA: i_poitem        TYPE STANDARD TABLE OF bapimepoitem,
        i_poitemx       TYPE STANDARD TABLE OF bapimepoitemx,
        i_poitem_sch    TYPE STANDARD TABLE OF bapimeposchedule,
        i_poitem_schx   TYPE STANDARD TABLE OF bapimeposchedulx,
        i_acct_***      TYPE STANDARD TABLE OF bapimepoaccount,
        i_acct_assx     TYPE STANDARD TABLE OF bapimepoaccountx,
        i_services      TYPE STANDARD TABLE OF bapiesllc ,
        i_srvacc        TYPE STANDARD TABLE OF bapiesklc,
        i_return        TYPE STANDARD TABLE OF bapiret2,
        wa_header       TYPE bapimepoheader,
        wa_headerx      TYPE bapimepoheaderx,
        wa_poitem       TYPE bapimepoitem,
        wa_poitemx      TYPE bapimepoitemx,
        wa_poitem_sch   TYPE bapimeposchedule,
        wa_poitem_schx  TYPE bapimeposchedulx,
        wa_acct_***     TYPE bapimepoaccount,
        wa_acct_assx    TYPE bapimepoaccountx,
        wa_services     TYPE bapiesllc,
        wa_srvacc       TYPE bapiesklc,
        wa_return       TYPE bapiret2,
        ws_po           TYPE bapimepoheader-po_number.
  break gbpra8.
  wa_services-pckg_no = 10.
  wa_services-line_no = 1.
  wa_services-outl_no = '0'.
  wa_services-outl_ind = c_x.
  wa_services-subpckg_no = 20.
  APPEND wa_services TO i_services.
  wa_srvacc-pckg_no = 10.
  wa_srvacc-line_no = 1.
  wa_srvacc-serno_line = 01.
  wa_srvacc-serial_no = 01.
  wa_srvacc-percentage = 100.
  APPEND wa_srvacc TO i_srvacc.
  LOOP AT i_input_file INTO wa_input_file.
    IF wa_input_file-column2 EQ 'HD'.
      wa_header-doc_type = wa_input_file-column3.
      wa_header-creat_date = sy-datum.
      wa_header-created_by = sy-uname.
      wa_header-vendor = wa_input_file-column4.
      PERFORM conversion_output USING wa_header-vendor
                                CHANGING wa_header-vendor.
      wa_header-comp_code = 'DE03'.
      wa_header-purch_org = 'DE03'.
      wa_header-pur_group = 'DE1'.
      wa_header-vper_start = wa_input_file-column9.
      wa_header-vper_end = wa_input_file-column10.
      wa_headerx-comp_code = c_x.
      wa_headerx-doc_type = c_x.
      wa_headerx-creat_date = c_x.
      wa_headerx-created_by = c_x.
      wa_headerx-vendor = c_x.
      wa_headerx-purch_org = c_x.
      wa_headerx-pur_group = c_x.
      wa_headerx-vper_start = c_x.
      wa_headerx-vper_end = c_x.
    ENDIF.
    IF wa_input_file-column2 EQ 'IT'.
      wa_poitem-po_item = wa_input_file-column3.
      wa_poitem-short_text = wa_input_file-column6.
      wa_poitem-plant = wa_input_file-column8.
      wa_poitem-quantity = '1'.
      wa_poitem-tax_code = 'V0'.
      wa_poitem-item_cat = 'D'.
      wa_poitem-acctasscat = 'K'.
      wa_poitem-matl_group = wa_input_file-column7.
      wa_poitem-pckg_no = '10'.
      APPEND wa_poitem TO i_poitem .
      wa_poitemx-po_item = wa_input_file-column3.
      wa_poitemx-po_itemx = c_x.
      wa_poitemx-short_text = c_x.
      wa_poitemx-plant = c_x.
      wa_poitemx-quantity = c_x.
      wa_poitemx-tax_code = c_x.
      wa_poitemx-item_cat = c_x.
      wa_poitemx-acctasscat = c_x.
      wa_poitemx-matl_group = c_x.
      wa_poitemx-pckg_no = c_x.
      APPEND wa_poitemx TO i_poitemx.
      wa_poitem_sch-po_item = wa_input_file-column3.
      wa_poitem_sch-delivery_date = sy-datum.
      APPEND wa_poitem_sch TO i_poitem_sch.
      wa_poitem_schx-po_item = wa_input_file-column3.
      wa_poitem_schx-po_itemx = c_x.
      wa_poitem_schx-delivery_date = c_x.
      APPEND wa_poitem_schx TO i_poitem_schx.
      wa_acct_***-po_item = 10.
      wa_acct_***-serial_no = 01.
      wa_acct_***-gl_account = '0006360100'.
      wa_acct_***-co_area  = '1000'.
      wa_acct_***-costcenter = 'KC010000'.
      APPEND wa_acct_*** TO i_acct_***.
      wa_acct_***-po_item = 10.
      wa_acct_***-serial_no = 02.
      wa_acct_***-gl_account = '0006360100'.
      wa_acct_***-co_area  = '1000'.
      wa_acct_***-costcenter = 'KC010000'.
      APPEND wa_acct_*** TO i_acct_***.
      wa_acct_assx-po_item = 10.
      wa_acct_assx-serial_no = 01.
      wa_acct_assx-po_itemx = c_x.
      wa_acct_assx-serial_nox = c_x.
      wa_acct_assx-gl_account = c_x.
      wa_acct_assx-co_area  = c_x.
      wa_acct_assx-costcenter = c_x.
      APPEND wa_acct_assx TO i_acct_assx.
      wa_acct_assx-po_item = 10.
      wa_acct_assx-serial_no = 02.
      wa_acct_assx-po_itemx = c_x.
      wa_acct_assx-serial_nox = c_x.
      wa_acct_assx-gl_account = c_x.
      wa_acct_assx-co_area  = c_x.
      wa_acct_assx-costcenter = c_x.
      APPEND wa_acct_assx TO i_acct_assx.
      wa_services-pckg_no = 20.
      wa_services-line_no = 2.
      wa_services-service = wa_input_file-column9.
      wa_services-quantity = '100'.
      wa_services-gr_price = '100'.
      wa_services-userf1_txt = wa_input_file-column13.
      APPEND wa_services TO i_services.
      wa_srvacc-pckg_no = 20.
      wa_srvacc-line_no = 1.
      wa_srvacc-serno_line = 02.
      wa_srvacc-serial_no = 02.
      wa_srvacc-percentage = 100.
      APPEND wa_srvacc TO i_srvacc.
    ENDIF.
  ENDLOOP.
  CALL FUNCTION 'BAPI_PO_CREATE1'
    EXPORTING
      poheader                     = wa_header
      poheaderx                    = wa_headerx
  POADDRVENDOR                 =
  TESTRUN                      =
  MEMORY_UNCOMPLETE            =
  MEMORY_COMPLETE              =
  POEXPIMPHEADER               =
  POEXPIMPHEADERX              =
  VERSIONS                     =
  NO_MESSAGING                 =
  NO_MESSAGE_REQ               =
  NO_AUTHORITY                 =
  NO_PRICE_FROM_PO             =
   IMPORTING
     exppurchaseorder             = ws_po
  EXPHEADER                    =
  EXPPOEXPIMPHEADER            =
   TABLES
     return                       = i_return
     poitem                       = i_poitem
     poitemx                      = i_poitemx
  POADDRDELIVERY               =
     poschedule                   = i_poitem_sch
     poschedulex                  = i_poitem_schx
     poaccount                    = i_acct_***
  POACCOUNTPROFITSEGMENT       =
     poaccountx                   = i_acct_assx
  POCONDHEADER                 =
  POCONDHEADERX                =
  POCOND                       =
  POCONDX                      =
  POLIMITS                     =
  POCONTRACTLIMITS             =
     poservices                   = i_services
     posrvaccessvalues            = i_srvacc
  POSERVICESTEXT               =
  EXTENSIONIN                  =
  EXTENSIONOUT                 =
  POEXPIMPITEM                 =
  POEXPIMPITEMX                =
  POTEXTHEADER                 =
  POTEXTITEM                   =
  ALLVERSIONS                  =
  POPARTNER                    =
  break gbpra8.
  LOOP AT i_return INTO wa_return.
  ENDLOOP.
ENDFORM.                    " split_data
*&      Form  conversion_output
      Conversion exit input
FORM conversion_output  USING    p_ip
                        CHANGING p_op.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = p_ip
    IMPORTING
      output = p_op.
ENDFORM.                    " conversion_output
Suggest you to Search in <b>SDN with key - BAPI_PO_CREATE1</b>
Will get few more useful related Posts.
Reward points if this Helps.
Manish

Similar Messages

  • How to use the BAPI BAPI_ALM_ORDER_MAINTAIN

    HI experts,
    I am using BAPI_ALM_ORDER_MAINTAIN to update the Object list in ECC 6.0 for a service order txn code IE31.
    I dont know how to use this BAPI_ALM_ORDER_MAINTAIN for object list updation.
    It will be very helpful if anyone who worked on this or know about BAPI_ALM_ORDER_MAINTAIN how to use, plz reply this thread.
    I am really searching for along time about the bapi, but couldnt getany thing.
    the doc of BAPI_ALM_ORDER_MAINTAIN is very vague, that i m not able to understand.
    So, sap persons, plz reply this thread,
    Ntk

    Friends,
    I am getting the following message with the FM BAPI_ALM_ORDER_MAINTAIN,  "Order  is changed, but not created".
    But when i see the Service Order, im not able to see the new equipments added in the Object tab.
    Here is my code...
    DATA: l_alm_bapi TYPE c,
          T_METHODS TYPE STANDARD TABLE OF bapi_alm_order_method,
          ls_methodS TYPE bapi_alm_order_method,
          LS_OBJ type bapi_alm_order_objectlist,
          lt_OBJ type standard table of bapi_alm_order_objectlist,
          lt_operation
             TYPE STANDARD TABLE OF bapi_alm_order_objectlist,
          ls_operation TYPE bapi_alm_order_objectlist,
          lt_oBJ_up
             TYPE STANDARD TABLE OF bapi_alm_order_olist_up,
          ls_oBJ_up TYPE bapi_alm_order_olist_up,
          lt_return TYPE STANDARD TABLE OF bapiret2,
                lt_return1 like BAPIRET2,
          ls_return TYPE bapiret2,
          LS_NUMBERS TYPE   BAPI_ALM_NUMBERS,
         T_NUMBERS TYPE STANDARD TABLE OF BAPI_ALM_NUMBERS.
    CLEAR T_METHODS.
    LS_METHODS-REFNUMBER = 1.
    LS_METHODS-OBJECTTYPE = ''.
    LS_METHODS-METHOD = 'SAVE'.
    LS_METHODS-OBJECTKEY = '%00000000001'..
    APPEND LS_METHODS TO T_METHODS.
    LS_METHODS-REFNUMBER = 1.
    LS_METHODS-OBJECTTYPE = 'OBJECTLIST'.
    LS_METHODS-METHOD = 'CHANGE'.
    LS_METHODS-OBJECTKEY = '%00000000001'..
    APPEND  LS_METHODS TO T_METHODS.
    CLEAR T_NUMBERS.
    LS_NUMBERS-AUFNR_IN = '000004010558'..
    APPEND LS_NUMBERS TO  T_NUMBERS.
    LS_OBJ-COUNTER = 1.
    LS_OBJ-FUNCT_LOC = '5619'.
    LS_OBJ-EQUIPMENT = '0000010000292'.
    LS_OBJ-SORTFIELD = 'X'.
    ls_oBJ-PROCESSING_IND = 'X'.
    ls_oBJ-SERIALNO = ''.
    ls_oBJ-SERMAT = '0010-30000'.
    ls_oBJ-DESCRIPTN = 'MAIN UNIT DR300'.
    APPEND LS_OBJ TO LT_OBJ.
    LS_OBJ_UP-SORTFIELD = 'X'.
    LS_OBJ_UP-PROCESSING_IND = 'X'.
    APPEND LS_OBJ_UP TO LT_OBJ_UP.
    CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
      TABLES
        IT_METHODS              = T_METHODS
      IT_HEADER               =
      IT_HEADER_UP            =
      IT_HEADER_SRV           =
      IT_HEADER_SRV_UP        =
      IT_USERSTATUS           =
      IT_PARTNER              =
      IT_PARTNER_UP           =
      IT_OPERATION            =
      IT_OPERATION_UP         =
      IT_RELATION             =
      IT_RELATION_UP          =
      IT_COMPONENT            =
      IT_COMPONENT_UP         =
       IT_OBJECTLIST           = LT_OBJ
       IT_OBJECTLIST_UP        = LT_OBJ_UP
      IT_OLIST_RELATION       =
      IT_TEXT                 =
      IT_TEXT_LINES           =
      IT_SRULE                =
      IT_SRULE_UP             =
      IT_TASKLISTS            =
      EXTENSION_IN            =
       RETURN                  = LT_RETURN
       ET_NUMBERS              = T_NUMBERS.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    WAIT =
    IMPORTING
    RETURN = lt_return1.
    Kindly help me out anyone who has worked with these FM. I am not able to do this.

  • How to use the BAPI:BAPI_PAYM_ITEM_POST_CLEARING

    Hi,
    What are the input parameters to give for the  BAPI BAPI_PAYM_ITEM_POST_CLEARING..and what it Returns ?.Can you give me small example?.
    Regards,
    Kiran.
    Edited by: SPY SPY on Jan 22, 2008 11:06 AM

    You have to pass Header and GM code as the INput parameters for uing this BAPI....GM code would be structure.
    Also you have to pass the INternal table Item for the goods mvt cxreate which will contains
          BATCH.
          MOVE_TYPE.
          ENTRY_QNT.
          MOVE_PLANT.
          MOVE_STLOC.
          MOVE_BATCH.
          MOVE_REAS
    these parameters.
    Regards,
    Sushil.

  • How to use the BAPI_GOODSMVT_CREATE for Transfer posting Sales order

    Hi Friends,
    How to use the Bapi BAPI_GOODSMVT_CREATE for transfer posting sales order to sales order.
    pls, send the list of parameteres to pass to the bapi, if program avail please send it to me.
    Thanks in advance
    Shankar

    You have to pass Header and GM code as the INput parameters for uing this BAPI....GM code would be structure.
    Also you have to pass the INternal table Item for the goods mvt cxreate which will contains
          BATCH.
          MOVE_TYPE.
          ENTRY_QNT.
          MOVE_PLANT.
          MOVE_STLOC.
          MOVE_BATCH.
          MOVE_REAS
    these parameters.
    Regards,
    Sushil.

  • How to use the BAPI_VENDOR_CREATE

    Hi Experts,
    Could anyone explain me, how to use the BAPI, 'BAPI_VENDOR_CREATE' !
    Our requirement is to create vendors from the third party system say like 'BIZTALK' . Those people will be connecting to our SAP server through a custom RFC, which I have to create and in that RFC, I have to call this BAPI. since the BAPI, 'BAPI_VENDOR_CREATE' doesn't have any import parameters, I am unable to pass the Vendor numbers and other fields say like, 'COMPANY CODE, ACCOUNT GROUP, STREET etc.., ' , which are also needed by the time of creating vendors.
    Can anyone help me out, how to solve this issue!!! Or else is there any otherway of approaching this problem, also please let me know...
    Thanks in advance.
    SOMU.

    You have to pass Header and GM code as the INput parameters for uing this BAPI....GM code would be structure.
    Also you have to pass the INternal table Item for the goods mvt cxreate which will contains
          BATCH.
          MOVE_TYPE.
          ENTRY_QNT.
          MOVE_PLANT.
          MOVE_STLOC.
          MOVE_BATCH.
          MOVE_REAS
    these parameters.
    Regards,
    Sushil.

  • How to delete an operation from order using the bapi

    Can somebody please tell me how to delete an operation from order using the bapi
    BAPI_ALM_ORDER_MAINTAIN.
    Following was the test data for the BAPI.
    000000 OPERATION DELETE 0000040052810070
    000000 SAVE 0000040052810070
    Even I tried entering the operation table. The BAPI control ends fine, but when I check the order using IW32, the operation still exists.
    So, can you please tell me where Iam going wrong.

    Hi Subash Mohanvel,
    Check bapireturn parameter of the bapi BAPI_ALM_ORDER_MAINTAIN after execution of the code , and if there is no error message in the return table then call bapi_Transaction_commit.
    Unless you call this database saving of the records/values will not get reflected in the system.
    Hope that helps.
    Regards
    Kapadia
    ***Assigning points is the way to say thanks in SDN.***

  • Need Help ! PO using a BAPI -  BAPI_PO_CREATE1

    Hi friends,
    Need some help. I am trying to create a PO using a BAPI - BAPI_PO_CREATE1
    <i><b>I want the new PO to have all the characteristics of an existing PO. which is stored in wa_order_split_create-docnr and for the new PO, i want the quantity from wa_order_split_create-qty_acptd and the delivery data to be wa_order_split_create-dly_date. But this process and code below gives a short dump in  the std FM  - MEPO_DOC_ITEM_GET . It raises an exception of failure.</b></i>
    Am i making any mistake while filling the header or item or schedule lines before BAPI_PO_CREATE1 ?
    MOVE: wa_order_split_create-docnr TO i_ebeln,
    wa_order_split_create-docitm TO i_ebelp .
    CALL FUNCTION 'ME_EKKO_SINGLE_READ'
    EXPORTING
    pi_ebeln = i_ebeln
    IMPORTING
    po_ekko = i_ekko
    EXCEPTIONS
    no_records_found = 1
    OTHERS = 2.
    IF sy-subrc <> 0 .
    ENDIF .
    Fill PO Header
    i_bpoh-comp_code = i_ekko-bukrs .
    i_bpoh-doc_type = i_ekko-bsart .
    i_bpoh-vendor = i_ekko-lifnr .
    i_bpoh-langu = i_ekko-spras .
    i_bpoh-pmnttrms = i_ekko-zterm .
    i_bpoh-purch_org = i_ekko-ekorg .
    i_bpoh-pur_group = i_ekko-ekgrp .
    i_bpoh-currency = i_ekko-waers .
    i_bpoh-agreement = i_ekko-konnr .
    i_bpoh-incoterms1 = i_ekko-inco1 .
    i_bpoh-incoterms2 = i_ekko-inco2 .
    Fill PO update indicator 'X'
    i_bpohx-comp_code = c_char_x .
    i_bpohx-doc_type = c_char_x .
    i_bpohx-vendor = c_char_x .
    i_bpohx-langu = c_char_x .
    i_bpohx-pmnttrms = c_char_x .
    i_bpohx-purch_org = c_char_x .
    i_bpohx-pur_group = c_char_x .
    i_bpohx-currency = c_char_x .
    i_bpohx-agreement = c_char_x .
    i_bpohx-incoterms1 = c_char_x .
    i_bpohx-incoterms2 = c_char_x .
    CALL FUNCTION 'ME_EKPO_SINGLE_READ'
    EXPORTING
    pi_ebeln = i_ebeln
    pi_ebelp = i_ebelp
    IMPORTING
    po_ekpo = i_ekpo
    EXCEPTIONS
    no_records_found = 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 .
    Fill PO Item
    i_wa_bpoi-po_item = i_ekpo-ebelp .
    i_wa_bpoi-material = i_ekpo-matnr .
    i_wa_bpoi-plant = i_ekpo-werks .
    i_wa_bpoi-stge_loc = i_ekpo-lgort .
    i_wa_bpoi-quantity = wa_order_split_create-qty_acptd .
    i_wa_bpoi-po_unit = i_ekpo-meins .
    i_wa_bpoi-tax_code = i_ekpo-mwskz .
    i_wa_bpoi-val_type = i_ekpo-bwtar .
    i_wa_bpoi-item_cat = i_ekpo-pstyp .
    i_wa_bpoi-acctasscat = i_ekpo-knttp .
    i_wa_bpoi-agreement = i_ekpo-konnr .
    i_wa_bpoi-agmt_item = i_ekpo-ktpnr .
    APPEND i_wa_bpoi TO i_bpoi .
    Fill PO Item update indicator 'X'
    i_wa_bpoix-po_item = i_ekpo-ebelp .
    i_wa_bpoix-po_itemx = c_char_x .
    i_wa_bpoix-material = c_char_x .
    i_wa_bpoix-plant = c_char_x .
    i_wa_bpoix-stge_loc = c_char_x .
    i_wa_bpoix-quantity = c_char_x .
    i_wa_bpoix-po_unit = c_char_x .
    i_wa_bpoix-tax_code = c_char_x .
    i_wa_bpoix-val_type = c_char_x .
    i_wa_bpoix-item_cat = c_char_x .
    i_wa_bpoix-acctasscat = c_char_x .
    i_wa_bpoix-agreement = c_char_x .
    i_wa_bpoix-agmt_item = c_char_x .
    APPEND i_wa_bpoix TO i_bpoix .
    Fill PO Item Schedule
    i_wa_bpos-po_item = i_ekpo-ebelp .
    i_wa_bpos-sched_line = '0001' .
    i_wa_bpos-delivery_date = wa_order_split_create-dly_date .
    i_wa_bpos-quantity = wa_order_split_create-qty_acptd .
    APPEND i_wa_bpos TO i_bpos .
    Fill PO Item schedule update indicator 'X'
    i_wa_bposx-po_item = i_ekpo-ebelp .
    i_wa_bposx-sched_line = '0001' .
    i_wa_bposx-delivery_date = c_char_x .
    i_wa_bposx-quantity = c_char_x .
    APPEND i_wa_bposx TO i_bposx .
    CLEAR: i_pargr .
    SELECT SINGLE pargr
    INTO i_pargr
    FROM t161
    WHERE bstyp = i_ekko-bstyp
    AND bsart = i_ekko-bsart .
    CLEAR i_ekpa[].
    CALL FUNCTION 'MM_READ_PARTNERS'
    EXPORTING
    application = c_char_p
    ebeln = i_ebeln
    bstyp = i_ekko-bstyp
    pargr = i_pargr
    TABLES
    x_ekpa = i_ekpa[].
    LOOP AT i_ekpa INTO i_wa_ekpa .
    i_wa_bpop-partnerdesc = i_wa_ekpa-parvw .
    i_wa_bpop-langu = sy-langu .
    IF NOT i_wa_ekpa-lifn2 IS INITIAL .
    i_wa_bpop-buspartno = i_wa_ekpa-lifn2 .
    ELSE .
    i_wa_bpop-buspartno = i_wa_ekpa-parnr .
    ENDIF .
    APPEND i_wa_bpop TO i_bpop .
    CLEAR: i_wa_ekpa, i_wa_bpop .
    ENDLOOP .
    CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
    CALL FUNCTION 'BAPI_PO_CREATE1'
    EXPORTING
    poheader = i_bpoh
    poheaderx = i_bpohx
    IMPORTING
    exppurchaseorder = i_new_ebeln
    TABLES
    return = i_bapiret2
    poitem = i_bpoi[]
    poitemx = i_bpoix[]
    poschedule = i_bpos[]
    poschedulex = i_bposx[].
    i_order = i_new_ebeln .
    SHIFT i_order LEFT DELETING LEADING '0' .
    i_return-errortype = c_char_i .
    i_return-workarea = c_zsw .
    i_return-message = '064' .
    i_return-variable1 = i_order .
    loop at i_bapiret2 into i_bapiretn where type ca 'EAX' .
    append i_bapiretn to t_bapi_return .
    endloop .
    if t_bapi_return[] is initial .
    i_create_order = c_char_x .
    CALL FUNCTION 'SWD_POPUP_MESSAGE_SEND'
    EXPORTING
    act_return = i_return.

    Hi,
    Make the required settings to trigger an idoc during the creation of a PO in Me21N with multiple line items, check how the idoc is being created, This should be starting point to know how to create idoc with multiple line items.
    Hope this works for you.
    Rajeev

  • Open Purchase Order UPload Using the BAPI 's

    i need to upload the open Purchase Order using the BAPI function BAPI_PO_CREATE1., below is the given fileds blod are for Header, header will Repeat for the line items,can any one help me out  using the BAIP's for upload the PO, i need sample code for this ........
    Thanks & Regards
    Raghu
    <u>Field Name     Field Description                              Type     Length</u>
    <b>EBELN             Purchasing Document Number                         CHAR     010          X
    BUKRS             Company Code                                                     CHAR    004     MN10     C
    EKORG             Purchasing Organization                              CHAR     004     MN00     C
    EKGRP             Purchasing group                              CHAR     003          X
    BSART             Order type (Purchasing)                              CHAR     004          X
    LIFNR             Account Number of Vendor or Creditor                    CHAR     010          X
    BEDAT             Purchase Order Date                              DATS     010          X
    ZTERM             Terms of payment key                              CHAR     004          X
    WAERS             Currency Key                                   CUKY     005          X
    INCO1             Incoterms (part 1)                              CHAR     003          X
    INCO2             Incoterms (part 2)                              CHAR     028          X</b>
    EBELP             Item Number of Purchasing Document                    NUMC     005          X
    EMATN             Material number                                   CHAR     018          X
    WERKS             Plant                                        CHAR     004          X
    LGORT             Storage location                              CHAR     004          X
    EPSTP             Item category in purchasing document                    CHAR     001          X
    KNTTP             Account assignment category                         CHAR     001          X
    EINDT             Item delivery date                              DATS     010          X
    MENGE            "Purchase order quantity (direct input, transfer of POs)"     CHAR     013          X
    MEINS            Order unit                                   UNIT     003          X
    NETPR            "Net price: Document currency (direct input, transfer of"     CHAR     011          X
    PEINH            "Price unit (direct input, transfer of POs)"               CHAR     005          X
    BPRME            Order Price Unit (Purchasing)                         UNIT     003          X
    BPUMZ            Numerator: Conversion OPUn into OUn (direct input of POs          CHAR     005          X
    BPUMN            Denominator: Conversion OPUn into OUn (direct input of P          CHAR     005          X
    SAKTO            Cost element                                   CHAR     010          X
    KOSTL              Cost Center                                   CHAR     010          X
    VBELN          Sales and Distribution Document Number                    CHAR     010          X
    VBELP          Sales document item                              NUMC     006          X
    WEMPF          Goods recipient                                   CHAR     012          X
    WEBTH          "Amount in local currency (direct input, transfer of POs)"     CHAR     013          X
    WEBTF          "Amount in document currency (direct input, transfer of P"     CHAR     013          X
    WEREF          Flag for treatment of GR/IR (direct input of POs)          CHAR     001          X
    SPINF          Indicator: Update info record                         CHAR     001          X
    WEPOS          Goods Receipt Indicator                              CHAR     001          X
    REPOS          Invoice receipt indicator                         CHAR     001          X

    i need to upload the open Purchase Order using the BAPI function BAPI_PO_CREATE1., below is the given fileds blod are for Header, header will Repeat for the line items,can any one help me out  using the BAIP's for upload the PO, i need sample code for this ........
    Thanks & Regards
    Raghu
    <u>Field Name     Field Description                              Type     Length</u>
    <b>EBELN             Purchasing Document Number                         CHAR     010          X
    BUKRS             Company Code                                                     CHAR    004     MN10     C
    EKORG             Purchasing Organization                              CHAR     004     MN00     C
    EKGRP             Purchasing group                              CHAR     003          X
    BSART             Order type (Purchasing)                              CHAR     004          X
    LIFNR             Account Number of Vendor or Creditor                    CHAR     010          X
    BEDAT             Purchase Order Date                              DATS     010          X
    ZTERM             Terms of payment key                              CHAR     004          X
    WAERS             Currency Key                                   CUKY     005          X
    INCO1             Incoterms (part 1)                              CHAR     003          X
    INCO2             Incoterms (part 2)                              CHAR     028          X</b>
    EBELP             Item Number of Purchasing Document                    NUMC     005          X
    EMATN             Material number                                   CHAR     018          X
    WERKS             Plant                                        CHAR     004          X
    LGORT             Storage location                              CHAR     004          X
    EPSTP             Item category in purchasing document                    CHAR     001          X
    KNTTP             Account assignment category                         CHAR     001          X
    EINDT             Item delivery date                              DATS     010          X
    MENGE            "Purchase order quantity (direct input, transfer of POs)"     CHAR     013          X
    MEINS            Order unit                                   UNIT     003          X
    NETPR            "Net price: Document currency (direct input, transfer of"     CHAR     011          X
    PEINH            "Price unit (direct input, transfer of POs)"               CHAR     005          X
    BPRME            Order Price Unit (Purchasing)                         UNIT     003          X
    BPUMZ            Numerator: Conversion OPUn into OUn (direct input of POs          CHAR     005          X
    BPUMN            Denominator: Conversion OPUn into OUn (direct input of P          CHAR     005          X
    SAKTO            Cost element                                   CHAR     010          X
    KOSTL              Cost Center                                   CHAR     010          X
    VBELN          Sales and Distribution Document Number                    CHAR     010          X
    VBELP          Sales document item                              NUMC     006          X
    WEMPF          Goods recipient                                   CHAR     012          X
    WEBTH          "Amount in local currency (direct input, transfer of POs)"     CHAR     013          X
    WEBTF          "Amount in document currency (direct input, transfer of P"     CHAR     013          X
    WEREF          Flag for treatment of GR/IR (direct input of POs)          CHAR     001          X
    SPINF          Indicator: Update info record                         CHAR     001          X
    WEPOS          Goods Receipt Indicator                              CHAR     001          X
    REPOS          Invoice receipt indicator                         CHAR     001          X

  • Create a Purchase order using the BAPI using the data in the XML file.

    Hello Gurus,
    here is the scenario can anyone help me how to proceed explaining the procedure?
    Create a Purchase order using the BAPI using the data in the XML file.
    comprehensive explanations are appreciated.
    thanks in advance.

    hi,
      first use fm "bapi_po_create".
      then use fm "BAPI_ACC_GL_POSTING_POST"
    The demo environment was made with real business scenario in mind, but following subjects need to be addressed in a live implementation:
    •     No exceptions and error handling is implemented, except the order rejection (e.g. partly delivery);
    •     In Navision both XML Ports and the XML DOM has been used to integrate with SAP XI, because XML ports has some drawbacks regarding to Namespaces in XML Documents (mandatory in SAP XI);
    •     A minimum of SAP and Navision customization is required to implement this solution. (e.g. user exit in SAP, Navision XML DOM).

  • How to use the functionality of Simulation for the Transaction MIRO

    Hi Group,
    I have a requirement to call SAP from MS Excel and check for the SImulation option as under:
    The Excel will pass the values of Invoice Number, Posting date, PO number, PO Item number, Company code and etc., through the call of BAPI   -   'BAPI_INCOMINGINVOICE_CREATE'  in order to create Invoice in the SAP system.
    But the above BAPI is creating the Invoices in SAP system. Rather, I need to just check(thru SIMULATION) the records and come back to MS Excel with the MIRO numbers that will be created and the errror messages that will be returned back.
    In summary, I have to add two Buttons as:
       POST : this has to create MIRO(invoice Numbers) in the SAP System(populating the Success/Error Messages by calling
                   the above BAPI   -  This functionality is working fine now
       SIMULATE: this has to do  same functionality of "POST" option but should not create MIROs in the SAP system
                          Currently I am not able to achieve this as the above BAPI is creating MIROs in SAP.
    Kindly provide your inputs on how to go about incorporating the above SIMULATION functionality, by giving some simulation BAPIs that can be used for my functionality.
    Thanks for your help in advance.
    Regards,
    Vishnu.

    Hi Group,
    In continuation to my previous posting, I would like to give more inputs as under:
    when I was using the BAPI - BAPI_INCOMINGINVOICE_CREATE (unless I commit the transaction), MIRO would not be created in the system.
    Now, when I run the BAPI again with a different set of data, the Invoice Number is getting incremented by one.... this I dont need, if the Invoice is not committed and if I run the next time, I need to get the same Invoice Number....
    How can I achieve this task?
    Kindly let me know your inputs on this.
    Regards,
    Vishnu.

  • How to Use PM BAPI for equipment Master upload : BAPI_EQUIPMENT_SAVEREPLICA

    Hi ,
      How to use PM BAPI for equipment Master upload : BAPI_EQUIPMENT_SAVEREPLICA.
      May i know what are the input parameters & fields mandatory
      for each Table structures ct_data , ct_datax , it_descript , it_longtext.
      Can any one explain me Step by Step Process.
      B'cos i tried with below code. Equipment is not getting created.
      wa_itab-equipment_ext = '000000000100000001'.
      wa_itab-descript      = 'Test 2 -> Lube Oil Pump'.
      wa_itab-text_language = 'EN'.
      wa_itab-sdescript     = 'Short Description'.
      APPEND wa_itab TO it_itab.
      CLEAR  wa_itab.
      LOOP AT it_itab INTO wa_itab.
        ct_data-ta_guid       = '000000000000000001'.
        ct_data-equipment_ext = wa_itab-equipment_ext.
        ct_data-descript      = wa_itab-descript     .
        ct_data-valid_date    = sy-datum.
        ct_data-equicatgry    = 'M'.
        APPEND ct_data.
        CLEAR  ct_data.
        ct_datax-ta_guid       = '000000000000000001'.
        ct_datax-equipment_ext = 'X'.
        ct_datax-equipment     = 'X'.
        APPEND ct_datax.
        CLEAR  ct_datax.
        it_descript-ta_guid       = '000000000000000001'.
        it_descript-text_language = wa_itab-text_language.
        it_descript-descript      = wa_itab-sdescript    .
        APPEND it_descript.
        CLEAR  it_descript.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'LTXT'.
        it_longtext-text_line      = 'SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'INTV'.
        it_longtext-text_line      = 'aaaaaaaaaaaaaaa'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'INTV'.
        it_longtext-text_line      = 'bbbbbbbbbbbb'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'INTV'.
        it_longtext-text_line      = 'cccccccccccccccc'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      call BAPI-function in this system
        CALL FUNCTION 'BAPI_EQUIPMENT_SAVEREPLICA'
          TABLES
            ct_data     = ct_data
            ct_datax    = ct_datax
            it_descript = it_descript
            it_longtext = it_longtext
            return      = return
          EXCEPTIONS
            OTHERS      = 1.
        IF sy-subrc = 0.
          CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
          WRITE : 'Successful'.
        ENDIF.
        IF NOT return IS INITIAL.
          LOOP AT return.
            IF return-type = 'A' OR return-type = 'E'.
              WRITE : 'Error'.
            ENDIF.
          ENDLOOP.
        ENDIF.
        REFRESH  return.
      ENDLOOP.
    Regards
    SUrendar

    Hi ,
      How to use PM BAPI for equipment Master upload : BAPI_EQUIPMENT_SAVEREPLICA.
      May i know what are the input parameters & fields mandatory
      for each Table structures ct_data , ct_datax , it_descript , it_longtext.
      Can any one explain me Step by Step Process.
      B'cos i tried with below code. Equipment is not getting created.
      wa_itab-equipment_ext = '000000000100000001'.
      wa_itab-descript      = 'Test 2 -> Lube Oil Pump'.
      wa_itab-text_language = 'EN'.
      wa_itab-sdescript     = 'Short Description'.
      APPEND wa_itab TO it_itab.
      CLEAR  wa_itab.
      LOOP AT it_itab INTO wa_itab.
        ct_data-ta_guid       = '000000000000000001'.
        ct_data-equipment_ext = wa_itab-equipment_ext.
        ct_data-descript      = wa_itab-descript     .
        ct_data-valid_date    = sy-datum.
        ct_data-equicatgry    = 'M'.
        APPEND ct_data.
        CLEAR  ct_data.
        ct_datax-ta_guid       = '000000000000000001'.
        ct_datax-equipment_ext = 'X'.
        ct_datax-equipment     = 'X'.
        APPEND ct_datax.
        CLEAR  ct_datax.
        it_descript-ta_guid       = '000000000000000001'.
        it_descript-text_language = wa_itab-text_language.
        it_descript-descript      = wa_itab-sdescript    .
        APPEND it_descript.
        CLEAR  it_descript.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'LTXT'.
        it_longtext-text_line      = 'SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'INTV'.
        it_longtext-text_line      = 'aaaaaaaaaaaaaaa'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'INTV'.
        it_longtext-text_line      = 'bbbbbbbbbbbb'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'INTV'.
        it_longtext-text_line      = 'cccccccccccccccc'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      call BAPI-function in this system
        CALL FUNCTION 'BAPI_EQUIPMENT_SAVEREPLICA'
          TABLES
            ct_data     = ct_data
            ct_datax    = ct_datax
            it_descript = it_descript
            it_longtext = it_longtext
            return      = return
          EXCEPTIONS
            OTHERS      = 1.
        IF sy-subrc = 0.
          CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
          WRITE : 'Successful'.
        ENDIF.
        IF NOT return IS INITIAL.
          LOOP AT return.
            IF return-type = 'A' OR return-type = 'E'.
              WRITE : 'Error'.
            ENDIF.
          ENDLOOP.
        ENDIF.
        REFRESH  return.
      ENDLOOP.
    Regards
    SUrendar

  • Consuming an RFC Call Using the BAPI eWay

    Greetings all,
    We are trying to set up a scenario in which we have a custom RFC function that we are calling synchronously using the BAPI eWay. Here, an ABAP program calls an RFC which is like a proxy on the JCAPS server. On the JCAPS side, we are wanting to map the RFC onto a Web Service call and pass the results back as the exporting parameters of the RFC. While the examples demonstrate the use of an asynchronous function module such as IDOC_INBOUND_ASYNCHRONOUS, it is not clear to me how to work with synchronous calls. Any information would be greatly appreciated. Thanks.
    Best Regards,
    James Wood
    Bowdark Consulting, Inc.
    [email protected]

    I have a similar (if not identical) problem. Chris, your reply to James is talking about the process originating within JCaps. In my scenario (and it sounds like James' too), the process is originating from SAP. What I'm trying to do is this:
    SAP calls to my JCD - this is the part that I'm having trouble with
    My JCD does something with the data sent to it from SAP (call a database or whatever)
    The JCD responds back to SAP so that the request/reply cycle can complete and the SAP program has what it needs
    When I create an OTD object in JCaps using my RFC, there doesn't seem to be a way to make the JCD that I want to create use that OTD as a source for the input message.
    James, if I'm way off base here, let me know and I'll go get my own thread. :)
    Any help or direction would be appreciated. I've Googled this to death and have come up short.

  • How to use the cases in button action?

    Hi Experts,
    I want to get a prompt message if the field is empty.I got it but at the same time if the field is filled I want the other action to be performed that is to call a BAPI and give me output.How can I give two events for the same action.
    How to use the cases in button action?
    So, please guide me.Urgent need
    Regards
    Nutan

    Hi Nutan,
    if I understand you, then you have a simple validation. Therefore you can use the validation functionality of VC for your components. An alternative could be by writing a new ABAP RFC function module like:
    BAPI Input parameters as input and BAPI output parameters as output and an additional return code or string for a message:
    IF I_FIELD IS INITIAL.
      E_RETURN_CODE = "THE FIELD IS EMPTY."
    ELSE.
      CALL FUNCTION <YOUR_BAPI>
      <BAPI PARAMETERS>
    ENDIF.
    I hope that helps.
    Best Regards,
    Marcel

  • How to use the Function module 'BAPI_APPRAISAL_GETDETAIL'

    hello friends,
    I have to create the report which displays appraisee name, appraiser name,reviewer name and result.Using BAPI_APPRAISAL_GETDETAIL we can get the above all.But i don't know how to use the above function module.If anyone have  used in their program could you please send me or anyone have idea how to do that Please help.It is very Urgent Help me.
    Thanks in advance,
    Regards,
    Ashok.

    Hi,
    I do not hae the code but i can tell you how you use the FM and get the required data, please follow the below mentioned steps:
    1) In this Bapi you need to pass the Plan verison and Object Id data in the BAPI Import parameters and while passing the these values need to decalra the data variables same (of use the same reference fields as they are in Bapi import fields)as they are Bapi importing data fields.
    2) decalre the Internal Table structure as they are in the Export and Table parameters.
    3) Assign the decalred Import and Tables structures to the BAPI FM.
    4) once the Bapi is run with the Import parameters data the Apprisal data  and Apprisee data will returened in the import and table structures and also return value wll be imported.
    5) now using the Structures which are in Import and Table decalrations in the FM you can retrieve the data by reading them.
    Do let me know if you need any more details in this regard.
    Raghotham Reddy.
    If you find this is the right solution then allocate reward point.

  • Doubt about How to test the BAPI

    Hi Experts,
    I have one doubt. How to test one BAPI. I have BAPI_DOCUMENT_SAVEOBJECTLINKS
    I am using this BAPI to attach the document to the material. I opened se37 .Here how to test the BAPI wether the BAPI is Suitable to attach the document  or not. Please let me know . Its very urent.
    Helpful answers may be reward points
    Regards
    Khanna

    Hi,
    First you have to create a new document using CV01N tcode. Here leave the document field as blank, document type value can be choosen from F4 help and document part and document version can be given as 0. Press enter and add the necessary values and save. It will then create a new document. Using that document go to SE37 and execute the BAPI. In the BAPI also you need to give the document no that is generated, and document type, document part and document version of the newly generated document. In the OBJECTLINKS table of the BAPI give the material number and other details. Please see the function module documentation of this BAPI also.
    Please reward points if it helps.
    Regards
    Vimal

Maybe you are looking for

  • I keep getting an error while trying to reinstall itunes?

    I am trying to reinstall itunes and i am having an issue. I keep getting an error while trying to install and I keep getting very far but I always seem to end up with this. "Could not open key UNKNOWN\Components\DA42BC89BF25F5BD0AF- \b25099274a207264

  • EBay No Longer Working After 2.0.1 Update

    I've been using eBay for quite some time, with all versions of Safari from 1.0 until now, and I have not had problems. A few hours ago, I let my computer update Safari to 2.0.1, and now it (a) takes about 5 minutes for Safari to load eBay, and (b) wh

  • Problem in sending mail using java mail api

    This is the pogram I am using as of now to send a mail to yahoo id. import javax.mail.*; import javax.mail.internet.*; public class SendingMail2 public SendingMail2() try String from = "ravikiran_sunrays"; String to = "[email protected]

  • Cant upgrade iPad 1 3g to 4.3.1

    Have tried several times to do this upgrade, but it keeps failing: iTunes could not back up the iPad ... because the iPad disconnected. After first failure I checked for an updatedOS X to 10.6.7 and then tried again. Same result. Alos tried rebooting

  • PE51 to SMARTFORM to add logo

    Hi experts!! We have the pay slip configured with PE51. It's working fine. Now we need add a logo and create the output as a PDF. To achive this I have been told that I have to create a smartform with the logo. How I should create the smartform from