SQ01 query on LDB BRF with selection criteria on BSEG
Dear all,
we built an inofset on LDB BRF (BKPF - BSEG) and a query with selection criteria based on both BKPF and BSEG tables.
My proble : when the query select a posting fullfilling header data selection criteria but not line item criteria, it still displayed the header data in the layout.
We set up a filter on the account to hide results where account is blank but we loss the filter exporting the result on access. So if anyome has a better idea, we'll be very thankfull.
Br,
Hi Rick,
What Edan proposed will work as logical AND (both filters on dates will be checked simultaneously).
Here is a solution.
Youll have a user entry variable on 0CALDAY.
- Create a new variable on 0CALDAY, customer exit, mandatory, not ready for input. This variable should return the date entered in user entry variable.
- Create a structure in columns.
- New selection (lets name it chg). Put there your KF and your Change date char. Restrict it by the user entry var. Hide it.
- New selection (lets name it crt). Put there your KF and your Created on date char. Restrict it by the customer exit var. Hide it.
New formula (lets name it FilteredAmount):
( 'chg' <> 0 ) * 'chg' + ( 'crt' <> 0 ) * 'crt'
Create a condition:
FilteredAmount <> 0.
Best regards,
Eugene
Similar Messages
-
How to specify custom query as well as a selection criteria
Hi
I'm struggling to specify a custom select query with variable no. of agruments through toplink.
The custom query looks like:
select outer.col1, outer.col2, outer.col3,
outer.effective_date, outer.capacity_rate, outer.expiry_date, outer.comments, outer.create_date,
outer.create_user_id, outer.modify_date, outer.modify_user_id, outer.vol_uom_type_code
from tbl outer,
( select max(effective_date) effective_date, col1, col2, col3 from tbl
where expiry_date is null
or (trunc(effective_date) >= to_date('01/01/'||to_char(sysdate,'yyyy'), 'dd/mm/yyyy') )
group by col1, col2, col3
) inner
where outer.col1 = inner.col1
and outer.col2 = inner.col2
and outer.col3 = inner.col3
and trunc(outer.effective_date) = trunc(inner.effective_date)
My domain class TBL.class is mapped one to one with DB Table TBL.
With this customer query, I want to add a selection criteria depending upon what is specified on the UI-screen - I can get col1, col2 or a combination of these as search criteria.
So far I have tried multiple approaches:
1. Specifying the custom query (without arguments) as a ReadAll Query in toplink descriptor and then using expression builder to add the criteria but this doesn't work as custom ReadAll query gets overridden and i get back all the results from
TBL which match the criteria specified.
expFinal = new ExpressionBuilder().get("col1").equal(srchCriteria.getCol1());
results = (List) getTopLinkTemplate().readAll(TBL.class,expFinal,false);
2. Using Named Query:
Toplink doesn't allow me to specify a custom SQL along with a selection criteria - both for the same NamedQuery.
3. Specifying the DB query in java layer and then adding arguments and argument values. When query is executed, i don't see arguments being added.
ReadAllQuery query = new ReadAllQuery(TBL.class);
query.setSQLString(READ_ALL_QUERY);
ExpressionBuilder exp = new ExpressionBuilder();
query.addArgument("col1", Long.class);
Vector vect = new Vector();
vect.add(srchCriteria.getCol1());
query.addArgumentValues(vect);
result = (List) getTopLinkTemplate().executeQuery(query, false);
Please suggest. Would be great if you could share some code bits.
Thanks
NitinNitin,
This style of query does require code to apply logic as it is created. If you wish to have this used as a named query you can use a query re-direct so that instead of executing a query we call a method of yours.
You can setup your named query to use re-direction into a static method as:
QueryRedirector redirector = new MethodBaseQueryRedirector(QueryRedirectorExample.class, "redirectMethod");
ReadAllQuery raq = new ReadAllQuery(Employee.class);
raq.addArgument("FIRST_NAME");
raq.setRedirector(redirector);
descriptor.getDescriptorQueryManager().addQuery("findByFirstNameLike", raq);The static method that then gets invoked where you can dynamically create a query looks like:
public static Object redirectMethod(DatabaseQuery query, Record record, Session session) {
String firstName = (String)record.get("FIRST_NAME");
ReadAllQuery raq = new ReadAllQuery(Employee.class);
if (firstName != null) {
raq.setSelectionCriteria(raq.getExpressionBuilder().get("firstName").likeIgnoreCase(firstName));
return session.executeQuery(raq);
}Doug -
Portal Activity Report with Selection criteria
Hi All,
I have created an iview using 'Portal Activity Report' template, added the iview to page and page is added to the role which is created for this report. Also, users were assigned to the new role. When users go to portal and see this report, they are seeing the final output of this report along with the 'Download Report' option.
My requirement is to give selection screen option (Type of report and Reporting period) to users. So that users will change the selection criteria and run the report as per their need. Please advice me on how to do this.
Thanks in advance.
Swapna.swapna,
you can do this by creating a webdynpro application for accessing the database tables, the list of data base tables is in this [help |http://help.sap.com/saphelp_nw04/helpdata/en/48/6aa9429b930b31e10000000a1550b0/frameset.htm]document and use web dynpro application to connect to that tables. Check this thread for[ dynpro and database tables |dynpro and database tables;
regards
Mahesh -
A/r Invoice report query based on posting date selection criteria
Hi experts,
I am trying to write a query to get the A/r invoice report including Docnum, Docdate, cardname, project, linetotal, taxcode, taxtotal.
and i tried the below query
SELECT T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName],T1.[LineTotal] FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry WHERE T0.[DocDate] >=[%0] AND T0.[DocDate] <=[%1]
In this query ,
1) i am unable to sum up the linetotal( total before tax)
2) also unable to fetch the sum of taxamount.
3) its more important , the above query will me docnum , when i try to open that doc, it opens the 2007 docments. whereas the other details are correct like docdate, amount and all.
example: from date: 1/04/2011 to date: 28/07/2011
Docnum Docdate cardname linetotal.... etc
2 1/04/11 XYZ 5000
when i click the 2 (docnum) it opens me the 04/04/2007 documents.
how to limit the doc within the periods given?
thanks in advance
DwarakHi Rahul/Gordon,
thanks for your query's .
additionally, i want this query without the A/r invoices whichever having credit memo as target doc.
and
i have selection criteria as T0.[U_Sec_Category] = '[%2]' and this has 3 values like 1)CIM 2)BIN 3)DMP
among these CIM should be seen only only user1 and BIN & DMP only by user2.
can u plz get me this
thanks,
Dwarak -
Count() function with selective criteria?
I'm struggling with what I would expect to be a fundamental reporting concept in CR.
Suppose I have the following EMPLOYEE table:
u2022 EMPLOYEE.ID
u2022 EMPLOYEE.GENDER_CODE
u2022 EMPLOYEE.MANAGER_FLAG
I need to generate a statistical summary report containing the following:
u2022 Total number of Employees
u2022 Number of Male Employees
u2022 Number of Management Employees
This would be easy if I could just use a Count() function in the Function Workshop which
contained selective criteria. For example: Count ({EMPLOYEE.GENDER_CODE} = 'M')
But I can't figure out how to do this without getting a CR error message.
Record Selection doesn't work, because I need the whole data set.
Group Selection with Summaries doesn't work, because the gender and management
attributes are not mutually exclusive.
One solution that seems awkward to me is to create additional SQL commands in the
Database Expert using COUNT(*) and WHERE criteria to get the number of Males
and number of Managers. But I have to believe that there is a better way. Plus this
approach causes problems elsewhere in my report.
Am I missing something?
Thanks,
BillThanks Raghavendra!
The good news is that I was able to create a "1 or 0" formula and then sum the resulting values.
The bad news is that I'm only able to get this to work for part of my report.
I am joining two tables. As an example COMPANY and EMPLOYEE.
I can use "1 or 0" formulas on all of the employee statistics.
But I cannot do the same for company statistics, because the number of company records being assigned a 1 is being inflated by the join between the two tables.
I have achieved a successful result by using Running Total Fields at the end of the report.
But I want to place these summary statistics at the begining of my report. (Such as Total Companies in the Western Region.)
I tried to use "COMPANY.NAME = previous(COMPANY.NAME)" logic in my function, but then I was not allowed to summarize it.
Any ideas?
Thanks,
Bill -
Issue calling program from transaction with selection criteria
Hi Guys,
I ve a issue regarding calling a program from transaction.
There is a standard transaction calling a program using selection criteria no (say for eq 10 fields, just look at the eg below)
Submit <table-proname> and return using selection-set <table-varia>
With rbukrs = i_bkorm-burks Comp Code
with Revent = i_bkorm-event event
with rbelnr = ibkorm-belnr Doc no
with rgjahr = ibkorm-gjahr fiscal year
with ruzeit = ibkorm-ruzeit time
with rusnam = ibkorm-rusnam user name
And so on
Now, In my program selection screen i ve only three fields, (not all mentioned above)
Parameter:
Rbukrs type bukrs, comp code
Rbelnr type belnr, doc no
Rghar type gjahr. fiscal year
Now, i configure this transaction with this program i can able to run this program from transaction.
Is every thing go right, Pls give your sugg
Points & help awarded.
Thanks in advance.Hi,
you can call the program using 3 selection screen fields even though it is having 10 fileds, but before calling make sure that there is no mandatory fields (in rest of the 7 fields), then it will runs you report.
reward if needful.
Thanks,
Sreeram. -
Problem with Selection Criteria with 2 or statements.
I have a report with 2 or statements in the selection criteria:
like "US IT GFS INFOSYS*" or
like "US IT GFS INFOSYS*" or
like "US IT GFS INFOSYS*"
I am just trying to do do a count of records. The details has the record # and am doing a distinct count. If I rearrange this or statement, then I get a different count. The above statement gives me a count of 1136. If I rearrange the statement to:
like "US IT GFS INFOSYS*" or
like "US IT GFS INFOSYS*" or
like "US IT GFS INFOSYS*"
I only get 192 records. I don't understand why? Please help.Cara,
When Crystal evaluates an or statement it will stop evaluating after one of the clauses is true. Since the first or clause is returning data, true, it is not evaluating the other 2 clauses. When you change the order I am assuming that the first clause is returning data though different from the original record selection.
You may want to consider using a command object or stored procedure to generate the filter as SQL should evaluate all the or clauses. -
Performance problem with selecting records from BSEG and KONV
Hi,
I am having performance problem while selecting records from BSEG and KONV table. As these two tables have large amount of data , they are taking lot of time . Can anyone help me in improving the performance . Thanks in advance .
Regards,
PrashantHi,
Some steps to improve performance
SOME STEPS USED TO IMPROVE UR PERFORMANCE:
1. Avoid using SELECT...ENDSELECT... construct and use SELECT ... INTO TABLE.
2. Use WHERE clause in your SELECT statement to restrict the volume of data retrieved.
3. Design your Query to Use as much index fields as possible from left to right in your WHERE statement
4. Use FOR ALL ENTRIES in your SELECT statement to retrieve the matching records at one shot.
5. Avoid using nested SELECT statement SELECT within LOOPs.
6. Avoid using INTO CORRESPONDING FIELDS OF TABLE. Instead use INTO TABLE.
7. Avoid using SELECT * and Select only the required fields from the table.
8. Avoid nested loops when working with large internal tables.
9. Use assign instead of into in LOOPs for table types with large work areas
10. When in doubt call transaction SE30 and use the examples and check your code
11. Whenever using READ TABLE use BINARY SEARCH addition to speed up the search. Be sure to sort the internal table before binary search. This is a general thumb rule but typically if you are sure that the data in internal table is less than 200 entries you need not do SORT and use BINARY SEARCH since this is an overhead in performance.
12. Use "CHECK" instead of IF/ENDIF whenever possible.
13. Use "CASE" instead of IF/ENDIF whenever possible.
14. Use "MOVE" with individual variable/field moves instead of "MOVE-
CORRESPONDING" creates more coding but is more effcient. -
Form on a SQL Query - doesn't work with SELECT * - bug or feature ?
When I do this,
Create Page -> Page with Component -> Form -> Form on a SQL Query -> SELECT * FROM EMP
I do not get any items displayed and it creates a simple HTML region / page. Do we have to necessarily specify the column names ?
Iam looking at a way to see if any addition of columns in the table does not involve IT intervention in recreating the form.
When we try to create with Form on a SQL Query, then shouldn't it be similar to the Report where the same thing works, if I give SELECT function_returning_columns() from DUAL even then the same thing happens where it creates an ITEM called functions_returning_columns() it creates HTML region
I asked a related question with no answer :-( in
Dynamic Creation of Items in Runtime through Application UIHi Marc,
Thanks. I just tried something like this. Taking the EMP table example, (it doesn't matter which table), I created a region based on a Pl/Sql function returning SQL query
( I selected the vertical report template including nulls to display it like a form ) :
DECLARE
v_sql VARCHAR2(3000) ;
mn_idx NUMBER := 1 ;
BEGIN
v_sql := 'SELECT ' ;
FOR recs IN (SELECT * FROM ALL_TAB_COLUMNS WHERE TABLE_NAME = 'EMP' ORDER BY COLUMN_ID)
LOOP
v_sql := v_sql || 'HTMLDB_ITEM.TEXT(' || mn_idx || ',' ||
recs.column_name || ') ' || recs.column_name || ', ' ;
mn_idx := mn_idx + 1 ;
END LOOP ;
v_sql := SUBSTR(v_sql, 1, LENGTH(v_sql) -2) ;
v_sql := v_sql || ' FROM EMP WHERE EMPNO = 7369 ORDER BY 1 ' ;
RETURN v_sql ;
END ;
This allowed me to do my updates etc.., Then I created a button called 'Apply' and a process called 'update_changes' on button click and defined this:
DECLARE
v_sql varchar2(1000) ;
mn_ctr NUMBER := 1 ;
BEGIN
v_sql := 'BEGIN UPDATE EMP SET ' ;
FOR recs IN (select COLUMN_ID, COLUMN_NAME, DATA_TYPE
from all_tab_columns where table_name = 'EMP'
ORDER BY COLUMN_ID) loop
-- Make changes here if required- this is assuming 9 columns --
v_sql := v_sql || recs.column_name || ' = HTMLDB_APPLICATION.G_F0' || mn_ctr || '(1),' ;
mn_ctr := mn_ctr + 1;
end loop ;
v_sql := substr(v_sql, 1, length(v_sql) - 1) ;
v_sql := v_sql || ' WHERE EMPNO = 7369; END ;' ;
execute immediate (v_sql) ;
END ;
Since this is for example, I didn't include code for Checksum and hardcoded empno = condition and have provision for 9 columns. I made some changes and tried saving it and I was able to do it.
I altered the table to add a column / drop a column and when I relogin, Iam able to see the changes.
Can you tell me if there could be any drawbacks in this approach ?. -
Want to load data with selection criteria
Hi Everyone,
I want to load data from X ODS to Y ODS , X ods is a datasource to Y ods.
On Y ods i don't have any data loaded.
But on X ods i am having 10 requests with 200000 records.
In X ods i am having a request with 2 records.
I want to load the 2 records request to Y ODS.to check data on Y ods
Can anyone help me in solving these, b'cos i am new to BW, It's urgent Please.
Can you tell me step by step navigation.Hi,
Just select Full upload; it will bring the InfoPackage and then in the Selection tab give the range value. If this is required only one time then this method is fine or full load is fine, otherwise you will have to write a code to pick the records. If you frequently want to load data from one ODS to another ODS then better go for init and then from next time onwards do the delta load. If you don't want to provide selection in the InfoPackage then the other way is to load all the data from X to Y and do selective deletion on Y ODS.
Hope this helps.
PB -
SUBMIT RFGLBALANCE WITH selection criteria, then How to get resulted itab?
Hi Experts,
Am looking to develop a similar report which is doing by SAP at detail/item level, but am looking to develop a SUMMARY level.
SAP report is = FS10N (bhind prog. is RFGLBALANCE / RFGLITEMS )
my_alv = shuld show only TOTALS / SUMMARY line
Almost the selection screen is same in both cases.
So, I wanna to use the same prog. by using SUBMIT from my_alv_report.
So, when I use
SUBMIT RFGLBALANCE
WITH ..........................
WITH ........................
AND RETURN.
then, my_alv_report control goes to RFGLBALANCE prog. there my input is processed and the output internal table is populating in RFGLBALANCE.............so, now, I wanna to get / fetch / pull this populated internal table into my_alv_repor and there by using the same for my alv display.
( I know that, if both r Z prog.s/ Z_BAPIs, then, I can use EXPORT & IMPORT )
So, pls. let me know that,
Is it possible ?
If so, How to get it done?
SUBMIT Syntax pls.
thanqthanq.
so, then, Can I use like, *INCLUDE RFGLBALANCE*(Standard Prog.) in my_alv_report, I mean, like
report my_alv_report message-id Z1.
INCLUDE RFGLBALANCE.
own_Logic.
thanq -
How to ignore the selection criteria temporary page in print
Hi Experts,
I use 2007A and when i would like to print example a Trial Balance then the system prints the selection criteria on the first printed page .
How can I delete or ignore this option? There's no need for this print.
I was searching in help files but with no success.
Thanks,
EszterIn Administration > System Initialization > Print Preferences > General Tab
There is a checkbox for "Print SAP Business One Generation Message"
Uncheck it to not print the first page with selection criteria.
Hope this was what you were looking for. -
BW ignores selection criteria in a Infopackage after transport
Hi all,
After transporting Infopackages with selection criteria the target system ignores them. If I create further Infopackages on the target system everthing is fine. It seems as if the criteria were not transported but they are displayed. I replaced the criteria, saved the infopackage again but this didn't solve my issue.
We are using BW 7.0 Level 14.
Any ideas?
Many thanks, DennisHi Srini,
thanks for your quick repsonse. I am talking about 10 Infopackages. I transported some of them again but always the same issue. I created new infopackages on production and indeed it works but I use them in process chains and therefoe I might change the chains on production. This is something I don't want to do.
Any other ideas?
Cheers, Dennis -
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. -
Including User selection criteria along with LDB standard selection screen
Hi
While creating a HR report, along with the standard selection screen, if the cusomer requires some more fields to be added, How to retrive the data from the DB?
Is it the way to retrive the data based on Standard selection criteria from the LDB and then filter it based on user criteria or any other way?
Please help me out in this regard.
Thank you.Yes thats the way. You get the data based on Selection screen of LDB (You can select Report Catogory you wish to) once you get data, You can put CHECK statement to see the data against PXXXX type to the filter value from you custom field on selection screen.
Maybe you are looking for
-
How do I get a list of cameras names from MAX to use in a CVI app?
I wish to avoid any confusion in selecting cameras to use in my CVI application, so I'm looking for a way, from within my app, to get the list of camera names as set up in MAX. Then I can populate a listbox and the user can choose their camera withou
-
After installing Firefox v4 my Comcast and Norton tool bars were disabled, Firefox could not find an update and deemed them not compatible with v4. Do you have any information on getting this corrected. Right now I have no protection from Norton when
-
Adobe Captivate 7 Teacher & Student Subscription for Macs
Is there an Adobe Captivate 7 Teacher & Student Subscription for Macs? Also with Capitvate 7 Mac Edition work on a Mac running OX Mavericks 10.9?
-
Album tracks from 1 album are split up in the Library list
When I download a CD of a Musical, the album will be displayed in 5 or 6 spots in the Library with only a few of the tracks in each. How do I get all of the tracks (in the correct order) listed under just one album? Thanx, chicajill
-
Does anyone know if Apple allows a copy of iWork to be installed on a single user's desktop and laptop (when not used at the same time...like Adobe) or is the Family Pack what is needed to be able to install it on more than one machine?