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

selection-screen(condition)

Former Member
0 Likes
1,535

Hi all,

I have a report with about 15 select-options in selection screen. My condition is there should be atleast one input from the end user if not I should say 'Not enough inputs'. For this I implemented a logic using 'at selection-screen' event. It is working well.

My question is when I execute my report, I see the Multiple selections option (right arrow button) for all the select-options in the selection screen. When I press this button, I am not getting a pop-up but the condition which I kept in 'at selection-screen' event is executed and it says 'no enough inputs'.

When I press the Multiple selections button the control is passing through the 'at selection-screen' event. Is it possible that when I press the Multiple selections button, I get the pop-up before the control comes to 'at selection-screen' event.

Below is my code. Please try this code for example.

select-options: s_werk for qals-werk.

select-options: s_matnr for qals-matnr matchcode object mat1.

select-options: s_charg for qals-charg matchcode object mch1.

select-options: s_art for qals-art.

select-options: s_pruef for qals-prueflos.

select-options: s_vaplz for aufk-vaplz.

select-options: s_ltxa1 for afvc-ltxa1.

select-options: s_aufnr for qals-aufnr.

select-options: s_enst for qals-enstehdat.

select-options: s_past for qals-pastrterm.

select-options: s_paend for qals-paendterm.

select-options: s_plnty for qals-plnty.

select-options: s_herst for qals-hersteller matchcode object kred.

select-options: s_lifnr for qals-lifnr matchcode object kred.

select-options: s_kunnr for qals-kunnr matchcode object debi.

select-options: s_verwm for qamv-verwmerkm.

.

.

.

.

.

*****************

at selection-screen.

*****************

count = 0.

if not s_werk is initial.

count = count + 1.

endif.

if not s_matnr is initial.

count = count + 1.

endif.

if not s_charg is initial.

count = count + 1.

endif.

if not s_art is initial.

count = count + 1.

endif.

if not s_pruef is initial.

count = count + 1.

endif.

if not s_vaplz is initial.

count = count + 1.

endif.

if not s_ltxa1 is initial.

count = count + 1.

endif.

if not s_aufnr is initial.

count = count + 1.

endif.

if not s_past is initial.

count = count + 1.

endif.

if not s_paend is initial.

count = count + 1.

endif.

if not s_plnty is initial.

count = count + 1.

endif.

if not s_herst is initial.

count = count + 1.

endif.

if not s_lifnr is initial.

count = count + 1.

endif.

if not s_kunnr is initial.

count = count + 1.

endif.

if not s_verwm is initial.

count = count + 1.

endif.

if count < 1.

message e000(0) with 'No enough inputs'.

endif.

*******************

start-of-selection.

*******************

.

.

.

*******************

end-of-selection.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,477

Is this problem solved? If so, please mark as solved. Thanks.

Regards,

Rich Heilman

14 REPLIES 14
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,477

You need to check the sy-ucomm in the event.




tables: t001w.

select-options: s_werks for t001w-werks.


at selection-screen.

<b>  check sy-ucomm <> '%000'.  'Multiple Selection fcode</b>

  if  s_werks is initial.
    message e001(00) with 'Enter a value'.
  endif.

Regards,

Rich Heilman

Read only

0 Likes
1,477

Hi Rich,

Can you please tell me what exactly this statement checks for.

<b>check sy-ucomm <> '%000'. 'Multiple Selection fcode</b>

Thanks

Read only

0 Likes
1,477

Hi,

When I press the Multiple Selections button, the 'at selection-screen' event is executed and then I am getting the pop-up window. Is there a way to get the pop-up window before the 'at selection-screen' event is executed.

Please reply. Thanks

Read only

0 Likes
1,477

No, there is no way to get the popup before the at selection-screen event. The only thing that you can do to avoid the processing of code in the AT SELECTION-SCREEN event is to check for the function code of the "multiple selection button". In my previous post, I suggestted to add a check statement. This check statement is checking that the user did not press the multiple funtion button, if he did that the code under the CHECK statement in the AT SELECTION-SCREEN event would not get fired. Does this make sense?

Regards,

Rich Heilman

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,478

Is this problem solved? If so, please mark as solved. Thanks.

Regards,

Rich Heilman

Read only

0 Likes
1,477

Hi Rich,

I didnt try yet the thing you mentioned in your reply. I'll test it and respond soon to this post. Thanks

Read only

0 Likes
1,477

Just so you know, you have no control over when the events are fired. They are fired at specific times, you have to be able to handle them when you don't want to do the logic under them. In your case, you don't want to do the logic if the user has hit the MS button. That is the fcode that the CHECK statement is looking for.

Regards,

Rich Heilman

Read only

0 Likes
1,477

Hi Rich,

I appreciate your replies. I will try this thing and respond back. PLease remember this post. I will let you know if I succeeded.

Thanks once again.

Read only

0 Likes
1,477

Hi Rich,

I tried what you said.

check sy-ucomm <> '%000'.

if count < 1.

message e000(0) with 'Not enough inputs'.

endif.

But what I observed is when I press the Multiple Selections button the code under the check statement is not skipped but instead executed and I am getting the error message not enough inputs.

I changed the <> in check statement to = and what I observed is the code under the check statement is not executed irrespective of whether I press the Multiple selections button.

PLease clarify on this. Waiting for your reply. Thanks

Read only

0 Likes
1,477

Hi,

write this code under start-of-selection , it will work.

if s_werk[] is initial and

if s_matnr[] is initial and

if s_charg[] is initial and

if s_art[] is initial and

if s_pruef[] is initial and

if s_vaplz[] is initial and

if s_ltxa1[] is initial and

if s_aufnr[] is initial and

if s_enst[] is initial and

if s_past[] is initial and

if s_paend[] is initial and

if s_plnty[] is initial and

if s_herst[] is initial and

if s_lifnr[] is initial and

if s_kunnr[] is initial and

if s_verwm[] is initial .

message message s000(0) with 'Not enough inputs'

exit.

endif.

regards

Appana

Read only

0 Likes
1,477

Check the value of sy-ucomm at the CHECK statment in debug mode when you click the multiple selection button. What ever the value is of sy-ucomm is the value that you need to check. In my system, the value was

'%000'.

Regards,

RIch Heilman

Read only

0 Likes
1,477

It is good programming practice to do validations in the AT SELECTION-SCREEN event, not the START-OF-SELECTION, but if you don't care, then by all means do it.

Regards,

Rich Heilman

Read only

0 Likes
1,477

Hi Rich,

I agree with you. I am going with your logic. Its working now. But sorry I cant assign you full points as I did that already to other person. But I did assign you maximum points I can. Thanks once again.

Read only

0 Likes
1,477

No problem with the points, you can do as he suggested, it obviously works, but again, validations are supposed to be handled in the AT SELECTION-SCREEN event. Just wanted you to be aware.

If you code the validations in the START-of-SELECTION event, they will not be done when the user hits "ENTER". They will only be done when the user clicks the "EXECUTE" button. This is why it is good to do them in the AT SELECTION-SCREEN event. Make Sense?

REgards,

Rich Heilman