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.

Similar Messages

  • Need logic for calculate the balance quantity in open sales order

    hi all
    i need logic to calcuclate the balance quantity in open sales order ,
    where i am using VBAK header and VBAP item , and VBFA for document flow tables
    i need to have the balance quantity , for the open sales order
    especially taking with respect to  VBFA-VBTYP_N = M for invoice creation and N for canellation
    any one please help me

    thank you but i am clear abt it
    will you please anyother way to calucaluate the logic ,
    and i need to populate in bukets also for the terms of 5 years
    Edited by: sridhar loganathan on Nov 25, 2008 6:43 AM

  • Transfer of Intercompany sales orders using LSMW

    Hi
    I have to Transfer the open intercompany sales orders using LSMW. Consider a scenario where customer places an order on sales org A with plant A. sales org A raises purchase order on Sales org B with plant B. The material moves from Plant B ie supplying plant to delivering plant A. THen it is delivered to custome from plant A. Can u please tell me whether i have to pass the suppying plant or it will be determined automatically. Similarly what about the purchase requisition no. Is it created automatically.
    Thanks
    regards
    Tushar

    Hi,
    The purchase requisition is going to automatically created incase of a intercompany order  (ie nothing but the third party order).  In this case of orders the line item category in the sales order would be TAS. The intercompany sales order nothing different from a normal order during the creation of the order, after that the operations will be different from the normal standard order.  You can use the same LSMW which you have used for transfering normal standard orders.
    The configs are going to be different in the system for intercompany sales orders compared to the standard sales orders. That is the problem of the functional consultant to take care.
    Thanks,
    Mahesh.

  • Where does the Remaining quantity of a Sales Order line item reside in CRM

    Hi Experts,
    When a Sales Order from CRM flows to ECC and is partially delivered, it can be observed in the CRM system that the remaining quantity of the line item gets updated.
    In which table does this remaining quantity value reside in CRM ?
    Any pointers/suggestions would be of great help. Points Assured.
    Thanks in Advance,
    Kris

    The remaining quantity info is nowhere available.
    But the delivered quantity info is available in the table CRMD_CUMULATED_I.
    Solved Myself.

  • Greying out of Material Quantity field in sales order

    Hi,
    At the time of sales order creation the system proposes the free quantity in the sub line item according to the Free goods determination records (VBN1). The requirement is to make the sub line item quantity field grey, so that the system determined free goods qty should not be changed at the time of order creation (VA01).
    Is there any standard settings available or need to use the user exits.
    Thanks in advance.
    Regards,
    Guru

    Dear Experts,
    Could you help me on this issue.
    Regards
    Guru

  • Update Delivery Text - As done for Sales order using RTEXT-SELKZ

    Dear all,
    We have to update the delivery header texts. But could not find the exact field name for the BDC .
    The similar field name for Sales order is RTEXT-SELKZ.
    Thanks in Advance,
    Regards,
    Vivek K

    Hello,
    if you need to update delivery header texts ,then you can get text data from input file .& then find out what's the text id where you have to insert text data.
    Text id,object,language,Text name ,these 3 fields can help you from delivery.
    Delivery-> display->header-> select particular text-> presss details icon->goto->header.This path will give text id ,object name details of the required text.
    Then use function save_text to load this data for each delivery .
    Hope this helps.
    Thanks.

  • System doesnt let me change the delivery quantity greater than sales order

    Hi,
    In delivery document , when I change delivery quantity greater than related sales order quantity , system just show the Message no. VL363 but let me change the quantity.
    Is it any way that system do not let me to change delivery quantity greater than its related sales order?
    thanks.
    Lida.

    Is it any way that system do not let me to change delivery
             quantity greater than its related sales order?
    Go to zeroVLP,  select the item category and maintain "B"  for the field  Check overdelivery

  • Default material quantity 1 in sales order

    hi experts
    client demand when we enter material in sales order system should pick quantity 1 (one) by default
    is it possible ?
    thanks in advance

    Hi
    This is possible thro development only
    By making the item category settings that is order qty is always = 1 i dont know whether the default value that is 1  will come in the sales order
    But it will restrict the order qty to ONE only
    If you make it to 2 system will show error  and i hope this is not your requirement
    If your requirement is, by default the order  qty should be 1 and that should be editable
    For this ABAP development is reqd
    If your requirement is the order qty, by default should be 1and that is limited to 1 maximum (not changable to 2 ) the item cat settings is sufficient
    But in this case also the 1 has to be manually input there
    Regards
    Raja

  • How to create the service lines in a sales order using Process_order API

    Hi ,
    I have to create the service lines in a Config to order using process Order API. When i am trying to create a sercvice line , it is comming as new line all together. but i need that one to happen in the configuration itself after the option item but not like standalone line.
    what are the manditory fields for service lines to create using Process_order API.
    Apprciate your help on this.
    Thanks
    Rags

    Moderator message - Please do some analysis before posting here - thread locked
    Rob

  • Sales order Using LSMW and BAPI BUS2032

    Hi Guys,
    I am trying to use LSMW for creating sales order through BAPI.
    Business Object      BUS2032
    Method               CREATEFROMDAT2          
    Message Type         SALESORDER_CREATEFROMDAT2
    Basic Type           SALESORDER_CREATEFROMDAT202
    I can do it using a BDC program.
    I want to know how the sales order flat file will look like (one header and multiple line item)if i am using LSMW with BAPI and how it is mapped for multiple line items.
    Thanks in Adv.
    Akhil

    See if you can get something out of this.
    One simple step by step example
    Complete the step one (you are using the correct BAPI )
    insetp 2(Maintain Source Structures) create source structures like with the header and details hierarchy                                                                               
    5  ZCFOF0021_HDR     Header                                              
               ZCFOF0021_PARTNER        Partner                                                                               
    ZCFOF0021_ITM            Item Detail                                                                               
    In Step 3(Maintain Source Fields) create the fields for all source structures like below example                                                                               
    5  ZCFOF0021_HDR   Header                        OLDNR         C(008)    Legacy JDE Sales Order Number                                                                               
    VKORG         C(004)    Sales Organization                                                                               
    VTWEG         C(002)    Distribution Channel                                                                               
    SPART         C(002)    Division                                                                               
    AUART         C(004)    Sales Document Type                                                                               
    VDATU         C(008)    Requested delivery date                                                                               
    BSTKD         C(020)    Customer purchase order number                                                                               
    BSARK         C(004)    Customer purchase order type                                                                               
    BSTDK         C(008)    Customer purchase order date                                                                               
    INCO1         C(003)    Incoterms (part 1)                                                                               
    INCO2         C(028)    Incoterms (part 2)                                                                               
    ZTERM         C(004)    Terms of payment key                                                                               
    LIFSK         C(002)    Delivery block (document header)                                                                               
    FAKSK         C(002)    Billing block in SD document                                                                               
    WAERK         C(005)    SD document currency                                                                               
    KURSK         C(009)    Exchange Rate for Pricing and Statistics                                                               
           AUTLF         C(001)    Complete delivery defined for each sales order                                                         
           VSBED         C(002)    Shipping conditions                                                                               
    ZOTC_PATNAME  C(035)    Patient Name                                                                               
    ZOTC_PATREFNO C(035)    Patient Reference Number                                                                               
    ZOTC_IMPDATE  C(008)     Implant Date                                                                               
    BNAME         C(030)    Branching name                                                                               
    TAXK1         C(001)    Alternative tax classification                                                                               
    5  ZCFOF0021_PARTNER         Partner                                                                               
    OLDNR        C(008)    Legacy JDE Sales Order Number                                                                               
    PARVW        C(002)    Partner function                                                                               
    KUNNR        C(010)    Sold To                                                                               
    NAME1        C(035)    Name 1                                                                               
    STRAS        C(035)    House number and street                                                                               
    STR_SUPPL1   C(040)    Street 2                                                                               
    LAND1        C(003)    Country Key                                                                               
    PSTLZ        C(010)    Postal Code                                                                               
    ORT01        C(035)    City                                                                               
    REGIO        C(003)    Region (State, Province, County)                                                                               
    AUART        C(004)     Sales Document Type                                                                               
    5  ZCFOF0021_ITM             Item Detail                                                                               
    OLDNR        C(008)    Legacy JDE Sales Order Number                                                                               
    MATNR        C(018)    Material Number                                                                               
    WERKS        C(004)    Plant                                                                               
    LGORT        C(004)    Storage Location                                                                               
    VRKME        C(003)    Sales unit                                                                               
    KSCHL2       C(004)    Condition type                                                                               
    KBETR2C      C(011)    Condition rate with decimal places and minus sign                                                    
              KWAER2       C(005)    Currency key                                                                               
    WMENGC       C(013)    Order qty in sales units - 00009001 corresponds to 9.001                                             
              CHARG        C(010)    Batch Number                                                                               
    In Step 4 (Maintain Structure Relations)  assign source structures to target strucutres like below                                                                               
    E1SALESORDER_CREATEFROMDAT2 Header Segment                                               <<<< ZCFOF0021_HDR     Header                                                                               
    E1BPSDHD1                   Communication Fields: Sales and Distribution Document Header <<<< ZCFOF0021_HDR     Header            
        E1BPSDHD1X                  Checkbox Fields for Sales and Distribution Document Header                                            
        E1BP_SENDER                 Logical System of Sender                                                                               
    E1BPSDLS                    SD Checkbox for the Logic Switch                                                                      
    5  E1BPSDITM                   Communication Fields: Sales and Distribution Document Item   <<<< ZCFOF0021_ITM     Item Detail                                                                               
    E1BPSDITM1                  Communication Fields: Sales and Distribution Document Item                                                                               
    E1BPSDITMX                  Communication Fields: Sales and Distribution Document Item                                            
        E1BPPARNR                   Communications Fields: SD Document Partner: WWW              <<<< ZCFOF0021_PARTNER Partner           
        E1BPSCHDL                   Communication Fields for Maintaining SD Doc. Schedule Lines  <<<< ZCFOF0021_ITM     Item Detail       
        E1BPSCHDLX                  Checkbox List for Maintaining SD Document Schedule Line                                               
        E1BPCOND                    Communication Fields for Maintaining Conditions in the Order <<<< ZCFOF0021_ITM     Item Detail       
        E1BPCONDX                   Communication Fields for Maintaining Conditions in the Order                                          
        E1BPCUCFG                   CU: Configuration Data                                                                               
    E1BPCUINS                   Instances of Several Configurations                                                                   
        E1BPCUPRT                   Part_of Entries of Several Configurations                                                             
        E1BPCUVAL                   Characteristic Values of Several Configurations                                                       
        E1BPCUBLB                   BLOB Internal Configuration Data (SCE)                                                                
        E1BPCUVK                    Variant Condition Keys in Configurations                                                              
        E1BPCUREF                   CU: Reference Order Item / Instance in Configuration                                                  
        E1BPCCARD                   Communication Table: Means of Payment Order/Billing Document                                          
        E1BPSDTEXT                  Communication Fields: SD Texts                                                                        
        E1BPSDKEY                   Key in Sales and Distribution Document                                                                
        E1BPPAREX                   Ref. Structure for BAPI Parameter EXTENSIONIN/EXTENSIONOUT   <<<< ZCFOF0021_ITM     Item Detail       
    5  E1BPADR1                    BAPI Reference Structure for Addresses (Org./Company)        <<<< ZCFOF0021_PARTNER Partner                                                                               
    E1BPADR11                   BAPI Reference Structure for Addresses (Org./Company)        <<<< ZCFOF0021_PARTNER Partner       
    In Step 5(Maintain Field Mapping and Conversion Rules) assign source fields to target fields
    Map each filed to the target fields.

  • Error reading material cost estimate for sales order (KE292)

    Dear All,
    I have an issue with billing. we are posting july month transactions, the material cost is maintained through MR21. When releasing billing document for accounting we are getting error message like"Error reading the material cost estimate for sales order "11"
    Message no. KE292
    Diagnosis
    In Profitability Analysis (CO-PA), the system tried to valuate item 000010 of sales order 11 by reading the corresponding product cost estimate.
    However, no product cost estimate could be found for this sales order item.
    The system accessed product costing for product AMLFP011011XX00P using costing key YB3 as defined in the
    CO-PA Customizing settings.
    System Response
    The system cannot process the document any further.
    Procedure
    Check your Customizing settings."
    We cross checked with other client as a current date and we ran cost estimate through CK40N with same material. and we posted entries. Here it is working fine. but in above process it is not working. Can you pls guide me where i missed.
    Regards,
    Nagaraju,

    Hi,
    When the Costing Key is assigned to the material types in the COPA customizing, then system expects Cost estimation when billing is released to Accounts.
    If you dont run cost estimation but update the material master through MR21, system will not accept as in the Costing key configuration you must have selected the Current Standard price field for the valuation.
    Hence, try to run cost estimation and then do releasing.
    Thanks & Regards
    Ravi Kumar

  • Regarding Picking quantity over than Sales Order quantity

    Hi,
    When I am doing Picking from Warehouse the picking quantity is over Sales Order quantity. I don't want to allow it. To restrict it what are the settings I have to do.
    Please give me solution asap.
    Regards,
    Bhaskar.K

    Hi,
    You can customize this in the delivery item category by configuring the system reaction with the option "Check Over Delivery".
    Reward if convinced.
    Rgds

  • 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

  • Quantity update into sales order using BAPI_SALESORDER_CREATEFROMDAT2

    Hi All,
    I am able to create a sales order using the BAPI "BAPI_SALESORDER_CREATEFROMDAT2".
    But even after assinging the Target_quntity and the Target_quantity_units, the values are not getting updated into the Sales order, but the sales order gets created .
    Did anyone of you had a similare problem, how was it solved.
    cold some one please help me out on this.
    Regards

    Hi
    I had used below code (using <b>BAPI_SALESORDER_CREATEFROMDAT1</b>)..but never faced any problem.. you can try the same...
    Regards,
    Raj
    REPORT  z_sd_salesorder_create
            NO STANDARD PAGE HEADING
            LINE-SIZE 150
            MESSAGE-ID zz.
                  S T R U C T U R E  D E C L A R A T I O N S             *
    TYPES: BEGIN OF x_ppl,
            ppl_order(18),   " ppl Orderno
            auart(4),         " Sales Doc Type
            vkorg(4),         " Sales Organization
            vtweg(2),         " Distribution Channel
            spart(2),         " Division
            div(3),           " Division
            kunnr(10),        " Sold-to Party
            date(10),         " Doc Dt
            matnr(18),        " Item Matnr#
            uom(3),           " UOM
            qty(15),          " Qty
           kschl(4),         " Pricing condiiton type
           kbetr(11),        " Rate
           END OF x_ppl.
    TYPES: BEGIN OF x_file,
            loc(30),          " Location
            div(3),           " Division
            ppl_order(18),   " ppl Orderno
            kunnr(10),        " Sold-to Party
            date(10),         " Doc Dt
            matnr(20),        " Item Matnr#
            qty(15),          " Qty
            uom(3),           " UOM
           kbetr(11),        " Rate
           discount(5),      " Discount
           END OF x_file.
    TYPES: BEGIN OF x_output,
            ppl_order(18),       " ppl Orderno
            mesg(130),            " Mesg Success/Error
           END OF x_output.
    TYPES: BEGIN OF x_werks,
            name2(30),                " Location
            werks TYPE werks_ext,     " Plant
           END OF x_werks.
    TYPES: BEGIN OF x_info,
            vkorg TYPE vkorg ,   " Sales org
            vtweg TYPE vtweg,    " Dist channel
            werks TYPE werks_ext," Plant
            spart TYPE spart,    " Storage Loc
           END OF x_info.
    TYPES: BEGIN OF x_material,
            ppl_prdid(20),      " ppl Prd id
            matnr TYPE matnr,    " Material (SAP)
           END OF x_material.
           I N T E R N A L    T A B L E    D E C L A R A T I O N S       *
    DATA: it_file  TYPE STANDARD TABLE OF x_file  WITH HEADER LINE." File Data
    DATA: it_data  TYPE STANDARD TABLE OF x_ppl  WITH HEADER LINE." ppl File
    DATA: it_out TYPE STANDARD TABLE OF x_output WITH HEADER LINE. " Outcome
    DATA: it_werks TYPE STANDARD TABLE OF x_werks WITH HEADER LINE.    " Plant
    DATA: it_info TYPE STANDARD TABLE OF x_info WITH HEADER LINE.      " Othr Info
    DATA: it_matnr TYPE STANDARD TABLE OF x_material WITH HEADER LINE. " Material Info
    DATA: it_item TYPE STANDARD TABLE OF bapiitemin WITH HEADER LINE.  "Order Itm data
    DATA: it_partner TYPE STANDARD TABLE OF bapipartnr WITH HEADER LINE. "Order Partner data
               V A R I A B L E S      D E C L A R A T I O N S            *
    DATA  : v_correct  TYPE i,
            v_error    TYPE i,
            v_total    TYPE i,
            v_return   LIKE bapireturn1,
            v_index    LIKE sy-tabix.
    *- Return values
    DATA: it_orderh TYPE bapisdhead, "Order Hdr data
          order TYPE bapivbeln-vbeln,
          soldto TYPE bapisoldto,
          shipto TYPE bapishipto,
          return TYPE bapireturn1.
    DATA: hdate   TYPE sy-datum.
                    U S E R   I N P U T S   S C R E E N                  *
    SELECTION-SCREEN: BEGIN OF BLOCK blk01 WITH FRAME TITLE text-t01.
    PARAMETERS: p_file TYPE rlgrap-filename OBLIGATORY. " File name
    SELECTION-SCREEN END OF BLOCK blk01.
                      S E L E C T I O N    S C R E E N                   *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      PERFORM get_file.
                    S t a r t    o f    S e l e c t i o n                *
    START-OF-SELECTION.
      PERFORM get_upload.
      PERFORM validate_data.        " Validate the data
      PERFORM data_swap.            " Prepare the data for processing
      IF NOT it_data[] IS INITIAL.
        PERFORM get_update.           " Create SalesOrders
      ELSE.
        MESSAGE i001(zz) WITH text-001.
        STOP.
      ENDIF.
                    E n d    o f    S e l e c t i o n                    *
    END-OF-SELECTION.
      IF NOT it_data[] IS INITIAL.
        PERFORM get_write.
      ENDIF.
    *&      Form  get_file
          Get File name
    FORM get_file .
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          program_name  = syst-repid
          mask          = '*'
        CHANGING
          file_name     = p_file
        EXCEPTIONS
          mask_too_long = 1
          OTHERS        = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " get_file
    *&      Form  get_upload
          to upload the file
    FORM get_upload .
      DATA l_file TYPE string.
      CLEAR: it_file, it_file[].
      l_file = p_file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = l_file
          filetype                = 'ASC'
          has_field_separator     = 'X'
        TABLES
          data_tab                = it_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.
      ELSEIF sy-subrc = 0.
        SORT it_file BY loc ppl_order.
      ENDIF.
    ENDFORM.                    " get_upload
    *&      Form  get_update
          Creating mapping Data in Z table
    FORM get_update .
      DATA: l_itemno(2) TYPE n,
            l_partner TYPE parvw,
            l_kunnr TYPE kunnr,
            l_matnr TYPE matnr,
            l_mesg TYPE string,
            l_kbetr TYPE p DECIMALS 2.
      DATA: l_in_qty LIKE vbap-zmeng,
            l_meins LIKE mara-meins,
            l_qty   LIKE vbap-zmeng.
      CLEAR: v_correct, v_error, v_total.
      SORT it_data BY ppl_order.
      LOOP AT it_data.
        CLEAR v_index.
        v_index = sy-tabix.
    *- New SalesOrder
        AT NEW ppl_order.
          READ TABLE it_data INDEX v_index.
          CLEAR: it_orderh, it_item, it_partner,
                 order, soldto, shipto, return,
                 it_item[], it_partner[].
          v_total = v_total + 1.  "Increment Total SalesOrders counter
          CLEAR l_itemno.
          l_itemno = '10'.
    *- Covert date fields into Internal format
          CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'
            EXPORTING
              datum = it_data-date
              dtype = 'DATS'
            IMPORTING
              idate = it_data-date.
    *- Populate SalesOrder header data.
          CALL FUNCTION 'CONVERSION_EXIT_AUART_INPUT'
            EXPORTING
              input  = it_data-auart
            IMPORTING
              output = it_data-auart.
          it_orderh-doc_type   = it_data-auart.
          it_orderh-sales_org  = it_data-vkorg.
          it_orderh-distr_chan = it_data-vtweg.
          it_orderh-division   = it_data-spart.
          it_orderh-purch_no   = 'DEPOT'.
          it_orderh-price_date = it_data-date.      "Doc Dt
          it_orderh-req_date_h = it_data-date.      "Del.Dt
          it_orderh-purch_no_s = it_data-ppl_order.
    *- Partner data
          CLEAR: l_partner, l_kunnr.
    *- Convert Partner type into internal format
          l_partner = 'SP'.  "SoldTo Party
          CALL FUNCTION 'CONVERSION_EXIT_PARVW_INPUT'
            EXPORTING
              input  = l_partner
            IMPORTING
              output = l_partner.
    *- Convert Customer into internal format
          l_kunnr = it_data-kunnr.
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = l_kunnr
            IMPORTING
              output = l_kunnr.
          it_partner-partn_role = l_partner.
          it_partner-partn_numb = l_kunnr.
          APPEND it_partner.
          CLEAR it_partner.
        ENDAT.
    *- Item data
        it_item-itm_number = l_itemno.
    *- Convert material number into internal format
        CLEAR l_matnr.
        l_matnr = it_data-matnr.
        CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
          EXPORTING
            input        = l_matnr
          IMPORTING
            output       = l_matnr
          EXCEPTIONS
            length_error = 1
            OTHERS       = 2.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        it_item-material  = l_matnr.
    *- Call FM to get new qty based on SAP UOM
        CLEAR: l_meins, l_qty, l_in_qty.
        l_in_qty = it_data-qty.
        CALL FUNCTION 'Z_GET_QTY_FROM_UOM'
          EXPORTING
            matnr     = it_item-material
            in_meins  = it_data-uom
            in_qty    = l_in_qty
          IMPORTING
            out_meins = l_meins
            quantity  = l_qty.
        IF sy-subrc = 0.
          it_data-qty = l_qty.
          it_data-uom = l_meins.
        ENDIF.
        it_data-qty = it_data-qty * 1000.
        it_item-req_qty = it_data-qty.
        it_item-sales_unit = it_data-uom.
        it_item-req_date   = it_data-date.
    *- Pricing data
       it_item-cond_type = it_data-kschl.  "Pricing condition
       CLEAR l_kbetr.
       l_kbetr = it_data-kbetr / 10. "Price (Rate)
       it_item-cond_value = l_kbetr.
        APPEND it_item.
        CLEAR  it_item.
    *- Increment Item counter.
        l_itemno = l_itemno + 10.
    *- At end of SalesOrder
        AT END OF ppl_order.
          READ TABLE it_data INDEX v_index.
    *- Call the BAPI for SalesOrder creation
          CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
            EXPORTING
              order_header_in = it_orderh
            IMPORTING
              salesdocument   = order
              sold_to_party   = soldto
              ship_to_party   = shipto
              return          = return
            TABLES
              order_items_in  = it_item
              order_partners  = it_partner.
          IF sy-subrc = 0.
            COMMIT WORK.
          ENDIF.
          v_return = return+0(1).
          IF v_return = 'E'.
            v_error = v_error + 1.
            CLEAR l_mesg.
            l_mesg = return.
            CONDENSE l_mesg.
          ELSE.
            v_correct = v_correct + 1.
            CLEAR l_mesg.
            CONCATENATE 'Salesorder'(007) order 'successfully created.'(008)
            INTO l_mesg SEPARATED BY space.
            CONDENSE l_mesg.
          ENDIF.
    *- Populate the output table
          CLEAR it_out.
          it_out-ppl_order = it_data-ppl_order.
          it_out-mesg = l_mesg.
          APPEND it_out.
          CLEAR it_out.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " get_update
    *&      Form  get_write
          Write the results
    FORM get_write .
      WRITE:/ 'Total Number of Records :'(002), v_total COLOR 1.
      WRITE:/ 'Total Correct Records   :'(003), v_correct COLOR 3.
      WRITE:/ 'Total Error Records     :'(004), v_error COLOR 6.
      SKIP 3.
      IF NOT it_out[] IS INITIAL.
        WRITE:/5 'ppl Order #'(005),
              28 'Message'(006).
      ENDIF.
      SKIP 1.
      LOOP AT it_out.
        WRITE:/5  it_out-ppl_order,
               28 it_out-mesg.
      ENDLOOP.
    ENDFORM.                    " get_write
    *&      Form  validate_data
          Validate the data
    FORM validate_data .
      DATA: l_bstkde TYPE bstkd_e.
      LOOP AT it_file.
        SELECT bstkd_e INTO l_bstkde
         UP TO 1 ROWS
         FROM vbkd
         WHERE bstkd_e = it_file-ppl_order.
        ENDSELECT.
        IF sy-subrc = 0.  " This ppl Order is already been created in SAP, so delete record
          DELETE it_file.
        ENDIF.
      ENDLOOP.
      SORT it_file BY ppl_order.
    ENDFORM.                    " validate_data
    *&      Form  data_swap
          Prepare the data for processing
    FORM data_swap .
      CLEAR: it_werks, it_info, it_matnr, it_data,
             it_werks[], it_info[], it_matnr[], it_data[].
      IF NOT it_file[] IS INITIAL.
    *- Get the plant from location
        SELECT name2
               werks
          INTO CORRESPONDING FIELDS OF TABLE it_werks
        FROM t001w FOR ALL ENTRIES IN it_file
        WHERE name2 = it_file-loc.
        IF sy-subrc = 0.
          SORT it_werks BY name2 werks.
    *- Get the Sales Org, Division and Distribution Channel
          IF NOT it_werks[] IS INITIAL.
            SELECT vkorg
                   vtweg
                   werks
            INTO CORRESPONDING FIELDS OF TABLE it_info
            FROM tvkwz FOR ALL ENTRIES IN it_werks
            WHERE werks = it_werks-werks.
            IF sy-subrc =  0.
              LOOP AT it_info.
                it_info-spart = '99'.
                MODIFY it_info INDEX sy-tabix.
              ENDLOOP.
              SORT it_info BY vkorg vtweg werks.
            ENDIF.
          ENDIF.
        ENDIF.
    *- Get material from ppl material
        SELECT ppl_prdid
               matnr
          FROM zppl_master
          INTO TABLE it_matnr FOR ALL ENTRIES IN it_file
          WHERE ppl_prdid = it_file-matnr.
        IF sy-subrc = 0.
          SORT it_matnr BY ppl_prdid matnr.
        ENDIF.
      ENDIF.
    *- Update the data in it_data
      LOOP AT it_file.
        CLEAR it_data.
       it_data-auart = 'OR'.
        it_data-auart = 'OR'.  " CHANGED BY Jo ON 3103005
        READ TABLE it_werks WITH KEY name2 = it_file-loc BINARY SEARCH.
        IF sy-subrc = 0.
          READ TABLE it_info WITH KEY werks = it_werks-werks BINARY SEARCH.
          IF sy-subrc = 0.
            it_data-vkorg = it_info-vkorg.
            it_data-vtweg = it_info-vtweg.
          ENDIF.
        ENDIF.
    *- Material
        READ TABLE it_matnr WITH KEY ppl_prdid = it_file-matnr BINARY SEARCH.
        IF sy-subrc = 0.
          it_data-matnr = it_matnr-matnr.
        ENDIF.
        it_data-ppl_order = it_file-ppl_order.
        it_data-date  = it_file-date.
        CONCATENATE it_file-kunnr it_file-loc+1(2) INTO it_data-kunnr.
        it_data-qty   = it_file-qty.
        it_data-uom   = it_file-uom.
       it_data-kbetr = it_file-kbetr.
    *- Pricing condition
       it_data-kschl = 'PR00'.
        CASE it_file-div.
          WHEN 'BRN'.
            it_data-div = '04'.
          WHEN 'GEN'.
            it_data-div = '03'.
          WHEN 'IVF'.
            it_data-div = '02'.
          WHEN 'OPH'.
            it_data-div = '01'.
        ENDCASE.
        it_data-spart = it_data-div.
        APPEND it_data.
        CLEAR  it_data.
      ENDLOOP.
    ENDFORM.                    " data_swap

  • 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>

Maybe you are looking for

  • HELP!!! - Internet up, but EasyLink Advisor can not find network

    All, This is my first experience using a wireless router and although I sent everything up according to directions and the network has worked for at least 3 weeks now (both my computer and PS3 seem to work without issue), all of a sudden when I click

  • Generating a manifest CLASSPATH using Ant

    I'm using Ant 1.5.4 to build my applications. When I create a JAR file to deploy I ask Ant to add a main class and CLASSPATH to the manifest, like this: <target name="deploy" depends="report" description="deploy the application">     <buildnumber />

  • Paneltabbed with showdetailitem(s) ignores disclosed property

    JDev Rev: 4831 I have a jspx with a paneltabbed & 2 showdetialitem(s). I have set disclosed="true" on the first item and disclosed="false" on the second. 1. Goto the jspx and the first item is disclosed 2. Select the second item and it's then disclos

  • Screensaver

    Well I have discussed this in SL after I upgrade to 10.6.8. I thought an upgrade to Lion will help fix this issue. But problem persist. Can anyone know how to fix this problem apart from deleting the systemPreferences.plist? My previous discussion wi

  • Trouble Installing Visual Studios 2013 Community on Windows Standard 7 Embedded.

    Hi there, I'm not sure if this is solvable or not, but I cannot seem to get MS Windows Standard 7 Embedded to run Visual Studios 2013.  I have been able to make it work fine on Win7 HP, and on Win 8.1, but it seems to not be compatible with the Win S