Query for Sales order and corr.AR Invoice Info
Hi,
I need to write a query which gives the flollowing sales order info along with the coressponding AR invoices info
Sales Order columns reqd:
OPERATING_UNIT
ORDER_NUMBER
CUSTOMER_NUM
CUSTOMER_NAME
ORDERED_DATE
FLOW_STATUS_CODE
TOTAL_ORDER_AMOUNT
AR invoice columns reqd for the sales orders:
Invoice number,
Invoice date,
Invoice Total.
Can anyone help me out with this?
Thanks,
Ash
Hi Ash,
There are some issues that must be defined before you have the exact query.
Do you have freight charges or non-inclusive tax? If you have, freight charges and tax amounts must be included?
Depending on you grouping rule, you can have lines from more than one order in a single invoice. In this case, as invoice amount you want the sum of all lines, or only the lines from that order?
Below is an example using two views. It assumes that grouping rules split lines from different order into different invoices.
Hope it helps,
Ketter Ohnes
create or replace view order_summary as
select oh.org_id,
oh.ORDER_NUMBER,
oh.header_id,
ott.name tt_name,
ca.account_number,
p.party_name,
oh.ordered_date,
oh.flow_status_code,
sum(ol.ordered_quantity*ol.unit_selling_price) total,
sum(ol.tax_value) tax,
(select sum(operand)
from OE_PRICE_ADJUSTMENTS_v x
where x.header_id = oh.header_id
and x.adjustment_type_code='FREIGHT_CHARGE') freight_charge
from oe_order_headers_all oh,
oe_order_lines_all ol,
hz_cust_accounts ca,
hz_parties p,
oe_transaction_types_tl ott
where ol.header_id=oh.header_id
and oh.sold_to_org_id = ca.cust_account_id
and ca.party_id = p.party_id
and oh.order_type_id = ott.transaction_type_id
and ott.language =
(select language_code
from fnd_languages
where installed_flag = 'B')
group by oh.org_id,
oh.header_id,
oh.ORDER_NUMBER ,
ott.name,
ca.account_number,
p.party_name,
oh.ordered_date,
oh.flow_status_code;
create or replace view invoice_summary as
select a.interface_header_context,
a.trx_date,
a.trx_number,
b.interface_line_attribute1,
b.interface_line_attribute2 tt_name,
a.customer_trx_id,
sum(b.extended_amount) invoice_total
from ra_customer_trx_all a,
ra_customer_trx_lines_all b
where a.customer_trx_id = b.customer_trx_id
and b.interface_line_context = 'ORDER ENTRY'
and b.line_type in ('LINE','FREIGHT')
group by a.interface_header_context,
a.trx_date, a.trx_number,
b.interface_line_attribute1,
b.interface_line_attribute2,
a.customer_trx_id;
select *
from order_summary o,
invoice_summary i
where o.order_number between :1 and :2
and o.order_number = i.interface_line_attribute1
and o.tt_name = i.tt_name;
Similar Messages
-
Query for Sales Order and AR Invoice Information
Hi,
I need to write a query which gives the flollowing sales order info along with the coressponding AR invoices info
Sales Order columns reqd:
OPERATING_UNIT
ORDER_NUMBER
CUSTOMER_NUM
CUSTOMER_NAME
ORDERED_DATE
FLOW_STATUS_CODE
TOTAL_ORDER_AMOUNT
AR invoice columns reqd for the sales orders:
Invoice number,
Invoice date,
Invoice Total.
Can anyone help me out with this?
Thanks,
AshHi Ash,
Table RA_CUSTOMER_TRX_ALL can be joined to RA_CUSTOMER_TRX_LINES_ALL table through CUSTOMER_TRX_ID column. The table RA_CUSTOMER_TRX_LINES_ALL.INTERFACE_LINE_ATTRIBUTE6 = OE_ORDER_LINES_ALL.LINE_ID. And from the LineId, you can get the HeaderId os the OE_ORDER_HEADERS_ALL table.
You must have visualized the query by now.
Thanks
Sumit -
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
EltonHi 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 -
VD05 - Customer master record blocked for sales orders and billing
Hi,
I have a scenario whereby I have blocked a customer master record for sales orders and billing using transaction VD05, but it still allows you to create sales orders and post billing documents.
What is the reason for this?
Regards
GandiHi,
Block the customer for the sales order, delivery and Billing for the specific sales area in vd05
and try out,
Regards
Pradeep BV. -
CRM - R-3 integration for sales order and billing
Hi All,,
Please could you help me to set up the connectivity between CRM and R-3.
This will be for Sales order and billing.
Regards,
PiyushHi All,
Thanks for your information.
I have created a site, subscription, connectivity is established between R-3 and CRM through RFC destination.
What else do i need to do, Could you please share <b>step by step</b> information for the whole scenario 'Sales order in CRM to R-3 and Billing info from R-3 to CRM ?
This will help me a lot to do things.
If you have documents for this please mail me at [email protected]
Regards,
Piyush -
Update KOMV-KBETR field for sales order and billing
I would like to update the KOMV-KBETR (condition amount or percentage) under condition tab for both Sales order and billing.
example:There are two condition types ZA00 and ZB00 and need to get the KBETR value from ZA00 and add it to KBETR value of ZB00 and update the sum in KBER value of ZB00.
1. creation of sales order & billing.
2. Change of sales order & billing.
3. For single & multiple line items in both sales order & billing.
4. during updation of price in the change mode of sales order & billing.
5.When user click on Update button in the condition tab(i.e., when clicked on Carryout new pricing)
I tried with the VOFM routine but as the routine is triggering multiple times the sum is calculated again and again.For that I set flags also.It is working for sales orders but for billing creation the field XKOMV-KBETR is cleared after this routine.
So I would like to know are there any EXITS for this scenario or any one entountered the similiar issue which I am facing.Hi Brad,
It is an Client requirement.So need to do the addition of that condition types.
Can you please let me know the configuration point where we can do it and the condition type which we need to update the Rate/Amount value.ie., KOMV-KBETR is and Price list value and not the subtotal one.
Thanks,
Srilakshmi Lagisetty. -
BDC Program for Sales order and Enquiry
Hi All,
Pls can you help me.
To create sales order and enquiry I have bapis .
BAPI_SALESORDER_CREATEFROMDAT2
BAPI_INQUIRY_CREATEFROMDATA2
but i want BDC Programs for that bapis
pls can you help me
thanks
marsHi Krishna ,
Please check the below links .
[http://www.sap-basis-abap.com/abap/bapi-sample-to-upload-data-from-flat-file-to-va01.htm]
[http://abapreports.blogspot.com/2008/06/bapi-sample-code-for.html] -- > Select and Copy from this one. -
Authority check for sales order and stock transport order
In my code i have a requirement to enter sales order and Stock transport order. However i want that a WM resource should not be allowed to enter sales order and an SD resouce should not be allowed to enter stock tranpsort order. Please suggest.
Hi,
Another way to solve this is create a Z table with field user name and Resource type and compare the user id ( sy-uname) with the Z table and allow accordingly.
In production environment controlling authorization in this approch is much easier.
Hope this helps.
Regards
Bikas -
Best Datasources to use for Sales Orders and Invoiced Quantities
Hello Experts,
Just wanted to ask if anyone has experience and can recommended the ECC Datasources to use to extract:
1. Invoiced Qty = Sales History
2. Open Sales Orders
3. Shipped Qty= Goods issued but not yet invoiced
So far in my research I have down the following datasources:
1. 2LIS_13_VDITM Billing Document Item Data for Invoiced Quantities
2. 2LIS_11_SSL, or 2LIS_11_SCL or 2LIS_11_VASCL for Open Sales Orders
3. 2LIS_12_VCITM, 2LIS_11_V_SSL for Shipped Quantities
Any suggestions?
Thanks alot
VictoriaHi Victoria:
Plese take a look at SAP Best Practices (Scenario Documentation and Building Blocks)
Open this URL: http://help.sap.com/bp_bw370/html/index.htm
Click "Preconfigured Scenarios" link
Click on the Links to navigate on the different available scenarios and to see the documents you can download (Technical Documentation > Configuration Guide)
*Customer Relationship Management
-- Sales Analysis
-- Cross-Functional Analysis: Financial and Sales Data
-- Booking Billing Backlog Analysis
-- Sales Planning
-- Scheduling Agreements Analysis
-- CRM Analytics
Edited by: Francisco Milan on Jun 3, 2010 6:23 PM -
Different Pricing Procedure for Sale order and Billing Document
Hello Experts
As per scenario,we create Excise Invoice (T-Code J1IIN) on Basis of Proforma Invoice.Proforma Invoice and Excise Invoice follow Pricing from Sale Order.AS per pricing Some excise condition types are get update in Proforma and excise Invoice.
AS Per Customer Payment Confirmation we Create Export Billing Invoice (T-code VF01) on basis of Outbound delivery.
Issue -: AS per export Billing Rule we don't want to update Excise Condition type in Export Billing Document,and at same time it should not create any accounting entries for same condition type. we Dont want excise Duity in Export Billing Document as Export Billing Doccumnet aslo Follow Pricing procedure of Sale order
Should i create new Pricing procedure or what other things to solve above issue.
Please help me out
Thanks and Regards
Pash@SDHello,
The key to your requirement can be maintenance of Excise condition type with proper access sequence and accordingly maintain condition record for them.
You create an access sequence with following access:
- Country / Plant / PlntRegion / Region / Price grp / Mat.pr.grp / Materia
- Country / Plant / PlntRegion / Region / Price grp / Mat.pr.grp
- Country / Plant / PlntRegion / Region / TaxCl1Cust / Mat.pr.grp
- Country / Plant / PlntRegion / TaxCl1Cust / Mat.pr.grp
For export maintain condition record based on any key combination, say for
Country / Plant / PlntRegion / TaxCl1Cust / Mat.pr.grp - Tax % - Tax Code
FR / 1000 / KR / 03 (EXPORT) / 04 / 0% / V1
I hope this can assist you.
Thanks & Regards
JP -
Query For Sales Order Amendments
Hi,
Does anyone have a query that lists the amendments to a Sales Order?
I basically want to create an alert that runs this query once a day and shows me the sales orders that have been amended that particular day.
Any help on this would be gratefully received.
Regards
DavidHi..
Try These Query in Alert you will get your req. fulfill
SELECT T0.[DocNum], T0.[DocStatus], T0.[DocDate], T0.[DocDueDate], T0.[CardCode], T0.[CardName] FROM ADOC T0 WHERE T0.[ObjType] = 17 AND T0.[UpdateDate] = GETDATE()
Regards,
Bhavank
Edited by: Bhavank on Sep 28, 2010 5:50 PM -
Planned Order creation for Sales Order and Purchase Order
Hi
We have a following requirement.
In normal scenario when we have demand for material which was created by MD61 and in addition to that if there is Sales Order the 1st planned order gets revised.To better expalin this consider possible scenario
You create plan via MD61 for 200 qty .The system creates Planned Order for 200.
Now there is Sales Order for 150 peices.Then what happens is original Planed Order of 200 is changed to 50 and another planned order is created for 150 peices.The requirement is not summed.
Now in new scenario instead of Sales Order there is Intercompany Purchase Order of 150 peices.
Now the system is not changing original Planned Order of 200,but it created another planned order of 150.So now there are 2 Planned Orders of 150 and 200.
What I want to know is there any way wherein the system will reduce the original planned order (similar to Sales Order scenario)
RegardsHi,
Use Strategy 52 in urs case.
PIR witll be created .
None convertable planned order will be created.
Once you get sales order for that material.
New planned order will be created which will consume PIR( planned order ).
Eg.
PIR 10.
Planned order 10 qty.
Sales oder 6
Planned order for SO 6 qty
Planned order through pir will become 4 qty.
Regards,
Vishal -
BOM business requirement for sales order and PGI
Hi Experts,
Current setting
The BOM structure is A = A1+A2
1) Material A created in MM master item category group = ERLA
2) Sub component material A1 and material A2, MM master item category group = NORM for both component.
3) Maintained in CS01 BOM header is A and items are A1 and A2.
4) Item category in IMG was created and assign item category also created.
4.1) OR-ERLA-TAQ-TAE
new business requirement as listed below.
5) The material A is alway zero quantity on hand, no goods receipt required with no physical with such material or package at all. (it is dummy material number in SAP).
6) while SO created.
6.1) Fro material A sales price captured at BOM header level only, NO QTY and COSTshow in the sales order.
6.2) Material A1 and A2 are actual physical inventory item in the ware house.
6.3) The sub component of material A1 and A2 is required to captured QTY and COST. NO SALES PRICES NEEDED.
CONCLUSION
HOW to setup/configure such a business scenario?
- Is it logic to configure as OR-ERLA-TAE-TAN that's what i think of?
My problem is how to make the material A is alway ZEROS stock on hand and allow in sales order creation with ZEROS order qty?
MATERIAL QTY COST SALES NET VALUE
A 0 0 1,500.00
A1 1 100.00 0
A2 1 50.00 0
Thanks & Regards,
Yong Kok Wah
Edited by: Yong Kok Wah on Jan 27, 2010 11:16 AMAs per your post,
- You are creating Main item which is a dummy material without any physical inventory maintained, but the pricing/billing should be done @ main item level.
- here you are not dispatching main item, but billing should be carried at this level. in such case, I suggest you to go with the new sch.line cat w/o maintaining any mov type to it. & use Zitem category for this main item in VOV7, mark "Order qtty=1" so that min order qtty for this main item should be 1, so that you can calculate price.
- You want to capture Cost of sub items , summation of sub items cost is total cost of main item & Profit will be calculated accordingly.
Sub items, sch.line category should have mov type, item cat should be not relevant for pricing & billing , but relevant for sch.lines. In Copy control from delivery - Billing @ item level, for the main item ,- item category, choose "Cumulate cost", so that cost of the sub items will be cumulated to main item.
eg:
MATERIAL QTY COST SALES NET VALUE
A 0 0 1,500.00
A1 1 100.00 0
A2 1 50.00 0
My problem is how to make the material A is alway ZEROS stock on hand and allow in sales order creation with ZEROS order qty?
To avoid this, mark order qtty=1, in item category for main item, but for the same item, sch.line category should not have mov type. so that there will nt be any PGI document. But PGI should be done for sub items to capture inventory & cost.
Test & revert, if any issues. -
Performance tuning for Sales Order and its configuration data extraction
I write here the data fetching subroutine of an extract report.
This report takes 2.5 hours to extract 36000 records in the quality server.
Kindly provide me some suggestions for performance tuning it.
SELECT auart vkorg vtweg spart vkbur augru
kunnr yxinsto bstdk vbeln kvgr1 kvgr2 vdatu
gwldt audat knumv
FROM vbak
INTO TABLE it_vbak
WHERE vbeln IN s_vbeln
AND erdat IN s_erdat
AND auart IN s_auart
AND vkorg = p_vkorg
AND spart IN s_spart
AND vkbur IN s_vkbur
AND vtweg IN s_vtweg.
IF NOT it_vbak[] IS INITIAL.
SELECT mvgr1 mvgr2 mvgr3 mvgr4 mvgr5
yyequnr vbeln cuobj
FROM vbap
INTO TABLE it_vbap
FOR ALL ENTRIES IN it_vbak
WHERE vbeln = it_vbak-vbeln
AND posnr = '000010'.
SELECT bstkd inco1 zterm vbeln
prsdt
FROM vbkd
INTO TABLE it_vbkd
FOR ALL ENTRIES IN it_vbak
WHERE vbeln = it_vbak-vbeln.
SELECT kbetr kschl knumv
FROM konv
INTO TABLE it_konv
FOR ALL ENTRIES IN it_vbak
WHERE knumv = it_vbak-knumv
AND kschl = 'PN00'.
SELECT vbeln parvw kunnr
FROM vbpa
INTO TABLE it_vbpa
FOR ALL ENTRIES IN it_vbak
WHERE vbeln = it_vbak-vbeln
AND parvw IN ('PE', 'YU', 'RE').
ENDIF.
LOOP AT it_vbap INTO wa_vbap.
IF NOT wa_vbap-cuobj IS INITIAL.
CALL FUNCTION 'VC_I_GET_CONFIGURATION'
EXPORTING
instance = wa_vbap-cuobj
language = sy-langu
TABLES
configuration = it_config
EXCEPTIONS
instance_not_found = 1
internal_error = 2
no_class_allocation = 3
instance_not_valid = 4
OTHERS = 5.
IF sy-subrc = 0.
READ TABLE it_config WITH KEY atnam = 'IND_PRODUCT_LINES'.
IF sy-subrc = 0.
wa_char-obj = wa_vbap-cuobj.
wa_char-atnam = it_config-atnam.
wa_char-atwrt = it_config-atwrt.
APPEND wa_char TO it_char.
CLEAR wa_char.
ENDIF.
READ TABLE it_config WITH KEY atnam = 'IND_GQ'.
IF sy-subrc = 0.
wa_char-obj = wa_vbap-cuobj.
wa_char-atnam = it_config-atnam.
wa_char-atwrt = it_config-atwrt.
APPEND wa_char TO it_char.
CLEAR wa_char.
ENDIF.
READ TABLE it_config WITH KEY atnam = 'IND_VKN'.
IF sy-subrc = 0.
wa_char-obj = wa_vbap-cuobj.
wa_char-atnam = it_config-atnam.
wa_char-atwrt = it_config-atwrt.
APPEND wa_char TO it_char.
CLEAR wa_char.
ENDIF.
READ TABLE it_config WITH KEY atnam = 'IND_ZE'.
IF sy-subrc = 0.
wa_char-obj = wa_vbap-cuobj.
wa_char-atnam = it_config-atnam.
wa_char-atwrt = it_config-atwrt.
APPEND wa_char TO it_char.
CLEAR wa_char.
ENDIF.
READ TABLE it_config WITH KEY atnam = 'IND_HQ'.
IF sy-subrc = 0.
wa_char-obj = wa_vbap-cuobj.
wa_char-atnam = it_config-atnam.
wa_char-atwrt = it_config-atwrt.
APPEND wa_char TO it_char.
CLEAR wa_char.
ENDIF.
READ TABLE it_config WITH KEY atnam = 'IND_CALCULATED_INST_HOURS'.
IF sy-subrc = 0.
wa_char-obj = wa_vbap-cuobj.
wa_char-atnam = it_config-atnam.
wa_char-atwrt = it_config-atwrt.
APPEND wa_char TO it_char.
CLEAR wa_char.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP. " End of loop on it_vbap
Edited by: jaya rangwani on May 11, 2010 12:50 PM
Edited by: jaya rangwani on May 11, 2010 12:52 PMHello Jaya,
Will provide some point which will increase the performance of the program:
1. VBAK & VBAP are header & item table. And so the relation will be 1 to many. In this case, you can use inner join instead multiple select statement.
2. If you are very much confident in handling the inner join, then you can do a single statement to get the data from VBAK, VBAP & VBKD using the inner join.
3. Before using for all entries, check whether the internal table is not initial.
And sort the internal table and delete adjacent duplicates.
4. Sort all the resultant internal table based on the required key fields and read always using the binary search.
You will get a number of documents where you can get a fair idea of what should be done and what should not be while doing a program related to performance issue.
Also you can have number of function module and BAPI where you can get the sales order details. You can try with u2018BAPISDORDER_GETDETAILEDLISTu2019.
Regards,
Selva K. -
RA for sales order and RA for project
Hi,
What is the technical difference between these two RA methods, while sales order is linked to project.
Can any one brief some detail .
ZinniRA is a methodology and can be used for any cost collector - you can see various posts or go to SAP help to understand what RA is.
When Sales Order is a cost collector then you can use RA on sales order
When Project is a cost collector then you use RA on WBS element
By cost collector I mean the object that is being used to collect all costs (and revenue)
When project is linked to sales order then the project object is used as a cost collector, hence RA on sale sorder is not required
Maybe you are looking for
-
Video capture device Plextor PX-AV200U doesn't work
Hello there. This is the last piece of HW that I still didn't manage to work with linux. I bought it few years ago, when I used windows and I'm trying to make it work since I started to use linux 3 years ago. My dmesg output is: usb 1-10: new high sp
-
How do you stop downloading file from hyperlinks
Sometimes I click a hyperlink and a file starts to download. Is there a way to have a confirmation screen ask if I would like to download this file. I hate that is just does it. It would stop a a lot of garbage in my download folder too.
-
How to use zen micro on my Apple
I don't know how to get my emac to recognize my mp3 player
-
I have an ImageView which contains an Image that has transparency. The default behavior for ImageView is to not fire mouse events on parts of the image that are fully transparent. However, I want events on all pixels in the image, regardless of their
-
Is there Any better Developer tools than Report6i/Form6i
Hi Is ther any other Editior Similar to TOAD(pl/sql Developer) Which can ease the development by popping the method/properties