Need to define selection criteria
How can i define OITL.DocDate<= as a selection criteria instead of a static value in this query
SELECT
OLCT.Location,OWHS.WhsName
,OBTN.DistNumber,SUM(OBTN.Balance)Balance
,OPCH.DocDate,OPCH.DocNum,OPCH.NumAtCard,OPCH.CardCode+' - '+OPCH.CardName,PCH1.Dscription
FROM
OPCH
INNER JOIN PCH1 ON OPCH.DocEntry=PCH1.DocEntry
INNER JOIN PDN1 ON PCH1.BaseType=PDN1.ObjType AND PCH1.BaseEntry=PDN1.DocEntry AND PCH1.BaseLine=PDN1.LineNum
INNER JOIN OITL ON PDN1.ObjType=OITL.DocType AND PDN1.DocEntry=OITL.DocEntry AND PDN1.LineNum=OITL.DocLine
INNER JOIN ITL1 ON OITL.LogEntry=ITL1.LogEntry AND OITL.ItemCode=ITL1.ItemCode
INNER JOIN (
SELECT
OBTN.AbsEntry,OBTN.DistNumber,SUM(ITL1.Quantity)[Balance],OBTN.U_RefID
FROM
OBTN
INNER JOIN ITL1 ON OBTN.AbsEntry=ITL1.MdAbsEntry
INNER JOIN OITL ON ITL1.LogEntry=OITL.LogEntry AND ITL1.ItemCode=OITL.ItemCode
where OITL.DocDate<= '20140331'
GROUP BY
OBTN.AbsEntry,OBTN.DistNumber,OBTN.U_RefID
)OBTN ON ITL1.MdAbsEntry=OBTN.AbsEntry
INNER JOIN OWHS ON PCH1.WhsCode=OWHS.WhsCode
INNER JOIN OLCT ON PCH1.LocCode=OLCT.Code
WHERE OBTN.Balance>0
GROUP BY OLCT.Location,OWHS.WhsName,OBTN.DistNumber,OPCH.DocDate,OPCH.DocNum,OPCH.NumAtCard,OPCH.CardCode,OPCH.CardName,PDN1.DocEntry,PCH1.Dscription
ORDER BY PDN1.DocEntry
Hi,
Try this query:
declare @date as datetime
set @date = ( select max(T0.[DocDate]) from OITL T0 where T0.[DocDate] <= [%0])
SELECT
OLCT.Location,OWHS.WhsName
,OBTN.DistNumber,SUM(OBTN.Balance)Balance
,OPCH.DocDate,OPCH.DocNum,OPCH.NumAtCard,OPCH.CardCode+' - '+OPCH.CardName,PCH1.Dscription
FROM
OPCH
INNER JOIN PCH1 ON OPCH.DocEntry=PCH1.DocEntry
INNER JOIN PDN1 ON PCH1.BaseType=PDN1.ObjType AND PCH1.BaseEntry=PDN1.DocEntry AND PCH1.BaseLine=PDN1.LineNum
INNER JOIN OITL ON PDN1.ObjType=OITL.DocType AND PDN1.DocEntry=OITL.DocEntry AND PDN1.LineNum=OITL.DocLine
INNER JOIN ITL1 ON OITL.LogEntry=ITL1.LogEntry AND OITL.ItemCode=ITL1.ItemCode
INNER JOIN (
SELECT
OBTN.AbsEntry,OBTN.DistNumber,SUM(ITL1.Quantity)[Balance]
FROM
OBTN
INNER JOIN ITL1 ON OBTN.AbsEntry=ITL1.MdAbsEntry
INNER JOIN OITL ON ITL1.LogEntry=OITL.LogEntry AND ITL1.ItemCode=OITL.ItemCode
where OITL.DocDate<= @date
GROUP BY
OBTN.AbsEntry,OBTN.DistNumber
)OBTN ON ITL1.MdAbsEntry=OBTN.AbsEntry
INNER JOIN OWHS ON PCH1.WhsCode=OWHS.WhsCode
INNER JOIN OLCT ON PCH1.LocCode=OLCT.Code
WHERE OBTN.Balance>0
GROUP BY OLCT.Location,OWHS.WhsName,OBTN.DistNumber,OPCH.DocDate,OPCH.DocNum,OPCH.NumAtCard,OPCH.CardCode,OPCH.CardName,PDN1.DocEntry,PCH1.Dscription
ORDER BY PDN1.DocEntry
Thanks & Regards,
Nagarajan
Similar Messages
-
BPL - Define Selection Criteria (Selection Exit)
We are using TDMS 3.0 with following patch level:
DMIS 2006_1_700 0010
DMIS_CNT 2006_1_700 0010
DMIS_EXT 2007_1_700 0000
We have a scenario where we want to transfer all sales transactions of particular plant in target system. We have selected package BPL scenario in TDMS with business context sales document.
Under 'Define selection criteria' activity, we are getting only sales Document number as a filter criteria. We can extend the filter criteria to any column of table VBAK, but not any of the dependent tables (Like VBAP - containing plant)
The operation guide shows an example of selection criteria for materials, filtering by the start table (MARA-MATNR) and at the same time by a dependent table (MARC-WERKS). I want to apply the same logic to tables VBAK & VBAP. There are two problems in my way:
1. As per operation guide, when you execute 'Define Selection Criteria', we should see three tab pages. 'Selections', 'Selection criteria' & 'Tables'. But I can see only two in my system i.e 'Selection criteria' & 'Tables'. There is no 'Selection' tab page in my system.
2. Referring to forum Re: BPL: Filtering depending tables , we can use 'Selection Exit'. But can anybody guide me how that can be implemented and attached to the filter / process?
Thanks & Regards,
Audy.Hi again.
Forum rules do not allow more than one question in the same thread, but anyway...
TDMS BPL works by direct inserts in the database, so functional dependencies are not checked. This means that in VA01 you cannot create a sales order for a customer that does not exist but with BPL you can, though later of course you'll have problems when checking the sales order in VA03 (this is just an example: in practice the sales order context by default also includes the relevant customers). Unlike archiving, where you cannot delete a customer if sales orders for that customer still exist, in TDMS there are no such checks. This means there is really no sequence: in the end everything will be there.
The direct inserts also mean that document numbers are kept the same, so existing objects with the same number are overwritten; check if that is a problem for you.
About the last part of your question: first, don't forget that BPL does not include customizing, so make sure it is already there; second, BPL contexts are designed to include most tables related to a business process, but as you know R/3's data model is quite complex. After the copy you might realize that for your specific process maybe some tables were not considered. In that case I suggest you complain via OSS so that the context can be improved and we all profit.. ;). You must also be careful if you have Z tables that must be added to the context.
Regards,
Rui Dantas -
Add selection criteria to Billing due date list VF04
Dear gurus,
I need to execute report VF04 but looking sales documents by material. is there any enhacement point or user-exit to add this option to program?
Thank in advance.
Best regards
JuanHi,
Take a copy of the program SDBILLDL.
Add the field as a parameter ocr select option.
(1). In ex line 565 add following:
LOOP AT p_gt_fvkdfi.
CLEAR vbak.
LOOP AT s_ernam.
DELETE s_ernam.
ENDLOOP.
ENDIF.
SELECT SINGLE ernam
INTO ( VBAK-ERNAM)
FROM vbak WHERE vbeln = p_gt_fvkdfi-vbeln
AND ernam IN s_pernam.
IF sy-subrc NE 0.
DELETE p_gt_fvkdfi.
CONTINUE.
ENDIF.
ENDLOOP.
Create your own transaction code to this report instead of VF04.
(2).
What you can do is use user exits, USEREXIT_VKDFS_SORTKRI_SALES and USEREXIT_VKDFS_SORTKRI_DEL in V05IEXIT for sales and delivery related billing respectively. All you need to do is to load the user name into VKDFS-SORTKRI and that should be it.
(3).
http://saptechsolutions.com/pdf/SDBillingDocumentConsolidationAndSplit.pdf
(4).please chec for OSS notes.
(5).SPRO IMG -> Sales and Distribution -> Billing -> Lists -> Define Selection Criteria
regards
balajia. -
How to use a subreport field as selection criteria for the main report
Dear All,
I created a report with one subreport and im comparing information from both reports but i need to apply selection criteria in the main report using one of the fields in the subreport, the problem is that the subreport field doesnt appear in the select expert screen. By any chance, someone knows how make a subreport field be used by the select expert.
Thanks,
Martha MedranoDear Dom,
I created the subreport table called IIM (748 items) in sql in the main report as you suggested with the below code:
SELECT "IIM"."IPROD", "IIM"."IDESC", "IIM"."IID"
FROM "S102F360"."BPCS405CDF"."IIM" "IIM"
WHERE NOT ("IIM"."IDESC" LIKE 'GEN%' OR "IIM"."IDESC" LIKE 'OBS%') AND "IIM"."IID"<>'IZ' AND "IIM"."IPROD" LIKE '3%'
and i have another table called ITEM_MASTER (3221 items):
SELECT "ITEM_MASTER"."ITEM_ID", "ITEM_MASTER"."DESCRIPTION"
FROM "WHSPRO"."dbo"."ITEM_MASTER" "ITEM_MASTER"
ORDER BY "ITEM_MASTER"."ITEM_ID"
and im trying to display all items in the ITEM_MASTER table that are not in the IIM file but i haven't been able to accomplish this, i am using as primary the ITEM_MASTER table with 'Inner Join' as Join Type, and '!=" as Link Type. Do you have any ideas on how can i display the requested items.
Thanks for your help -
User Exit to add user-defined selection critieria onto VL10G
Does anyone know how to add user-defined selection criteria onto <b>VL10G</b> - Sales and purchase order display screen? OSS note <b>524424</b> states the userexit to transfer user-defined selection criteria from the selection screen to the report but no information on how to add the selection criteria on the screen. Is that something can be done through configuration or user-exit?
Any advice or sample is greatly appreciated.I was in a hurry, I forgot to add, the user role specific selection screen assignment to VL10G is done at "delivery scenario" level
The delivery scenarios that are predefined in the system can be found under Logistics Execution -> Outbound Process -> Goods Issue for Outbound Delivery -> Outbound Delivery -> Create -> Collective Processing of Documents for Shipment.
You can make the following settings in a delivery scenario:
<b>Selection screen</b>
You can use the selection screen parameters to define the appearance of the selection screen used to select the delivery list.
There are three combinations of selection parameters available that each include a different number of tabs.
A long selection screen with no tabs
A selection screen with three tabs
A selection screen with six tabs
The selection criteria is the same on all three screens in the standard system, it is simply arranged differently.
This parameter also triggers scheduling of the report for processing the delivery list, with the same three available tab options.
Customer enhancements are also possible in the LV50R_PREFZ1 program, which should be triggered from a delivery scenario.
<b>User role</b>
In the standard system, a predefined user role is assigned to each delivery scenario. If necessary, you can copy these user roles into your own user roles, make changes as required, and then assign them to a delivery scenario of your choice.
If the user role assignment for a delivery scenario is changed in Customizing, the new settings are valid for all users that carry out this delivery scenario. -
Delivery List : Selection criteria in VA05
Hii
Can any body please solve this out?
1. In VA05, I want to set the date of present month. Like if I open that in august then the date range will show by default 01.08.09 initial and ending 31.08.09 and if I open that in september then it will be 01.09.09 and 30.09.09
Note - Display Variant is not working. Tell me some other tricks
2. In Further Select Criteria there is no criteria for plant. Is it possible to set Plant option over there?
Please solve the issue.
Thanks and Regards
SantanuHi
Plant can be added to the list of further selection criteria through configuration. Please follow the below process...
Goto IMG - Sales & Distribution - Sales - Lists - Define Selection Criteria - execute
In the screen - goto New Entries and add the following details..
1. Program Name - SAPMV75A
2. TRG (Transaction Group) - 0
3. Display Group - K
4. Event - SELK
5. It - 8
6. Field Name - WERKS
Enter the details and save the changes. Goto VA05 and you can see the field PLANT in the Fur Sel Criteria.
Thanks,
Ravi -
Enahancing Selection Criteria in MIRO
Hi,
We need, two additional selection criteria to be added on the selection screen (RM08RL82, 1000).
Please suggest a solution.
Thanks
~Sid
"Max Points Are Gaurenteed"Hi,
Two options :
Get the access key and change the slection cirteria.
or copy the program RM08RL82 as ZRM08RL82 and change the selction criteria and use an exit to trigger it.
Regards,
Madhu..!! -
Need to take part of selection criteria out of a custom report (R painter)
Hi Experts..
I have a requirement to hide cost elements/group which appear as part of selection criteria on our custom report (report painter) for projects.
1. Why this appears as part of the selection criteria as i did not find this defined in Edit --> General data selection. (I only found CO area, Valuation, Fiscal year, Period, and Object in there).
2. We have found a system performance issue when a user put in cost elements for selection. So I am required to take this out. I thought i can just take this out from General data selection.. If I can't find it in there, where would i be able to do that??
3. Suppose I would hide this selection by creating a screen variant.. I was looking in SHD0
but its not working with our Z T.Code...it display the error message "Variants are possible only for dialog transactions"... This does not seem to work with a custom t-code. Then how would I do this ????
Please help clarify on this ....
Thanks....
Monica
Edited by: Monica Kong on Aug 24, 2008 6:01 AMHi Monica,
I believe we have an executable report here...
go to se38 -> enter program name -> click on "attributes" button -> display
We can see the type as 'Executable' or 'Modulepool'
generally a selection screen is brought by using keywords 'Parameters' or 'select-options' in Executable programs and with screen in modulepool ..although we can use a combination of both in some cases
So in your program..
check for keywords
'Parameters'/'Select-options'
The best way to proceed is to press F1 on the field that needs to be removed from selection...note the details
"screen number" and "screen field"
(1)By default screen number = 1000 if it is an executable program
Now see the scrren field ..if it is select-options it will something like field-low or field-high
so in the report
search for field for cost center and group with keyword starting as parameters or select-options and comment the same
Remember to comment tte fields throughout the program since this field will be used in multiple locations
(2) if it is modulepool program note the screen number , go the program and screen and remove the field from screen painter and comment the fields where ever used in the program
Also note that using screen variant is a good option but done if user needs specific settings on a report or we need the original report as it is plus additional report with few variations
Hope it helps
Pls check and revert
Regards
Byju -
InfoSet - Z tables need to be appeared on the selection criteria
Hi ,
My requirement is to have Z table fields in the selection criteria in an info set.
Currently i have an info set which has only standard SAP fields for selection. I have couple of Z tables whose fields need to be included in the selection criteria. Based on the values selected, report has to be displayed. So i believe some code has to be added for it.
Can you please tell me how to add Z Fields in the query.
Thanks,
Sarika.Hi Sarika,
Again refer to the above link http://shafiq.us/sap/index.php?option=com_content&view=article&id=54:adhoc-query&catid=41:adhocquery&Itemid=61
Then go to heading "Ad-hoc Queries (Tcode: SQ01)"
Then see Step 6-b, this is where you specify which field will be displayed on selection screen. Follow the steps and I am sure you will be able to complete your requirement. -
Change to Selection criteria in Datasource, do we need to re-init?
Hello all,
We are planning to change the selection criteria for a datasource, we want the year to be one of the selection criteria so we can load data only for particular years.
Now this datasource is in production for some time, so once we do this change will we have to re-init the extractor or the delta that is working will keep working fine?
Please let me know.
Thanks,Hi Kiran
Its worth mentioning that if its a V3 datasource like logistics then you need to load the setup table with the required data before extraction.
Also ensure that the measures in your DSO are in overwrite mode unless the year that you are loading does not currently exists in the DSO. (ie. its a new year)
The Full Repair Request option is under the Scheduler menu on the infopackage.
Hope this helps. <removed by moderator>
If you need more help let me know.
Asif
Edited by: Siegfried Szameitat on Jun 15, 2009 5:17 PM -
Where is define Templates in Profit Center Report - Selection Criteria
Hello Experts,
where is define Templates in Profit Center Report - Selection Criteria Window ?
Dixit PatelDefine Templates in
Financials ->Cost Accounting -> Cost Centre Hierarchy -
BEx Selection Criteria need to be change
Hi friends,
I need to change the Bex Query Selection Criteria from Date to Year.
Kindly Help me out on this Issue.
Thanks in Advance
PriyankaHi,
Let the variable for 0CALDAY be ZVARDAY of Processing type Customer Exit Interval
Let the variable for 0CALYEAR be ZVARYER of User Entry single value
Add the 0CALYEAR to the Filter and attach the variable ZVARYER
Go to Cmod transaction and add the code to the variable exit
check the code with an Abap Consultant.
WHEN 'ZVARDAY'.
IF i_step = 2.
READ TABLE i_t_var_range INTO zrange
WITH KEY vnam = 'ZVARYER'.
lyear = zrange-low+0(4).
CONCATENATE lyear '0101' INTO l_s_range-low.
CONCATENATE lyear '1231' INTO l_s_range-high.
APPEND l_s_range TO e_t_range.
regards
Happy Tony -
Selection Criteria needs to be change
Hi,
I have one Bex query ZHR_PONT_R_TOTALLUMPDISCOUNT.
i want to change the selection screen from the Date to Year.
Can anybody help me out in this issue. How to change.
Thanks
PriyaHi,
Whappened while executing as per the previous thread:
Re: BEx Selection Criteria need to be change
Let me know the outcome.
Regards
Happy Tony -
Selection criteria is fiscal year/period but need to restrict KF by date
Hi,
I have query where selection criteria is based on fiscalyear/period and in result I need to have Netvalue for all the sales order by created on date for that fiscal year/period.
For eg if I have entered fiscal year/period as 008.2007, I should get net value for all the orders that have created on date between 08/01/2007 to 08/31/2007.
Can anyone help me about this please.Hi DV
Here is the code
put it in I_STEP=2
WHEN 'EXIT NAME"
READ TABLE I_T_VAR_RANGE INTO loc_var_range with key vnam = 'userinput variable name'
v_fiscal_year = loc_var_range-low_0(4)
v_period = loc_var_range-low+4(3)
CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = v_fiscal_year
I_MONMIT = 00
i_periv = Give your fiscal year variant name
i_poper = v_per
IMPORTING
e_date = v_date_beg
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4.
CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = v_fiscal_year
I_MONMIT = 00
i_periv = Give your fiscal year variant name
i_poper = v_per
IMPORTING
e_date = v_date_end
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4.
CLEAR s_range.
MOVE:
v_date_beg TO loc_range-low,
v_date_end TO loc_range-high.
loc_range-sign = 'I'.
loc_range-opt = 'BT'.
APPEND s_range TO e_t_range.
Thanks
Tripple k -
How to call the same query more than once with different selection criteria
Hi,
Please do anybody know how to solve this issue? I need to call one query with the fixed structure more than once with different selection criteria. For example. I have following data
Sales organization XX
Income 2008 Income 2009
Customer A 10 20
Customer B 30 0
Sales organization YY
Income 2008 Income 2009
Customer A 20 5
Customer B 50 10
Now, I need this. At the selection screen of query, user fill variable charakteristic "Sales organization" with interval XX - YY, than I need to generate two separate results per sales organization, one for Sales Organization XX and the second for SO YYwhich will be displayed each on separate page, where result for SO YY will be dispayed under result for SO YY. Are there some options how to do it for example in Report Designer or WAD or with programming? In Report Designer is possible to use one query more than once, but I dont know how to force each query in RD to display result only for one Sales Organization, which will be defined in selection screen.
Thank you very much
J.Hello,
thanks to all for cooperation. Finally we solved this issue with the following way..
User fill appropriate SO on the selection screen, which is defined as range. This will resulte, that selected SO are listed in report below each othe (standard behavior). Required solution we achieved with the Report Designer, we set page break under each Result row of RD. This caused, that report is divided into required part per SO, which are stated each on separate page.
J.
Maybe you are looking for
-
Unable to configure Request based provisioning in OIM 9.1.0.1
Hi, I have been trying to configure request based provisioning wherein Admin can request to provision a resource for a certain user. I have checked on the Auto Prepopulate and Auto Save options in the Process Definition. The problem which I am facing
-
Hi My apple tv 2 has been working fine for some time now, but as of last night when i turned off the ATV i hasn't been able to display a picture. The ATV shows the Apple logo as ussual when i turn it on, but afterwards the screen writes "no signal".
-
Data validation for Date Field in Web Dynpro ABAP
Hi , In my WDA i want to perform data validation for date filed. (i.e. While creating a new record i have to check the Start Date should be always lesser than End Date.) If u ll enter the wrong date it should validate the Date and throw an error mess
-
Plain HTTP Adapter - How to add CR/LF into Prolog?
Hi all! I have to do a multipart/formdata request to an external HTTP Server. This requires to set boundaries etc. AND to add Carriage Returns / Line Feeds into the HTTP-Body. I think I could solve the problem using the Prolog / Epilog functionality
-
somehow, my itunes is frozen due to an error message regarding something about quicktime, which the help line suggested I delete and then reinstall quicktime download specific software for ipod/itunes..I need help...