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: 

Issue while implementing Validations in Dynamic Selection Screen

Former Member
0 Kudos

Hello ABAP Gurus ,

I have a Dynamic Selection screen ,


If I press Rad button BP Based then below selection screen will come

and If I press Rad button CA Based then below selection screen will come

Now in Both Screen Blocks Billing Period field is common.

I have to Keep that mandatory which is a PARAMETERS type declaration.

Now issues which I am facing :

1. If I use Obligatory then

    the screen wouldn't allow a user to Select second radio button reason being first radio button's Billing Period is also obligatory and its empty, similarly vice versa.

2. Now am using a FLAG which will get SET when Individual Screen gets active based on Radio Button click ,

   and based on that flag am writing my code in AT SELECTION SCREEN even that is not working properly.

Reason being , At very first initial run AT SELECTION-SCREEN OUTPUT will trigger and it will set flag = 'X'.

and selection screen appears , now the user selects Second Radio Button and at that time AT SELECTION SCREEN event gets triggered and its shows the message for First Screen Blocks Billing Period only.

Please guide for this issue.

1 ACCEPTED SOLUTION

0 Kudos

Hi,

Check this post and Yadav's comment-

So what you need to do is not to mark the billing period field as obligatory but still you get the tick in the field which looks like mandatory.

In the PAI (At selection-screen event) you can check if the user checked the other radio button in which case just show the other screen. If the user presses enter or execute, display the error message and dont let him navigate to output.

Best regards,

Saurabh

17 REPLIES 17

Former Member
0 Kudos

I have an alternative for this ,

Since Billing Period is common , instead of making Two different declarations , I will use one and proceed.

But how such issue can be rectified ( asking Out of Curiosity only ).

I had faced this issue earlier also , but at that time fields where different and I was clueless.

former_member226225
Contributor
0 Kudos

Hi Sijin,

Remove the obligatory for the Billing Period field in Parameters .

try to validate in Start-of-selection.

see  the below code.


start-of-selection.

if p_billingPeriod is intial.

lv_bill_flag = 'X'.

stop.

endif.

end-of-selection.

if lv_bill_flag is not initial.

message 'enter billing period' type 'S' display like 'E'.

endif.

I hope this will be helpful.

Thanks & Regards,

Raghunadh Kodali

0 Kudos

But how can this work ?

Reason being I need to do the validations before leaving the Selection Screen itself for that reasons I am using AT SELECTION-SCREEN OUTPUT and AT SELECTION-SCREEN events.

0 Kudos

Hi

Dont put obligatory for the field.

just write the logic.

at selection-screen on P_BILLP.

if p_billp is initial.

   message 'please enter some value' type 'E'.

endif.

Note: it will stop the execution in selection screen.

it will definitely solve your issue.

regards

laxman

Former Member
0 Kudos

Hi Sijin,

You can try out with only one declaration for billing period and that shoud not be dynamic as it is same for both the conditions.

Hope this may be useful.

Regards,

Dipti.

0 Kudos

Yeah as I have already mentioned I have that alternative , but I want to know how this kinda problem can be sorted out. I had faced this issue earlier also.

0 Kudos

Hi,

Check this post and Yadav's comment-

So what you need to do is not to mark the billing period field as obligatory but still you get the tick in the field which looks like mandatory.

In the PAI (At selection-screen event) you can check if the user checked the other radio button in which case just show the other screen. If the user presses enter or execute, display the error message and dont let him navigate to output.

Best regards,

Saurabh

0 Kudos

Hey ,


screen-required =

This thing didn't strike into my mind , but your reference post made me think about it.

Let me try with some workarounds and will get back aSAP.

Former Member
0 Kudos

Hi

Dont put obligatory for the field.

just write the logic.

at selection-screen on P_BILLP.

if p_billp is initial.

   message 'please enter some value' type 'E'.

endif.

it will definitely solve your issue.

regards

laxman

0 Kudos

Tried that also ,

You can even check the same it won't work.

Its same as keeping OBLIGATORY.

0 Kudos

after entering the value in p_billp check it wil work

0 Kudos

Yeah that I know.

We need to press One ENTER also.

But its not recommended.

It should not behave like that.

I guess there is no solution for this and  I need to stick my alternative only.

0 Kudos

other wise try this

MESSAGE 'error' TYPE 'S' DISPLAY LIKE 'E'.

0 Kudos

I tried with workaround based on your suggestion and reference thread.

I will explain it ,

This screen-required = 2 sets that Obligatory symbol.

And later in AT SELECTION-SCREEN event I am writing the below code

And the result is as below :

when user Selects second radiobutton

He gets a message on Prior.

And even if he doesn't fill the same he can select First radio button.

As per QE team message should not come in Prior , but I think this is the only workaround possible for this case.

0 Kudos

Good something is better than nothing.

But I was just wondering instead of always doing the check in PAI. Cant you first check for

sy-ucomm = <Execute buttons sy-ucomm which you can find in debugging>

This way the message will not be displayed everytime PAI is hit.

Just a passing thought.

Regards,

Saurabh

0 Kudos

By PAI u mean AT SELECTION-SCREEN event I guess.

But standard process is like this only. AT SELECTION-SCREEN is event is for validating only.

Just waiting for any Expert ABAPers comment for a Perfect solution if possible for this scenario , else this solution is also almost 90% to the point.

QE People are like this only ( they just want a issue to be highlighted ).

chandra_sekhar3
Explorer
0 Kudos

Hi Sijin,

Please find my comments in below.

Instead of radio button use as a check box as a piece of code mentioned in below and use some screen group. It will be helpful to you.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.

PARAMETERS :    cb_pdf  TYPE char1 AS CHECKBOX USER-COMMAND check1,

                 p_path TYPE rlgrap-filename MODIF ID sp1.

SELECTION-SCREEN END OF BLOCK b3.



FORM f_hide_file_path .

   IF cb_pdf = c_on.

* --> Nothing to do

   ELSE.

     LOOP AT SCREEN.

       IF screen-group1 = 'SP1'.

         screen-active = 0.

         MODIFY SCREEN.

       ENDIF.

     ENDLOOP.

   ENDIF.

ENDFORM.

Thanks,

Chandra.