‎2012 Oct 14 5:34 AM
I have the following requirement.
there is a table which stores all the information about a Table or structure in SAP.
when User enters a structure or table name on selection screen,
1 The user needs to retrieve all custom(Z or Y) dataelemets and domains names from a table or structure which is entered on screen.
2 When the user gives for example Z* all the custom dataelemts and domains names must be selected in to internal tables.
3.There should also be NOintervels option for selectoption on selection screen.
Can anyone let me know efficient select queries for above of them.
‎2012 Oct 14 7:06 AM
Hi Kiran,
You can use the code given below as I have already encountered almost same but different requirement.
*Global structured data type declaration
TYPES : BEGIN OF GTY_TABDETAILS,
TABNAME TYPE DD03L-TABNAME,
FIELDNAME TYPE DD03L-FIELDNAME,
KEYFLAG TYPE DD03L-KEYFLAG,
ROLLNAME TYPE DD03L-ROLLNAME,
DATATYPE TYPE DD03L-DATATYPE,
DOMNAME TYPE DD03L-DOMNAME,
END OF GTY_TABDETAILS.
*Intenal table and work area declaration
DATA : GT_TABDETAILS TYPE STANDARD TABLE OF GTY_TABDETAILS,
GW_TABDETAILS TYPE GTY_TABDETAILS.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_TAB FOR GW_TABDETAILS-TABNAME NO INTERVALS OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
*Initializing the tables, work areas and variables
INITIALIZATION.
CLEAR : GT_TABDETAILS, GW_TABDETAILS.
TOP-OF-PAGE.
WRITE : / 'Field Name',
20 'Key Field',
35 'Data Element',
60 'Data Type',
80 'Domain Name'.
START-OF-SELECTION.
SELECT TABNAME FIELDNAME KEYFLAG
ROLLNAME DATATYPE DOMNAME
FROM DD03L
INTO TABLE GT_TABDETAILS
WHERE TABNAME IN S_TAB.
LOOP AT GT_TABDETAILS INTO GW_TABDETAILS.
WRITE : / GW_TABDETAILS-FIELDNAME UNDER 'Field Name',
GW_TABDETAILS-KEYFLAG UNDER 'Key Field' CENTERED,
GW_TABDETAILS-ROLLNAME UNDER 'Data Element',
GW_TABDETAILS-DATATYPE UNDER 'Data Type',
GW_TABDETAILS-DOMNAME UNDER 'Domain Name'.
ENDLOOP.
Hope its useful. Do reward if you find helpful or correct.
Thnaks & Regards,
Varun Kumar Sahu
‎2012 Oct 14 10:19 AM
For Step 1 use of FM DDIF_DTEL_GET, as it will give you every information required in next steps, you only will have to code some LOOP. Also what did you not code successfully, can you post your actual code, did you read the Rules of Engagement ?
Regards,
Raymond