‎2007 Jun 19 6:57 AM
hi gurus,
i have one table say ztable...and i should create a dynamic selection screen which should populate the selection screen by the table field names.
example..if i have 3 fields im my table..my selection screen should have three selection option fields..and in future if i add one more field in my table it should automatically create another slection-option in selection screen..
thanks
jaideep
‎2007 Aug 13 6:47 AM
hi everyone
i have a similar problem it cud be of gr8 help if anyone can help me on this
Thanks
cnu
‎2007 Aug 13 6:54 AM
Hi,
This can solve your problem, but I dontthink its an IDEAL solution.
Use the statement
SELECTION-SCREEN BEGIN OF SCREEN 9001.
*Here give the list of SELECT-OPTIONS and
PARAMTERS as you wish for the table.
SELECTION-SCREEN END OF SCREEN.
Then once the FIELDS are selected to be displayed.
Use
CALL SELECTION-SCREEN 9001.
And then use
LOOP AT SCREEN.
Here hide the fields that you dont want
Or Activate the fields you want.
ENDLOOP.
Screen 9001 will not be shown till the point you use CALL SELECTION-SCREEN
Regards,
Sesh
‎2007 Aug 13 7:05 AM
HI,
for this kind of requirement u need to create a dynamic program.for that u need to use the function module RSS_TEMPLATE_INSTANTIATE.see the doccumentation of the funtion module.
REPORT ZDYN_SELSCR.
DATA:T_ABAPSOURCE LIKE ABAPSOURCE OCCURS 0 WITH HEADER LINE.
"table which holds the sorce code for dynamic selection screen creation
CALL FUNCTION 'RSS_TEMPLATE_INSTANTIATE'"function module for creating the program dynamically to create dynamic sel screen
EXPORTING
I_TEMPLATE = '<b>ZDYN_TEMP</b>' "template(include program)
I_PROGRAM_NAME = 'ZDYN_PROG' "program that is to be created dynamicaly to create sel screen(this is just name)
I_PROGRAM_TYPE = '1' "type '1' indicates EXECUTABLE program
I_META_OBJECT = 'MARA' "meta object(give ur table name)
TABLES
E_T_PROGRAM_SOURCE = T_ABAPSOURCE. "this table holds the source code to create sel screen
INSERT REPORT 'ZDYN_PROG' FROM T_ABAPSOURCE."inserting source code into program from table
GENERATE REPORT 'ZDYN_PROG'. "generating the dynamically generated program
SUBMIT ZDYN_PROG VIA SELECTION-SCREEN AND RETURN.
<b>ZDYN_PROG</b>:
*@data: tabname like dfies-tabname.
*@DATA:H_NUM(3) TYPE N VALUE 1.
*@DATA:SEL_OPT(8).
*@DATA:FT_ZTMW_HEADER_COM TYPE DFIES OCCURS 0 WITH HEADER LINE.
*@tabname = i_meta_object.
REPORT z\i_meta_object\.
tables:\i_meta_object\.
*@call function 'GET_FIELDTAB'
*@ exporting
*@ only = 'X'
*@ tabname = tabname
*@ withtext = ' '
*@ tables
*@ fieldtab = FT_ZTMW_HEADER_COM
*@ exceptions
*@ internal_error = 1
*@ no_texts_found = 2
*@ table_has_no_fields = 3
*@ table_not_activ = 4
*@ others = 5.
*@LOOP AT FT_ZTMW_HEADER_COM.
*@CONCATENATE 'HEAD' H_NUM INTO SEL_OPT.
select-options \SEL_OPT\ for \tabname\-\FT_ZTMW_HEADER_COM-FIELDNAME\.
*@H_NUM = H_NUM + 1.
*@ENDLOOP.
at selection-screen output.
*@H_NUM = 1.
*@LOOP AT FT_ZTMW_HEADER_COM.
*@CONCATENATE 'HEAD' H_NUM INTO SEL_OPT.
%_\SEL_OPT\_%_APP_%-TEXT = '\FT_ZTMW_HEADER_COM-SCRTEXT_s\'.
*@H_NUM = H_NUM + 1.
*@endloop.
<b>reward if helpful.</b>
rgds,
bharat.
Message was edited by:
Bharat Kalagara