0

Is it possible to call the function MAT1_F4_HELP_EXIT in the PBO module of the screen to trigger search help for a material field on a custom screen (assigning the search help using se11 and search help exit is not working).

I am confused regarding the parameters that are being passed in the function.

Edit (taken from discussion)

I have a field called material, and I want to trigger a search help (MAT1). I have assigned it the table field and it is not letting the user do it automatically. So, I want to call it explicitly.

screenshot of the field properties in the screen painter

10
  • What is your exact requirement? You simply want a search help to trigger on a field of type MATNR? Dec 27, 2018 at 21:51
  • @LaurensDeprost I have a field called material, i want to trigger a search help (MAT1). I have assigned it the table field and it is not letting the user do it automatically. So, I want to call it explicitly. For your knowledge, when i try to hit f4 the debugger records sy-ucomm as '&F4'. Is this correct?
    – Rahul
    Dec 27, 2018 at 21:54
  • Have you built the screen using the screen painter? Dec 27, 2018 at 22:00
  • @LaurensDeprost yes
    – Rahul
    Dec 27, 2018 at 22:00
  • 1
    @SandraRossi I deleted it because we did not get anywhere with the question. Although your point is well noted and i will be take it into consideration the next time, thank you.
    – Rahul
    Dec 28, 2018 at 13:20

1 Answer 1

1

I have reproduced the issue (cf minimal code and screen at the bottom).

Steps to reproduce :

  • start the program (-> ALV displayed)
  • double click one line of the ALV (-> screen 0100 displayed)
  • press F4 on screen field defined with search help (-> popup 'abnormal situation' instead of search help!)

Reason: the active GUI status reassigns the F4 function key a classic function key behavior instead of calling the search help and as you didn't set a GUI status in your screen, the one of the previous screen is used again.

Solution: define your own GUI status and set it in the PBO of the screen (and don't redefine F4 of course!)

Rule of thumb : always define your own buttons and menus for every screen (why would you display buttons and menus from other screens which make no sense).

Minimal code:

REPORT.
SELECT * FROM sflight INTO TABLE @DATA(flights).
" does a CALL SCREEN which does SET PF-STATUS 'STANDARD_FULLSCREEN' (in program SAPLKKBL)
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    i_callback_program      = sy-repid
    i_callback_user_command = 'USER_COMMAND'
    i_structure_name        = 'SFLIGHT'
  TABLES
    t_outtab                = flights
  EXCEPTIONS
    OTHERS                  = 2.
FORM user_command
      USING
        r_ucomm     LIKE sy-ucomm
        rs_selfield TYPE slis_selfield.
  IF r_ucomm = '&IC1'.
    CALL SCREEN 100.
  ENDIF.
ENDFORM.
MODULE pbo OUTPUT.
  " missing part !! ==> create GUI status 0100 and do SET PF-STATUS '0100'
ENDMODULE.
MODULE pai INPUT.
  CASE sy-ucomm.
    WHEN '&F03'.
      SET SCREEN 0.
    WHEN '&F4'.
      " corresponds to F4 key inherited from ALV GUI status 'STANDARD_FULLSCREEN'
      MESSAGE 'abnormal situation -> define your own GUI status !' TYPE 'I'.
  ENDCASE.
ENDMODULE.

Screen 0100 :

  • Any field with search help (same as you did)

Flow logic of screen 0100 :

PROCESS BEFORE OUTPUT.
  MODULE pbo.
PROCESS AFTER INPUT.
  MODULE pai.
2
  • Hello again, All buttons and menus are in the same screen, Sandra. Can you explain further what do you mean by the rule of thumb statement and how it is related in my problem. Also, When i hit F4 no message or pop up is produced (I know you generated this but just to let you know). I will try out the solution you have suggested and get back to you. Thank you so much. I tried every other way and i just could not figure this out.
    – Rahul
    Dec 28, 2018 at 13:17
  • 1
    That worked Sandra. I simply created a screen with the fields and buttons. I understand now that setting the pf-status gives the programmer the standard functionality of setting the menu/button options to the screen. Thank you so much!! :D
    – Rahul
    Dec 28, 2018 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.