Application Development and Automation 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: 
Read only

dynamic selection screen

Former Member
0 Likes
411

i am presently working on sapR/3 4.6c. i am writing a conversion program. the data comes from the flat file which is to be displayed onto the selection screen. for each set of records a particular selection screen is to be shown.

Details.....

this conversion program will work as an upload file to create or change the Classes and Characteristic values assigned to a particular Material Master Object. The creation or change details will be indicated via the selection screen and the applicable materials will also be listed in the selection screen.

plz kindly suggest as to how to proceed. ur help will be rewarded with points. thanking you in advance.

Kiran

1 ACCEPTED SOLUTION
Read only

aris_hidalgo
Contributor
0 Likes
348

Hi,

The code below is for a dynamic selection screen. What it does is that if the user is a super user, he/she can upload files but if he/she is a normal user, upload of files is not permitted so the parameter in selection-screen for file upload is invisible.

SELECTION-SCREEN BEGIN OF BLOCK box1 WITH FRAME TITLE text-001.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS: pr_upld RADIOBUTTON GROUP grp MODIF ID id3

USER-COMMAND ucomm.

SELECTION-SCREEN COMMENT 2(20) text-007 FOR FIELD pr_upld.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 03(15) text-a11 FOR FIELD p_flnme MODIF ID id3.

PARAMETERS: p_flnme LIKE rlgrap-filename DEFAULT 'C:\' MODIF ID id3.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(22) text-002 FOR FIELD p_dcode MODIF ID id1.

PARAMETERS: p_dcode LIKE vbak-kunnr MODIF ID id1,

p_name1 LIKE kna1-name1 MODIF ID id1.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS: pr_list RADIOBUTTON GROUP grp MODIF ID id4.

SELECTION-SCREEN COMMENT 2(7) text-003 FOR FIELD pr_list MODIF ID id4.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS: pr_add RADIOBUTTON GROUP grp MODIF ID id2.

SELECTION-SCREEN COMMENT 2(3) text-005 FOR FIELD pr_add MODIF ID id2.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS: pr_edit RADIOBUTTON GROUP grp MODIF ID id5.

SELECTION-SCREEN COMMENT 2(4) text-006 FOR FIELD pr_edit MODIF ID id5.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 03(20) text-a12 FOR FIELD p_code MODIF ID id2.

*PARAMETERS: p_kunnr LIKE zts0001-kunnr.

PARAMETERS: p_code LIKE zts0001-cdseq MODIF ID id6.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK box1.

AT SELECTION-SCREEN OUTPUT.

IF v_compflag EQ space.

LOOP AT SCREEN.

IF screen-group1 = 'ID1'.

screen-input = '0'.

screen-output = '1'.

MODIFY SCREEN.

ELSEIF screen-group1 = 'ID2'.

screen-active = '1'.

MODIFY SCREEN.

ELSEIF screen-group1 = 'ID3'.

screen-active = '0'.

MODIFY SCREEN.

ELSEIF screen-group1 = 'ID4'.

screen-active = '1'.

MODIFY SCREEN.

ELSEIF screen-group1 = 'ID5'.

screen-active = '1'.

MODIFY SCREEN.

ELSEIF screen-group1 = 'ID6'.

screen-active = '1'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSEIF v_compflag NE space.

LOOP AT SCREEN.

IF screen-group1 = 'ID1'.

screen-active = '0'.

MODIFY SCREEN.

ELSEIF screen-group1 = 'ID2'.

screen-active = '0'.

MODIFY SCREEN.

ELSEIF screen-group1 = 'ID3'.

screen-active = '1'.

MODIFY SCREEN.

ELSEIF screen-group1 = 'ID4'.

screen-active = '1'.

MODIFY SCREEN.

ELSEIF screen-group1 = 'ID5'.

screen-active = '0'.

MODIFY SCREEN.

ELSEIF screen-group1 = 'ID6'.

screen-active = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

*for users that are not controllers

LOOP AT SCREEN.

IF screen-name = 'P_CODE'.

screen-input = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

IF pr_list = 'X' OR

pr_add = 'X' OR

pr_upld = 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'ID6'.

screen-input = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ELSEIF pr_edit = 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'ID6'.

screen-input = '1'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

*for controllers

IF pr_upld = 'X'.

LOOP AT SCREEN.

IF screen-name = 'P_FLNME'.

screen-input = '1'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ELSEIF pr_list = 'X'.

LOOP AT SCREEN.

IF screen-name = 'P_FLNME'.

screen-input = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

AT SELECTION-SCREEN.

CHECK sy-ucomm = 'UCOMM'.

Hope this will give you an idea.

Regards!

2 REPLIES 2
Read only

aris_hidalgo
Contributor
0 Likes
349

Hi,

The code below is for a dynamic selection screen. What it does is that if the user is a super user, he/she can upload files but if he/she is a normal user, upload of files is not permitted so the parameter in selection-screen for file upload is invisible.

SELECTION-SCREEN BEGIN OF BLOCK box1 WITH FRAME TITLE text-001.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS: pr_upld RADIOBUTTON GROUP grp MODIF ID id3

USER-COMMAND ucomm.

SELECTION-SCREEN COMMENT 2(20) text-007 FOR FIELD pr_upld.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 03(15) text-a11 FOR FIELD p_flnme MODIF ID id3.

PARAMETERS: p_flnme LIKE rlgrap-filename DEFAULT 'C:\' MODIF ID id3.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(22) text-002 FOR FIELD p_dcode MODIF ID id1.

PARAMETERS: p_dcode LIKE vbak-kunnr MODIF ID id1,

p_name1 LIKE kna1-name1 MODIF ID id1.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS: pr_list RADIOBUTTON GROUP grp MODIF ID id4.

SELECTION-SCREEN COMMENT 2(7) text-003 FOR FIELD pr_list MODIF ID id4.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS: pr_add RADIOBUTTON GROUP grp MODIF ID id2.

SELECTION-SCREEN COMMENT 2(3) text-005 FOR FIELD pr_add MODIF ID id2.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS: pr_edit RADIOBUTTON GROUP grp MODIF ID id5.

SELECTION-SCREEN COMMENT 2(4) text-006 FOR FIELD pr_edit MODIF ID id5.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 03(20) text-a12 FOR FIELD p_code MODIF ID id2.

*PARAMETERS: p_kunnr LIKE zts0001-kunnr.

PARAMETERS: p_code LIKE zts0001-cdseq MODIF ID id6.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK box1.

AT SELECTION-SCREEN OUTPUT.

IF v_compflag EQ space.

LOOP AT SCREEN.

IF screen-group1 = 'ID1'.

screen-input = '0'.

screen-output = '1'.

MODIFY SCREEN.

ELSEIF screen-group1 = 'ID2'.

screen-active = '1'.

MODIFY SCREEN.

ELSEIF screen-group1 = 'ID3'.

screen-active = '0'.

MODIFY SCREEN.

ELSEIF screen-group1 = 'ID4'.

screen-active = '1'.

MODIFY SCREEN.

ELSEIF screen-group1 = 'ID5'.

screen-active = '1'.

MODIFY SCREEN.

ELSEIF screen-group1 = 'ID6'.

screen-active = '1'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSEIF v_compflag NE space.

LOOP AT SCREEN.

IF screen-group1 = 'ID1'.

screen-active = '0'.

MODIFY SCREEN.

ELSEIF screen-group1 = 'ID2'.

screen-active = '0'.

MODIFY SCREEN.

ELSEIF screen-group1 = 'ID3'.

screen-active = '1'.

MODIFY SCREEN.

ELSEIF screen-group1 = 'ID4'.

screen-active = '1'.

MODIFY SCREEN.

ELSEIF screen-group1 = 'ID5'.

screen-active = '0'.

MODIFY SCREEN.

ELSEIF screen-group1 = 'ID6'.

screen-active = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

*for users that are not controllers

LOOP AT SCREEN.

IF screen-name = 'P_CODE'.

screen-input = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

IF pr_list = 'X' OR

pr_add = 'X' OR

pr_upld = 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'ID6'.

screen-input = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ELSEIF pr_edit = 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'ID6'.

screen-input = '1'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

*for controllers

IF pr_upld = 'X'.

LOOP AT SCREEN.

IF screen-name = 'P_FLNME'.

screen-input = '1'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ELSEIF pr_list = 'X'.

LOOP AT SCREEN.

IF screen-name = 'P_FLNME'.

screen-input = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

AT SELECTION-SCREEN.

CHECK sy-ucomm = 'UCOMM'.

Hope this will give you an idea.

Regards!

Read only

Former Member
0 Likes
348

Hi Kiran,

You can create dynamic report by filling the report source code into an internal table and then calling the statement INSERT PROGRAM.

Refer the following code :


TYPES: line(72) type c. 
DATA: itab TYPE STANDARD TABLE OF line. 

APPEND 'report test.' TO itab. 
APPEND 'write: ''Hello world!''.' TO itab. 

INSERT REPORT 'test_report' FROM itab. 

After the user intervention you can process the selection screen parameter and delete the program if you don't want it using DELETE REPORT prog.

<b>Reward points if it helps.</b>