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

halfer
  • 19,824
  • 17
  • 99
  • 186
Rahul
  • 903
  • 1
  • 10
  • 27
  • What is your exact requirement? You simply want a search help to trigger on a field of type MATNR? – Laurens Deprost Dec 27 '18 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 '18 at 21:54
  • Have you built the screen using the screen painter? – Laurens Deprost Dec 27 '18 at 22:00
  • @LaurensDeprost yes – Rahul Dec 27 '18 at 22:00
  • Have you tried specifying a search help for the field in the screen painter? – Laurens Deprost Dec 27 '18 at 22:02
  • @LaurensDeprost I did and it doesnt seem to be working, I am calling this screen based on a hotspot selection on an alv grid. I think this can be the issue why it isnt popping up.(I know this sounds stupid but i have no other explanation). – Rahul Dec 27 '18 at 22:04
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/185853/discussion-between-laurens-deprost-and-rahul). – Laurens Deprost Dec 27 '18 at 22:06
  • @LaurensDeprost I saw your comment and are you recommending that i should create the selection screen as a subscreen and alv grid in a custom container? Because the way the program is set up right now standard selection screens will not be accepted as a dialog transaction. – Rahul Dec 27 '18 at 23:16
  • @Rahul here we are again, trying to make F4 work, it is not a good idea to [delete your questions and all discussions around](https://stackoverflow.com/questions/53871603/search-help-not-working-for-a-field-in-custom-screen) because it gives a context and information collected at that time. [Also, same question in SCN](https://answers.sap.com/questions/715813/search-help-f4-not-working-on-material-field-in-cu.html). Conclusion: you should learn from these failures by giving more details in your initial question. – Sandra Rossi Dec 28 '18 at 11:13
  • 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 '18 at 13:20

1 Answers1

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.
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • 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 '18 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 '18 at 13:48