07-25-2005 6:02 PM
Hi,
I want to create a screen with SE51 and design the fields in layout at runtime.
For example I got a Z table (let's call it ztab) that contains fields (zfld1, zfld2). I want to create a screen with these 2 fields as Input field. But if in the future I add a 3rd field I want my screen to able to take in account dynamically.
it's possible?
thanks,
joseph
07-25-2005 6:12 PM
07-25-2005 6:12 PM
07-25-2005 6:16 PM
Yes me too....
I was thinking: <b>if it was possible</b> so why every time that i add a field in table I have to refresh his view maintenance in se54?
I keep looking for an answer. If i find something i will let you know
07-25-2005 6:20 PM
using this screen what will you be doing? a report generation? maintenance utility? if so as i said before you could use
function module
RS_TABLE_LIST_CREATE
pass "ANZE" to action parameter and
the desired table name to the table_name parameter
or
use FM
VIEW_MAINTENANCE_CALL
with action parameter as 'U' for update
and view_name as the table name.
Regards
Raja
07-25-2005 6:27 PM
hi Raja,
I was just wondering how can I create a screen dynamically with se51.
When I look at the screen SAPLSSEL 1106 it's seems that it's possible.
07-25-2005 6:40 PM
i am also sure that it should be possible, otherwise how could se16, selection screen (1000),table maintenance generator, etc all gets created at runtime.
Regards
Raja
07-25-2005 6:50 PM
If you need to generate a selection dynamically, you could use the following functionality. These statements are reserved for SAP use only and is not recommended that you use them. SAP will probably not support any program using these.
report zrich_0001 .
data: programname type sy-repid,
program type table of progtab with header line.
data: syindex(5) type c.
data: mess(72), lin(72), wrd(72).
programname = 'ZRICH_0010'.
program = 'report zrich_0010.'. append program.
do 20 times.
syindex = sy-index.
shift syindex left deleting leading space.
concatenate 'select-options: s_' syindex into program.
concatenate program 'for sy-datum.' into program separated by space.
append program.
enddo.
syntax-check for program message mess line lin word wrd.
insert report programname from program.
submit (programname) via selection-screen and return .
delete report programname.
Regards,
Rich Heilman
07-26-2005 5:06 AM
Hi Joseph,
Here is the sample code for dynamic selection-screen.
START-OF-SELECTION.
PERFORM DYNAMIC_CODE.
FORM DYNAMIC_CODE.
APPEND 'REPORT ZSEARCH NO STANDARD PAGE HEADING.' TO ITAB.
APPEND 'TABLES : DD03L,DD02L.' TO ITAB.
DATA TAB LIKE TEXTPOOL OCCURS 0 WITH HEADER LINE.
APPEND 'SELECTION-SCREEN BEGIN OF BLOCK BLK' TO ITAB.
APPEND 'WITH FRAME TITLE TEXT-001.' TO ITAB.
DO P4 TIMES.
REC_CNT = SY-INDEX.
CONDENSE REC_CNT NO-GAPS.
IF P1 = 'X'.
CONCATENATE 'PARAMETERS:F' REC_CNT
' LIKE DD03L-FIELDNAME OBLIGATORY.'
INTO WA.
APPEND WA TO ITAB.
TAB-ID = 'S'.
CONCATENATE 'F' REC_CNT INTO WA.
TAB-KEY = WA.
CONCATENATE'$$$$$$$$' 'Field Name' REC_CNT INTO WA.
TAB-ENTRY = WA.
ENDIF.
IF P2 = 'X'.
CONCATENATE 'PARAMETERS:D' REC_CNT
' LIKE DD03L-ROLLNAME OBLIGATORY.'
INTO WA.
APPEND WA TO ITAB.
TAB-ID = 'S'.
CONCATENATE 'D' REC_CNT INTO WA.
TAB-KEY = WA.
CONCATENATE'$$$$$$$$' 'Data Element' REC_CNT INTO WA.
TAB-ENTRY = WA.
ENDIF.
IF P3 = 'X'.
APPEND 'SELECTION-SCREEN BEGIN OF LINE.' TO ITAB.
CONCATENATE 'SELECTION-SCREEN COMMENT (15) FOR FIELD DT'
REC_CNT '.' INTO WA.
APPEND WA TO ITAB.
CONCATENATE 'PARAMETERS:DT' REC_CNT
' LIKE DD03L-DATATYPE OBLIGATORY.'
INTO WA.
APPEND WA TO ITAB.
CONCATENATE 'SELECTION-SCREEN COMMENT (16) FOR FIELD SIZE'
REC_CNT '.' INTO WA.
APPEND WA TO ITAB.
CONCATENATE 'PARAMETERS:SIZE' REC_CNT
' LIKE DD03L-LENG OBLIGATORY.' INTO WA.
APPEND WA TO ITAB.
APPEND 'SELECTION-SCREEN END OF LINE.' TO ITAB.
TAB-ID = 'S'.
CONCATENATE 'DT' REC_CNT INTO WA.
TAB-KEY = WA.
CONCATENATE'$$$$$$$$' 'Data Type' REC_CNT INTO WA.
TAB-ENTRY = WA.
APPEND TAB.
TAB-ID = 'S'.
CONCATENATE 'SIZE' REC_CNT INTO WA.
TAB-KEY = WA.
CONCATENATE'$$$$$$$$' 'Len. of Field' REC_CNT INTO WA.
TAB-ENTRY = WA.
ENDIF.
APPEND TAB.
ENDDO.
APPEND 'SELECTION-SCREEN END OF BLOCK BLK.' TO ITAB.
ENDFORM. " DYNAMIC_CODE
09-28-2005 5:45 AM
Hi Rich
please can any one give me the sol,
i want to create the input fields, checkboxes on my screen dynamically. if materials are 10 i want to create 5 input fields for each material, if materials are 20 then for all 20 mat all fields are to be created with the values from program. how can i do this..tell me its very urgent..please can anyone... im new to this so i dont know how to open a new thread.. sorry
waiting for ur reply...
kumar
09-28-2005 5:53 AM
it is possible but not advisible to do like that according to sap
GENERATE - Generate a screen
Note
This statement is for internal use only.
Incompatible changes or further developments may occur at any time without warning or notice.
GENERATE DYNPRO h f e m ID g.
...MESSAGE F1 ...LINE F2 ...WORD F3.
Parts marked with " ..." are interchangeable
Extras:
1. ... OFFSET f4
2. ... TRACE-FILE f5
Effect
Generates the screen specified in the field g.
Here, the source code is taken from the structure h and the internal tables f, e and m. The field h (screen header) should correspond to the structure D020S, the internal table f (field list) to the structure D021S, the internal table e (flow logic) to the structure D022S and the internal table m (matchcode information) to the structure D023S.
If a syntax error occurs, the error message is stored in the field f1.
If a syntax error occurs, the number of the incorrect line is stored in the field f2.
By reading the return code value, you can determine whether this line refers to the flow logic or the field list.
If a syntax error occurs, the incorrect word is stored in the field f3.
The Return Code is set as follows:
SY-SUBRC = 0:
The screen was generated.
SY-SUBRC <> 0:
The screen could not be generated.
SY-SUBRC = 4:
The error is in the flow logic.
SY-SUBRC = 8:
The error is in the field list.
Addition 1
... OFFSET f4
Effect
If a syntax error occurs, the position of the incorrect word is output in this field.
Addition 2
... TRACE-FILE f5
Effect
Stores performance data in this file. This addition automatically switches on the trace mode.
<b>Go thru the abap help with keywork generate dynpro..</b>
09-28-2005 5:53 AM
kumar
please open new thread
else u won't be able to award points
regards
kumar click 'Back to Topic Link' link , then click 'Post new Topic' link , enter subject and your query
and then click 'Post Message' button
Message was edited by: Surpreet Singh Bal
07-25-2005 6:16 PM
check out this function module , i guess this may be the one you want
VIEW_MAINTENANCE_CALL
if not the source code would give you an idea.
Regards
Raja