10-17-2008 8:35 AM
Hello to all,
is there a way to generate a selection screen popup at runtime dynamically?
Is there any guide, that explains how "generate dynpro" has to be used?
Thanks
Christian
10-17-2008 8:38 AM
Hello,
This there is an option with key word 'Window staring and window ending'.
or Creat the screen and call the screen when ever you want the selection screen.
10-17-2008 8:42 AM
Hello,
I know how to call a dynpro as popup.
But my problem is, that I have to generate this selection on runtime, as then all fields are known like Tx SE16.
regards
10-17-2008 8:57 AM
hi,
you can create a selection screen as a pop up using this code. Here 200 is just a arbitary screen number which i have given.
REPORT ZSDSDSD.
tables : vbak.
SELECTION-SCREEN BEGIN OF SCREEN 200 AS WINDOW.
SELECT-OPTIONS : s_vbeln FOR vbak-vbeln,
s_ernam FOR vbak-ernam,
s_erdat FOR vbak-erdat.
SELECTION-SCREEN END OF SCREEN 200.
CALL SELECTION-SCREEN '0200' STARTING AT 10 10.
10-17-2008 9:01 AM
Hello Rajneesh,
I'm looking for a way where the selection-fields could be defined at runtime.
Regards
10-17-2008 9:24 AM
HI,
you can define(not create) multiple selection screens and then call them according to your data or conditions . for example,
tables : vbak.
data flg type c value 'T'.
SELECTION-SCREEN BEGIN OF SCREEN 200 AS WINDOW.
SELECT-OPTIONS : s_vbeln FOR vbak-vbeln,
s_ernam FOR vbak-ernam.
SELECTION-SCREEN END OF SCREEN 200.
SELECTION-SCREEN BEGIN OF SCREEN 201 AS WINDOW.
SELECT-OPTIONS : s_vbeln1 FOR vbak-vbeln.
SELECTION-SCREEN END OF SCREEN 201.
if flg = 'Y'.
CALL SELECTION-SCREEN '0200' STARTING AT 10 10.
ELSE.
CALL SELECTION-SCREEN '0201' STARTING AT 10 10.
ENDIF.
10-24-2008 6:54 AM
Hello,
I looking for a way to create my own dynamic search help selection popup.(like fm F4IF_FIELD_VALUE_REQUEST).
So I have to generate the selection screen at runtime an display this as a poup.
Any ideas to solve this?
Regards Christian
10-24-2008 7:03 AM
Hello,
So you mean to say that u need of POP up window with the field and the search help.
10-24-2008 10:11 AM
10-30-2008 8:56 AM
Hi Christian,
at the moment I don´t have a solution for you but since 1 hour, I have nearly the same problem...
Perhaps I can give you an idea to solve it, but I am not sure if it works. I must test it for my own...
My plan is to build 1 Reports and a functionality to build a dynamic report, for example a persistent abap class.
-> Report A: executes the class (FM or something else) which generates the sourcecode of the dynamic Report.
-> The Class reads the metadata which fields are required on the dynamic selection screen (in my case from a database table)
-> Then I build a source code with correct syntax into an internal table, which contains the code of the selection-screen.
-> With this source code i generate a persistent report ( statement: insert report )...
-> Then Report A calls the generated Report via SUBMIT statement.
-> for the transport of the data from the selection screen of the "dynamic" Report to Report A
I would try to do use the ABAP-Memory...
-> perhaps it is necessary to generate an "empty" dynamic report with contains an selection screen
so that the compiler can check the submit statement. Then the "dynamic" report becomes overwritten
on execution of Report A.
I hope, this works 🐵
I would try it this way and post it later (next days) if it works...
Regards,
Oliver
Edited by: Oliver Seifer on Oct 30, 2008 10:02 AM
cause: posted wrong statement "generate report" instead of "insert report"
Edited by: Oliver Seifer on Oct 30, 2008 10:02 AM
10-30-2008 9:09 AM
Hello Oliver,
sorry that i didn't update this thread. I tried the way you described above and it works. Sometimes I get short dumps in the shared memory block. I didn't solve this yet.
I post you my code below:
DATA la_dssfield TYPE /XXX/zssys_dssfield.
CLEAR: wa_code, it_code.
CLEAR: Ranges.
wa_code = '*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'.
APPEND wa_code TO it_code.
wa_code = '*!!!!!! Generated program. Do not change anything!!!!'.
APPEND wa_code TO it_code.
wa_code = '*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'.
APPEND wa_code TO it_code.
wa_code = 'REPORT /XXX/ZSYS_GENSELSCREEN.'.
APPEND wa_code TO it_code.
**** Generate Tables Section
DATA lt_tmp_dssfield TYPE /XXX/ztsys_dssfield.
lt_tmp_dssfield[] = it_dssfield[].
**** Delete Parameters
DELETE lt_tmp_dssfield WHERE basictype EQ 'P'.
**** Delete Duplicates
SORT lt_tmp_dssfield BY reftable.
DELETE ADJACENT DUPLICATES FROM lt_tmp_dssfield COMPARING reftable.
**** Generate Tables Code
LOOP AT lt_tmp_dssfield INTO la_dssfield.
CONCATENATE 'TABLES' la_dssfield-reftable '.' INTO wa_code SEPARATED BY space.
APPEND wa_code TO it_code.
ENDLOOP.
**** Build Selection Screen
DATA: l_tabix(10) TYPE c,
l_type(128) TYPE c,
l_desc(10) TYPE c.
LOOP AT it_dssfield INTO la_dssfield.
l_tabix = sy-tabix.
CONDENSE l_tabix.
wa_code = 'SELECTION-SCREEN BEGIN OF LINE.'.
APPEND wa_code TO it_code.
CONCATENATE 'SELECTION-SCREEN COMMENT 1(32) cmt' l_tabix '.' INTO wa_code.
APPEND wa_code TO it_code.
CONCATENATE la_dssfield-reftable la_dssfield-reffield INTO l_type SEPARATED BY '-'.
CASE la_dssfield-basictype.
WHEN 'P'.
CONCATENATE 'PARAMETERS' la_dssfield-fieldname 'LIKE' l_type '.' INTO wa_code SEPARATED BY space.
WHEN 'S'.
CONCATENATE 'SELECT-OPTIONS' la_dssfield-fieldname 'FOR' l_type '.' INTO wa_code SEPARATED BY space.
WHEN 'V'.
CONCATENATE 'SELECT-OPTIONS' la_dssfield-fieldname 'FOR' l_type ' NO INTERVALS.' INTO wa_code SEPARATED BY space.
ENDCASE.
APPEND wa_code TO it_code.
wa_code = 'SELECTION-SCREEN END OF LINE.'.
APPEND wa_code TO it_code.
ENDLOOP.
**** Initialize Comment Fields
wa_code = 'INITIALIZATION.'.
APPEND wa_code TO it_code.
**** Set GUI-Status
MOVE 'SET PF-STATUS ''STATUS_1000'' OF PROGRAM ''/XXX/ZSYS_GENSELSCREEN''.' to wa_code.
APPEND wa_code to it_code.
**** Set title
DATA: l_stitle type string,
l_sprog type string,
l_stitletxt type string.
MOVE '''TITLE_1000''' To l_stitle.
MOVE '''/XXX/ZSYS_GENSELSCREEN''' to l_sprog.
CONCATENATE 'SET TITLEBAR' l_stitle 'OF PROGRAM' l_sprog 'WITH'
INTO wa_code SEPARATED BY space.
APPEND wa_code TO it_code.
CONCATENATE '''' i_title '''' into wa_code.
append wa_code to it_code.
MOVE '.' to wa_code.
APPEND wa_code TO it_code.
LOOP AT it_dssfield INTO la_dssfield.
l_tabix = sy-tabix.
CONDENSE l_tabix.
CONCATENATE 'cmt' l_tabix INTO l_tabix.
CONCATENATE l_tabix ' = ''' la_dssfield-descr '''.' INTO wa_code.
APPEND wa_code TO it_code.
ENDLOOP.
*** Start of Selection
* wa_code = 'START-OF-SELECTION.'.
* APPEND wa_code TO it_code.
**** AT SELECTION-SCREEN
wa_code = 'AT SELECTION-SCREEN.'.
APPEND wa_code TO it_code.
wa_code = 'DATA: okcode type SYUCOMM.'.
APPEND wa_code TO it_code.
wa_code = 'MOVE sy-ucomm to okcode.'.
APPEND wa_code TO it_code.
* Data types for shared objects
wa_code = 'DATA t_ranges TYPE ACE_FIELD_RANGES_T.'.
APPEND wa_code TO it_code.
wa_code = 'DATA wa_ranges LIKE LINE OF t_ranges.'.
APPEND wa_code TO it_code.
wa_code = 'DATA t_fldrange TYPE ACE_GENERIC_RANGE_T.'.
APPEND wa_code TO it_code.
wa_code = 'DATA wa_fldrange TYPE ACE_GENERIC_RANGE.'.
APPEND wa_code TO it_code.
* Read the input from the selection screen and
* store it in Shared Objects
LOOP AT it_dssfield INTO la_dssfield.
* Assign the fieldname in the variable
CONCATENATE 'wa_ranges-fieldname = '''
la_dssfield-fieldname '''.'
INTO wa_code SEPARATED BY space.
APPEND wa_code TO it_code.
wa_code = 'REFRESH t_fldrange.'.
APPEND wa_code TO it_code.
* Processing for SELECT-OPTIONS
* Loop and move data to the shared memory
IF la_dssfield-basictype EQ 'S'
OR la_dssfield-basictype EQ 'V'.
CONCATENATE 'LOOP AT ' la_dssfield-fieldname '.'
INTO wa_code SEPARATED BY space.
APPEND wa_code TO it_code.
wa_code = 'CLEAR wa_fldrange.'.
APPEND wa_code TO it_code.
CONCATENATE 'MOVE-CORRESPONDING ' la_dssfield-fieldname 'TO' 'wa_fldrange.'
INTO wa_code SEPARATED BY space.
APPEND wa_code TO it_code.
wa_code = 'APPEND wa_fldrange TO t_fldrange.'.
APPEND wa_code TO it_code.
wa_code = 'ENDLOOP.'.
APPEND wa_code TO it_code.
wa_code = 'wa_ranges-fieldrange[] = t_fldrange[].'.
APPEND wa_code TO it_code.
wa_code = 'APPEND wa_ranges TO t_ranges.'.
APPEND wa_code TO it_code.
ELSEIF la_dssfield-basictype EQ 'P'.
* Processing for PARAMETERS
wa_code = 'CLEAR wa_fldrange.'.
APPEND wa_code TO it_code.
* Process if the parameter is not initial
CONCATENATE 'IF ' la_dssfield-fieldname 'IS NOT INITIAL.'
INTO wa_code SEPARATED BY space.
APPEND wa_code TO it_code.
wa_code = 'wa_fldrange-sign = ''I''.'.
APPEND wa_code TO it_code.
wa_code = 'wa_fldrange-option = ''EQ''.'.
APPEND wa_code TO it_code.
CONCATENATE 'wa_fldrange-low = ' la_dssfield-fieldname '.'
INTO wa_code SEPARATED BY space.
APPEND wa_code TO it_code.
wa_code = 'APPEND wa_fldrange TO t_fldrange.'.
APPEND wa_code TO it_code.
wa_code = 'ENDIF.'.
APPEND wa_code TO it_code.
wa_code = 'wa_ranges-fieldrange[] = t_fldrange[].'.
APPEND wa_code TO it_code.
wa_code = 'APPEND wa_ranges TO t_ranges.'.
APPEND wa_code TO it_code.
ENDIF.
ENDLOOP.
wa_code = 'DATA: area type ref to /XXX/zsmasys_genselscreen.'.
APPEND wa_code TO it_code.
wa_code = 'DATA root type REF to /XXX/zclsys_genselscreen.'.
APPEND wa_code TO it_code.
* Get ref to the shared memory
wa_code = 'area = /XXX/zsmasys_genselscreen=>attach_for_write( ).'.
APPEND wa_code TO it_code.
wa_code = 'create object root area handle area.'.
APPEND wa_code TO it_code.
* Store the value in memory
wa_code = 'root->set_fields( t_ranges ).'.
APPEND wa_code TO it_code.
* Store ok_code in memory
wa_code = ' root->set_okcode( okcode ).'.
APPEND wa_code TO it_code.
wa_code = 'area->set_root( root ).'.
APPEND wa_code TO it_code.
* Commit and detatch
wa_code = 'area->detach_commit( ).'.
APPEND wa_code TO it_code.
* Quit the program: Return to the main code
wa_code = 'LEAVE PROGRAM.'.
APPEND wa_code TO it_code.
* Generate the report program
INSERT REPORT '/XXX/ZSYS_GENSELSCREEN' FROM it_code.
COMMIT WORK.
* Execute the report
SUBMIT /XXX/zsys_genselscreen VIA SELECTION-SCREEN AND RETURN.
Importing parameters are:
it_dssfield type /XXX/zTsys_dssfield
i_title type title_txt
/XXX/ztsys_dssfield has the following line structure:
FIELDNAME CHAR08
REFTABLE TABNAME
REFFIELD FIELDNAME
BASICTYPE CHAR01
DESCR CHAR30_BRO
I hope It helps you!
I'm looking for a way to do the same in a selection-screen Pop-Up.
For further questens contact me!
Regards Christian
10-30-2008 9:39 AM
Hi Christian,
what a nice surprise.
Thank you very much for your source code.
I think I can use some parts of it - unfortunately our basis release does not support shared objects
That´s why I "want" to use ABAP-Memory...
With regards,
Oliver
10-30-2008 9:42 AM