Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to insert code conditions ina QUERY

Former Member
0 Likes
2,407

Hi All,

I'm creating a Query to extract the data from EKKO, EKPO and EKKN.

here I have to insert a piece of code as checking below.

IF EKPO-KNTTP ne '   '.      "not equal to blank
extract the data from table EKKN.
ENDIF.

here I need your help like how to write this code in a Query.

Thanks,

Sunil Bodda.

Edited by: sunil bodda on Apr 15, 2009 12:05 PM

4 REPLIES 4
Read only

Former Member
0 Likes
1,099

select the query and go to QUERY in the menubar then goto more functions where you have an option display report name it will give you the report name.

Menubar ---> Quer ---> MoreFunctions ----> Display Reportname.

Goto SE80/SE38-->Report name and add the Codes in the program.

Regards,

gurpreet

Read only

Former Member
0 Likes
1,099

Hi,

In SAP Queries, all the code will be written in infosets. Identify under which event your code should be written and made it.

Once done, generate infoset and query in sequence and execute.

Regards,

Prasanth

Edited by: Prasanth Ponnaganti on Apr 15, 2009 2:02 PM

Read only

former_member655569
Participant
0 Likes
1,099

Hi Sunil,

You need to code it in infoset. follow the steps below.

1. Goto SQ02, enter your infoset.

2. Click on "Extras" button(above find button). On the next page you will find a "Code" tab.

3. Declare a constant as space. choose DATA in the drop down for coding section.

4. Choose "Record processing" or if any other appropriate choice from the drop down in the coding section.

5. CHECK EKPO-KNTTP EQ c_space. and write your code here.

Hope this helps.

Read only

Former Member
0 Likes
1,099

Hi Sunil,

To write any code in a query, please follow these steps :

1. Create InfoSet by using t-code SQ02 give the name of the Infooset

2. Select redio button direct read from table(Your table name).

3. Select redio button include all key feilds.

4. Press 'code' (Shift+f8) .

There you get ABAP Editor, here you can write your own code.

Thanks.

Regards,

Lokesh.