Select query help for Sales order

Hi Experts,
I have to write a select query to fetch sales orders which are open along with the quantities which are open ( not delivered). What would the best approach for this?
Any help is appreciated. Expecting code samples....Thanks
Thanks
Ricky

hi,
do like this,
write a select query for vbak and vbuk as follows.
delivery status field is <b>lfstk</b> from <b>vbuk</b>,
and relation field is <b>vbeln</b> from the both the tables.
reward points if useful,
regards,
seshu.

Similar Messages

  • Query help for sales employee sales

    Hi....
    How can we have a query for
    Name of sales employee
    Item group
    Item name
    Total selling amount
    Total sales order
    Total delivery
    Total AR invoice
    Please help
    Thanks a lot

    Hi,
    What Total selling amount do you need? Invoice - Credit Memo?
    How about the other Total, total count or total amount?
    Thanks,
    Gordon

  • Query for Sales Order Analysis

    Dear Experts
    I have written a Query for Sales Order Analysis and would like to have help on this.
    The query is used for generating daily report for Sales Order on number of documents (Sales Order), total amount of sales orders and total GP of Sales Order. The query is written as below:
    SELECT T0.[DocNum], SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0] GROUP BY T0.[DocNum] ORDER BY T0.[DocNum]
    where U_Total_GP is a UDF for storing the GP of each order.
    After executing the query, a selection criteria of date appears and after a date is selected, the report shown information required. However, the query does not calculate column total for total amount and total GP. Although I know the total for each column can be displayed by pressing "Ctrl" + Click on the column title, it would have to be done from time to time.
    Therefore, I would like to modify my query in order to calculate the column totals when executed. Are there any suggestions for this?
    Thank you
    Regards
    Elton

    Hi Elton,
    Try this:
    SELECT T0.[DocNum], SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0] GROUP BY T0.[DocNum]
    Union ALL
    SELECT '', SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0]
    ORDER BY T0.[DocNum]
    Thanks,
    Gordon

  • I'M modifing std module pool for sales order plz can any one help me

    hi
    i'M modifing std module pool for sales order plz can any one help me
    i'm introucing some fileds in  sales order header level additional data2 screen
    i want it for only to doc conditio i shld i proceed

    can anyone help me

  • Additional selection Condition for sales order in CFM1

    Dear APO Gurus,
    Our business scenario requires CFM1 to have additional selection
    condition based on Sales order type (Table:VBAK, Field: AUART) for
    sales order data.
    Kindly guide us if there are any enhancement or OSS note to acheive the
    requirement?
    I know OSS note: 507696 can be used for enhancing CFM1 selection conditions based on MARC table
    fields. Any way this will not solve our requirement.
    Thanks in advance for your answer.
    Vignesh M

    Hi Bipin,
    Yes, that would be an option if we couldnt find a solution for setting a new selection condition in CFM1. Is there a CIF userexit related to sales order? That would be grateful..
    Cheers.
    Thanks in advance
    Vignesh M

  • TABLE/FIELD FOR SALES ORDER'S SHIP TO LOCATION

    Hi everyone,
    Does anyone tell me what is the related tables/fields for Sales Order's Ship To Location? Since I want to display the Ship To Location information in the Oracle Report in Oracle Apps R11i.
    I tried to use the following SQL select statement to retrieve the Ship to address:-
    -- SHIP TO LOCATION
    select a.address_id, c.customer_name, C.CUSTOMER_ID, A.SITE_USE_ID from ra_Site_uses_all a, ra_addresses_all b, ra_customers c
    where a.site_use_code = 'SHIP_TO' and
    a.status = 'A' and
         b.address_id = a.address_id and
         c.CUSTOMER_ID = b.CUSTOMER_ID and
         b.status = 'A' and
         c.customer_id in (select customer_id from ra_customers) and
         c.status = 'A' and
         c.customer_name like 'CLARION (H.K.)%'
    But I found that the data is BILL TO address. Can anyone help me? Thanks.

    Hi all, I managed to solve my problem. Here's the query in case someone need it. Thanks
    SELECT party.party_name "Send to" (SELECT party.party_name
    FROM hz_cust_site_uses_all bill_su,
    hz_cust_acct_sites_all bill_cas,
    hz_party_sites bill_ps,
    hz_locations bill_loc,
    hz_parties party,
    oe_order_headers_all h
    WHERE h.invoice_to_org_id = bill_su.site_use_id
    AND bill_su.cust_acct_site_id = bill_cas.cust_acct_site_id
    AND bill_cas.party_site_id = bill_ps.party_site_id
    AND bill_loc.location_id = bill_ps.location_id
    AND bill_cas.party_site_id = bill_ps.party_site_id
    AND bill_ps.party_id = party.party_id
    AND h.order_number = 'your_order_number') "Invoice to"
    FROM oe_order_headers_all h,
    hz_cust_site_uses_all ship_su,
    hz_cust_acct_sites_all ship_cas,
    hz_party_sites ship_ps,
    hz_locations ship_loc,
    hz_parties party
    WHERE h.ship_to_org_id = ship_su.site_use_id
    AND ship_cas.party_site_id = ship_ps.party_site_id
    AND ship_su.cust_acct_site_id = ship_cas.cust_acct_site_id
    AND ship_cas.party_site_id = ship_ps.party_site_id
    AND ship_ps.party_id = party.party_id
    AND ship_loc.location_id = ship_ps.location_id
    AND h.order_number = 'your_order_number';

  • Trying to create a query that shows Sales Order/Invoice Totals as well as Paid/Outstanding/Available Down Payments

    Currently working on SAP B1 v8.82
    I'm looking to generate a query that will give an overall report for a given customer that shows Sales Order No, Invoice No, Sales Order Total, Invoice Total, Amount Paid on Invoice, Amount Remaining on Invoice, Down Payments Available, Open on Sales Order.
    I'm not sure what the best way to select the columns in bold above.  Invoice Total should be self-explanatory.  Amount Paid should be any down payments or applied payments on the invoice.  The balance due on the invoice (which seems to be T0.DocTotal if I'm not mistaken) should = 'Invoice Total' - 'Amount Paid on Invoice'. In the Down Payments Available column I want the total amount of money on the account or on down payments that aren't tied to a Sales Order.  If a client overpaid in the past for instance and there's a credit on their account, then it should contribute to this sum.  Open on Sales Order should be pretty easy.  I guess it's just the sum of everything that is still open on the Sales Order.  I'm just not sure what the best way to sum all the un-delivered freight, tax, and line items is.  Here's what my query looks like so far.
    SELECT DISTINCT T4.[DocNum] [Sales Order No],
    T0.DocNum [Invoice No],
    T4.DocTotal [Sales Order Total]
    T0.DocTotal [Amount Outstanding],
    FROM OINV T0
    INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN DLN1 T2 ON T1.BaseEntry = T2.DocEntry AND T1.BaseLine = T2.LineNum
    INNER JOIN RDR1 T3 ON T2.BaseEntry = T3.DocEntry AND T2.BaseLine = T3.LineNum
    INNER JOIN ORDR T4 ON T3.DocEntry = T4.DocEntry
    INNER JOIN OSLP T5 ON T4.SlpCode = T5.SlpCode
    WHERE T0.CardName Like '%%[%0]%%'
    GROUP BY T4.DocNum, T0.DocNum, T0.DocTotal, T4.DocTotal
    I tried doing a little searching around for queries similar to what I need, but I could find exactly what I was looking for and I'm very unfamiliar with OJDT, JDT1, and ITR1 tables which I think might be important to finding unapplied payments...

    Thanks.  There's a few problems though.
    1)  It seems that OINV DocTotal != Balance Due.  I'm seeing a number of invoices where there was a balance due, but we applied additional money (either we took another incoming payment and applied it or applied money from the account balance, etc.) and yet it still shows a total.
    2)  It's pulling incoming payments from different customers.  I think this is because the table was joined based on "RCT2 T4 on T4.[DocEntry]  =  T3.[DocNum] and T4.[InvoiceId] = T2.[LineNum]"  In one example I have 2 incoming payments 446 and 614.  Both have the DocEntry 542, but one relates to A/R Invoice 542 (for a different client) while the other relates to Down Payment Invoice 542.  *I was able to fix this by adding WHERE T5.CardCode = [%0]*
    3)  I'm going to work with this a little bit and see if I can alter it to make it work for me.  Basically this query falls a little short on the following:
    -  Doesn't include incoming payments that aren't linked to a down payment invoice.
    -  Does not give the Invoice Total (I'd like to know how much of the SO was invoiced.  DocTotal seems to give me Amount Invoiced - Down Payments.  I'm not sure the best way to get this number.  Maybe I could do the sum of each line * tax + freight)
    -  Does not give the outstanding amount on an invoice.  The ARtotal [DocTotal] column gives me how much was owed when the invoice was created, but it doesn't tell me what is currently owed.
    -  Lastly it may complicate the query too much and could be left off, but it would be nice to see if they have any money from credits or incoming payments that has not been applied.  Perhaps this would be easily accomplished by simply pulling in their account balance.

  • Proforma Invoice for Sales Order

    Hi,
    Currently, SAP will generate all items using the entered SO for Proforma Invoice despite that some items already being created.
    There isn't any suitable user exit to filter those checking on items being generated.
    Please revert if there is any other way in doing it.

    Hi
    My suggestion is to use the copying requirements at the item category level in the copy control in VTFA
    Copy routine is created in VOFM
    KIndly take the help of ABAPER for the Code, example given below
    if vbap-vbeln is not initial.
      select single * from vbfa into wa_vbfa
      where vbelv = vbap-vbeln
      and posnv = vbap-posnr
      and VBTYP_N = 'U'.
      if sy-subrc = 0.
          concatenate 'proforma for sales order ' vbap-vbeln 'and' vbap-posnr 'already generated' into lv_text separated by space.
          message lv_text type 'E'.
      endif.
    endif.
    Regards
    Damu

  • Deleting list for sale order

    Hi Guru’s
    How can get the deleting list for sale order?   
    Useful answer duly rewarded back.
    Regards,
    Devendra

    Hi Devendra,
    General Sales order will be deleted form the database after archiving.
    Step for Archiving:
    Sales Order is archived and deleted by the Archiving object know as SD_VBAK.
    If you just want to delete the sales order with out thinking of saving to archive server then please follow the path:
    1.GOTO SARA ---> Click Customizing -> click Archiving Object specific customizing (Technical settings)> In delete jobs mention start automatic --> Leave other settings as per the standard save and close it.
    2. Click write --> Mention Variant name -->Click on Maintain --> Select all the sales orders that you want to archive and delete --> Mention sales organinsation under which you have created --> Select Production Mode --> Click on Attributes --> Mention meaning of that attribute it could be any text --> Enter and save.
    3. Click on Spool parameters --> mention the output type --> Enter now you can see green signal light
    4. Click on Start date --> Click on Immediate --> Save.
    5. Execute or click F8 and see the job.
    6. After some time you can see the data is archived and deleted form the database.
    Hope this will help you in deleting the sales order form the database.
    Please Note: It is bit complicated you should take help of SAP Archiving consultant.
    -Thanks,
    Ajay
    Message was edited by:
            Ajay Kumar
    Message was edited by:
            Ajay Kumar

  • LSMW - Need help with Sales Order (Modification VA01)

    Hi,
    I need help with an LSMW for Sales Order (VA01).
    I need to do the following:
    1. Copy the Standard Sales Order LSMW
    2. They (users) would like to be able to pick the batch (lot) from the sales order.
    3. Also, they would like to have functionality, where from the list of Sales Order numbers, they would be able to switch one part number for another.
    Please help with the above 3 needs.
    Thanks,
    Laura

    Hi
    Run transaction SE38, insert your program (RVINVB10), select DOCUMENTATION option and press display
    Just only you need to consider the BDC program needs to read afile with all informations to create a sales order, so you have to create a program to prepare a file arraged as RVINVB10 needs, the documentaion explains how the file has to be created.
    Max

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

  • ATP for sales order

    Hello,
    Could someone please tell me how do we determine if the client site is presently using ATP for sales order. Does OVJ9/OVJ2 tell us if they have turned the ATP check on? Any help is much appreciated.
    thanks

    Availability check can be turned on/off at two levels in SD.
    1) In Schedule line category VOV6
    2) In Requirements class OVZ9
    If the checkbox is not selected in any of the above two then availability check will not happen during order processing.
    Regards,
    GSL.

  • Approval Procedure for Sale Orders

    Hi Experts:
    Anyone can help me?...I´m needing an Approval Procedure for Sale Orders to be activated whenever the user is trying to give diferent discount percentage from the one assigned in the price list throughout Period Discounts. We have Sap Business One 2007A SP01 PL05
    Thanks very much in advance
    CLAUDIA

    Hi CLAUDIA,
    This has to be done through user query approval.  However, since I don't have similar environment to try, you may start to create your own query first.
    Thanks,
    Gordon

  • Condition for sales order delivery block

    Hi All,
    I am new to Workflow,
    I have created work flow  for Sales order changes, its works fine.
    but my requirement is after that it will check whether sales is block for delivery or not.
    if it is block then only it should send mail.
    Regards,
    Arpit

    Hi Arpit,
    1. Go to t-code SWO1.
    2. Click Settings -> Delegate.
    3. Delegate the BO YBUS2032 to the BO BUS2032.
    In workflow perform the following steps:
    1. Go to t-code SWDD and open your workflow template.
    2. Go to Basic Data (cap sign button at the top of the screen) or click Ctrl + F8
    3. Go to Start Events tab.
    4. In the Object type enter your BO name BUS2032 (not YBUS2032), in Event of object enter the BO event.
    5. Click on 'B' i.e. Binding Defined, click on generate automatic binding. It would automatically generate the appropriate binding for the workflow. You can also alter the binding as per requirement.
    6. Click on 'C' i.e. Start Condition. A dialog would open, select the appropriate start condition for the workflow. Use the attribute that you created and make the start condition. Check the condition before saving (recommended).
    6. Click on 'A' to Activate the binding and start condition. All 'A', 'B' and 'C' would get green.
    7. Save the changes made and activate your workflow.
    Hope this helps!
    Regards,
    Saumya

  • Selected Item in Create Sales Order

    Hi Experts,
    Does anyone knows how to fo this?
    Here's the scenario. I have a multiple line items.
    Lets say item 10 and its free goods item 11; item 20 and its free goods 21; and item 30 and its free goods 31.
    What I need to do is to change the ship-to party of the free goods item I selected.
    I'm using the USEREXIT_MOVE_FIELD_TO_VBAK (it does not pass through USEREXIT_MOVE_FIELD_TO_VBAP). My problem is, I did not know the variable that handles/holds the line item (POSNR) I selected. I need to identify the line item selected in-order to change the ship-to party.
    Points will be rewarded generously for helpful answers...
    Thanks in advance...
    -salem-

    Find the user exits below for Sales order.
    Transaction Code - VA01                     Create Sales Order
    Exit Name           Description
    SDTRM001            Reschedule schedule lines without a new ATP check
    V45A0001            Determine alternative materials for product selection
    V45A0002            Predefine sold-to party in sales document
    V45A0003            Collector for customer function modulpool MV45A
    V45A0004            Copy packing proposal
    V45E0001            Update the purchase order from the sales order
    V45E0002            Data transfer in procurement elements (PRreq., assembly)
    V45L0001            SD component supplier processing (customer enhancements)
    V45P0001            SD customer function for cross-company code sales
    V45S0001            Update sales document from configuration
    V45S0003            MRP-relevance for incomplete configuration
    V45S0004            Effectivity type in sales order
    V45W0001            SD Service Management: Forward Contract Data to Item
    V46H0001            SD Customer functions for resource-related billing
    V60F0001            SD Billing plan (customer enhancement) diff. to billing plan
    If user exists doesn't suit ur requirement then go for customer exit. Goto program MV45AFZZ then serch for Customer exists.

Maybe you are looking for