Program for Sales Order cretaion using BAPI BAPI_SALESORDER_CREATEFROMDAT2

Hi All,
Can any one please give me one modal program which uses the BAPI 'BAPI_SALESORDER_CREATEFROMDAT2' to create Sales Orders...
Thank You very much in advance.....................

Hi Krishna ,
Please check the below links .
[http://www.sap-basis-abap.com/abap/bapi-sample-to-upload-data-from-flat-file-to-va01.htm]
[http://abapreports.blogspot.com/2008/06/bapi-sample-code-for.html] -- > Select and Copy from this one.

Similar Messages

  • Rg: Open Sales Order Uplaod Using BAPI (BAPI_SALESORDER_CREATEFROMDAT2)

    Hi Frinds..
    I am Creating Program Sales Order Uplaod Progrm using BAPI BAPI_SALESORDER_CREATEFROMDAT2.
    All header and Po data uploaded Properly . But Item Leal data not updated.. Please let me know any Conditions need to pass to update item data.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
            EXPORTING
              salesdocumentin      = v_extr
              order_header_in      = l_vbak
              order_header_inx     = l_vbakx
              behave_when_error    = 'P'
            IMPORTING
              salesdocument        = v_vbeln
            TABLES
              return               = return
              order_items_in       = l_vbap
              order_items_inx      = l_vbapx
              order_partners       = l_vbpa
              order_schedules_in   = l_shline
              order_schedules_inx  = l_shlinex .
    I can pass like that.

    hi Prabu,
    It is not uploading for company code 1100 ..

  • Sales Order Creation using bapi BAPI_SALESORDER_CREATEFROMDAT2

    Please help me..
    I am using BAPI_SALESORDER_CREATEFROMDAT2 for creating sales order
    can you please tell me in which field the quantity(of items) is to be populated.
    i am populating in BAPISDITM-TARGET_QTY but i am not getting quantity field after sales order is created.
    i also tried with BAPISDITM-TRG_QTY_NO but i am not getting .
    and also if i provide ship to number it is automatically taking the adress but if i want to give my own adress in which structure i have to populate

    Please help me..
    I am using BAPI_SALESORDER_CREATEFROMDAT2 for creating sales order for replace VA01, 
    can you please tell me in which field the amount KBETR (of items) is to be populated.
    i thing that i will populate COND_VALUE in ORDER_CONDITIONS_IN with field kbetr but I don't know what will I populate field COND_TYPE ? the same problem I have with net value (NETWR).
    Would you explain me what I will populate fields  in differents fields of this BAPI ?

  • Credit check for sales order creation using BAPI

    HI,
    I am using BAPI_SALESORDER_CREATEFROMDAT2 for creating sales order.
    I want the credit check for a customers credit limit done while creating the sales order. Is it possible to make
    credit check with above bapi? If it is possible please give me the solution.
    <b>Helpful answers will be rewarded</b>

    hi,
    it's the same code that is executed for the credit check in the bapi as in va01
    If you put in the correct data, see sap note 366265, the credit check will be executed
    kind regards
    Paul Q

  • Mass sales order creation using BAPI

    Dear All,
    Can anyone help in  mass sales order creation using Bapi BAPI_SALESORDER_CREATEFROMDAT2.
    For example if i want to create 3 sales order with three item per order . i am populating
    HEADER = 3 Records
    Item   = 9 records
    schedule = 9 records
    partner  = 1 record.
    Then after populating the records I am calling Bapi BAPI_SALESORDER_CREATEFROMDAT2
    to create order. It should have created three order but unfortunately it creates
    only one sales order. I debugged and found that records are correct both in header,
    item, scheudle and partners.
    Could you please guide me what I am missing for creation of mass orders.
    I appreciate your time and many thanks in advance.
    cheers
    chandra

    Hi Chandra,
    Do like this.
    Loop at Header table into wa_header.
    *-- Move BAPI Header data
    Loop at item table into wa_item where condition.
    *--  in this move all Item and Schedule line item  to the BAPI.
      At end of item .
    Use the below function modules.
    BAPI_SALESORDER_CREATEFROMDAT2
    BAPI_TRANSACTION_COMMIT.
    Endloop.
    Endloop.
    Regards,
    Balavardhan.K

  • Need sales order creation using bapi in oops

    need code for sales order creation using bapi in oops

    hi rocky,
              could you pls give a bit explanation on what you are expecting.
    regards,
    Pavan

  • Reena Prabhakar - Sales order creation Using BAPI

    Hi Reena,
    This is Dinesh,i also face problem in Sales order creation using BAPI if you can send me the code it would be great help to me.
    Regards,
    Dinesh

    Anyhow, here is the code that I am using currently which works perfectly well. Not sure if it will be of any help to you, since the values to the BAPI come from the Webdynpro application. I have values stored in my "Test data directory" which I use for testing from the backend.
    FUNCTION ztest.
    Call the BAPI to create Sales Order
      CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
        EXPORTING
          order_header_in     = l_order_header
        IMPORTING
          salesdocument       = l_salesdocument
        TABLES
          return              = it_return
          order_items_in      = it_order_items
          order_partners      = it_order_partners
          order_schedules_in  = it_order_schdl
          order_conditions_in = it_order_conditions
          order_text          = it_order_text.
      READ TABLE it_return WITH KEY type = 'E'.
      IF sy-subrc = 0.
    *-- error occured
        CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
      ELSE.
    *-- no error
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      ENDIF.
    ENDFUNCTION.

  • Driver program for Sale Order

    Hi all,
    Can any body tell me Standard Driver program for Sale Order Smart form?
    Useful answer will be rewarded
    Thanks in advance,
    Sachin.

    Hi Sachin,
    you can do this by,
    <b> NACE</b> (tocde) -->  select  <b>Sales</b> --> click <b>output types</b> -->
    select any standard output type --> double click on processing routines.
    You can see the program name
    For this it is -
    <b>RVADOR01</b>
    Reply me if there is any queries

  • Change only material qunatity in sales order by using BAPI

    Hi All,
    How to change only the material quantity in existing sales order by using BAPI.
    Please help me in this regards.
    Regards
    Deekshitha.

    Hi
    See the sample code and do accordingly
    REPORT Z_SALES_ORDER_CHANGE
    NO STANDARD PAGE HEADING
    LINE-SIZE 132
    LINE-COUNT 65(0)
    MESSAGE-ID ZZ.
    TABLES: VBAP.
    DATA:
    V_FILEIN(90) TYPE C,
    V_RECIN TYPE I,
    V_RECVBAP TYPE I,
    V_RECORDER TYPE I,
    V_VBELN LIKE VBAP-VBELN,
    ORDERHEADERINX LIKE BAPISDH1X.
    DATA: BEGIN OF I_ORDERS OCCURS 0,
    VBELN LIKE VBAK-VBELN,
    POSNR LIKE VBAP-POSNR,
    BRGEW(18) TYPE C,
    VOLUM(18) TYPE C,
    END OF I_ORDERS.
    DATA: BEGIN OF I_OUTPUT OCCURS 0,
    VBELN LIKE VBAK-VBELN,
    POSNR LIKE VBAP-POSNR,
    GEWEI LIKE VBAP-GEWEI,
    BRGEW LIKE VBAP-BRGEW,
    VOLUM LIKE VBAP-VOLUM,
    CKWGT TYPE C,
    CKVOL TYPE C,
    END OF I_OUTPUT.
    DATA: BEGIN OF ORDERITEMIN OCCURS 0.
    INCLUDE STRUCTURE BAPISDITM.
    DATA: END OF ORDERITEMIN.
    DATA: BEGIN OF ORDERITEMINX OCCURS 0.
    INCLUDE STRUCTURE BAPISDITMX.
    DATA: END OF ORDERITEMINX.
    DATA: BEGIN OF RETURN OCCURS 0.
    INCLUDE STRUCTURE BAPIRET2.
    DATA: END OF RETURN.
    DATA: BEGIN OF BAPIRETURN OCCURS 0.
    INCLUDE STRUCTURE BAPIRET2.
    DATA: END OF BAPIRETURN.
    PARAMETERS:
    P_PATH(45) TYPE C DEFAULT '/usr/users/ftpsapom/' LOWER CASE,
    P_FNAME(32) TYPE C DEFAULT '/sweetjo.txt' LOWER CASE.
    START-OF-SELECTION.
    CONCATENATE PATH AND FILE NAME INTO ONE VARIABLE
    CONCATENATE P_PATH P_FNAME INTO V_FILEIN.
    OPEN DATASET
    IF V_FILEIN IS INITIAL.
    MESSAGE E002 WITH 'FILE' V_FILEIN 'DOES NOT CONTAIN ANY DATA!'.
    ELSE.
    OPEN DATASET V_FILEIN
    FOR INPUT
    IN TEXT MODE.
    IF SY-SUBRC = 0.
    READ DATASET
    DO.
    READ DATASET V_FILEIN INTO I_ORDERS.
    IF SY-SUBRC = 0.
    APPEND I_ORDERS.
    ELSE.
    EXIT.
    ENDIF.
    ENDDO.
    CLOSE DATASET
    CLOSE DATASET V_FILEIN.
    IF SY-SUBRC <> 0.
    MESSAGE E002 WITH 'ERROR - CLOSING' V_FILEIN.
    ENDIF.
    ELSE.
    MESSAGE E002 WITH 'ERROR - COULD NOT OPEN' V_FILEIN.
    ENDIF.
    ENDIF.
    SORT AND REMOVE DUPLICATES FROM I_ORDERS
    SORT I_ORDERS BY VBELN POSNR.
    DELETE ADJACENT DUPLICATES FROM I_ORDERS.
    POPULATE I_OUTPUT
    LOOP AT I_ORDERS.
    SHIFT I_ORDERS-POSNR LEFT DELETING LEADING SPACE.
    CONCATENATE '0' I_ORDERS-POSNR INTO I_ORDERS-POSNR.
    SELECT SINGLE BRGEW VOLUM
    FROM VBAP
    INTO (VBAP-BRGEW, VBAP-VOLUM)
    WHERE VBELN = I_ORDERS-VBELN
    AND POSNR = I_ORDERS-POSNR.
    IF SY-SUBRC = 0.
    IF VBAP-BRGEW = 0.
    I_OUTPUT-CKWGT = 'X'.
    ENDIF.
    IF VBAP-VOLUM = 0.
    I_OUTPUT-CKVOL = 'X'.
    ENDIF.
    I_OUTPUT-VBELN = I_ORDERS-VBELN.
    I_OUTPUT-POSNR = I_ORDERS-POSNR.
    I_OUTPUT-GEWEI = 'ST'.
    I_OUTPUT-BRGEW = I_ORDERS-BRGEW.
    I_OUTPUT-VOLUM = I_ORDERS-VOLUM.
    APPEND I_OUTPUT.
    CLEAR: I_OUTPUT.
    ENDIF.
    V_RECIN = V_RECIN + 1.
    ENDLOOP.
    POPULATE BAPI DATA AND RUN BAPI
    CLEAR: ORDERHEADERINX, ORDERITEMIN, ORDERITEMINX,
    RETURN, BAPIRETURN.
    REFRESH: ORDERITEMIN, ORDERITEMINX, RETURN, BAPIRETURN.
    ORDERHEADERINX-UPDATEFLAG = 'U'.
    LOOP AT I_OUTPUT WHERE CKWGT = 'X' OR CKVOL = 'X'.
    V_RECVBAP = V_RECVBAP + 1.
    IF I_OUTPUT-VBELN <> V_VBELN AND SY-TABIX <> 1.
    V_RECORDER = V_RECORDER + 1.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    SALESDOCUMENT = V_VBELN
    ORDER_HEADER_INX = ORDERHEADERINX
    TABLES
    RETURN = RETURN
    ORDER_ITEM_IN = ORDERITEMIN
    ORDER_ITEM_INX = ORDERITEMINX.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    WAIT = 'X'
    IMPORTING
    RETURN = BAPIRETURN.
    WRITE OUT RETURN
    LOOP AT RETURN.
    WRITE: / RETURN.
    ENDLOOP.
    WRITE: / BAPIRETURN.
    SKIP.
    CLEAR: ORDERITEMIN, ORDERITEMINX,
    RETURN, BAPIRETURN.
    REFRESH: ORDERITEMIN, ORDERITEMINX, RETURN, BAPIRETURN.
    ENDIF.
    ORDERITEMIN-ITM_NUMBER = I_OUTPUT-POSNR.
    ORDERITEMIN-UNTOF_WGHT = I_OUTPUT-GEWEI.
    IF NOT I_OUTPUT-CKWGT IS INITIAL.
    ORDERITEMIN-GROSS_WGHT = I_OUTPUT-BRGEW.
    ORDERITEMINX-GROSS_WGHT = 'X'.
    ENDIF.
    IF NOT I_OUTPUT-CKVOL IS INITIAL.
    ORDERITEMIN-VOLUME = I_OUTPUT-VOLUM.
    ORDERITEMINX-VOLUME = 'X'.
    ENDIF.
    APPEND ORDERITEMIN.
    ORDERITEMINX-ITM_NUMBER = I_OUTPUT-POSNR.
    ORDERITEMINX-UNTOF_WGHT = 'X'.
    ORDERITEMINX-UPDATEFLAG = 'U'.
    APPEND ORDERITEMINX.
    V_VBELN = I_OUTPUT-VBELN.
    ENDLOOP.
    RUN BAPI ON LAST ORDER
    IF NOT ORDERITEMIN IS INITIAL.
    V_RECORDER = V_RECORDER + 1.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    SALESDOCUMENT = V_VBELN
    ORDER_HEADER_INX = ORDERHEADERINX
    TABLES
    RETURN = RETURN
    ORDER_ITEM_IN = ORDERITEMIN
    ORDER_ITEM_INX = ORDERITEMINX.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    WAIT = 'X'
    IMPORTING
    RETURN = BAPIRETURN.
    WRITE OUT RETURN
    LOOP AT RETURN.
    WRITE: / RETURN.
    ENDLOOP.
    WRITE: / BAPIRETURN.
    SKIP.
    ENDIF.
    WRITE OUT RECORD COUNT FROM FILE
    WRITE: / 'RECORD COUNT FROM FILE ', V_RECIN.
    SKIP.
    WRITE OUT RECORD COUNT FROM FILE
    WRITE: / 'RECORD COUNT OF LINES TO CHANGE ', V_RECVBAP.
    SKIP.
    WRITE OUT RECORD COUNT FROM FILE
    WRITE: / 'RECORD COUNT OF ORDERS TO CHANGE ', V_RECORDER.
    SKIP.
    TOP OF PAGE
    TOP-OF-PAGE.
    WRITE:/1(5) TEXT-H01, 6(8) SY-DATUM MM/DD/YY,
    100(8) TEXT-H02, 126(8) SY-PAGNO.
    WRITE:/1(5) TEXT-H03, 6(8) SY-UZEIT USING EDIT MASK '__:__:__',
    20(77) TEXT-H04,
    100(8) TEXT-H05, 108(25) SY-REPID.
    WRITE:/1(6) TEXT-H06, 8(12) SY-UNAME,
    20(4) TEXT-H07, 25(32) SY-HOST,
    100(13) TEXT-H08, 121(8) SY-SYSID,
    129 '/', 130(3) SY-MANDT.
    ULINE.
    SKIP.
    Reward points if useful
    Regards
    Anji

  • Deletion Utility Program for Sales Order.

    Hi Experts,
    We decided to have a deletion utility program for Sales orders. 
    The program should take sales order numbers from a source file, and delete one by one, also the program should generate process log details at the end.
    For creating the above program i need to create a new program or there is any BAPI for deleting the Sales Orders.
    Thanks & Regards,
    Ramana

    Hi,
    Possible UPDATEFLAGS:
    BAPISDH1X-UPDATEFLAG = 'D'.
    U = change
    D = delete
    I = add
    If you go to SE37 give BAPI_SALESORDER_CHANGE --> Display ---> In application tool bar Last Buttion Function Module Documentaion --> Here you get some usefull information.
    Dont Change the BAPI Just pass the Header X = 'D'.
    Try this Sample Program.
    PARAMETERS: p_vbeln  TYPE vbap-vbeln OBLIGATORY.
    DATA:  i_hdrx TYPE bapisdh1x.
    i_hdrx-updateflag = 'D'.
      CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
        EXPORTING
          salesdocument     = p_vbeln
          order_header_inx  = i_hdrx
        TABLES
          return            = i_ret.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      LOOP AT i_ret.
        WRITE / i_ret-message.
      ENDLOOP.
    Thanks,
    Durai.V
    Edited by: Durai V on Aug 19, 2008 8:22 AM

  • Standard Driver Program for Sales Order Confirmation

    Hi,
    My requirement is to develop smartforms and driver program for Sales Order Confirmation.
    For doing this, I found there is a standard smartforms R2RBL_SDORC_L for Sales Order Confirmation. So I thought I can take a Z copy of this smartform and modify it to my requirement. So that we can use the Import parameters (Form Interface parameters) of the form R2RBL_SDORC_L. This will also reduce the work of writing the code in Driver program.
    Now, I need to know what is the standard driver program for this form R2RBL_SDORC_L. If I can find the program name, I can take a Z copy of that and enhance it to my requirement.
    Ultimately I believe I can reduce the work of writing code to fetch all Sales order details.
    Can anyone let me know the standard driver program name for the form R2RBL_SDORC_L?

    Can anyone share how you approached in developing smartforms and driver program for Sales order confirmation?
    Note: This program and smartforms will be assigned in the NACE transaction.

  • Standard(Smartform) Program for Sales order Confirmation

    Hi Experts,
    I have a new Requirement on Smartforms,
    It is Sales order confirmation, Can Any one say what is Revelant program for this Requirement...
    (RVORDER01) is for SAP SCript But i Required Smartform Program..???
    Thanks,,
    ksreddy.

    I Required a program for sales order confirmation ..
    Resolved..!!
    Thanks,

  • How to update VBFA while sales order creation using BAPI

    Hi,
    I am trying to create sales orders for each schedule line items while inquiry creation.
    This I have done in the user exit in the VA11 program MV45AFF using BAPI "BAPI_SALESORDER_CREATEFROMDAT2".
    along with the Inquiry, Sales orders are also getting created. But I am facing 2 problems.
    1) BAPI is not returning the sales order number to the program but when checked from SE37 it is returning the sales order   
        number.
    2) It is not updating the VBFA (SD flow) table.
    Regards,
    Krishna.

    Hello,
    1) BAPI is not returning the sales order number to the program but when checked from SE37 it is returning the sales order
    number.
    - are you passing simulation parameter (TESTRUN) as 'X'
    2) It is not updating the VBFA (SD flow) table.
    - Please use BAPI_SALESDOCUMENT_COPY for copying and updating VBFA table
    Thanks
    Krish

  • Driver program for sales order in smartforms?

    whatst he driver prog for sales order in smartforms?
    how to attach my smart form to driver prog
    thanks  & regards
    lakshmi

    Hi,
      Driver Program is the program which is used to link the form and the ABAP program.
    U have to use the FM 'SSF_FUNCTION_MODULE_NAME' to give the form name.
    Here 'Z_TRNG_SMART_MUL_PURCH_T012' is the form name.
    sf_formname = 'Z_TRNG_SMART_MUL_PURCH_T012'.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = sf_formname
        IMPORTING
          fm_name            = sf_fm_name
        EXCEPTIONS
          no_form            = 1
          no_function_module = 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.
      CALL FUNCTION sf_fm_name
        EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
      CONTROL_PARAMETERS         =
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
      OUTPUT_OPTIONS             =
      USER_SETTINGS              = 'X'
          v_ekpo                     = v_ekpo
         v_adrnr              =  v_adrnr
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
      JOB_OUTPUT_INFO            =
      JOB_OUTPUT_OPTIONS         =
        TABLES
          it_ekko                    = it_ekko
          it_ekpo                    =  it_ekpo
    EXCEPTIONS
      FORMATTING_ERROR           = 1
      INTERNAL_ERROR             = 2
      SEND_ERROR                 = 3
      USER_CANCELED              = 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.
    Thanks & Regards,
    Roja Velagapudi.

  • Migration program for sales order condtions KONV, KONP?

    Hi,
    Is there a standard way of migrating sales order conditions (tables KONV, KONP) or do I have to write a batch for VA02?
    Slath

    Hi,
    try using the function module RV_KONDITION_SICHERN_V13A. Use the condition record number that is in the sales document to which you want to update your conditions.
    This function module will do everything the standard way. In case if you are changing any existing condition record data for any order then use the existing data to fill Y tables passed to the function module and fill the X tables with the new data you want.
    Hope this helps.
    regards,
    Satya

Maybe you are looking for

  • Error Message While Trying to Send email from Mac Mail...

    hello. i have been following the discussion board from some time, and finally made my first mac purchase. only 3 days old.anyways, i am trying to send mail from my .mac email account. i paid for the 1 year subscription,so i know my subscription statu

  • Can someone suggest an affordable external hard drive for use with FCPX and video editing on my Macbook Pro Retina

    I have a Macbook Pro Retina from 2012 and I only got the 250GB hard drive.  I'm getting ready to purchase a Panosonic HC-X920 to use with Final Cut Pro X already installed on my laptop.  Since I know the file sizes are going to be so big, can anyone

  • How can I delete malicious email? using outlook on iPad2

    I have an email message with no content that freezes up my iPad every time I try to delete it.  I went into my Outlook mail on my pc, found it in my junk mail folder and deleted it without any problem, but can solve the problem on my iPad.  My real q

  • Pr CS7 Feature Requests

    I am excited about getting my hands on CS6, and congratulate the Adobe team for their hard work.  However... I haven't seen anything in the web pages or videos about these features that are vital to working editors, already requested by me and many o

  • Drag and drop request

    I was waiting for 1.1 as it was supposed to fix drag'n'drop issue on Windows (a lot of quiet Win-Mac differences in Lr...). I expected this to fix one of the main issues with Lr that I have. That is: I can send RAW files to Photoshop through CameraRA