I would be very grateful for your help. I want to dynamically create the where clause of a select statement. I...
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
am able to do it when the actual where clause is static but it fails when using results from an internal table.
* define the internal table which will
* hold the where clause
data w_clause_b(80) occurs 10 with header line.
data : count_rec type i.
* select the transaction which will be * used in the select statement
select-options: s_trx for tstc-tcode no intervals obligatory
move 'tcode in s_trx' to where_tab.
SELECT COUNT( * ) INTO COUNT_REC
WHERE STARTDATE GE RAW_DATE_FR
AND STARTDATE LE RAW_DATE_TO
It works when I use:
concatenate 'tcode =' '''VA01''' into where_tab separated by space.
I have also tried various combinations including:
concatenate 'tcode in' s_trx into where_tab separated by space.
I can't tell why yours isn't working! I've created the following small program which does pretty much what yours does and it works fine.
DATA where_tab(80) OCCURS 10 WITH HEADER LINE.
DATA : count_rec TYPE i.
SELECT-OPTIONS: s_trx FOR tstc-tcode NO INTERVALS OBLIGATORY
MOVE 'tcode in s_trx' TO where_tab.
SELECT COUNT( * ) INTO count_rec
Dig Deeper on SAP interface technologies
Related Q&A from Matthew Billingham
An SAP user is trying to run a report in an SAP ALV Grid online and wants to know how to get the data in the report to appear along with the header.continue reading
An SAP user needs information on how to change the password on several SAP user accounts from a central location.continue reading
An SAP user needs to transfer customer purchase order spreadsheet data to SAP VA01 to create a new sales order.continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.