Sales order with material having environmentally rlavant flag checked

Hi All,
I have a requirement where i have to develop a ALV for sales order details with material having environmentally rlavant flag checked during material creation.
Problem: The details of sales orders are picked, whic dont have material.
So I have used the following logic:
1) data retrieval:
select vbeln
       erdat
       auart
       kunnr
  from vbak
  into table it_vbak
  where erdat in s_erdat
    and auart in s_auart.
  if it_vbak is not initial.
    select vbeln
           matnr
      from vbap
      into table it_vbap
      FOR ALL ENTRIES IN it_vbak
      where vbeln = it_vbak-vbeln.
      if it_vbap is not initial.
        select matnr
               kzumw
          from mara
          into table it_mara
          FOR ALL ENTRIES IN it_vbap
          WHERE matnr = it_vbap-matnr
            and kzumw = 'X'.
        endif.
    select vbeln
           bstkd
      from vbkd
      into table it_vbkd
      FOR ALL ENTRIES IN it_vbak
      where vbeln = it_vbak-vbeln.
     select vbeln
            parvw
            kunnr
       from vbpa
       into table it_vbpa
       FOR ALL ENTRIES IN it_vbak
       where parvw = 'WE'
         and vbeln = it_vbak-vbeln.
  endif.
        if it_vbpa is not initial.
        SELECT kunnr
               adrnr
          from kna1
          into table it_kna1
          FOR ALL ENTRIES IN it_vbpa
          where kunnr = it_vbpa-kunnr.
          if sy-subrc eq 0.
            select addrnumber
                   name1
                   name2
                   street
                   city1
                   region
                   post_code1
              from adrc
              into TABLE it_adrc
              FOR ALL ENTRIES IN it_kna1
              where addrnumber = it_kna1-adrnr.
               if it_adrc is NOT INITIAL.
                 select addrnumber
                        smtp_addr
                   from adr6
                   into TABLE it_adr6
                   FOR ALL ENTRIES IN it_kna1
                   where addrnumber = it_kna1-adrnr.
              endif.
                endif.
          endif.
2) Reading the data:
loop at it_vbak into wa_vbak.
clear wa_final.
  read table it_vbap into wa_vbap with key vbeln = wa_vbak-vbeln.
  read table it_mara into wa_mara with key matnr = wa_vbap-matnr.
  read table it_vbkd into wa_vbkd with key vbeln = wa_vbak-vbeln.
  read table it_vbpa into wa_vbpa with key vbeln = wa_vbak-vbeln.
  read table it_kna1 into wa_kna1 with key kunnr = wa_vbpa-kunnr.
  read table it_adrc into wa_adrc with key addrnumber = wa_kna1-adrnr.
  read table it_adr6 into wa_adr6 with key addrnumber = wa_kna1-adrnr.
    wa_final-matnr = wa_mara-matnr.
    wa_final-bstkd = wa_vbkd-bstkd.
    wa_final-erdat = wa_vbak-erdat.
    wa_final-kunnr = wa_vbpa-kunnr.
    wa_final-name1 = wa_adrc-name1.
    wa_final-name2 = wa_adrc-name2.
    wa_final-street = wa_adrc-street.
    wa_final-city1 = wa_adrc-city1.
    wa_final-region = wa_adrc-region.
    wa_final-post_code1 = wa_adrc-post_code1.
    wa_final-smtp_addr = wa_adr6-smtp_addr.
    append wa_final to it_final.
    clear wa_final.
endloop.
Problem: The details of sales orders are picked, whic dont have material.
So please suggest me the solution for this problem.
With Regards,
S.Asha.

You are not filtering your VBAK records, after getting data from MARA table, Moreover I can see your consolidation logic is also wrong ..you can refer following pseudo code .
LOOP at IT_VBAP.
READ TABLE IT_MARA ..... based on material no in line item
if sy-subrc = 0 .
...get the data from other internal table and pass it to WA_FINAL..
APPEND WA_FINAL TO IT_FINAL..
else .
   CONTINUE..
endif .
ENDLOOP .

Similar Messages

  • Creditreport that displays Sales Orders with Material Availability Date as

    Hi
    I need input if the following requirement can be met in FSCM credit mgmnt.
    Currently In FDK43 there is a total sales figure that represents the Sales that are consuming the Credit Limit assigned to the customer, unfortunately there is no drill down on this number to see which sales orders are responsible for the consumption of credit
    Do we have any sales report that displays Sales Orders with Material Availability Date as an output in conjunction with Credit limit .

    Not in standard provided. Custom program is required.
    Regards
    Hein

  • Sales order with material & plan cost

    Hi,
    A sales order with material and assign WBS can display the plan revenue which equal sales revenue. How can I make the material cost also be display as plan cost? This material cost should equal standard price of material master.

    It is not possible to copy material cost from sales order to project. Please activate network cost planning, and assign the same material in the project structure, so system will take the material cost in plan cost.

  • BOM explosion in Sales order with material variants

    Dear all,
    we would like to work with Variant Matching in the Sales Order. Additionaly we would like to explode the BOM....according to the SAP help this is not possible....
    http://help.sap.com/erp2005_ehp_06/helpdata/en/bd/05a7d69d3211d190380000e8a49aad/frameset.htm
    Does anybody of you has any ideas how and where to make this happen?
    Thanks for your help and kind regards
    Jan

    Hi,
    I have gonethrough the SAP link referred by you but never come across with any problem in type matching during Sales order even if the BOM explosion is set for Multilevel in Configuration Profile provided the other pre requisite set up was perfect.
    Regards
    Brahmaji D

  • Sales order with Material Delivered through pipeline

    Hello  Community,
    I'm looking for a SAP scenario/solution that can manage Sales order delivered through pipeline.
    I found a lot of information about Pipeline but from MM side not SD one.
    I also check Oil and Chemmical solution but did not found proper solution
    Here is my business case.
    1° Sales order is created with 1 month delivery period through Pipeline.
    2° System has not to book the entire quantity the fisrt day of delivery but has to book it day by day (can be done through APO)
    3° About GI actual delivered quantity is measured and one GI is done at the end of the period.
    4° Creation of one Billing for the period.
    I proposed a sollution with a POD but Customer want to make GI at the end of the delivery.
    If anybody faces this kind of Scenarion help would be apprciated.
    Thank you for support
    and best regards.
    Benoî

    Hello,
    We finally decided to create automatically daily delivery schedule in STO and ask to logistic people to create daily OBD and GI.
    Quiet basic and it works.
    Thank you and regards.
    Benoî

  • Avoid substitute material.., while creating sales order with BAPI?

    Hi experts.
    I use BAPI_SALESDOCU_CREATEFROMDATA1 function module to create a sales order.
    Material A has a substitute material B with substitute reason 0005.
    So if I use material A when creating sales order with above BAPI function, the order is created with material B.
    I don't want to substitute the material automatically. I want to create the sales order with material A.
    What should I do? Help me please.
    Thanks in Advance.

    Hi bvrn Reddy,
    I know, your message is almost two years old, but, did you find a solution? I'm facing the same problem. The material A has B as substitute, but in va01 a popup appears (its customizing inside the substitution reason, strategy = A). Of course, we have no popup inside the bapi, but there must be a way to decide which material the bapi should use. At the moment I only get the substitute, never the old mat (even there is something in stock).
    Maybe you've got a helpful hint for me, thanks!
    Ben

  • Not using substitute material while creating sales order with function?

    hi experts.
    I use SD_SALESDOCUMENT_CREATE function to create a sales order.
    Material A has a substitute material B with substitute reason 0005.
    So if I use material A when creating sales order with SD_SALESDOCUMENT_CREATE, the order is created with material B.
    I don't want to substitute the material automatically. I want to create the sales order with material A.
    What should I do? Help me please.
    Edited by: Ji Yeob Kim on Nov 19, 2009 11:34 AM

    Hi Kim,
    I also have same requirement. Please suggest how you resolved this?
    Thanks
    bvrnreddy

  • ERP - SD Sales orders with billing plan (material number change appear)

    Sales and Distribution.
    Regarding sales orders with billing plan.
    We create the sales order and create billing plan at header or item level.
    We issue down payment request(s) upon receipt of sales order.
    Often during the life time of the sales order one or more of the material numbers are changed after the down payment request(s) has been issued and paid by the client.
    Our issue is that prior to changing the material number in the sales order we have to reverse the payment(s), reverse the down payment request(s) and after the material number change re-issue the down payment request(s) and register the payment again.
    We wish to find a solution avoiding all the reversals.
    If you have a similar situation please inform how to handle material number change in the sales orders with billing plan.
    Best regards
    Lise

    Dear Consultor SD ,
    There is no setting to create the invoice based on schedule line.
    What you can possibly do is create multiple deliveries based on the schedule line and
    then invoice the individual deliveries.
    If you want system to split the deliveries based on schedule line, then you will have to include Schedule line also
    in the COMBINATION REQUIREMENT in VTLA.
    Thanks & Regards,
    Hegal K Charles

  • BAPI/FM in ECC to create a sales order with variant configurable material

    Hi all,
    I need to create a function module that creates a sales order in ECC with a variant configurable material.
    can some one tell me if there is a in built function module or BAPI that i can make use of to create a sales order with variant configurable material in ECC.
    Regards,
    Jessica Sam

    Thanks MxG,
    I dont know how to use this BAPI. .Can you suggest me a sample code.
    My reqmnt is, i have
    Sold to party, ship to party, bill to party , VC config material and all char values that should be populated while creating a sales order.
    please help me with what values should i populate in i/p paramters and and how to use this BAPI with some sample code if posible.
    Regards,
    Jessica.

  • BAPI/ FM in CRM to create a sales order with variant configurble material

    Hi All,
    I need to create a sales order using variant configurable material in CRM not manually through GUI. I need to develop a function module that will create sales order using variant configurable material in CRM .
    Can some one tell me if there is an in-built BAPI/Function Module availabe in CRM to create sales order using variant configurable material in CRM .
    When i researched i found that there is a BAPI 
    BAPI_BUSPROCESSND_CREATEMULTI which can create a sales order in CRM.
    I dont know if this can create a sales order with varinat configurable material in CRM
    can some one guide be how i can build a function module in CRM which generates a sales order with variant configurable material.
    Regards,
    Jessica Sam

    Jessica
    I am not a CRM expert and am still learning. But you can try the BAPI CRMXIF_ORDER_SAVE and see if that helps.
    Good Luck
    Ram

  • Sales order with line items having multiple values in multiple currency

    Please suggest solution for creating sales order having line items with multiple values in multiple currencies.
    e.g. Line Item A Qty/1 No,  value 100INR100$100EUR. Customer wants all three values to display at sales order line item level and create billing in 3 currencies.

    Hi,
    As far as my understanding it may be possible round the solution,
    For 1 company code we can able to maintain 3 currancies,
    1 currancy is hard currance & other two are dual currancies.
    Create sales order with 3 line items having 3 diffrant currancies
    Spilt invoice on the basis of currancy
    Last pass to this invoices to accounting.
    Whole process is
    Sales order >>> Delivery >>> Invoice 1, Invoice 2, Invoice 3(Split invoice on basis of Currancy).
    Consult with FI Team they will tell you about dual currancy & hard currancy
    Kapil

  • Transfer posting to special stock sales order with different material

    I am able to MB1B a material  (Transfer posting) using mvt 412 E and transfer from own stock to sales order stock ,where Sales order belongs to a different material.
    It should not allow posting to a "E" stock to a sales order of different material. (anyway system allows that without any warning/error?)
    MB1B:Only stock type change (within same storage location).

    Hi ,
    I tried replicating your Query and observed it as a standard Behaviour
    When you use 412 E  for posting stock to sales order , system is not validating whether the Material is available in Sales order or
    Material Check is only happening against the Plant and storage location but not at sales order level
    if you want the check to happen, may be you can try to put a code in this Include
    MGV_MATNR_LAMA_SAPLMATL which will Read the Material
    regards,
    santosh

  • Load a sales order with delivery date in the past

    Hi,
    We want to load in the system a sales order with delivery date in the past, and maintain the schedule delivery date in the past. To do that, in the customizing Sales And Distribution / Basic Functions / Delivery Scheduling and Transportation Scheduling / Define Scheduling By Sales Document Type, I selected the flag Blackwards. But the problem is that the rest of the dates in the scredule line: goods issue date, loading date, material avail.date and transportation Plan Date, are in blank and you cannot enter any data because the system deletes it.
    How can I have these dates informed with dates in the past?
    Thanks in advance,

    You can control this using the "Message Control" in the SAP IMG.
    Supplier Relationship Management>SRM Server>Cross-Application Basic Settings>Message Control>Influence Message Control
    Using this you convert Error to Warning or even swith off this message.
    Please refer this thread for complete steps:
    Re: How to change an error message to a warning message in SRM
    Note: you need to suppress the messages relevant to your case here.
    Regards
    Kathirvel

  • Creation of sales order with reference to inquiry no.

    Hi gurus!
    Im having trouble in creation of sales order with reference to inquiry no. The scenario is like this one. In va11(creation of inquiry no.), in the field of <b>SERVICE LEVEL</b>, i indicated a value. after the creation of inquiry no, i want to create a sales order with reference to inquiry no. But the problem is, the <b>SERVICE LEVEL</b> field does not have any value. What is the main problem to this scenario? is it the VARIANT CONFIG or the program itself? please help its urgent
    Regards,
    Mackoy

    Dear Machoy,
    In IMG under
    Sales and Distribution -> Sales -> Sales Documents -> Maintain Copy Control for Sales Documents -> Copying Control: Sales Document to Sales Document
    or Transaction VTAA
    http://help.sap.com/erp2005_ehp_02/helpdata/en/70/a7853478616434e10000009b38f83b/frameset.htm
    If you create a sales document with reference to a preceding document, the system copies nearly all the data from the preceding document. The data in the preceding document originally comes from the customer and material master records. Because the data is copied from the preceding documents into the sales document, any changes that have been made to the master data records since the preceding document was created are not included in the sales document. If, when you create with reference, you add another item to the document that was not in the preceding document, the system determines the data for it from the master records, such as the material master or info record.
    You have created an inquiry and a quotation with reference to this inquiry. Before you created the quotation, you changed some data in the material and customer master records.
    You have changed the material description in the material master record. This description is stored in the sales document at item level.
    You have changed the terms of payment in the customer master record from ZB01 to ZB03. These are stored in the sales document at header level.
    When you created the inquiry, the system copies the original material description to the item. If you enter another item in the quotation for the same material, the system displays the new material description for the new item.
    However, the system continues to propose the original term of payment, that is, ZB01, for all items including the new one. This is because it is copied from the header of the preceding document into the header of the quotation, and the change in the customer master record has no affect on the quotation.
    Regards,
    Naveen.

  • BAPI_SALESORDER_CREATEFROMDAT2 for creating sales orders with configurable

    Hi All,
    I want to create sales order with a material which in turn triggers a configurable network order.
    I am using the following BAPI : BAPI_SALESORDER_CREATEFROMDAT2.
    After reading the "[Variant Configuration (LO-VC)|http://help.sap.com/printdocu/core/print46c/en/data/pdf/lovc/lovc.pdf]" documentation, I thought I had to populate the
    following tables ORDER_CFGS_REF, ORDER_CFGS_INST and ORDER_CFGS_VALUE.
    The call function return no errors and the sale order is well created. However, I have no values in the network.
    If I created a sale order in VA01, a network is created with value. So the customizing is good.
    Do you have any idea how to populate this tables ? Sample code will be very helpful.
    We found in this forum a lot of sample code about configurable material, with obj_type populate with MARAu2019. But no example with configurable network.
    Actually I complete these tables like this :
    " E1CUCFG
      ls_order_cfgs_ref-posex = '000010'.
    *  ls_order_cfgs_ref-config_id = '000010'.
      ls_order_cfgs_ref-config_id = '000001'.
      ls_order_cfgs_ref-root_id = '00000001'.
      ls_order_cfgs_ref-complete = 'T'.
      ls_order_cfgs_ref-consistent = 'T'.
    *  ls_order_cfgs_ref-cbase_id = '4ECADFC4BE9F03A6E10080000AC4AB76'.
    *  ls_order_cfgs_ref-cbase_id_type = 'G'.
      APPEND ls_order_cfgs_ref TO lt_order_cfgs_ref.
    " E1CUINS
      ls_order_cfgs_inst-config_id = '000001'.
      ls_order_cfgs_inst-inst_id = '00000001'.
      ls_order_cfgs_inst-obj_type = 'PLKONET'. u201C(in replacement of MARA)
      ls_order_cfgs_inst-class_type = '300'. u201C(or 020).
      ls_order_cfgs_inst-obj_key = '01000000801'.
      APPEND ls_order_cfgs_inst TO lt_order_cfgs_inst.
    " E1CUVAL
      ls_order_cfgs_value-config_id = '000001'.
      ls_order_cfgs_value-inst_id = '00000001'.
      ls_order_cfgs_value-charc = 'XXXX'. u201C(corresponding to Flag DTA)
      ls_order_cfgs_value-charc_txt = 'Flag DTA'.
      ls_order_cfgs_value-value = '0'.
      APPEND ls_order_cfgs_value TO lt_order_cfgs_value.
    Thanks,

    Have a look to OSS-Message 567348. There is sample coding for using BAPI_SALESORDER_CHANGE, but the parameters should be the same to yout BAPI
    Best regards
    Torsten Manhardt

Maybe you are looking for

  • Hungarian VAT report in HUF showing differences with accounting documents

    When we run the VAT report for the USCC for Hungary with transaction S_ALR_87012357 in HUF, the amounts picked up by the report may differ from the amounts in the accounting document. It seems that the error occurs if the amount ends on a zero. So we

  • XmlFile to B1PurchaseOrder, message gets stuck in processing

    Hello all, please I need help. A message goes in processing, but don't fuhther What can be the problem here? I'm gettig a following log-message: Message-ID    Name of Sendersystem      Sender object               Sender obj.key   Name of receiver sys

  • Documentation for Adobe Interactive Forms functionality

    Hi, Can someone please give me a decent URL for documentation of the techincal and functional aspects of the Adobe Interactive Forms and what they can provide ? I have checked service.sap.com but cannot locate what I want. Cheers Colin. Message was e

  • Auditing not being recorded

    Hi all, I have a system on SAP BI BO 4 SP6. I've created an oracle schema for auditing and done the appropriate configuration in CMC. However, in CMC, I'm getting the below warning and nothing is being recorded in the audit tables: WARNING: Auditing

  • How to input pictures  from Motorola RAZR phone to iMac

    Hi Guys, I would like to know how to input pictures from my RAZR phone to my iMac. I used a USB cable that I ordered from AT&T and nothing happened. What software do I need for my iMac? Thanks for your help, blueheron11