Creation of sales order using IDOC

Hello All,
PO is created in a website,which comes to SAP as a Idoc.Sales order need to be created with this idoc information. We are extending ORDERS05, since we are in need to add z segment as a child segment of E1EDKA1 to hold 3 email addresses.
Could anyone say how to handle these email addresses in SAP and which exit is to be used for the same?
Is that EXIT_SAPLVEDA_001 or EXIT_SAPLVEDA_004.
Thanks in advance.
Meenakshi

Hi,
its EXIT_SAPLVEDA_001.
Regards

Similar Messages

  • Creation of sale order using bapi in webdynpro using table control

    only first row is getting updated when checked in va03, the line items are not getting replaced, only first row is committed..
    Here is the code for table control i used...
    http://www.scribd.com/doc/51879492/creation-of-sale-order-using-bapi-in-webdynpro-using-table-control
    pls help me out with this..

    Duplicate Posting.  Original is here: Sales order creation with bapi in webdynpro using table control

  • Creating sales order using IDOC - Delivery hour

    Hi,
    i've a problem to solve. when creating a sales order i need that when the segment is E1EDK03 and the IDDAT is 002 i need to extract the delivery hour and insert it in the table vbak-vzeit, now what i'm doing in the exit EXIT_SAPLVEDA_001 is:
    DATA: hour LIKE vbak-vzeit.
    CHECK segment-segnam = 'E1EDK03'.
    IF segment-sdata(3) = '002'.
      hour = segment-sdata+11(6).
    ENDIF.
    and now i want to acess the value in hour in the exit EXIT_SAPLVEDA_002 to put it in the dxvbak struct tha i think that is the table correct to then internaly fill the vbak. the problem is that the variable hour is not available in the exit EXIT_SAPLVEDA_002. i do i do to pass the value that i want from the exit EXIT_SAPLVEDA_001  to be available in exit EXIT_SAPLVEDA_002  and then insert that value in the right place to fill vbak.

    Can u tell me the steps to create a sales order using idoc, i've created a bapi but thats a temprory use. I wanted to created a sales order automatically when a purchase order is saved.
    Please let me know if u can help me, i wanted to do it using idoc
    Regards
    Sanju

  • Creation of  sales order using inbound idoc

    hello all,
             I have a scenario where i need to read data from a flat file, then create a sales order with the flat file data using IDOC. we can also create sales order using BAPI but the problem is that we need to handle serveral errors so we want to use IDOC.
           we are trying to use the function modules 'Idoc_input_orders'  but we are not sure how exactly we need to pass the parameters into the function module, actullays data control structure is asking for different parameters like partner, idoc number, idoc port etc which we need not have as we are processing it internally in the same system.
        It would be great if some one could help me regarding.
    Thanks
    krishnam raju N
    Message was edited by:
            krishnam Raju N
    krishnam Raju N

    Hi,
    see FUNCTION 'IDOC_INBOUND_FROM_FILE'
    Regards,
    Clemens

  • Problem when setting Reason of Rejection for a sales order using IDOC

    Hi All,
          I am working on a requirement where i need to put a reason for rejection as 'Item Cancelled' for a sales order via IDOC 'IDOC_INPUT_ORDCHG' in a third party scenerio where the PR is created automatically from the sales order . When the IDOC is run in the foreground I get the information message Subsequent function  " 'Purchase requisition from sales document' not possible Item & was rejected "(Message V1579) and the IDOC results in a error when run  in the background mode because of the same information message. The message should not appear when a sales order is being processed in the background but still the message is being displayed . Is there any way the message can be suppressed ? Thanks in Advance.
    Regards,
    Sowmya.

    can you send the program how you create a so or po using IDOC, as i've a assignment creating PO using IDOC & then creating a sales order of the PO. and i dont know how to create a IDOC. SO IF you have sample program it would be help full
    Thanxs

  • Creation of sales order via IDoc ORDERS05 - specify a reason of rejectio

    Hi,
    I want to create a sales order via IDoc (type:ORDERS05), i specify for an E1EDP01 segment a reason of rejection (ABGRU),
    The sales order is created succefully by calling the FM IDOC_INPUT_ORDERS but the order quantity of the item where i have specified a reason of rejection is equals to 0.
    Is this normal? i want that this will take 3 value either 0?
    Could anyone help me?
    Thx

    Hi,
    Thank you for ur answer.
    I've followed the procedure that you have explained and the Quantity 3 have been succefully passed to VA01 but is set to zero when i execute the next OK-CODE (=UER2, i think it is llike Enter button ). I simulate the same procedure by creating a sales order on VA01 and i've finally found the problem : at item level, if i enter the Material (MATNR), the order Quantity (KWMENG) and the Reason of rejection (ABGRU), the quantity is set to zero after clicking the enter button ; but if i enter only The material and The quantity followed by enter button, and enter after the Reason of rejection, it works fine, the Quantity doesn't change.
    What is the solution that you propose to me?
    I've try this one on debugger mode:
    The FM which interpret the Idoc create the sales order by CALLING TRANSACTION 'VA01' USING bdcdata....
    I've modified the bdcdata to implement the sequence of the steps before (MATNR + QTY <ENTER> ABGRU <ENTER>).
    1. Is it possible to code this modification?
    2. Is there a way to structure the Idoc for having this sequence in bdcdata?
    Thanks in advance!
    Narivelo

  • ERROR IN CREATING SALES ORDER,USING IDOC TYPE ORDERS05

    I am using exit to write my code for creating sales order of IDOC Type ORDERS05 and order type ZDRX.
    IF I proceess the Idoc in background each time error message comes
    FIELD kuwev-kunnr(ship to party)is not an input field.
    but if i run in foreground in debugging mode,sales order is getting created..
    please suggest something.

    If thats not working..
    try BAPI_SALESORDER_CREATEFROMDAT2
    If BAPI is not working. try creating a bdc for the same if there's not error on trying from VA01

  • Sales Order Using Idoc

    Hello All,
    We are creating Sales Order through Idocs : Basic Type  - ORDERS05   Message Type - ORDERS
    Sales Order is being created but for few Items , Reason for Rejection is set (thts not required in our case).
    I am trying to figure out why for some items its happening ?
    I tried to check the reason by Processing the Idoc in WE19 but could get through.
    Also tried to process the   Idoc using FM IDOC_INPUT_ORDERS in Debugging but not able to process further as getting error message : 'Idoc Has Different Status'.
    Any input on this would be helpful.
    Thanks
    Praveen

    This problem due to your config in the system, try to create a sales order for the item that posted via Idoc then see same item got rejected.. If yes discuss wtih your funtional guys....

  • Problem creating sales order using IDoc ORDERS05 (Inbound)

    Hello Experts,
    We are trying to create a sales order using the IDoc ORDERS05 with process code ORDE for creating sales order. I am getting the following error "VKORG, VTWEG, SPART cannot be determined for customer 0000006000 , vendor
    Diagnosis
    No sales organization, distribution channel or division were sent to the IDOC. This data is necessary if a sales order is to be added automatically. If this data is unavailable, you cannot create a sales order document.
    I was not able to find the fields to fill the distribution channel and divison in the Idoc structure. I have filled in Sales organization in E1EDK14 segment as 3000.
    I am not able to figure out the cause for the error.
    Same data works fine from BAPI_SALESORDER_CREATEFROMDAT2.
    Please help.
    Thanks,
    Suma
    Edited by: Suma B on Jun 17, 2008 11:12 AM

    Hello Suma
    In this case I would recommend to debug the IDoc processing.
    Call transaction WE19 and start the inbound processing of your IDoc in debugging mode. The error message will most likely occur in function module IDOC_INPUT_ORDERS.
      LOOP AT idoc_contrl.
    * SET/GET Parameter und interne Tabellen neu initialisieren
    * initialize SET/GET Parameter and internal tables
        PERFORM initialize_organizational_data.
    * IDOC-Segmente in die entsprechenden Anwendungsdaten übernehmen
    * Move IDOC to internal tables
        PERFORM interpret_idoc_orders.                    "<= check here
    * Prüfen ob gewisse Segmente gefüllt sind
    * check IDOC-Segments
        PERFORM check_idoc_segments.                 "<= check here
    * Prüfen und Ermitteln von Organisationsdaten
    * check internal tables and determine organization data
    Regards
      Uwe

  • Problem regarding the creation of sales order using bapi.

    Hai all,
    I am creating sales order using bapi but i am, get following error messages :
    TYPE ID  NUMBER MESSAGE
    E       VP   112       Please enter sold-to party or ship-to party
    E       V4   219       Sales document  was not changed
    I have entered all the parameters.
    my program is as follows :
    *& Report  ZSD_SALES_ORDER
    REPORT  ZSD_SALES_ORDER.
        Tables
    *table definitions
    TABLES:vbak,      "Sales Document: Header Data
            knvv,     "Customer Master Sales Data
            mara,     "General Material Data
            t001l,    "Plants/Branches
            mvke,     "Sales Data for Material
            vbap,     "Sales Document: Item Data
            konv.     "Conditions (Transaction Data)
        Types
    *type for upload data
    TYPES :BEGIN OF ty_upload,
           matnr(20) TYPE c,                  " Old material number
           quantity(20) TYPE c,               " Cumulative order quantity in sales units
    VALUE TYPE       BAPIKWERT1,
          value(20) TYPE c,                  " Condition value
                 value TYPE konv-kwert,                  " Condition value
    END OF ty_upload.
    *type for final output table
    TYPES :BEGIN OF ty_main,
               bismt  TYPE mara-bismt,    "Old material number
               matnr  TYPE vbap-matnr,    "Material Number
               kunnr  TYPE vbak-kunnr,    "customer number
               auart  TYPE vbak-auart,    "Sales Document Type
               vkorg  TYPE vbak-vkorg,    "Sales Organization
               vtweg  TYPE vbak-vtweg,    "Distribution Channel
               spart  TYPE vbak-spart,    "Division
               vbeln  TYPE vbak-vbeln,    "Sales document
               werks  TYPE marc-werks,    " Plant
               lgort  TYPE mard-lgort,    "Storage Location
               posnr  TYPE vbap-posnr,    "Sales Document Item
               parvw  TYPE vbpa-parvw,    "Partner function
               kwmeng TYPE vbap-kwmeng,   "Cumulative order quantity in sales units
               kschl  TYPE konv-kschl,    "Condition type
              kwert  TYPE konv-kwert,    "Condition value
    KWERT TYPE       BAPIKWERT1,
              kwert(20)  TYPE c,    "Condition value
               waers  TYPE konv-waers,    "Currency
         END OF ty_main.
    *type for old material number
    TYPES: BEGIN OF ty_matnr,
           matnr TYPE mara-matnr,
           bismt TYPE mara-bismt,
           END OF ty_matnr.
    *type for order number
    TYPES :BEGIN OF ty_output,
           vbeln  TYPE vbak-vbeln,       "Sales Document
         END OF ty_output.
        Constants                Begin with C_                           *
    CONSTANTS:
    c_zpmu(4) TYPE c VALUE 'ZPMU',
    c_zpmm(4) TYPE c VALUE 'ZPMM'.
    DATA: c_ch(1) TYPE c VALUE 'X'.
        Data                     Begin with W_                           *
    *global data for validations
    DATA: w_count TYPE i,
          w_vkorg TYPE vbak-vkorg,
          w_vtweg TYPE vbak-vtweg,
          w_spart TYPE vbak-spart,
          w_werks TYPE t001l-werks,
          w_check TYPE c,
          w_itemno TYPE posnr_va,
         W_COND TYPE C.
          w_cond(3) TYPE c.
        Internal tables          Begin with IT_                          *
    *internal table definitions
    DATA : it_upload TYPE STANDARD TABLE OF ty_upload ,
           wa_upload TYPE ty_upload.
    DATA : it_main TYPE STANDARD TABLE OF ty_main,
           wa_main TYPE ty_main.
    DATA: it_matnr TYPE STANDARD TABLE OF ty_matnr,
          wa_matnr TYPE ty_matnr.
    DATA : it_output TYPE STANDARD TABLE OF ty_output.
    Internal table for BAPI.
    DATA: it_bapisdhd1  TYPE STANDARD TABLE OF bapisdhd1,        "Sales and Distribution Document Header
          wa_bapisdhd1 TYPE bapisdhd1.
    DATA: it_bapisditm  TYPE STANDARD TABLE OF bapisditm ,       "Sales and Distribution Document Item
          wa_bapisditm TYPE bapisditm.
    DATA: it_bapiparnr  TYPE STANDARD TABLE OF bapiparnr,        "SD Document Partner: WWW
          wa_bapiparnr TYPE bapiparnr.
    DATA: it_bapischdl  TYPE STANDARD TABLE OF bapischdl,       "Schedule Lines
          wa_bapischdl TYPE bapischdl.
    DATA: it_bapicond TYPE STANDARD TABLE OF bapicond,       "Communication Fields for Maintaining Conditions in the Order
          wa_bapicond TYPE bapicond.
    DATA: it_bapiret2 TYPE STANDARD TABLE OF bapiret2,        "Return Parameter
          wa_bapiret2 TYPE bapiret2.
          Parameters              Begin with PR_                        *
    *selection screen definition
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME .
    PARAMETERS: pr_vkorg TYPE vbak-vkorg OBLIGATORY,
                pr_vtweg TYPE vbak-vtweg  OBLIGATORY,
                pr_spart TYPE vbak-spart  OBLIGATORY,
                pr_kunnr TYPE kna1-kunnr  OBLIGATORY,
                pr_werks TYPE marc-werks  OBLIGATORY,
                pr_lgort TYPE mard-lgort  OBLIGATORY.
    PARAMETERS: pr_auart TYPE vbak-auart OBLIGATORY,
               PR_AUGRU TYPE VBAK-AUGRU OBLIGATORY.
                            pr_augru TYPE vbak-augru.
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME.
    PARAMETERS : pr_file TYPE ibipparms-path OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK blk2.
          At selection-screen                                           *
    AT SELECTION-SCREEN.
      PERFORM f006_validate_vkorg.
      PERFORM f007_validate_vtweg.
      PERFORM f008_validate_spart.
      PERFORM f009_validate_kunnr.
      PERFORM f010_validate_werks.
      PERFORM f011_validate_lgort.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pr_file.
    *for f4 help----
      PERFORM f003_f4_help.
          S T A R T   O F   S E L E C T I O N                           *
    START-OF-SELECTION.
    *for material ,quantity and value upload
      PERFORM f001_upload_file.
    *get data
      PERFORM  f003_get_data.
    *for check the data
      PERFORM f002_check_data .
      PERFORM f004_process.
    *for posting
      PERFORM f005_posting.
    END-OF-SELECTION.
          E N D       O F   S E L E C T I O N                           *
    *&      Form  f001_upload_file
          upload file
    FORM f001_upload_file .
      DATA : lw_fname TYPE string.
      CLEAR lw_fname.
      lw_fname = pr_file.
      REFRESH it_upload.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = lw_fname
          filetype                = 'ASC'
          has_field_separator     = c_ch
        TABLES
          data_tab                = it_upload
        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.
      ENDIF.
      LOOP AT it_upload INTO wa_upload.
       wa_upload-value = ( wa_upload-value ) / 10.
       MODIFY it_upload FROM wa_upload.
      ENDLOOP.
    ENDFORM.                    "F001_UPLOAD_FILE
    *&      Form  f003_f4_help
          f4 help
    FORM f003_f4_help .
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
          field_name    = ' '
        IMPORTING
          file_name     = pr_file.
    ENDFORM.                    " f003_f4_help
    *&      Form  check_data
          text
    FORM f002_check_data .
      DATA: lw_lines TYPE i.
      DESCRIBE TABLE it_main LINES lw_lines.
      IF lw_lines LE 0.
        RETURN.
      ENDIF.
      SELECT a~matnr
             a~bismt FROM mara AS a INNER JOIN mvke AS b
                   ON amatnr = bmatnr
                   INTO CORRESPONDING FIELDS OF TABLE it_matnr
                   FOR ALL ENTRIES IN it_main
                   WHERE a~bismt = it_main-bismt.
      IF sy-subrc = 0.
        LOOP AT it_main INTO wa_main.
          CLEAR : wa_matnr.
          READ TABLE it_matnr INTO wa_matnr WITH KEY bismt = wa_main-bismt.
          IF sy-subrc = 0.
            MOVE: wa_matnr-matnr TO wa_main-matnr.
          ENDIF.
          MODIFY it_main FROM wa_main TRANSPORTING matnr WHERE bismt = wa_main-bismt.
        ENDLOOP.
      ELSE.
       MESSAGE e000(zmsd) WITH  text-001.
      ENDIF.
    ENDFORM.                    "CHECK_DATA
    *&      Form  F009_validate_vkorg
          text
    FORM f006_validate_vkorg .
      CLEAR w_vkorg.
      SELECT SINGLE vkorg
          INTO w_vkorg FROM tvko
          WHERE vkorg EQ pr_vkorg.
      IF sy-subrc <> 0.
        MESSAGE e000(zmsd) WITH text-012 pr_vkorg.
      ENDIF.
    ENDFORM.                    " F009_validate_vkorg
    *&      Form  f007_validate_vtweg
          text
    FORM f007_validate_vtweg .
      CLEAR:w_vtweg.
      SELECT SINGLE vtweg
           INTO w_vtweg FROM tvtw
           WHERE vtweg EQ pr_vtweg.
      IF sy-subrc <> 0.
        MESSAGE e089(zmsd).
      ENDIF.
    ENDFORM.                    " f007_validate_vtweg
    *&      Form  f008_validate_spart
          text
    FORM f008_validate_spart .
      CLEAR:w_spart.
      SELECT SINGLE spart
            INTO w_spart FROM tspa
            WHERE spart EQ pr_spart.
      IF sy-subrc <> 0.
        MESSAGE e087(zmsd).
      ENDIF.
    ENDFORM.                    " f008_validate_spart
    *&      Form  F010_validate_kunnr
          text
    FORM f009_validate_kunnr .
      DATA: l_kunnr TYPE kunnr.
      CLEAR: w_vkorg, w_vtweg,w_spart.
      SELECT  SINGLE  kunnr FROM  knvv
             INTO l_kunnr
             WHERE  kunnr  = pr_kunnr
             AND    vkorg  = pr_vkorg
             AND    vtweg  = pr_vtweg
             AND    spart  = pr_spart.
      IF sy-subrc <> 0.
       MESSAGE e000(zmsd) WITH text-010 pr_kunnr text-011 pr_vkorg  .
      ENDIF.
    ENDFORM.                    " F010_validate_kunnr
    *&      Form  f010_validate_werks
          text
    FORM f010_validate_werks .
      CLEAR:w_werks.
      SELECT SINGLE werks
            INTO w_werks FROM t001w
            WHERE werks EQ pr_werks.
      IF sy-subrc <> 0.
        MESSAGE e088(zmsd).
      ENDIF.
    ENDFORM.                    " f010_validate_werks
    *&      Form  F011_validate_lgort
          text
    FORM f011_validate_lgort .
      CLEAR:w_werks .
      SELECT   SINGLE werks  FROM  t001l
             INTO w_werks
             WHERE  werks  = pr_werks
             AND    lgort  = pr_lgort.
      IF sy-subrc <> 0.
        MESSAGE e000(zmsd) WITH text-007 pr_lgort text-008 pr_werks .
      ENDIF.
    ENDFORM.                    " F011_validate_lgort
    *&      Form  f003_get_data
          text
    FORM f003_get_data .
      CLEAR wa_main.
      REFRESH it_main.
      LOOP AT it_upload INTO wa_upload.
        CLEAR : wa_main.
        MOVE: wa_upload-matnr     TO  wa_main-bismt,
              wa_upload-quantity  TO  wa_main-kwmeng,
              wa_upload-value     TO  wa_main-kwert,
              pr_vkorg            TO  wa_main-vkorg,
              pr_vtweg            TO  wa_main-vtweg,
              pr_spart            TO  wa_main-spart,
              pr_kunnr            TO  wa_main-kunnr,
              pr_werks            TO  wa_main-werks,
              pr_lgort            TO  wa_main-lgort.
        APPEND wa_main TO it_main.
      ENDLOOP.
    ENDFORM.                    " f003_get_data
    *&      Form  f004_process
          text
    FORM f004_process .
    CLEAR w_check.
    LOOP AT it_main INTO wa_main.
       IF wa_main-matnr = ''.
         WRITE:/ text-006,
                     wa_main-bismt.
         w_check = 1.
       ENDIF.
       IF wa_main-kwmeng = 0.
         WRITE:/ text-005,
                 wa_main-bismt.
         w_check = 1.
       ENDIF.
       IF    pr_auart <> 'ZM01'.
         IF wa_main-kwert IS INITIAL.
           WRITE:/ text-004,
                    wa_main-bismt.
           w_check = 1.
         ENDIF.
       ENDIF.
    ENDLOOP.
    ENDFORM.                    " f004_process
    *&      Form  f005_posting
          text
    FORM f005_posting .
      CLEAR: w_itemno,
             w_cond.
      w_itemno = 10.
      w_cond = 1.
    IF w_check = '' OR w_check = 1.
      wa_bapisdhd1-doc_type = pr_auart.
      wa_bapisdhd1-ord_reason = pr_augru.
      LOOP AT it_main INTO wa_main.
        IF w_cond = 1.
          CLEAR: it_bapiret2,
                 it_bapisditm,
                 it_bapiparnr,
                 it_bapischdl,
                 it_bapicond.
          REFRESH:it_bapiret2,
                  it_bapisditm,
                  it_bapiparnr,
                  it_bapischdl,
                  it_bapicond.
          MOVE: wa_main-vkorg TO wa_bapisdhd1-sales_org,
                wa_main-vtweg TO wa_bapisdhd1-distr_chan,
                wa_main-spart TO wa_bapisdhd1-division.
          wa_bapisdhd1-wbs_eleM = 'Y561.1'.
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
            EXPORTING
              INPUT         = pr_kunnr
           IMPORTING
             OUTPUT        = pr_kunnr.
          wa_bapisdhd1-PURCH_NO_S = pr_kunnr.
          wa_bapisdhd1-PURCH_NO_C = pr_kunnr.
        ENDIF.
        MOVE: w_itemno TO wa_bapisditm-itm_number,
               wa_main-matnr TO wa_bapisditm-material,
              wa_main-BISMT TO wa_bapisditm-material,
              wa_main-werks TO wa_bapisditm-plant,
              wa_main-lgort TO wa_bapisditm-store_loc.
                           wa_bapisditm-target_qty = '10'.
        wa_bapisditm-PURCH_NO_S = pr_kunnr.
        wa_bapisditm-PURCH_NO_C = pr_kunnr.
        APPEND wa_bapisditm TO it_bapisditm.
        IF w_cond = 1.
          wa_bapiparnr-partn_numb = pr_kunnr.
          wa_bapiparnr-itm_number = 10.
            wa_bapiparnr-partn_role = 'SP'.
          APPEND wa_bapiparnr TO it_bapiparnr.
          wa_bapiparnr-partn_role = 'AG'.
          APPEND wa_bapiparnr TO it_bapiparnr.
          CLEAR wa_bapiparnr-partn_role.
                   wa_bapiparnr-partn_numb = pr_kunnr.
          wa_bapiparnr-partn_role = 'RE'.
          APPEND wa_bapiparnr TO it_bapiparnr.
          CLEAR wa_bapiparnr-partn_role.
                   wa_bapiparnr-partn_numb = pr_kunnr.
          wa_bapiparnr-partn_role = 'RG'.
          APPEND wa_bapiparnr TO it_bapiparnr.
          CLEAR wa_bapiparnr-partn_role.
                   wa_bapiparnr-partn_numb = pr_kunnr.
          wa_bapiparnr-partn_role = 'WE'.
          APPEND wa_bapiparnr TO it_bapiparnr.
        ENDIF.
        wa_bapischdl-itm_number = w_itemno.
        wa_bapischdl-req_qty    = wa_main-kwmeng.
         wa_bapischdl-PURCH_NO_S = pr_kunnr.
        APPEND wa_bapischdl TO it_bapischdl.
        wa_bapicond-itm_number = w_itemno.
        wa_bapicond-cond_type  = 'ZECL'.
         IF    ( wa_bapisdhd1-doc_type = 'ZPMU' ) OR ( wa_bapisdhd1-doc_type = 'ZPMM' ).
           wa_bapicond-cond_type  = 'ZVAL'.
         ELSE.
           wa_bapicond-cond_type  = 'ZMRP'.       "+PK12122006
         ENDIF.
        wa_bapicond-cond_value = wa_main-kwert.
        APPEND wa_bapicond TO it_bapicond.
        w_itemno = w_itemno + 10.
        w_cond   = w_cond + 1.
      ENDLOOP.
      data : SALESDOCUMENTIN like BAPIVBELN-VBELN.
      CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
        EXPORTING
          order_header_in     = wa_bapisdhd1
        IMPORTING
          salesdocument       = SALESDOCUMENTIN
        TABLES
          return              = it_bapiret2
          order_items_in      = it_bapisditm
          order_partners      = it_bapiparnr
          order_schedules_in  = it_bapischdl
          order_conditions_in = it_bapicond.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = c_ch.
    ENDIF.
      LOOP AT it_bapiret2 INTO wa_bapiret2.
        DATA : w_err(100) TYPE c,
        w_matnr TYPE matnr.
        IF wa_bapiret2-type = 'E' AND wa_bapiret2-id = 'V1' AND wa_bapiret2-number = 392.
          UNPACK wa_bapiret2-message_v1 TO w_matnr.
          READ TABLE it_matnr INTO wa_matnr WITH KEY matnr = w_matnr.
          IF sy-subrc EQ 0.
            CONCATENATE text-013 wa_matnr-bismt INTO w_err SEPARATED BY space.
            MESSAGE w_err TYPE 'S'.
          ENDIF.
        ENDIF.
        IF WA_BAPIRET2-TYPE = 'S'.  " Comment
          WRITE: 40 TEXT-009, WA_BAPIRET2-MESSAGE_V2+0(10).
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " f005_posting
    I have given all the necessary parameters. it is telling that error is in parameter
    sales_header_in.
    I have checked it.
    i have assigned purch_no_s and purch_no_c of the structure BAPISDHD1(ORDER_HEADER_IN)
    in the bapi with customer number.
    and also i have assigned the partnumber of the structure BAPIPARNR ORDER_PARTNERS
    in the bapi with customer number.
    but still , it is diplaying the error message, please enter the sold to or ship to party number.
    how to resolve this error.
    this is urgent requirement.
    points will be awarded.
    thanking u in advance,
    a.srinivas.

    Hi,
    Did u have a look at the standard programs which make use of BAPI_SALESORDER_CREATEFROMDAT1
    Heres a list...
    LWSSOU08                     
    MV45WF0S                     
    MWWMJF21_BAPI_SALESORDER_CREAT
    RBUS2032                    
    Regards,
    Tanveer.
    <b>Please mark helpful answers</b>

  • Creation of Sales Order using condition records

    Dear Experts,
    I am creating a sales order using a Function Module : ISM_SALESORDER_CREATEFROMDAT2
    In this function module I want to pass the conditon records with which the sales orders needs to be created.
    My code is as follows:
    LOOP AT it_knumh INTO wa_knumh.
            lwa_bapicondsb-itm_number = wa_knumh-kposn.
            lwa_bapicondsb-cond_type  = wa_knumh-kschl.
            lwa_bapicondsb-applicatio = wa_knumh-kappl.
            lwa_bapicondsb-conpricdat = price_date.
            lwa_bapicondsb-cond_no    = wa_knumh-knumh.
            APPEND lwa_bapicondsb TO  lit_bapicondsb.
          ENDLOOP.
          CALL FUNCTION 'ISM_SALESORDER_CREATEFROMDAT2'
            EXPORTING
              order_header_in     = lw_bapiheaderb
            IMPORTING
              salesdocument       = lw_docnob
            TABLES
              return              = lit_returnb
              order_items_in      = lit_bapiitemsb
              order_partners      = lit_bapiparnrb
              order_schedules_in  = lit_bapischdl
              order_conditions_in = lit_bapicondsb.
    I am getting an error as follows:
    V4     233     SALES_HEADER_IN has been processed successfully
    V4     233     SALES_ITEM_IN has been processed successfully
    V4     233     SALES_CONDITIONS_IN has been processed successfully
    V1     213     Condition ZMDD is not allowed as header condition
    V4     219     Sales document  was not changed
    where ZMDD -  is Discount in Paisa.
    please suggest......
    Regards,
    Abhijit

    Dear Abhijeet,
    I am afraid that you have put the message in wrong forum.
    Kindly put the message in SD / ABAP forum.
    Regards,
    Rajesh

  • Creation of sales order from idoc; items referencing to different contracts

    Hi All,
    My requirement is to create sales order from an idoc.
    IF a sale order contains multiple items , then the order should be created with contract referenced
    -at the So item level, the valid contract found for each material is different
    hence am not able to use the following bapis
    BAPI_SALESORDER_CREATEFROMDAT2  is not triggering the copy controls.
    BAPI_SALESDOCUMENT_COPY  i can give only one reference document
    Please help
    Thanks
    Deepa

    Hi Deepa,
    Following link can help you for creating sales order with reference
    http://msdn.microsoft.com/en-us/library/cc185190.aspx
    http://www.sap-img.com/fu036.htm
    Award points if useful
    Thanks,
    Ravee..

  • Creation of sales order Using BAPI

    Dear Friends,
    I need a complete program for Sales order creation using BAPI with all mandatory fields.
    I got some sample programs from our friends (SDN) but its not working perfectly.
    ( Complete working copy of Sales order creation using BAPI. )
    Please help me, Expecting your quick reply.
    Thanks in Advance.
    Shankar

    Hi,
    Did u have a look at the standard programs which make use of BAPI_SALESORDER_CREATEFROMDAT1
    Heres a list...
    LWSSOU08                     
    MV45WF0S                     
    MWWMJF21_BAPI_SALESORDER_CREAT
    RBUS2032                    
    Regards,
    Tanveer.
    <b>Please mark helpful answers</b>

  • 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 Sales Order using IDoc

    Hi All,
    Based upon customer's input file which contains header and line item details I have to create sales order in our system. We would like to use IDoc for this. Customer will send us file once a day by email or FTP.
    For this I have created a port and partner profile but I am not sure how the process will get initiated?
    Can someone please let me know how can I do this? There is now outbound process involved, I just need to create sales order based upon input file using IDoc.
    Regards,
    Sanjay

    HI,
    You cannot directly call the function modules that process the idoc, because these functions are called dynamically by the ALE layer and the function expects data in a certian format (IDoc format ).
    BAPI would be the best way to go for your scenario.
    However there is a workaround if you want to use IDoc only. You can follow this approach :
    1. Populate an outbound ORDERS05 IDoc from the file data.
    2. Distribute it to the same system, i.e sender system and receiver system is same.
    3. On the Inbound side the Idoc that you created on the outbound side will be received and processed.
    "R3  File----->Outound ORDRES05  -----
    ______________________________________|
    |
    '------> " Inbound ORDERS05 ( in the same R3 system)
    The tricky part is sending an Idoc and receiving in the same system, but you can find how to do this on the wiki pages.
    regards,
    Advait

Maybe you are looking for