Skip to Content
author's profile photo Former Member
Former Member

How to handle PAI of the pf-status

I have seen many tutorials on custom pf-status. I create the GUI status, add the button that I want on my program and handle theirs event in the PAI with something like this;

case ok_code.

when '&BUTTON1'.

"todo

when '&BUTTON2'.

"todo

endcase.

This part of the code work perfectly. But my problem is that, I'm not sure how to handle other buttons that I want to let the system handle them for me. For example; SAVE button, BACK button, PRINT button. I add these standard buttons in to my GUI status and think that the system will handle them for me, but when I click those buttons, nothing happen.

I would like to know how can I handle only the ok_code that I want and let the system handle the others for me, Is there any reference to every function that system can handle ?.

Thank you in advance,

Pinn

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 03, 2014 at 04:50 AM

    Hii,

    For custom PF-STATUS set, You have to handle the button manually by writing code in PAI of the screen.

    For BACK, CANCEL and EXIT button.

    CASE ok_code.

    WHEN 'BACK'.

    LEAVE TO SCREEN 0.

    WHEN 'CANCEL'.

    here you can use FM POPUP_TO_CONFIRM.

    Code according to answer parameters value.

    LEAVE PROGRAM.

    WHEN 'EXIT'.

    LEAVE PROGRAM.

    ENDCASE.

    For print button, you have to code according to what you want to print as output of internal table, Smart form or something else.

    For printing the output of internal table follow this link,

    http://scn.sap.com/thread/3215298

    For printing the smart form you can use FM 'SSF_FUNCTION_MODULE_NAME',

    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' " For getting the FM name of the Smartform

    EXPORTING

    formname = 'Your Smart form name'

    IMPORTING

    fm_name = fm_name "function module name will be implemented to pass data to smartform .

    EXCEPTIONS

    no_form = 1

    no_function_module = 2

    OTHERS = 3

    .

    IF sy-subrc <> 0.

    * Implement suitable error handling here

    ENDIF.


    Now call FM fm_name , this will be have all your smart form parameter name and just provide the value to them.


    regards

    Syed



    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 02, 2014 at 03:03 PM

    Hi,

    If you write your own screen system doesnt handle any button, You have to write every code 😔

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 02, 2014 at 03:03 PM

    Hi,

    In your GUI status, you should add a function code to each button you want to handle. For example, i added the 'EXIT', 'BACK' and 'UP', function codes to the GUI buttons.

    Then, you must add this to your code.

    case ok_code.

    when '&BUTTON1'.

    "todo

    when '&BUTTON2'.

    "todo

    when 'BACK' OR 'UP'.

    LEAVE TO SCREEN 0.

    when 'EXIT'.

    LEAVE PROGRAM.
    endcase.


    Best regards,

    Rubén Mircin


    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 02, 2014 at 03:16 PM

    In you custiomer program the system will only manage some menu items like in System and Help menu, you have to manage every other button, actually every button and option menu you created in menu painter must be managed in your dynpro PAI logic... 😔

    Regards,

    Raymond

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 02, 2014 at 03:04 PM

    if its a custom screen you have to handle it by yourself. how do you want system to handle these buttons?

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 03, 2014 at 06:48 AM

    Hi

    Please check whether you have defined you okcode variable in your dataelements list. The sy-ucomm value comes to your okcode variable. Just put a debugger and check what value you get in the okcode variable when u click on to back, exit, and cancel. If you r not getting any value in okcode variable.....check for sy-ucomm also.

    Warm Regards

    Suneesh

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.