Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Generate Screen Dynamic

former_member194669
Active Contributor
0 Kudos
203

How to create a screen dynamically at runtime.

ie.

I have following fields

MATNR

MATKX

DESCR

NAME1

I need to generate a screen at runtime. like this


MATNR                                           MATKX
DESCR                                           NAME1

I don't need to use fm POPUP_GET_VALUES for this.

Any info on this.

aRs

6 REPLIES 6

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
107

Seems pretty static, right? Why do you need to do this dynamically?

Regards,

Rich Heilman

former_member194669
Active Contributor
0 Kudos
107

Rich,

This is only example. The field are decided only at runtime.

My requirement is i am writing a ALV grid program to eliminate the cumbersome table maintenance generator screens. Input for this program is table name. But now user wants in the Grid select a line and go for details ,here user want a cusom screen to be displayed with all fields from table (input selection)

aRs

0 Kudos
107

I see. You can generate a screen at runtime, but it uses internal SAP statements which are not supposed to be used. Here is a sample program.

Please be extremely careful.



report zrich_0001
       no standard page heading.

data: h type table of d020s with header line,
      f type table of d021s with header line,
      e type table of d022s with header line,
      m type table of d023s with header line.
data: mess(50) type c,
      line(50) type c,
      word(50) type c.
data: dynproid(44).

dynproid = sy-repid.
dynproid+40(4) = '0100'.

h-prog = sy-repid.
h-dnum = '0100'.
append h.


f-fnam = 'P_TEST1'.
f-flg1 = '80'.
f-flg3 = '80'.
f-line = '01'.
f-coln = '03'.
f-type = 'CHAR'.
f-ityp = 'C'.
f-leng = '20'.
f-stxt = '____________________'.
append f.

f-fnam = 'P_TEST2'.
f-flg1 = '80'.
f-flg3 = '80'.
f-line = '02'.
f-coln = '03'.
f-type = 'CHAR'.
f-ityp = 'C'.
f-leng = '40'.
f-stxt = '________________________________________'.
append f.


e-line = 'PROCESS BEFORE OUTPUT.'.
append e.

e-line = 'PROCESS AFTER INPUT.'.
append e.

generate dynpro h f e m id dynproid
         message mess
         line    line
         word    word.


call screen 100.

Regards,

RIch Heilman

former_member194669
Active Contributor
0 Kudos
107

Rich,

Thanks for your reply.

I have more question regarding this.

If two users are using at the same time


generate dynpro h f e m id dynproid
         message mess
         line    line
         word    word.

Whether this command give any issue. My question is any sharing violation?

aRs

0 Kudos
107

I simply do not know. I would assume that there may be a clash there.

REgards,

RIch Heilman

former_member194669
Active Contributor
0 Kudos
107

Issue closed.