Creating the Sales Order using the bapi BAPI_SALESORDER_CREATEFROMDAT2

Hi,
My problem is , i have created one module pool program for accelerating the Sales Order creation.
I am using the bapi BAPI_SALESORDER_CREATEFROMDAT2 for sales order creation. After executing the program
bapi is given an errot that, incomplete sales order document is saved.
Can any body tell me plz what are the necessary fields i need to take in the header and item level , so that the complete
document will be saved through BAPI.
<removed_by_moderator>
Thanks
Edited by: Julius Bussche on Jan 11, 2010 12:09 PM

TABLES: VBAK,                             "Sales Document: Header Data
        VBAP.                             "Sales Document: Item Data
*************************************WORK AREA DECELERATION************************
DATA: BEGIN OF WA_HEADER,
        LI    TYPE I,                      "LINE TYPE
        AUART TYPE VBAK-AUART,             "Sales Document Type
        VKORG TYPE VBAK-VKORG,             "Sales Organization
        VTWEG TYPE VBAK-VTWEG,             "Distribution Channel
        SPART TYPE VBAK-SPART,             "Division
        KUNNR TYPE BAPIPARNR-PARTN_NUMB,   "Customer number
      END OF WA_HEADER.
DATA: BEGIN OF WA_ITEM,
        LI     TYPE I,
        MATNR  TYPE VBAP-MATNR,            "MATERIAL NUMBER
        ZMENG  TYPE VBAP-ZMENG,           "QUANTITY
      END OF WA_ITEM.
***********************************INTERNAL TABLE DECELERATION***************************************
DATA: IT_HEADER      LIKE TABLE OF WA_HEADER WITH HEADER LINE.                   "IT FOR HEADER
DATA: IT_ITEM        LIKE TABLE OF WA_ITEM WITH HEADER LINE.                     "IT FOR ITEM
DATA: IT             LIKE VBAK OCCURS 0 WITH HEADER LINE.
***************************SALES ORDER INTERNAL TABLE DECELERATION********************************
DATA:
      HEADER  TYPE TABLE OF BAPISDHEAD WITH HEADER LINE,        "SALES HEADER DATA
      ITEMS   TYPE TABLE OF BAPIITEMIN WITH HEADER LINE,         "SALES ITEM DATA
      PARTNERS TYPE TABLE OF BAPIPARTNR WITH HEADER LINE.      "SALLES PARTNERS
***********************************DYNAMIC FIEL PATH GETTING DECELERATION************************
DATA : HL_FIELD_NAME TYPE DYNPREAD-FIELDNAME VALUE 'G_P_SPATH',              "SCREEN FIELD NAME
       HL_FILE_NAME  TYPE IBIPPARMS-PATH VALUE 'G_P_SPATH',                  "Local file for upload/download
       IL_FIELD_NAME TYPE DYNPREAD-FIELDNAME VALUE 'G_P_EPATH',              "SCREEN FIELD NAME
       IL_FILE_NAME  TYPE IBIPPARMS-PATH VALUE 'G_P_EPATH',                  "Local file for upload/download
       FL_FIELD_NAME TYPE DYNPREAD-FIELDNAME VALUE 'G_P_EPATH',              "SCREEN FIELD NAME
       FL_FILE_NAME  TYPE IBIPPARMS-PATH VALUE 'G_P_EPATH'.                  "Local file for upload/download
DATA : CTR TYPE I .
DATA : CTR2 TYPE STRING.
DATA : CTR1 TYPE STRING.
Sales document number
DATA : L_VBELN LIKE BAPIVBELN-VBELN.
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE T1.
SELECTION-SCREEN : SKIP.
PARAMETER        : P_HPATH TYPE STRING.
PARAMETER        : P_IPATH TYPE STRING.
SELECTION-SCREEN : SKIP.
SELECTION-SCREEN : END OF BLOCK B1.
SELECTION-SCREEN : BEGIN OF BLOCK B2 WITH FRAME TITLE T2.
SELECTION-SCREEN : SKIP.
SELECTION-SCREEN : BEGIN OF LINE.
SELECTION-SCREEN : PUSHBUTTON 10(14) UPLOAD USER-COMMAND CLICK1.
SELECTION-SCREEN : END OF LINE.
SELECTION-SCREEN   END OF BLOCK B2.
******************************************INITIALIZATION.***************************************************
INITIALIZATION.
  T1       = 'Putchase Order Source File Path'.
  T2       = 'Push Button'.
  UPLOAD   = 'Upload'.
*******************************************AT SELECTION SCREE EVENT********************************************
AT SELECTION-SCREEN.
  CASE SY-UCOMM.
    WHEN 'CLICK1'.
      IF P_HPATH IS INITIAL AND P_IPATH IS INITIAL.      "CHECKING BTHE THE TEXT BOX
        MESSAGE I009.
      ELSE.
        PERFORM SELECT.                                  "CALLING THE SELECT SUBROUTINE
      ENDIF.
    WHEN OTHERS.
      MESSAGE 'PRESS FORM BUTTON' TYPE 'I'.      "WHEN EXECUTE BUTTON IS PRESSED
  ENDCASE.
***********************************GETTING HEADER FIEL PATH*******************************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_HPATH.
  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      PROGRAM_NAME  = SYST-CPROG
      DYNPRO_NUMBER = SYST-DYNNR
      FIELD_NAME    = HL_FIELD_NAME
    IMPORTING
      FILE_NAME     = HL_FILE_NAME.
  P_HPATH = HL_FILE_NAME.
***********************************GETTING ITEM FIEL PATH*******************************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_IPATH.
  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      PROGRAM_NAME  = SYST-CPROG
      DYNPRO_NUMBER = SYST-DYNNR
      FIELD_NAME    = IL_FIELD_NAME
    IMPORTING
      FILE_NAME     = IL_FILE_NAME.
  P_IPATH = IL_FILE_NAME.
START-OF-SELECTION.
*&      Form  SELECT
      text
-->  p1        text
<--  p2        text
FORM SELECT .
  CALL FUNCTION 'GUI_UPLOAD'             " function resposible to get the local flat
      EXPORTING                          " and upload it in a internal table
        FILENAME            = P_HPATH
        FILETYPE            = 'ASC'
        HAS_FIELD_SEPARATOR = '#'
      TABLES
        DATA_TAB            = IT_HEADER.
  CALL FUNCTION 'GUI_UPLOAD'             " function resposible to get the local flat
      EXPORTING                          " and upload it in a internal table
        FILENAME            = P_IPATH
        FILETYPE            = 'ASC'
        HAS_FIELD_SEPARATOR = '#'
      TABLES
        DATA_TAB            = IT_ITEM.
  LOOP AT IT_HEADER.
    Initialize Header values
    HEADER-DOC_TYPE     =  IT_HEADER-AUART.
    HEADER-SALES_ORG    =  IT_HEADER-VKORG.
    HEADER-DISTR_CHAN   =  IT_HEADER-VTWEG.
    HEADER-DIVISION     =  IT_HEADER-SPART.
    APPEND HEADER.
    PARTNERS-PARTN_ROLE = 'WE'.
    PARTNERS-PARTN_NUMB = IT_HEADER-KUNNR.
    APPEND PARTNERS.
    CTR = 10.
    LOOP AT IT_ITEM WHERE LI = IT_HEADER-LI.
      CTR2 = CTR.
      CONCATENATE '0000' CTR2 INTO CTR1.
***Initialize Item values
     ITEMS-ITM_NUMBER   = IT_ITEM-ITEM.
      ITEMS-ITM_NUMBER   = CTR1.
      ITEMS-MATERIAL     = IT_ITEM-MATNR.
      ITEMS-REQ_QTY   = IT_ITEM-ZMENG.
      APPEND ITEMS.
      CTR = CTR + 10.
    ENDLOOP.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
      EXPORTING
        ORDER_HEADER_IN = HEADER                      "SALES HEADER DATA
      IMPORTING
        SALESDOCUMENT   = L_VBELN                        "RETRIEVED SALES DOCUMENT NUMBER
      TABLES
        ORDER_ITEMS_IN  = ITEMS                       "SALES ITEM LEVEL DATA
        ORDER_PARTNERS  = PARTNERS.                    "SAKES PARTNERS
    APPEND L_VBELN TO IT.
    COMMIT WORK AND WAIT.
    CLEAR : HEADER , ITEMS[] ,PARTNERS,CTR,CTR1,CTR2.
    REFRESH : ITEMS.
  ENDLOOP.
  IF IT[] IS NOT INITIAL.
    LOOP AT IT.
      WRITE: / 'SALES ORDER', IT-VBELN , 'CREATED'.
    ENDLOOP.
    LEAVE TO LIST-PROCESSING.
    SET PF-STATUS SPACE.
  ELSE.
    MESSAGE I044.
  ENDIF .
ENDFORM.                    " SELECT

Similar Messages

  • How to create an Invoice for the sales order using the T-Code VF01

    Hello Experts,
    How to create an Invoice for a sales order using the T-Code VF01?
    Thanks in advace,
    Suma

    hi,
    Make the following settings-
    1. Create sales document and billing type
    2. assign billing type in sales document type config VOV8
    3. Activate itemcategory as sales order related billing
    4. Maintain copy control header and item level between sales order and billing
    5. Maintain pricing procedure for sales order and billing
    6. Define Output procedure in case to print invoice
    Regards
    Goutham

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

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

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

  • How to create the sales order using excell sheet thru BAPI's?

    Hi Guru's,
    In my excell sheet i had 11 sales order details ..now i wanted to create the sales order's sing BAPI's...?
    could please guide me step by step.....that would be greatly helpfull to me...
    Thanks in advance
    Srinivas....

    Hi,
    follow below steps.
    1. Get the excel data into internal table,  Build a internal table whcih fields are in bapi same order
    2. call the Bapi and pass the table data to the bapi
    3. after calling the  bapi,  call the commit bapi.
        then only it will careates.
    Regards
    Ganesh

  • Error while creating the sales order using Proxy

    Hi Folks,
    I am trying to create a Sales Order using Proxy via BAPI "BAPI_SALESORDER_CREATEFROMDAT2" :
    and i got this type of standard error message
    <Message>FB call: insufficient parameters</Message>
    few days back only i used the same bapi for creating the Sales Order and did it successfully...using the same parameters
    I don't have any clue about this type error .
    Kindly guide .
    Regards,

    Hi Nikhil,
    How refreshing the cache and restart the server will help ?
    basically i am testing the scenario at R/3 end only by generating XML template in SPROXY.
    My ECC 6.0 is on sp 12....I am not sure is it configuration related error or a bug ? as i have used the same code in ECC 6.0 with sp 09.
    regards,

  • Uploading the sales order using BAPI

    hi experts,
    i want to upload the sales order using BAPI.
    can you provide the FM.
    it will be much helpful if i have the sample code........
    thanks

    Hi Shyam,
    Use BAPI : BAPI_SALESORDER_CREATEFROMDAT2
    REPORT ZZBAPI_TEST1 .
    *===========================================================
    *** Start of selection
    *===========================================================
    START-OF-SELECTION.
    * test of sales order with BAPI
    PERFORM SALES_ORDER_BAPI.
    *================ End of main program ======================
    *& Form SALES_ORDER_BAPI
    * text
    FORM SALES_ORDER_BAPI.
    DATA : SD_HEADER LIKE BAPISDHEAD.
    DATA : BEGIN OF ITEMIN_IT OCCURS 1.
    INCLUDE STRUCTURE BAPIITEMIN.
    DATA : END OF ITEMIN_IT.
    DATA : BEGIN OF PARTNR_IT OCCURS 1.
    INCLUDE STRUCTURE BAPIPARTNR.
    DATA : END OF PARTNR_IT.
    DATA : WK_SD_DOCNO LIKE VBAK-VBELN.
    DATA: WK_RETURN LIKE BAPIRETURN.
    CLEAR : SD_HEADER , ITEMIN_IT , PARTNR_IT.
    SD_HEADER-DOC_TYPE = 'TA'.
    SD_HEADER-SALES_ORG = '1793'.
    SD_HEADER-DISTR_CHAN = '01'.
    SD_HEADER-DIVISION = '01'.
    SD_HEADER-PURCH_NO = 'Test'.
    * itemin_it-hg_lv_item = '10'.
    ITEMIN_IT-MATERIAL = '000000000000001143'.
    ITEMIN_IT-PLANT = '3018'.
    ITEMIN_IT-REQ_QTY = '1'.
    ITEMIN_IT-SALES_UNIT = 'CS'.
    APPEND ITEMIN_IT.
    * itemin_it-hg_lv_item = '20'.
    ITEMIN_IT-MATERIAL = '000000000000000848'.
    ITEMIN_IT-PLANT = '3018'.
    ITEMIN_IT-REQ_QTY = '1'.
    ITEMIN_IT-SALES_UNIT = 'KG'.
    APPEND ITEMIN_IT.
    * itemin_it-hg_lv_item = '30'.
    ITEMIN_IT-MATERIAL = '000000000000000848'.
    ITEMIN_IT-PLANT = '3018'.
    ITEMIN_IT-REQ_QTY = '1'.
    ITEMIN_IT-SALES_UNIT = 'EA'.
    APPEND ITEMIN_IT.
    LOOP AT ITEMIN_IT.
    WRITE : / SY-TABIX , ITEMIN_IT-MATERIAL , ITEMIN_IT-PLANT
    , ITEMIN_IT-REQ_QTY , ITEMIN_IT-SALES_UNIT.
    ENDLOOP.
    CLEAR : PARTNR_IT.
    PARTNR_IT-PARTN_ROLE = TEXT-001.
    PARTNR_IT-PARTN_NUMB = '0000000004'.
    APPEND PARTNR_IT.
    CLEAR : PARTNR_IT.
    PARTNR_IT-PARTN_ROLE = 'WE'.
    PARTNR_IT-PARTN_NUMB = '0000000051'.
    APPEND PARTNR_IT.
    LOOP AT PARTNR_IT.
    WRITE : / SY-TABIX , PARTNR_IT-PARTN_ROLE , PARTNR_IT-PARTN_NUMB.
    ENDLOOP.
    CLEAR : ITEMIN_IT , PARTNR_IT , WK_RETURN..
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDATA'
    EXPORTING
    ORDER_HEADER_IN = SD_HEADER
    IMPORTING
    SALESDOCUMENT = WK_SD_DOCNO
    * SOLD_TO_PARTY =
    * SHIP_TO_PARTY =
    * BILLING_PARTY =
    RETURN = WK_RETURN
    TABLES
    ORDER_ITEMS_IN = ITEMIN_IT
    ORDER_PARTNERS = PARTNR_IT
    * ORDER_ITEMS_OUT =
    * ORDER_CFGS_REF =
    * ORDER_CFGS_INST =
    * ORDER_CFGS_PART_OF =
    * ORDER_CFGS_VALUE =
    * ORDER_CCARD =
    EXCEPTIONS
    OTHERS = 1.
    WRITE : / 'sy-subrc = ' , SY-SUBRC.
    IF NOT WK_SD_DOCNO IS INITIAL.
    WRITE : / WK_SD_DOCNO , 'registerd'.
    ELSE.
    WRITE : / 'incorrect'.
    WRITE : / WK_RETURN-TYPE , WK_RETURN-CODE , WK_RETURN-MESSAGE.
    WRITE : / WK_RETURN-LOG_NO, WK_RETURN-LOG_MSG_NO,
    WK_RETURN-MESSAGE_V1.
    ENDIF.
    ENDFORM. " SALES_ORDER_BAPI
    Hope that helps.
    Regards
    Kapadia
    ***Assigning points is the way to say thanks in SDN.***
    Message was edited by:
            Mr Kapadia

  • 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 resolve the issue of route while creating a sales order using IDOC

    Hi,
    When I am creating a sales order mannualy the the route is correct and matching  also but while using IDOC try to create a sales order then the route is showing wrong.
    I tried to debug the program SAPMV45A but I am not getting anything.
    Could any body help me on this.
    Waiting for quick response.
    Best Regards,
    BDP

    Hi Bansidhar,
                 You need to debug the Function Module thats assigned to your Process code.
                 In standard config for Sales Order, Process Code ORDE is assigned to FM IDOC_INPUT_ORDERS. And this FM uses Call Transaction Method to create Sales Orders. SO you can  debug this FM.
               Hope this helps you solving the problem.
    Regards
    Srikanth  M

  • Create a work order using the BAPI for IW31

    Hi,
          I want to create a work order using the BAPI for IW31 tr. can any one help me with the program description.
    Full points will be awarded for the useful answers.
    Thanks and regards,
    Sunil

    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).

  • Sale Order Item Quantity Not Populating When Create A Sale Order Using BAPI

    I am having a problem when creating a sale order using BAPI
    BAPI_SALESORDER_CREATEFROMDAT2
    Problem is that sale order item quantity field is not populating
    code is as follows
    ORDER_ITEMS_IN-ITM_NUMBER = '0010'.
    ORDER_ITEMS_IN-MATERIAL = '000000000010000262'.
    ORDER_ITEMS_IN-TARGET_QU = 'LB'.
    ORDER_ITEMS_IN-TARGET_QTY = 1.

    Hi,
    Try populating ORDER_SCHEDULES_IN table in the bapi field REQ_QTY.
    Regds,
    Rudra

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

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

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

  • How to create a sales order using bapi

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

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

  • Update the material quantity in the sales order using LSMW...

    Hi Guru's,
    I created one sales order using BAPI..now i wanted update the material quantity in the sales order using LSMW...
    could you please provide the step by step process....
    if anyone of you provide the program logic similar to requirement that would be helpfull to me...
    thanks in advance
    Srinivas....

    Hi Sri,
    Hope it may help you.
    First do the recording for VA02 transaction, in that give the existing sales order number
    and update the Quantity and save it. Remaining steps are same what we used(LSMW) to upload data to applications.
    Regards,
    Vishvesh
    if helpful, rewards it.

  • FM SD_SALESDOCUMENT_CREATE  on creating a sales order using reference

    I create a sales order using a reference order number.On displaying it in VA02, and giving document flow, the reference document which I used to create the sales order gets displayed.
    A program/fm u2018Xu2019 is called on giving document flow (which takes the reference order number I used as input )
    Now if that u2018Xu2019 is getting the data of the reference order I used from some table u201CT_Yu201D.This table u201CT_Yu201D must be set during sales order creation itself. So, some program which is called during creation of sales order gets the reference order number I used as input and puts it in that table u201CT_Yu201D.
    My assumption is that SD_SALESDOCUMENT_CREATE is the function module handling that part. If it is not for that, then what is its function.
    *****If it is handling that part, which structure which this FM gets as input contains that order number which I used as reference?
    There are 3 bapiu2019s called on sales order creation, BAPI_SALESORDER_CREATEFROMDAT2, BAPI_SALESORDER_CREATEFROMDAT1, BAPI_SALESORDER_CREATEFROMDATA.
    Only one BAPI calls SD_SALESDOCUMENT_CREATE namely BAPI_SALESORDER_CREATEFROMDAT2
    *****Why does the FM SD_SALESDOCUMENT_CREATE not get triggered when I set a breakpoint in it during sales order creation?

    Please search in SDN so many thread related to create sales order

  • Creating a Sales Order using Web Dynpro

    Hi SDN,
      I want to create a Sales Order using Web Dynpro application. For that i have used "Bapi_Salesorder_Createfromdat2" as a adaptive RFC model. Every thing is fine and i could able to create a sales order for a single line item. But my intension is to create a sales order for multiple line items. So in the "Intialview" i have used a "Table" UI element to pass multiple line items. When i execute this application i could pass only single line item from this table. The table UI contol is not allowing to enter the second line item in the second row of the table. Can any one suggest me to solve this problem.
    Thanks in advance.
    Regards
    Basha

    Hi Basha,
    You need to create new element for the model node manually. For example: Create button "New item" and in action handler put someting like described here:
    Add row to table
    How to add more values in a Table in WD appl
    How to add a row to table dynamically?
    How to add a column to a table dynamically.
    add row to table bound to rfc model
    Best regards, Maksim Rashchynski.

Maybe you are looking for