BAPI_SALESORDER_CREATEFROMDAT2 - not working for multiple  BOM

Hi -
I am using BAPI_SALESORDER_CREATEFROMDAT2 function module to create sales order with multiple material. If more than one BOM materials are passed to the FM,this FM is giving error and not creating sales order. I have to pass multiple BOM to the FM and it should create sales order and expand the BOM to its components also.
Can anybody help on this.
An example will be good.
thanks
pls help
Edited by: sanchari g on May 13, 2009 11:05 AM

Hi Sanchari,
Try the following logic:
LOOP AT it_salesheader INTO wa_salesheader.
    CLEAR wa_order_header_in.
    CLEAR wa_order_header_inx.
    CLEAR wa_order_partners.
    CLEAR wa_bapicond.
    CLEAR wa_bapicondx.
    REFRESH it_order_items_in.
    REFRESH it_order_items_inx.
    REFRESH it_order_partners.
    REFRESH it_order_schedules_in.
    REFRESH it_order_schedules_inx.
    REFRESH it_bapicond.
    REFRESH it_bapicondx.
    wa_order_header_in-doc_type   = wa_salesheader-auart.
    wa_order_header_in-sales_org  = wa_salesheader-vkorg.
    wa_order_header_in-distr_chan = wa_salesheader-vtweg.
    wa_order_header_in-division   = '00'.
    wa_order_header_in-purch_no_c = wa_salesheader-bstnk.
    wa_order_header_in-purch_date = wa_salesheader-bstdk.
    wa_order_header_in-ref_1      = wa_salesheader-vbeln.
    wa_order_header_in-price_date = wa_salesheader-prsdt.
    LOOP AT it_salesitem INTO wa_salesitem WHERE vbeln = wa_salesheader-vbeln.
      wa_order_items_in-itm_number  = posnr_temp.
      wa_order_items_in-material    = wa_salesitem-matnr.
      wa_order_items_in-plant       = wa_salesitem-werks.
      wa_order_items_in-target_qty  = wa_salesitem-kwmeng.
      wa_order_items_in-ref_doc     = wa_salesitem-vbeln.
      wa_order_items_in-ref_doc_it  = wa_salesitem-posnr.
      wa_order_items_in-ref_1_s     = wa_salesitem-vbeln1.
      wa_order_items_in-poitm_no_s  = wa_salesitem-posnn.
      APPEND wa_order_items_in TO it_order_items_in.
   ENDLOOP.     "loop for line item which contains all BOMs.
   CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
      EXPORTING
        order_header_in               = wa_order_header_in
        order_header_inx              = wa_order_header_inx
       testrun                       = testrun
     IMPORTING
       salesdocument                  = v_salesdocument
      TABLES
       return                        = it_return
       order_items_in                = it_order_items_in
       order_items_inx               = it_order_items_inx
        order_partners               = it_order_partners
       order_schedules_in            = it_order_schedules_in
       order_schedules_inx           = it_order_schedules_inx
       order_conditions_in           = it_bapicond.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
     EXPORTING
       wait          = 'X'.
ENDLOOP.   "loop for the header data.
Hope it helps.
Regards,
Arnab.

Similar Messages

  • EXIT_SAPLV50E_001 User Exit is not working for multiple plants case

    Hi,
    I have to update foreign trade data in Invoice during invoice creation using VF11. For that, I have written code in EXIT_SAPLV50E_001 and updated segal value. This functionality is working fine, if I have a single plant in an invoice. But customer has scenario where they can have multipl plants in an invoice.
    For multiple plants in an invoice, this EXIT_SAPLV50E_001 is not called.
    I am unable to find another better place where in I could place my code. Please help. Remember, case in multiple plants.
    Will be rewarded.
    Regards
    Arpit

    Hi Arpit,
                   Please use below mentioned user exit in T-code VF11
    he following user exits are available for tcode VF11
    Exit Name           Description
    SDVFX001            User exit header line in delivery to accounting
    SDVFX002            User exit for A/R line in transfer to accounting
    SDVFX003            User exit cash clearing in transfer to accounting
    SDVFX004            User exit G/L line in transfer to accounting
    SDVFX005            User exit reserves in transfer to accounting
    SDVFX006            User exit tax line in transfer to accounting
    SDVFX007            User exit: Billing plan during transfer to Accounting
    SDVFX008            User exit: Processing of transfer structures SD-FI
    SDVFX009            Billing doc. processing KIDONO (payment reference number)
    SDVFX010            User exit item table for the customer lines
    SDVFX011            Userexit for the komkcv- and kompcv-structures
    V05I0001            User exits for billing index
    V05N0001            User Exits for Printing Billing Docs. using POR Procedure
    V60A0001            Customer functions in the billing document
    V60P0001            Data provision for additional fields for display in lists
    V61A0001            Customer enhancement: Pricing
    J_3RSINV            Customer enhancement: Pricing
    or You can use BADI
    BADI_SD_SALES_BASIC
    BADI_SD_TO_FM
    BADI_SD_BILLING
    Regards,
        Thangam.P

  • Calculation formula userexit not working for multiple condition types

    Hi,
    we have a problem in the CRM ISA-B2B scenario where the custom user exit is only working for single condition type.
    but we need it for multiple condition types .
    the value of the subtotal is not being retrieved for multiple conditions. at a time only one condition value is being retrieved and shown in the webshop - shopping basket.
    for ex:
    we have scenario 1 where Y001 -Freight condition type is applicable for one customer.and Y002 is applicable for another customer.
    when we are trying to show the subtotal condition value in the webshop by using a single custom user exit in the pricing procedure it is only working for either of the above 2 customers depending on the VMC cache status.
    is there any problem if use the single user exit for both condition types?
    and if it needs to be differentiated how exactly we can do that with the same logic in the java class.
    Thanks in advance,
    PSR.

    Hi Arshi,
    below is the code:
    public class ZValFormula_ZZWI1 extends ValueFormulaAdapter {
         private static String zzwi = "ZZWI1";
         private static char  zzwiC = '@';
         private static UserexitLogger userexitlogger = new UserexitLogger(
         ZValFormula_ZZWI1.class);
         public BigDecimal overwriteConditionValue(IPricingItemUserExit item,
                   IPricingConditionUserExit condition) {
              ICurrencyValue val = condition.getConditionValue();
              userexitlogger.writeLogDebug( "value saved for " + zzwi + " (" + zzwiC + ") = "
                        + val.getValueAsString());
              item.setSubtotal( zzwiC, val.getValue());
              return val.getValue();
    hope this would give more idea to look at the problem.
    Thanks,
    PSR

  • 3.4: keyword auto-completion not working for multiple levels

    Auto-completion does not work with higher level keywords, which used to work in LR 3.3 (IIRC).
    Example:
    I enter in the "Click here to add keywords" field:
    "He" then LR tries to complete the keyword by showing keywords starting with "He". Fine.
    But this is a keyword which does not exist so far, so I enter "Heldenplatz > W" because I want to have sorted it under Wien. If I'm not mistaken, LR 3.3 showed after entering the "W" a list of existing keywords starting with W (auto-completion for the one level higher tag). This is not the case anymore. I have to enter  "Heldenplatz > Wien" completely, which makes it slow and error-prone.
    Am I mistaken or can you reproduce it?
    Cheers

    GaryRowe wrote:
    How can it be, after all this time, that they still do not have effective regression testing in place ? Any sane development team (who wants to remain sane ;-) builds this as a priority ... unless they aren't given the resources?
    I think (don't remember though) that this never worked, so regression testing would not have helped.
    What is really to worry, that features aren't consequently and completely implemented (and tested). With a new option in Lightroom 3, Adobe has offered support for keywords with spaces. It seems that this feature as neither been thoroughly analysed or implemented. Thus, we face the currently inconsequent support of it:
    keyword completion only works with the first entered word, but when you enter a complete keyword hierarchy using the ">" letters
    filtering seems to have problems too

  • HT2486 Smart Group not working for Multiple 'Not a Member of' Options

    I am trying to go through my contacts and assign everyone to a group.  I want to create a smart group whose criteria is "not in Group 1" AND 'Not in Group 2'.
    This does not work.  It simply gives me all the contacts.
    Also, is there anyone to see a contact and know to which groups they belong.  When I can't remember who someone is, it is helpful if I know what group.

    I have a different conclusion : for me, it works since 10.9 where it has never worked before (and I just checked it still works with 10.9.1) !
    I did not modified my groups, they simply started to work properly with 10.9.

  • ECR/ECO Workflow not working for multiple Objects

    Hello all,
    We have implemented ECR/ECO workflow by customizing the SAP standard one. We are facing a problem when entering multiple ECO objects such as mutiple Documents, materials, BOMs etc. When we create the ECR, two parralel workflow start (one for ECM and other for ECO) and depending on how many ECO objects we have included, multiple instances of ECO workflows will trigger (I think this is the standard behaviour as well but not sure)
    In our workflow, we have a wait step in ECO workflow that waits until ECM has been converted into ECO (ECOP status) and starts the ECO workflow. Also, we have created a Wait step in ECM workflow and that waits until the ECO workflows have reached the CONFIRMATED Step when the processing of the objects are finished.
    When we enter one object, both workflows start and ECO waits until ECM has been converted into ECO and then start the processing the Objects. when the ECO workflow is done (Status confirmated), it switches back to ECM workflow and then goes on with Close/Release steps of the Objects/ECO etc.
             But, when we have multiple ECO objects, both start well as ECR converts to ECO and the ECO starts and then work items are processed but then stops just before the CONRIMATED steps even though all objects are changed/maintained properly and  ECO workflows are completed. As a result, the control doesn't refer back to ECM and we never get the ECO close and Release step work items.
    I have checked SWETYPV, SWEL, business objects ECM and ECO but nothing gives a result..
    Any help would be appreciated..
    Thanks

    Can you please update on what is the status in the workflow log. You can check this from SWIA tcode.
    If it is in process step please check for ST22 dump if any.
    Thanks
    Arghadip

  • LookUpSet is Not working for multiple columns in SSRS 2008 R2

    Hi Friends,
    I have a problem when i use more than one LookUpSet in SSRS to display more than one value based on Day Number & other fields..Please find the below details and please suggest me a solution for this.
    Crystal : 
                    Day1                              Day2
    Period 4     Arts,Maths               Arts,Maths
    For this in SSRS i am using LookUpSet as below based on StaffID,PeriodNumber & DayNumber like  this:
    = (IIF(Fields!DayNumber.Value=1,Join(LookupSet(Fields!StaffID.Value & Fields!PeriodNumber.Value &  Fields!DayNumber.Value
        , Fields!StaffID.Value & Fields!PeriodNumber.Value & Fields!DayNumber.Value
        , Fields!ClassCode.Value
        , "TIMSTF5"), "," ),"")) 
    which is displaying correct in SSRS,But when i use the same expression to display Day 2 classes it is returning empty even though i have values on Day 2.Please have a look at the SSRS output below:
                    Day1                              Day2
    Period 4     Arts,Maths              
    Day 2 Expression is :
    = (IIF(Fields!DayNumber.Value=2,Join(LookupSet(Fields!StaffID.Value & Fields!PeriodNumber.Value &  Fields!DayNumber.Value
        , Fields!StaffID.Value & Fields!PeriodNumber.Value & Fields!DayNumber.Value
        , Fields!ClassCode.Value
        , "TIMSTF5"), "," ),""))
    I am not sure why it is not liking to use more than LookUpSet in the same report,Please suggest me with a work around for this.
    Thanks in advance,
    Sam.

    Hi Guys,
    I have sorted out the problem.Solution for the above problem is use Max before the expression like below, since it has multiple days and periods in the Dataset.
    = Max((IIF(Fields!DayNumber.Value=2,Join(LookupSet(Fields!StaffID.Value & Fields!PeriodNumber.Value &  ields!DayNumber.Value
        , Fields!StaffID.Value & Fields!PeriodNumber.Value & Fields!DayNumber.Value
        , Fields!ClassCode.Value
        , "TIMSTF5"), ","  + vbcrlf),"")))
    Thanks,
    Sam

  • Workflow not working for multiple line items

    Hi gurus,
    we are working on ECN/ECO workflow.
    Once ECN is created in CC01, our workflow triggers.
    we are calling subflow from main WF for enhancing the materials of the Engineering change number(ECN).
    Subflow will take the material to different departments for enhancing the views like,
    Purchasing views by purchasing dept,
    quality views by quality dept,
    sales views by sales dept,
    etc.
    This whole process is working fine, if there is single material number in ECN.
    But, if there are 2 material numbers, the control is not returning back to MAIN WF from Subflow.
    do we need any config/setup to make it work. (we are using block while calling subflow).
    Any help will be of gr8 use.
    rgrds.
    santosh.

    Can you please update on what is the status in the workflow log. You can check this from SWIA tcode.
    If it is in process step please check for ST22 dump if any.
    Thanks
    Arghadip

  • Variable Substitution not working for multiple files

    Hi,
    Have a scenario in which we are using Interface Collection with multiple files as output.
    The naming of the files is derived from a payload field as follows.
    payload:MT_OrdersAck,1,Order,1,File_Header,1,StoreNo,1
    When the first file is generated this works fine, but fails for the rest of the files.
    I guess this is because of the hardcoding 1 in 
    payload:MT_OrdersAck,1,Order,1,File_Header,1,StoreNo,1
    how do we get around this problem?
    Any Ideas?

    Hi, I suppose you are using Mapping-Based Message Split, right? Do the following files look the same like the first file with respect to File_Header?
    Make sure that the payload structure (payload:MT_OrdersAck,1,Order,1,File_Header,1,StoreNo,1) is equal in all files and that first occurrence of StoreNo always has a value in all the files.
    Regards, Martin

  • Firefox 5.0 not Working for Multiple Users Sharing the Laptop

    Hello All,
    I upgraded Firefox from 3.15 to 5.0 using my user ID (admin) in Vista Business SP1. The same copy of Firefox 3.15 also used to work fine under my son's user id. The new install of 5.0 works fine under my user id but immediately freezes under my son's id. I reinstalled 5.0 in the same location under my son's user id but no change.
    I can get Firefox 5.0 to work under my son's login by running it as administrator but then only my bookmarks, etc. load. None of his profile or bookmarks are present.
    Any ideas on how to fix this?
    Thanks...
    Neil

    Google needs to update the Google Toolbar program for Firefox 5.0.
    The Google Toolbar '''7.1.20110512W''' version does work pretty good in Firefox 5.0 by using the Compatibility Reporter extension. But not every feature works 100%.<br />
    https://addons.mozilla.org/en-US/firefox/addon/add-on-compatibility-reporter/
    http://googlesystem.blogspot.com/2011/06/enable-google-toolbar-in-firefox-5.html
    Google Labs has been working on a GTB 8 version, but it looks like it isn't made for Firefox - just for Internet Explorer. <br />
    http://www.google.com/support/toolbar/bin/answer.py?hl=en&answer=1111588#toolbar_info <br />
    So, maybe Google isn't going to be supporting Firefox any longer. That might be a move to force Google Toolbar users over to Google Chrome, which I believe has all those features built-in.

  • Bdc session is not working for multiple records

    Hello Experts
    we have written abdc for f-27 using the session method.it is working fine for one record but if we supply mulite records it
    is giving the error, like bseg-wbter( ie amount which comes in the second screen) is not found in screen 1.
    ie the first screen.The bdc is working fine for one record in notepad.after completing the first record it goes to
    second record and in the first screen itself it says amount field not found in screen 1. But
    actually this field comes in second screen.
    my flat file is like this..
    10.10.2008     DA     9641     10.10.2008     1     IND     TEST          31     10001     320.21     10.10.2008     01     120021     345.94
    10.10.2008     DA     9641     10.10.2008     1     IND     TEST          31     10001     560.22     10.10.2008     01     120021     231.94

    please kindly see my program..
    LOOP AT itab.
        REFRESH itabbdc.
        PERFORM bdc_dynpro      USING 'SAPMF05A' '0100' 'X'.
        PERFORM bdc_field       USING 'BDC_CURSOR' 'RF05A-NEWKO'.
        PERFORM bdc_field       USING 'BDC_OKCODE' '/00'.
        PERFORM bdc_field       USING 'BKPF-BLDAT'  itab-bldat.
        PERFORM bdc_field       USING 'BKPF-BLART'  itab-blart.
        PERFORM bdc_field       USING 'BKPF-BUKRS'  itab-bukrs.
        PERFORM bdc_field       USING 'BKPF-BUDAT'  itab-budat.
        PERFORM bdc_field       USING 'BKPF-MONAT'  itab-monat.
        PERFORM bdc_field       USING 'BKPF-WAERS'  litab-waers.
        PERFORM bdc_field       USING 'BKPF-XBLNR'  itab-xblnr.
        PERFORM bdc_field       USING 'FS006-DOCID' itab-docid.
        PERFORM bdc_field       USING 'RF05A-NEWBS' itab-newbs.
        PERFORM bdc_field       USING 'RF05A-NEWKO' itab-newko.
        PERFORM bdc_dynpro      USING 'SAPMF05A' '0302' 'X'.
        PERFORM bdc_field       USING 'BDC_CURSOR' 'RF05A-NEWKO'.
        PERFORM bdc_field       USING 'BDC_OKCODE' '/00'.
        PERFORM bdc_field       USING 'BSEG-WRBTR'  itab-wrbtr.
        PERFORM bdc_field       USING 'BSEG-ZFBDT'  itab-zfbdt.
        PERFORM bdc_field       USING 'RF05A-NEWBS' itab-newbs2.
        PERFORM bdc_field       USING 'RF05A-NEWKO' itab-newko2.
        PERFORM bdc_dynpro      USING 'SAPMF05A' '0301' 'X'.
        PERFORM bdc_field       USING 'BDC_CURSOR' 'BSEG-WRBTR'.
        PERFORM bdc_field       USING 'BDC_OKCODE'  '=BU'.
        PERFORM bdc_field       USING 'BSEG-WRBTR'  itab-wrbtr2.
       PERFORM bdc_load USING 'F-27' itabbdc.
      ENDLOOP.
    *&      Form  open_session
          text
    -->  p1        text
    <--  p2        text
    FORM session_start .
      CALL FUNCTION 'BDC_OPEN_GROUP'
        EXPORTING
          client = sy-mandt
          group  = 'F-27DA'
          keep   = 'X'
          user   = sy-uname.
      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.                    "session_start
    FORM bdc_load USING tcode TYPE sytcode
                           bdcdata LIKE itabbdc.
      CALL FUNCTION 'BDC_INSERT'
        EXPORTING
          tcode     = tcode
        TABLES
          dynprotab = itabbdc.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.

  • Search spec not working for Multiple Business Object in Siebel

    Hi,
    In Siebel Applicaiton Specified Search spec in Administration - BI Reports->Standard Templates-> integtion Object. the Specified Search spec is not returning particular record. It's seems returning all records. below we are using search spec as [Row Id] = [Quote.BillingaccountId].
    for testing purpose specified how code value : [Row Id]='1-wXR8'(some BillingaccountId in our application from Quote Object).
    Does anybody worked on Searchspec for MultipleBusienssObjects and is the search spec syntax is correct.
    Thanks
    -Chakri

    Hi Ravi..
    thanks for replay. with SR you provided getting no search results. If you have already can you please email me at [email protected]
    And also mention format as IO1.Field1=IO2.Field2. Need to give IO.fieldname i.e Integration Object Name .Field name or IC.Fieldname.. Can you please correct.
    Thanks
    -Chakri

  • ADI not working for multiple records

    Hi,
    We currently have an issue with ADI. The ADI we have produces an MS Word letter based on a custom view and custom integrator.
    On the person form, when I query for an employee and the resultset is 1 our ADI is working fine and the letter/word document is generated.
    When the query returns more than one employee, the Web ADI errors. It does not download any records into the excel file and then when it tries to open the word document it asks for Header Record Delimiters?
    In the excel document I get a Run-Time error '5922' Method 'Run' of object '_Application' failed.
    Is there a setting that only restricts ADI to return one row from this form?
    Any help would be greatly appreciated.
    Many thanks
    Martin

    Hi,
    We currently have an issue with ADI. The ADI we have produces an MS Word letter based on a custom view and custom integrator.
    On the person form, when I query for an employee and the resultset is 1 our ADI is working fine and the letter/word document is generated.
    When the query returns more than one employee, the Web ADI errors. It does not download any records into the excel file and then when it tries to open the word document it asks for Header Record Delimiters?
    In the excel document I get a Run-Time error '5922' Method 'Run' of object '_Application' failed.
    Is there a setting that only restricts ADI to return one row from this form?
    Any help would be greatly appreciated.
    Many thanks
    Martin

  • Sound system not working for multiple programs at same time.

    So first off I have an HP Envy m6 Notebook Windows 8 laptop with an AMD10 processor, no added in cards or anything.
    I am using headphones and the first program I run after starting up my computer (WoW, itunes, winamp, youtube video, etc) is the only program that will work with my headphones until I again restart my computer. Everything else after that just won't output sound at all. I have no idea why this is, when I got to device managers > sound and try to set my headset as default device, I'm not allowed to do that either. Along with this it even says sound is coming out of my computer's speakers when its actually coming out of the headset. Anyone know why and can help?

    Hello Archen5,
    I see that you are having problems with the sound on your computer only working with the first program you open. I would like to help with this issue but I need some information.
    Can you provide the full model and product number of the computer? Here is a link that shows how to find that information.
    How long have you been having the problem?
    ↙-----------How do I give Kudos?| How do I mark a post as Solved? ----------------↓

  • Notification on shared reminders do not work for multiple Apple IDs

    When I share reminders between different Apple ID, they show up perfectly in the Reminder App with correct notification settings and all. But notifications only pops up for the user whose Apple ID created the reminder, not for all users sharing the reminder.
    Are there some kind of setting that I am missing, or is it a missing functionality.
    /Ramboost

    Hi,
    One small part of this.
    In Messages on the iOS devices delete all Messages.
    (You can Forward any you want to keep to the Apple ID used in Messages - you lose the formatting but you have the info)
    You may also need to clear iMessages "saved" on the iPad.
    Then set the Settings > Messages > Received At > Caller ID to the Apple ID that is being used elsewhere.
    Once this is done the Apple ID can sync with the iPhone Number and with all devices and apps using the ID.
    10:34 PM      Wednesday; July 25, 2012
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
      iMac 2.5Ghz 5i 2011 (Lion 10.7.2)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

Maybe you are looking for