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

select statement to filter Z objects

Former Member
0 Likes
2,197

I have a table which contains list of dataelements , domains etc.. the table contains all SAP standard objects as well as custom developed (starting with Z or Y) .

I want to select only objects starting with Z or Y.

can any one let me know how can I write select statement which retrieve all objects starting with Z and Y.

and also can you tell me in case if i have selected all the objects in the internal table  how can filter these objects using loop statement.

Moderator message: very basic and frequently discussed, please search for information before posting.

Message was edited by: Thomas Zloch

1 REPLY 1
Read only

RicardoRomero_1
Active Contributor
0 Likes
890

Hi,


Try with this code:

   REPORT  ztest_ric.

  TABLES: tadir.

  SELECT OBJ_NAME INTO tadir-OBJ_NAME
   FROM tadir
   WHERE PGMID EQ 'R3TR'
     AND OBJECT EQ 'DTEL'  "For data elements...
     AND ( OBJ_NAME LIKE 'Z%' OR OBJ_NAME LIKE 'Y%' ).

   WRITE:/ tadir-OBJ_NAME.

  ENDSELECT.

To do a loop you can use :

LOOP AT lt_my_table WHERE obj_name(1) EQ 'Z' OR obj_name(1) EQ 'Y'.

ENDLOOP.

Regards,