Create VA01 - Returns - BAPI

Hi All,
I am new to AFS and my requirement is to create a Return from my program.id Order type RE in VA01
The return should have AFS details , so the BAPI BAPI_CUSTOMERRETURN_CREATE seems to be not sufficient as it does not have any AFS data entry.
Please suggest how to populate the AFS data in Return.
Thanks,
Anoop

Please clarify "AFS".

Similar Messages

  • How to create purchase order using VA01 for BAPI?

    how to create purchase order using VA01 for BAPI?

    Hi Arun,
    Please check this link
    Example Program for BAPI_PO_CREATE1
    Re: BAPI_PO_CREATE1
    Questions in BAPI_PO_CREATE1
    Problem with BAPI_PO_CREATE1
    *& Report BAPI_PO_CREATE *
    REPORT bapi_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
    Best regards,
    raam

  • Create Sales Return Order by BAPI,in pricing manual conditions don't appear

    Dear All,
    While creating Sales Return Order by using BAPI function module, in pricing manual header conditions are not appearing.
    I tried following FMs for creating Sales Return Order. Sales Return Order created but manual header conditions are not appearing.
    1.      BAPI_CUSTOMERRETURN_CREATE
    2.      BAPI_SALESORDER_CREATEFROMDAT2
    3.      SD_SALESDOCUMENT_CREATE
    If we create through transaction code u2018VA01u2019 with reference document, manual header conditions are appearing in pricing perfectly.
    SAP version is SAP ECC 6.0.
    Makarand

    Hi there,
    Is your return referenced from the F2 invoice or from the riginal order?
    If it is from F2 then in VTAF & if it is from OR then in VTAA --> at the item level --> pricing type select the option G copy pricing element unchanged & redetermine taxes or C copy pricing elements & redetermine others. Choose the required option. This is when the same pricing procedure is used in OR & RE order types.
    Regards,
    Sivanand

  • How to create a Return Order from a Quality Notification?

    Hi everyone at SDN.
    Really need some help on this issue we are having. We want to create a Return Order from a Quality Notification, ie. the document flow should be:
    :: Serv. notif 000200000482
       :: Return Order 0060299453
    In the SAPGUI we are able to do this by going into transaction QN02, enter the notification number and in the menu: "Notification" --> "Functions" --> "Sales Order" --> "Create Selection of Order Type". Now we select the Return Order type and the result is as wanted.
    However, we want to do all this in ABAP instead. The BAPI I have tried with is BAPI_CUSTOMERRETURN_CREATE.
    And the following code is used:
        ls_order_h_in-refobjtype = 'BUS2078'. "Quality Notification
        ls_order_h_in-refdoctype = 'Z5'. "Quality Notification type
        ls_order_h_in-refobjkey = '000200000482'. "Ref. Quality Notification
        ls_order_h_in-doc_type = 'ZREN'. "Return Order type
        ls_order_h_in-sales_org = 'S001'.
        ls_order_h_in-distr_chan = '01'.
        ls_order_h_in-division = '01'.
    Then I add a material as well as the mandatory partner functions. When I execute the Return Order is created but when I check the document flow for the Return Order there is no link to the Quality Notification.
    Any suggestions on how to do this? I have tried using FM RV_DOCUMENT_FLOW_UPDATE_U for updating the document flow but it doesn't seem to like it when I enter a Notification in there. And when I run FM RV_ORDER_FLOW_INFORMATION for the above (working) Return Order there is no Quality Notification available. So this leads me to believe that I have to update something else then VBFA (Sales Document Flow)...
    I would really appreciate all the help I can get on this.
    Best Regards
    Niklas

    anyone?

  • In return sales order(va01)  return amt value is not showing plz help

    DEAR,
    Issue : When Sales Order, Delivary, Transfer Order, Billing is created by one user , and if the same user creates Sales Return Order(VA01) it is working fine. But if any other user creates this Sales Return then it is not showing Sales Return AMOUNT value which has to be copied from the Billing Dcoument.
    This Sales Return transaction calling Form Routine which contains code to get Sales Return value . when same user who created Sales Order, Delivary, Transfer Order, Billing creates Sales Return then SPA/GPA PARAMETERs used in Form Routine program to get Reference Billing Document no.,etc , are getting populated by values , but if different user creates Sales Return this SAP/GPA PARAMETERS is not getting populated. i.e
    DATA V_VBELN TYPE VBELN.
    GET PARAMETER ID 'VF' FIELD V_VBELN .
    why it is not getting populated plz help

    Hi,
    When you create a return based on a complaint, you:
    Post the goods to your warehouse for checking
    And then, implement one of the following activities:
    Approve the complaint and create a credit memo
    Approve the complaint, and implement a free of charge subsequent delivery based on the return
    Reject the complaint
    Process Flow
    You create a sales document with the order type for returns. You can create the return in one of the following ways:
    – Without reference to an order
    – With reference to an existing order
    – With reference to an invoice
    You can block the return in Customizing, so it is not invoiced. Go to Sales - Sales Documents - Sales document header - Define sales document type in the billing block field in the billing section.
    If the returned goods are sent to your warehouse, create a delivery (returns delivery) with reference to the return.
    The goods issue posted for the returns delivery matches the goods receipt to your own stock.
    After you have checked the goods, you can implement one of the following activities for the complaint:
    Approve it by deleting the block reject it by entering a reason for rejection.
    The quantity for which the customer should receive credit.
    The order quantity rather than the delivered quantity is used as the basis for the credit memo.
    If the customer returns only some of the goods and disposes of the remaining goods himself, you can still create a credit memo for the full amount.
    On the other hand, you can create a partial credit memo for certain items even if the customer returns the entire quantity. To do this, the quantity to be ordered in the return has to be reduced to the quantity to be credited.
    Whether the customer should receive a replacement.
    If the customer is to receive replacement goods, do not create a credit memo.
    You can enter a reason for rejection for the appropriate items in the return. You then create a free of charge subsequent delivery with reference to the return in order to send the replacement goods to the customer.
    regards,
    Siddharth.

  • Create material using bapi ' bapi_material_savedata'

    Hi Experts,
    i was tring to create material using bapi ' bapi_material_savedata' but the material is not updating in the table.
    please find the code and suggest me if any modification
    data: la_headdata type BAPIMATHEAD,
    la_clientdata type BAPI_MARA,
    la_CLIENTDATAX type BAPI_MARAX,
    la_return type BAPIRET2.
    data: i_materialdescription type table of BAPI_MAKT,
    wa_materialdescription like line of i_materialdescription.
    *la_headdata-MATERIAL = int_matnum-MATERIAL.
    *LOOP AT int_matnum.
    la_headdata-MATERIAL = int_matnum-MATERIAL.
    write : int_matnum-material.
    *ENDLOOP.
    la_headdata-MATERIAL = '100000518'."int_matnum-MATERIAL.
    la_headdata-IND_SECTOR = p_indsr.
    la_headdata-MATL_TYPE = p_matype.
    la_clientdata-BASE_UOM = 'FT3'.
    la_clientdata-pur_valkey = ' '.
    la_CLIENTDATAX-BASE_UOM = 'X'.
    la_clientdata-MATL_GROUP = '01'.
    la_CLIENTDATAX-MATL_GROUP = 'X'.
    wa_materialdescription = 'TEST'.
    append wa_materialdescription to i_materialdescription.
    clear: wa_materialdescription.
    CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
    EXPORTING
    headdata = la_headdata
    CLIENTDATA = la_clientdata
    CLIENTDATAX = la_CLIENTDATAX
    PLANTDATA =
    PLANTDATAX =
    FORECASTPARAMETERS =
    FORECASTPARAMETERSX =
    PLANNINGDATA =
    PLANNINGDATAX =
    STORAGELOCATIONDATA =
    STORAGELOCATIONDATAX =
    VALUATIONDATA =
    VALUATIONDATAX =
    WAREHOUSENUMBERDATA =
    WAREHOUSENUMBERDATAX =
    SALESDATA =
    SALESDATAX =
    STORAGETYPEDATA =
    STORAGETYPEDATAX =
    FLAG_ONLINE = ' '
    FLAG_CAD_CALL = ' '
    IMPORTING
    RETURN = la_return
    TABLES
    MATERIALDESCRIPTION = i_materialdescription
    UNITSOFMEASURE =
    UNITSOFMEASUREX =
    INTERNATIONALARTNOS =
    MATERIALLONGTEXT =
    TAXCLASSIFICATIONS =
    RETURNMESSAGES =
    PRTDATA =
    PRTDATAX =
    EXTENSIONIN =
    EXTENSIONINX =
    Please Help me
    Regards,
    Naresh

    Hi all,
    Now it is asking me for the other fields,
    E ,
    The field MARA-XCHPF/BAPI_MARA-BATCH_MGMT is defined as a required field; it does not contain an entry
    i have passed this val as
    la_clientdata-batch_mgmt = 'X'.
    even though i am getting the same error.
    can you help me to solve the issue.
    Tthanks
    Naresh
    Edited by: naresh.k.dasari on Jan 4, 2011 10:36 AM

  • Creating PDF using BAPI

    Hi,
    I am trying to create PDF using BAPI. I got one BAPI(Z_MM_EPSP_BAPI_GET_PO_PDF). That bapi returns bytecodes. How can I generate PDF file using this BAPI output in BLS. Give some example
    Thanks & Regards
    Art

    Art,
    Are you familiar with xMII at all? I would like to answer your question but it seems more like a tutoring lesson rather than a technical problem.
    Please post a problem and not how somone can help you do your work. Unless of course you are willing to paypal some money over. :-D

  • How to create sales return with multiple invoices

    Hi ,
    I am creating a sales order return with reference of billing document using FM SD_SALESDOCUMENT_CREATE, if i give one Billing document as a reference document it is creating document perfectly.
    But my Requirement is to create one Return sales order with multiple invoices.
    I tried to pass reference document no's in Item level , but it take first reference document number only , for that reference document only return is creating.
    Can you any one help me how to create this.
    Thanks in advance
    Swapna.

    Hello Venkat,
    As I know it is not possible to create a single return order for multiple invoices in the background.
    It is possible in the foreground by following the below steps.
    1) Goto VA01 --> enter the Sales order type and Sales area.
    2) Press F8 or click on create with reference, provide the first invoice.
    3) Now the main screen would appear, displaying line items from Invoice1.
    4) Without going back, again goto path, Sales document -> Create with reference
    5) Enter second invoice2. and the items from invoice2 will also appear in the Sales order line item.
    ------ Enter as many number of invoices by repeating the above step--------------------
    6) Press save, so one sales order is created for multiple invoices.
    Regards,
    Thanga

  • How to Create a Return Order wrt a Standard Order using Inbound IDOC Orders

    HI,
    We have a scenario :
    Standard Order - is exiting in System with 2 line items :
    Item 10
    Qty 20
    Item 20
    Qty 30
    Is it possible create a Return Order With Reference to this standard order for Line Item 20 only using inbound IDOC Orders?
    If yes what should be the mapping in the IDOC about the Standard Order, Item and QTY ?
    Regards
    Anurag

    hi,
    try using this bapi.
    /AFS/BAPI_SALESORD_CREATEFDATA.
    thanks,
    satish

  • Can we create cancellation/return delivery with BAPI_CONFEC_CREATE

    hi experts,
    i want to use the above BAPI to create cancellations and return deliveries in SRM 7. i am not able to figure out the exact data that needs to be passed to the BAPI to create cancellation/return delivery. i have used class approach to do the same and able to create them, but i am specifically interested in FM/BAPI
    does anybody used this BAPI to create cancellations?
    thanks

    hi,
    i could not make this BAPI work for cancellations but found another way of doing confirmations and cancellations using std FMs
    here is the code for confirmation
    CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
       EXPORTING
         I_OBJECT_ID                      = is_conf_header-po_number
         I_WITH_ITEMDATA                  = 'X'
       IMPORTING
         E_HEADER                         = ls_header
         ET_ATTACH                        = lt_attach
       TABLES
         E_ITEM                           = lt_item
         E_ACCOUNT                        = lt_account
         E_PARTNER                        = lt_partner
         E_LONGTEXT                       = lt_longtext
         E_ORGDATA                        = lt_orgdata
         E_TAX                            = lt_tax
         move-corresponding ls_header to ls_new_header.
    ls_new_header-process_type = 'CONF'.
    ls_new_header-subtype = 'CF'.
    ls_new_header-src_object_type = 'BUS2201'.
    ls_new_header-src_guid = ls_header-guid.
    clear ls_new_header-object_id.
    loop at lt_item into ls_item.
      read table it_conf_items into ls_conf_items with key po_item_number = ls_item-number_int.
    if sy-subrc ne 0.
      continue.
      endif.
      move-corresponding ls_item to ls_new_item.
      ls_new_item-src_object_type = 'BUS2201001'.
      ls_new_item-src_guid = ls_item-guid.
      ls_new_item-final_entry = ls_conf_items-final_entry.
      ls_new_item-quantity = ls_conf_items-quantity.
      append ls_new_item to lt_new_item.
      endloop.
    loop at lt_partner into ls_partner.
       move-corresponding ls_partner to ls_new_partner.
       append ls_new_partner to lt_new_partner.
       endloop.
       loop at lt_orgdata into ls_orgdata.
         move-corresponding ls_orgdata to ls_new_orgdata.
         append ls_new_orgdata to lt_new_orgdata.
         endloop.
    loop at lt_account into ls_account.
       move-corresponding ls_account to ls_new_account.
       append ls_new_account to lt_new_account.
       endloop.
    lv_src_guid = ls_header-guid.       .
    CALL FUNCTION 'BBP_PD_CONF_CREATE'
    EXPORTING
      I_SAVE                           =  'X'
       I_HEADER                         = ls_new_header
       I_SRC_GUID                       = lv_src_guid
       IT_ATTACH                        = lt_new_attach
    IMPORTING
       E_HEADER                         = ls_e_header
       ET_ATTACH                        = lt_e_attach
      TABLES
      I_ITEM                           = lt_new_item
       I_PARTNER                        = lt_new_partner
       I_ORGDATA                        = lt_new_orgdata
       E_ITEM                           = lt_e_item
       E_ACCOUNT                        = lt_e_account
       E_PARTNER                        = lt_e_partner
       E_ORGDATA                        =  lt_e_orgdata
        e_messages                       = lt_new_message
    et_msg[] = lt_new_message[].
    ls_conf_documents-doc_number = ls_e_header-object_id.
    append ls_conf_documents to et_conf_documents.
    CALL FUNCTION 'BBP_PD_CONF_SAVE'
    EXPORTING
        IV_USERTYPE               = 'X'
       IV_HEADER_GUID            = ls_e_header-guid
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT
    code for cancellation
    get all the confirmations created for the PO
        CALL FUNCTION 'BBP_PD_CONF_GETLIST'
          EXPORTING
            i_for_po_id = is_conf_header-po_number
          TABLES
            e_pdlist    = lt_pdlist
            e_messages  = lt_msgs.
    delete GRS which are cancelled
        LOOP AT lt_pdlist INTO ls_pdlist WHERE subtype EQ 'CA'.
          DELETE lt_pdlist WHERE guid = ls_pdlist-src_guid.
        ENDLOOP.
    delete the cancelllation documents. we don't need them anymore
        DELETE lt_pdlist WHERE subtype EQ 'CA'.
        loop at lt_pdlist into ls_pdlist.
          CALL FUNCTION 'BBP_PD_CONF_GETDETAIL'
           EXPORTING
              I_GUID                           =  ls_pdlist-guid
              I_WITH_ITEMDATA                  = 'X'
          IMPORTING
             E_HEADER                         =  ls_conf_hdr
           TABLES
             E_ITEM                           =  lt_con_items
             E_PARTNER                        =  lt_con_partner
    move-corresponding ls_conf_hdr to ls_new_header.
    ls_new_header-process_type = 'CONF'.
    ls_new_header-subtype = 'CA'.
    ls_new_header-src_object_type = 'BUS2203'.
    ls_new_header-src_guid = ls_conf_hdr-guid.
    clear ls_new_header-object_id.
    loop at lt_con_items into ls_con_items.
      move-corresponding ls_con_items to ls_new_item.
      ls_new_item-src_object_type = 'BUS2203001'.
      ls_new_item-src_guid = ls_con_items-guid.
      append ls_new_item to lt_new_item.
      endloop.
    loop at lt_con_partner into ls_con_partner.
       move-corresponding ls_con_partner to ls_new_partner.
       append ls_new_partner to lt_new_partner.
       endloop.
          lv_src_guid = ls_conf_hdr-guid.
    after that call BBP_PD_CONF_CREATE as we did for the confirmation followed by BBP_PD_CONF_SAVE and commit work.
    Edited by: SRM7CON on Mar 7, 2012 12:04 PM
    Edited by: SRM7CON on Mar 7, 2012 12:25 PM

  • How to create program for bapi?

    hi all,
    how to create program for bapi?
    reply me soon now.....
    can anybody help me.....
    thanks,
    S.Suresh.
    Title was edited by:
            Alvaro Tejada Galindo

    Hi ...Here is the step by step procedure for creating BAPIs.
    There are 5 different steps in BAPI.
    - Create BAPI Structure
    - Create BAPI Function Module or API Method.
    - Create BAPI object
    - Release BAPI Function Module.
    - Release BAPI object.
    Step1. Creating BAPI Structure:
    - Go to <SE11>.
    - Select Data Type & Enter a name.
    - Click on Create.
    - Note: Always BAPI should be in a development class with request number (Not Local Object).
    - Select Structure & hit ENTER.
    - Enter the fields from your database. Make sure that the first field is the Primary Key Field.
    - Then SAVE & ACTIVATE.
    Step 2. Creating BAPI module:
    - Enter TR.CODE <SE37>.
    - Before entering any thing, from the present screen that you are in, select the menu
    Goto -> Function Groups -> Create Group.
    Enter a name (Note: This name Must start with ZBAPI)
    Let this screen be as it is and open another window and there, enter TR.CODE <SE80).
    Click on the Third ICON that says Inactive Objects.
    Select the group that you just created and click on Activate.
    Notice that the group you created will disappear from the list of inactive objects.
    - Go back to ><SE37> screen and enter a name and hit <ENTER>. Then enter the group name that you just created and activated.
    NOTE: When you release a function module the respective group will be attached to that particular application. It cannot be used for any other application. NEVER include an already existing group that is attached to another module.
    Now click on the first Tab that says [ATTRIBUTES] and select the radio button that says remote-enabled module since we will be accessing this from any external system.
    Then click on the second tab that says [IMPORT].
    Enter a PARAMETER NAME, TYPE and the structure you created in the first step. Also select the check box ‘Pa’. All remotely enabled functional modules MUST be Pa enabled, where Pa means ‘Passed by Value’ and if you don’t select ‘Pa’, then that means it will be passed by reference..
    Then click on tab that says [EXPORT].
    Enter the following as is in the first three fields
    RETURN TYPE BAPIRETURN (These 3 field values are always same)
    Here also select ‘Pa’ meaning Pass by value.
    Note: BAPIRETURN contains structure with message fields.
    Then SAVE and ACTIVATE.
    Step 3. Creating BAPI object:
    - Enter Tr.Code <SWO1> (Note. It is letter ‘O’ and not Zero).
    - Enter a name and then click on create. Enter details.
    NOTE: Make sure that that Object Type and Program name are SAME.
    - Enter Application ‘M’, if you are using standard table Mara. If you are using your own database then select ‘Z’ at the bottom.
    - Then hit <ENTER>.
    - Now we have to add ‘Methods’. High light METHODS and then select the following from the menu:
    Goto Utilities -> API Methods -> Add Methods.
    - Enter function Module name and hit <ENTER>.
    - Select the second FORWARD ARROW button (>)to go to next step.
    - Check if every thing looks ok and again click on FORWARD ARROW button (>).
    - Then select ‘YES’ and click on <SAVE>.
    - Now on a different screen goto TR.CODE <SE37>. Enter Function Module name and select from the top menu Function Module -> Release -> Release.
    - Goback to TR.CODE <SWO1>.
    Here select the menu combination shown below in the same order.
    - Edit -> Change Release Status -> Object Type Component -> To Implemented.
    - Edit -> Change Release Status -> Object Type Component -> To Released.
    - Edit -> Change Release Status -> Object Type -> To Implemented.
    - Edit -> Change Release Status -> Object Type -> To Released.
    - Then click on <SAVE>.
    - Then click on Generate Button (4th button from left hand side looks like spinning wheel).
    - Then Click on the button that says ‘PROGRAM’ to see the source code.
    To check if this is present in work flow goto TR.CODE <BAPI>.
    Here it shows business object repository.
    - First click on the middle button and then select “ALL” and hit ENTER.
    - Goto tab [ALPHABETICAL] and look for the object that you created. This shows that the BAPI object has been created successfully
    Overall Info :
    http://help.sap.com/saphelp_47x200/helpdata/EN/00/32a43697bc11d1acf9080009b0fb56/frameset.htm
    BAPI Creation Info :
    http://help.sap.com/saphelp_47x200/helpdata/EN/e0/9eb2370f9cbe68e10000009b38f8cf/frameset.htm
    Reference :
    http://help.sap.com/saphelp_47x200/helpdata/EN/00/32a43697bc11d1acf9080009b0fb56/frameset.htm
    http://help.sap.com/saphelp_47x200/helpdata/EN/00/32a43697bc11d1acf9080009b0fb56/frameset.htm
    http://help.sap.com/saphelp_47x200/helpdata/EN/e0/9eb2370f9cbe68e10000009b38f8cf/frameset.htm

  • Steps for creating a new BAPI function module

    Hello experts,
    Can any one send me steps for creating a new BAPI function module , I got a requirement to do like this,but I dont have any clue about how to create.
    Please help !!!

    BAPI stands for Business Application Programming Interface.
    There are 5 different steps in BAPI.
    - Create BAPI Structure  
    - Create BAPI Function Module or API Method.  
    - Create BAPI object  
    - Release BAPI Function Module.  
    - Release BAPI object.
    Step1. Creating BAPI Structure:  
    - Go to <SE11>. 
    - Select Data Type & Enter a name. 
    - Click on Create.
    - Note: Always BAPI should be in a development class with request number (Not Local Object).
    - Select Structure & hit ENTER.
    - Enter the fields from your database. Make sure that the first field is the Primary Key Field.
    - Then SAVE & ACTIVATE.
    Step 2. Creating BAPI module: 
    - Enter TR.CODE <SE37>.
    - Before entering any thing, from the present screen that you are in, select the menu
       Goto -> Function Groups -> Create Group.
       Enter a name (Note: This name Must start with ZBAPI)
       Let this screen be as it is and open another window and there, enter TR.CODE <SE80).
       Click on the Third ICON that says Inactive Objects. 
       Select the group that you just created and click on Activate. 
       Notice that the group you created will disappear from the list of inactive objects.
    - Go back to <SE37> screen and enter a name and hit <ENTER>. Then enter the group name that you just created and activated.
    NOTE: When you release a function module the respective group will be attached to that particular application. It cannot be used for any other application. NEVER include an already existing group that is attached to another module.
    Now click on the first Tab that says [ATTRIBUTES] and select the radio button that says remote-enabled module since we will be accessing this from any external system.
    Then click on the second tab that says [IMPORT].
    Enter a PARAMETER NAME, TYPE and the structure you created in the first step. Also select the check box ‘Pa’. All remotely enabled functional modules MUST be Pa enabled, where Pa means ‘Passed by Value’ and if you don’t select ‘Pa’, then that means it will be passed by reference..
    Then click on tab that says [EXPORT].
    Enter the following as is in the first three fields 
      RETURN        TYPE        BAPIRETURN (These 3 field values are always same)
      Here also select ‘Pa’ meaning Pass by value.
    Note: BAPIRETURN contains structure with message fields.
    Then SAVE and ACTIVATE.
    Step 3. Creating BAPI object: 
    - Enter Tr.Code <SWO1>   (Note. It is letter ‘O’ and not Zero).
    - Enter a name and then click on create. Enter details. 
    NOTE: Make sure that that Object Type and Program name are SAME.   
    - Enter Application ‘M’, if you are using standard table Mara. If you are using your own database then select ‘Z’ at the bottom. 
    - Then hit <ENTER>. 
    - Now we have to add ‘Methods’. High light METHODS and then select the following from the menu: 
    Goto Utilities -> API Methods -> Add Methods.
    - Enter function Module name and hit <ENTER>.
    - Select the second FORWARD ARROW button (>)to go to next step. 
    - Check if every thing looks ok and again click on FORWARD ARROW button (>).
    - Then select ‘YES’ and click on <SAVE>.
    -  Now on a different screen goto TR.CODE <SE37>.  Enter Function Module name and select from the top menu  Function Module -> Release -> Release.
    - Goback to TR.CODE <SWO1>.
    Here select the menu combination shown below in the same order.
    - Edit -> Change Release Status -> Object Type Component -> To Implemented.
    - Edit -> Change Release Status -> Object Type Component -> To Released.
    - Edit -> Change Release Status -> Object Type -> To Implemented.
    - Edit -> Change Release Status -> Object Type -> To Released.
    - Then click on <SAVE>.
    - Then click on Generate Button (4th button from left hand side looks like spinning wheel).
    - Then Click on the button that says ‘PROGRAM’ to see the source code.
    To check if this is present in work flow goto TR.CODE <BAPI>. 
    Here it shows business object repository.
    - First click on the middle button and then select “ALL” and hit ENTER.
    - Goto tab [ALPHABETICAL] and look for the object that you created. This shows that the BAPI object has been created successfully.
    regards,
    aswin

  • Suppress an error message while creating a return PO ( ZRO type) (ME21n)

    Hello All,
    I have to write a code in order to suppress the below message while creating a return purchase order (of type ZRO) , transaction ME21n  after entering the purchase organization, purchase group, the vendor & the material no :-
    "You have no authorization to create without reference to another document".
    For users with the below values of parameter ID & parameter value :-
    parameter ID = EFB & parameter value = 02 in transaction 'SU3' , under "parameters" tab, this message is getting triggered.
    My requirement is to suppress this message.
    Please suggest an exit name or a BADI name wherein I can implement the code for this requirement.
    Regards,
    Rachana.

    You can remove parameter ID EFB
    and for Order type other then ZRO you can put check of doc. reference.

  • How to create invoice using bapi  base on delivery number with example

    hi,
    Pl give me one example to create invoice using bapi base on delivery number (PGI).

    Use this code
    * Pass the delivery no to the FM to create the invoice
          wa_vbsk-smart = u2018Fu2019.
            wa_komfk-vbeln = nast-objky. u201CuF0DF-----delivery number
            APPEND wa_komfk TO it_komfk.
            CLEAR wa_komfk.
    *    To fill the message structure
    *        l_wa_error-vbeln_vl = nast-objky. " Delivery No.
    *        l_wa_error-fkart = wa_ztab-bil_doc_type." Billing Doc type
            CALL FUNCTION 'RV_INVOICE_CREATE'
                    EXPORTING
    *                 delivery_date             = 0
                     invoice_date              = v_date  u201C<- date
    *                 invoice_type              = '    '
    *                 pricing_date              = 0
                     vbsk_i                    = wa_vbsk
                     with_posting              = u2018Du2019
    *                 select_date               = 0
                     i_no_vblog                = ' '
                     i_analyze_mode            = ' '
                     id_utasy                  = ' '
                     id_utswl                  = ' '
                     id_utsnl                  = ' '
                     id_no_enqueue             = ' '
                     id_new_cancellation       = ' '
    **             IMPORTING
    *               VBSK_E                    =
    *               OD_BAD_DATA               =
    *               DET_REBATE                =
                    TABLES
                      xkomfk                    = it_komfk
                      xkomv                     = it_komv
                      xthead                    = it_thead
                      xvbfs                     = it_vbfs
                      xvbpa                     = it_vbpa
                      xvbrk                     = it_xvbrk
                      xvbrp                     = it_vbrp
                      xvbss                     = it_vbss
    *               XKOMFKGN                  =
    *               XKOMFKKO                  =

  • ORDERS05 - Create a Return with reference to a Sales Order

    Hi all,
    I'm trying to create a return with reference to a sales order via IDOC ORDERS05. I'm indicating referenced Sales Order number into segment E1EDK02; indicating qualifier (QUALFR = 002) and Sales order number (BELNR). By this way, I create a Customer Return but without reference.
    Which fields or segment have to be filled in order to create it correctly?
    Thanks
    Marí

    Correct...
    You need something like:
    *Get the pricing cond number.
    select single knumv from vbak into cond
      where vbeln = '0000080347'.
    if sy-subrc = 0.
    Get the pricing record which are by line item.
      select * from konv into table konv_tbl where knumv = cond.
    Loop thru them one line at a time.
      loop at konv_tbl.
       bapi_cond-itm_number = '000010'.
        bapi_cond-cond_st_no = konv_tbl-stunr.
        bapi_cond-cond_count = konv_tbl-zaehk.
    CALL FUNCTION 'BAPI_CUSTOMERRETURN_CREATE'
      EXPORTING
        RETURN_HEADER_IN               = bapi_hdr
       BUSINESS_OBJECT               = 'BUS2102'
        CONVERT                        = 'X'
      IMPORTING
        SALESDOCUMENT                 = bapi_salesdoc
       RETURN                        = BAPI_RET
      TABLES
        RETURN                        = bapi_ret_tbl
        RETURN_ITEMS_IN                = bapi_itm
        RETURN_ITEMS_INX               = bapi_itm_out
        RETURN_PARTNERS                = bapi_prtnr
        RETURN_SCHEDULES_IN            = bapi_schd_lin
        RETURN_CONDITIONS_IN           = bapi_cond.  "pricing
      ORDER_TEXT                    = bapi_text.

Maybe you are looking for

  • ATI Radeon HD 4870 X2 and S20 ??

    Hello, Could somebody help me with this card ATI Radeon HD 4870 X2 ? I was wondering if we can put this card into S20 and if yes ..what exact we need to do this ? If not why ? As far as i know there is different power socket on card ? So do we need s

  • One set of clips won't sync when trying to create a Multicam clip

    I am trying to create a multicam clip using one long audio track, several clips from one camera and several clips from another camera. All three have audio recorded from the same shoot. One camera angle successfully synchronises with the audio track,

  • Problem with alphabetised sorting

    So your sorting system only recognises the first digit and this causes problems, for example sorting files starting with 1 to 12. Instead of getting a list of 1,2,3....12 you get 1,10,11,12,3,4,5....9. Frustrating to say the least.

  • Video frame capture SW?

    I need to capture still video frames from a couple movies to use the graphics for DVD labels. I need software that is freeware or dirt cheap as I wont be doing this again. Xilisoft.com makes such software but I dont want to spend $30 for something I

  • Noise in images

    How do I eliminate (or at least reduce) the amount of noise in images?