‎2012 Oct 16 5:12 PM
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
‎2012 Oct 16 5:21 PM
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,