2008 Sep 23 2:51 PM
Hello,
is there a way to make two data fields obligatory in a selection-screen that the user only has to enter either one OR the other value, meaning at least one of these two data fields have to be entered?
Thanks
Anne
2008 Sep 23 2:55 PM
hi,
simple:
AT SELECTION SCREEN.
IF ... IS INITIAL AND
... IS INITIAL.
==> issue error message that at least one of the above has to be filled
ENDIF.
hope this helps
ec
2008 Sep 23 3:17 PM
Hi,
Suppose there are two parameters in selection screen.
Parameters:para1 type matnr,
para2 type kunnr.
Do validation for that Functioanlity------
AT SELECTION-SCREEN.
if para1 is initial and para2 is inital.
Message 'Enter at least one value' type 'E'.
endif.
Error message is displayed only if both the fields are blank.
2008 Sep 23 4:19 PM
Thanks for your answers, that sounds good to me!
But how can I issue an error message that comes up as a pop-up in case both fields are empty? What is the code for that?
Thanks!!
2008 Sep 23 4:24 PM
2008 Sep 24 7:06 AM
Hi,
Check this sample code
REPORT z_sdn.
PARAMETERS:
p_fld1(10) TYPE c,
p_fld2(10) TYPE c.
AT SELECTION-SCREEN.
IF p_fld1 IS INITIAL AND p_fld2 IS INITIAL.
MESSAGE 'FILL EITHER OF TWO FIELDS' TYPE 'E'.
ELSE.
MESSAGE 'GOTO SELECTION SCREEN' TYPE 'I'.
ENDIF.
START-OF-SELECTION.
WRITE: 'TEST'.
Regards
Abhijeet
2008 Sep 24 7:44 AM
Hi anne,
As you want the message as a pop-up,use type 'I' message
Try this code;-
PARAMETERS:
p_1(20) TYPE c,
p_2(20) TYPE c.
AT SELECTION-SCREEN.
IF p_1 IS INITIAL AND p_2 IS INITIAL.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
* TITEL = ' '
textline1 = 'Enter data'.
* TEXTLINE2 = ' '
* START_COLUMN = 25
* START_ROW = 6ENDIF.
endif.
-Bhumika
2008 Sep 24 1:10 PM
Hi Bhumika,
I've used your code and it works good. The popup comes up, but it comes up in a new session and when I press "continue", it is loading forever.
Is there a way, that the pop-up comes up in the same session?
I just would like to press continue, but stay on the same screen?
THANKS
Anne
2008 Sep 24 7:54 AM
Anna,
You can put such a validation in the event at selection screen.
-Rajat
2008 Sep 24 2:14 PM
try it like this:
Parameters:
w_char1,
w_char2.
At selection-screen.
if w_char1 is initial and w_char2 is initial.
message 'enter a value' type 'E'.
endif.
Wth luck,
Pritam.
2008 Sep 24 2:36 PM
Hey,
now it stays in the same screen, but there is only the message showing and there is no way to get back to the original screen.
Thanks
Anne
2008 Sep 25 2:14 PM
hi Anne,
if I understand right the problem is not solved yet. Pls. have a look at the following sample and let me know if it is suitable or not:
PARAMETERS : p1 TYPE bkpf-bukrs,
p2 TYPE bkpf-gjahr.
AT SELECTION-SCREEN.
IF p1 IS INITIAL AND
p2 IS INITIAL.
MESSAGE i396(00) DISPLAY LIKE 'I'.
ENDIF.
Message will be displayed in popup and after hitting Enter will go back to the selection screen.
hope this helps
ec
2008 Sep 25 2:18 PM
Eric,
thanks for your answer.
I've used your code. When executing my program, a new screen opens and following message comes up:
No authorization for analyzing session
I've checked Su53, but there is no authorization missing, I have SAP_all and SAP_new.
Also, when I click on the green checkmark, nothing happens, it is loading forever and does not go back to the original screen....
Thanks
Anne
2008 Sep 25 2:22 PM
>
> I've used your code. When executing my program, a new screen opens and following message comes up:
> No authorization for analyzing session
it is just an error message I used as an example, you have to replace it with your own one (in the line MESSAGE...)
>
> Also, when I click on the green checkmark, nothing happens, it is loading forever and does not go back to the original screen....
that is very strange... by me, when I hit Enter (that should be equivalent with clicking on the green checkmark), it goes back to the selection screen.
2008 Sep 25 2:25 PM
Hm, there is nothing else I have to do but add this line of code?
Then I don't know what it is with my system, I just will not take me back to the original screen
Thanks
Anne
2008 Sep 25 2:28 PM
>
> Hm, there is nothing else I have to do but add this line of code?
>
> Then I don't know what it is with my system, I just will not take me back to the original screen
>
> Thanks
> Anne
just replace the message with a more suitable one (you can create an own one and that one)
about the navigation problem: I guess this also could be a SAPGUI problem. Pls. check internally if your SAPGUI version is OK!
2008 Sep 25 2:58 PM
I am using sapgui 710, patch 8, so I think, we're pretty up to date with that...
Thanks
Anne
2020 Mar 03 10:57 AM
Try this...
START-OF-SELECTION.
* Selection data is mandatory
IF s_act_id[] IS INITIAL
AND s_commdt[] IS INITIAL.
MESSAGE TEXT-e01 TYPE 'I'.
LEAVE LIST-PROCESSING.
ELSE.