‎2015 Feb 13 3:46 AM
Hi Experts,
I am new to SAP and I m trying to execute following code.
WRITE: '1.ABC',/,'2.XYZ',/.
PARAMETERS p_a TYPE i OBLIGATORY.
CASE p_a.
WHEN 1. WRITE 'ABC'.
WHEN 2. WRITE 'XYZ'.
WHEN OTHERS. WRITE 'Wrong Selection'.
ENDCASE.
I want to display the Menu before the user give input. Is there any way to execute WRITE before the PARAMETER get executed.
Thanx in Advance..
‎2015 Feb 13 4:36 AM
Hi,
To achive your requirement, you need to make use of SELECTION-SCREEN - COMMENT but not WRITE. And here the code to show your required output.
SELECTION-SCREEN COMMENT /1(50) comm1 MODIF ID mg1.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN COMMENT /1(30) comm2.
SELECTION-SCREEN ULINE /1(50).
PARAMETERS p_a TYPE i OBLIGATORY.
DATA screen_wa TYPE screen.
AT SELECTION-SCREEN OUTPUT.
* comm1 = '1.ABC,/,2.XYZ'.
comm2 = '1.ABC,/,2.XYZ'.
LOOP AT screen INTO screen_wa.
IF screen_wa-group1 = 'MG1'.
screen_wa-intensified = '1'.
MODIFY screen FROM screen_wa.
ENDIF.
ENDLOOP.
Output
Hope this helps you.
Thanks
KH
‎2015 Feb 13 4:44 AM
Hi Pankaj ,
This is not possible since you want to get the write before selection screen.
Only those write statements will be executed which are written after selection parameters .
PARAMETERS p_a TYPE i OBLIGATORY.
CASE p_a.
WRITE: '1.ABC',/,'2.XYZ',/.
WHEN 1. WRITE 'ABC'.
WHEN 2. WRITE 'XYZ'.
WHEN OTHERS. WRITE 'Wrong Selection'.
ENDCASE.
Regards ,
Rocky
‎2015 Feb 13 4:49 AM
Hi Pankaj,
You cannot write on selection screen as Every Write statement gets accessed only after START-OF_SELECTION. So, the write statement will not be displayed anywhere on selection screen.
Instead of the same you can use SELECTION SCREEN - COMMENT.
Here the piece of code for your requirement.
SELECTION-SCREEN COMMENT /1(50) comment1 MODIF ID com1.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN COMMENT /1(30) comm2.
SELECTION-SCREEN ULINE /1(50).
PARAMETERS: p_a TYPE i OBLIGATORY.
now , you can set the value of Comment1 and comment2 with the text you want.
for your program you can set value of comment 2 = '1.ABC,/,2.XYZ'.
Hope this will help you.
Regards,
Ashish
‎2015 Feb 13 7:06 AM
‎2015 Feb 13 7:29 AM
Hi,
If your issue resolved. Pls close the thread or else revert with your concerns.
Thanks
KH
‎2015 Feb 13 7:24 AM
You could also try with list box
TYPE-POOLS: vrm.
PARAMETERS p_a TYPE i OBLIGATORY AS LISTBOX VISIBLE LENGTH 5
USER-COMMAND dummy.
INITIALIZATION.
DATA: id TYPE vrm_id,
lt_values TYPE vrm_values,
ls_value LIKE LINE OF lt_values.
REFRESH lt_values.
ls_value-key = '1'.
ls_value-text = 'ABC'.
APPEND ls_value TO lt_values.
ls_value-key = '2'.
ls_value-text = 'XYZ'.
APPEND ls_value TO lt_values.
id = 'P_A'.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = id
values = lt_values.
AT SELECTION-SCREEN.Regards,
Raymond