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: 

Go back to selection screen again after its pai

shadab_sk
Participant
0 Kudos
1,661

Hi experts,

I have a requirement for which I have added a field on a selection screen. Now in its pai i.e. In at selection screen on field,  event I have to provide two options called continue button  and cancel button in the form of a warning message if some specific condition is met to the users of this program. Now if a user hits a cancel... Again the selection screen should come with the previous values filed..

Can you please help how this can be achieved. Please note I am displaying a warning message, not a error message.. . User should have the liberty to decide whether to continue with program execution or to cancel and go back to selection screen again from at selection screen on field event.

I need to move back again from selection screen pai to selection screen. I cannot code this in start of selection since it is an existing program and the pai event is the only apt place to put this warning message

Thank you,

Shadab

1 ACCEPTED SOLUTION

jrgkraus
Active Contributor
0 Kudos
387

look at this coding:

   
  if p_mypar = dangerous_value.
    CALL FUNCTION 'POPUP_TO_CONFIRM'
      EXPORTING
        text_question         = 'continue with dangerous value?'
      IMPORTING
        answer                = lv_answ.

    IF lv_answ <>  '1'.
      p_mypar = sav_param
      leave screen.
    ENDIF.
  endif.
  sav_param = p_mypar.

First, you determine if the value of your parameter is dangerous. Then you display a popup asking the user if he wants to continue. If he responds other than yes, set the parameter to the previously saved value and leave the PAI processing.

Hope this helps!

5 REPLIES 5

Former Member
0 Kudos
387

Dear Shadab,

Have you tried to give the logic "SET SCREEN TO 0" to go back the first screen?

Regards,

Yance

jrgkraus
Active Contributor
0 Kudos
388

look at this coding:

   
  if p_mypar = dangerous_value.
    CALL FUNCTION 'POPUP_TO_CONFIRM'
      EXPORTING
        text_question         = 'continue with dangerous value?'
      IMPORTING
        answer                = lv_answ.

    IF lv_answ <>  '1'.
      p_mypar = sav_param
      leave screen.
    ENDIF.
  endif.
  sav_param = p_mypar.

First, you determine if the value of your parameter is dangerous. Then you display a popup asking the user if he wants to continue. If he responds other than yes, set the parameter to the previously saved value and leave the PAI processing.

Hope this helps!

0 Kudos
387

Thanks Jorg Krause.

The answer which worked for me is  'Leave Screen' statement. what this statement do is-it explicitly triggers the PBO of selection screen again which was what required . I hope if it wasn't a selection screen and would have been a normal screen then this statement wouldn't have been  used ? cause it will act as endless loop and to terminate we would have been using screen 0 statement. Hope my understanding is correct.

Anyways thanks a lot.

Br,

Shadab

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos
387

I guess it works by chance. A RETURN statement might work too. You restart the selection screen, because you are in an executable program (are you?), that is called again automatically after it has been finished if a standard selection screen is available, see step 9 of

Flow of an executable program.

Sandra_Rossi
Active Contributor
0 Kudos
387

I'm reading again and again, and I don't understand what you mean by "the Continue and Cancel buttons in the form of a warning message". I understand that you need to display a popup with 2 buttons, and you can't do it with a "warning message" (in its official meaning, i.e. it's displayed and the only option available is to press Enter and then the program continues). With a popup, no difficulty. If it's a warning message, then it's impossible to change the standard behavior, so just forget it.

PS: if you want to stop the PAI immediately in your PAI field event, you can only send an error message. Change the field value is at your change, it's not handled by the system.