Application Development and Automation 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: 
Read only

create help F1 function

Former Member
0 Likes
4,073

Hello,

I want to add the function F1. When anybody click on the i-Button or press F1, a seperate Window should open with a help text.

I tried goto->documentation and enter there the documentation. But the documentation is displaying only on the first screen. When I go to the alv-grid screen there is a i-Button, but when i click on it, it doesn't respond.

Can someone help me please?

Greetings

Julia

1 ACCEPTED SOLUTION
Read only

former_member282968
Contributor
2,206

Hi Julia

To get the documentation on click of  i-Button follow the below steps:

1. In the report progam goto->documentation and enter the documentation.

2. These documentation gets saved in tables Viz.,DOKIL, DOKHL and DOKTL.

3. Now if you are using the ALV grid display then you must be using the   FM  'REUSE_ALV_GRID_DISPLAY'.In this there is a parameter called

IT_EVENT_EXIT .You need to pass the user command for this parameter, in this case it is '&INFO' with before and after fields.

4.So once you click on the i-button it triggers the f-code passed in the IT_EVENT_EXIT and comes to the sub-routine passed with the paramter I_CALLBACK_USER_COMMAND in the FM.

5.Then use the FM 'DSYS_SHOW_FOR_F1HELP' to display the documentation.

I have created the program for your reference please copy the below code and check:

REPORT  ZTEST_IT.

TYPE-POOLS:SLIS.


DATA:IT_LFA1                 TYPE TABLE OF        LFA1,
           WA_LFA1              TYPE                          LFA1,
           LT_EVENT_EXIT  TYPE TABLE OF       SLIS_EVENT_EXIT,
           LS_EVENT_EXIT  TYPE                          SLIS_EVENT_EXIT.



INITIALIZATION.

  LS_EVENT_EXIT-UCOMM = '&INFO'.
  LS_EVENT_EXIT-BEFORE = 'X'.
  LS_EVENT_EXIT-AFTER  = 'X'.
  APPEND LS_EVENT_EXIT TO LT_EVENT_EXIT.

START-OF-SELECTION.

  SELECT *
  FROM LFA1
  CLIENT SPECIFIED
  INTO TABLE IT_LFA1
  UP TO 100 ROWS
  WHERE MANDT = SY-MANDT.

END-OF-SELECTION.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM      = 'ZTEST_IT'
      I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
      I_STRUCTURE_NAME        = 'LFA1'
      IT_EVENT_EXIT           = LT_EVENT_EXIT
    TABLES
      T_OUTTAB                = IT_LFA1[]
    EXCEPTIONS
      PROGRAM_ERROR           = 1
      OTHERS                  = 2.

  IF SY-SUBRC <> 0.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  ENDIF.


*&---------------------------------------------------------------------*

*&      Form  USER_COMMAND

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->P_COMMAND    text

*      -->RS_SELFIELD  text

*----------------------------------------------------------------------*

FORM USER_COMMAND USING P_COMMAND  TYPE SY-UCOMM

                       RS_SELFIELD TYPE SLIS_SELFIELD.


  CASE P_COMMAND.

    WHEN '&INFO'.

      CALL FUNCTION 'DSYS_SHOW_FOR_F1HELP'

        EXPORTING

          DOKCLASS   = 'RE'

          DOKNAME    = 'ZTEST_IT'

          SHORT_TEXT = 'X'

        EXCEPTIONS

          OTHERS     = 1.

  ENDCASE.

ENDFORM.                    "USER_COMMAND

9 REPLIES 9
Read only

sergey_korolev
Active Contributor
0 Likes
2,206

When in ALV standard behavior of i-button is showing some help information concerning ALV usage. To define your own processing I would suggest to redefine the GUI status and define your own command for the i-button.

If you want to show the default documentation of your report you can use the call:

             CALL FUNCTION 'DSYS_SHOW_FOR_F1HELP'

                 EXPORTING

                      DOKCLASS           = 'RE'

                      DOKNAME            = <your report name>

                      SHORT_TEXT         = 'X'

                 EXCEPTIONS

                      OTHERS             = 1.

Read only

Former Member
0 Likes
2,206

REPORT  ZGB_TEST_SEARCH_HELP                    .

* INTERNAL TABLE FOR STORING NAMES IN SELECTION LIST

data: begin of t_itab occurs 0,

        name(10) type c,

      end of t_itab.

*FIELDNAME AND TAB NAME FOR THE SELECTION

DATA :field_tab LIKE dfies  OCCURS 0 WITH HEADER LINE.

*THE TABLE FOR RETURNING THE NAME OF THE SELECTED ITEM

DATA : return_tab LIKE ddshretval OCCURS 0 WITH HEADER LINE.

*START THE SELECTION SCREEN BLOCK

selection-screen begin of block ss1 with frame.

parameters: p_name1(10) type c.

selection-screen end of block ss1.

at selection-screen on value-request for p_name1.

*CLEAR ALL EXISTING DATA

*TO BE DONE EVERYTIME F4 HELP IS REQUESTED

REFRESH t_itab.

REFRESH field_tab.

  field_tab-fieldname = 'ERNAM'.

  field_tab-tabname = 'VBAK'.

APPEND field_tab.

t_itab-name = 'Andrews'.

append t_itab.

t_itab-name = 'Jennie'.

append t_itab.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

  EXPORTING

*   DDIC_STRUCTURE         = ' '

    retfield               = field_tab-fieldname

*   PVALKEY                = ' '

*   DYNPPROG               = ' '

*   DYNPNR                 = ' '

*   DYNPROFIELD            = ' '

*   STEPL                  = 0

    WINDOW_TITLE           = 'Select name'

*   VALUE                  = ' '

*   VALUE_ORG              = 'C'

*   MULTIPLE_CHOICE        = ' '

*   DISPLAY                = ' '

*   CALLBACK_PROGRAM       = ' '

*   CALLBACK_FORM          = ' '

*   MARK_TAB               =

* IMPORTING

*   USER_RESET             =

  tables

   value_tab              = t_itab

   FIELD_TAB              = field_tab

   RETURN_TAB             = return_tab

*   DYNPFLD_MAPPING        =

EXCEPTIONS

   PARAMETER_ERROR        = 1

   NO_VALUES_FOUND        = 2

   OTHERS                 = 3

          .

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  1. else.

p_name1 = return_tab-fieldval.

  1. ENDIF.

at selection-screen on help-request for p_name1.

CALL FUNCTION 'DSYS_SHOW_FOR_F1HELP'

  EXPORTING

*   APPLICATION              = 'SO70'

    dokclass                 = 'TX'

    DOKLANGU                 = SY-LANGU

    dokname                  = 'Z_GAURAB_DEMO'

*   DOKTITLE                 = 'This appears as bold title'

*   HOMETEXT                 = ' '

*   OUTLINE                  = ' '

*   VIEWNAME                 = 'STANDARD'

*   Z_ORIGINAL_OUTLINE       = ' '

*   CALLED_FROM_SO70         = ' '

*   SHORT_TEXT               = ' '

*   APPENDIX                 = ' '

* IMPORTING

*   APPL                     =

*   PF03                     =

*   PF15                     =

*   PF12                     =

EXCEPTIONS

   CLASS_UNKNOWN            = 1

   OBJECT_NOT_FOUND         = 2

   OTHERS                   = 3

          .

IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  1. ENDIF.

Apart from the FM DSYS_SHOW_FOR_F1HELP,following FM’s can also be used:

  1. HELP_OBJECT_SHOW_FOR_FIELD
  2. HELP_OBJECT_SHOW

follow above  i hope you can under stand the process other wise you folloe the below link:

<link to blocked site removed by moderator>

Regards

Mahesh.

Message was edited by: Thomas Zloch

Read only

Former Member
0 Likes
2,206

Hi

http://scn.sap.com/thread/933242 this link will help much more help to you.

Regards

Mahesh.

Read only

Former Member
0 Likes
2,206

thanks for your efforts!

I tried your proposals ( particularly the tutorial), but I have still problems:

frist I created a help document in transaction se61. And then I wanted to implement process on help-request in the dynpro configurator. But there it says, that I need a field. But I haven't got a field, it's a alv-grid, not a input field. So how I can declare it on the dynpro ( the fuba isn't the problem).

I also search for help to redefine the gui status, but I don't understand how to do it.

Can you please help me again?

Regards

Julia

Read only

0 Likes
2,206

Hi

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

PFL.

Regards,

Mahesh.

Read only

0 Likes
2,206

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

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

I hope above links are usefull.

Regards

mahesh

Read only

Former Member
0 Likes
2,206

create a standard text using transaction SO10 that you need to display on click of i button.

also create a custom GUI status for i button and on click of it display the text using Function module READ_TEXT

For example,

you can define a  function key.

if  sscrfields-ucomm= 'FC01'.

call function 'READ _TEXT'

endif.

Read only

former_member282968
Contributor
2,207

Hi Julia

To get the documentation on click of  i-Button follow the below steps:

1. In the report progam goto->documentation and enter the documentation.

2. These documentation gets saved in tables Viz.,DOKIL, DOKHL and DOKTL.

3. Now if you are using the ALV grid display then you must be using the   FM  'REUSE_ALV_GRID_DISPLAY'.In this there is a parameter called

IT_EVENT_EXIT .You need to pass the user command for this parameter, in this case it is '&INFO' with before and after fields.

4.So once you click on the i-button it triggers the f-code passed in the IT_EVENT_EXIT and comes to the sub-routine passed with the paramter I_CALLBACK_USER_COMMAND in the FM.

5.Then use the FM 'DSYS_SHOW_FOR_F1HELP' to display the documentation.

I have created the program for your reference please copy the below code and check:

REPORT  ZTEST_IT.

TYPE-POOLS:SLIS.


DATA:IT_LFA1                 TYPE TABLE OF        LFA1,
           WA_LFA1              TYPE                          LFA1,
           LT_EVENT_EXIT  TYPE TABLE OF       SLIS_EVENT_EXIT,
           LS_EVENT_EXIT  TYPE                          SLIS_EVENT_EXIT.



INITIALIZATION.

  LS_EVENT_EXIT-UCOMM = '&INFO'.
  LS_EVENT_EXIT-BEFORE = 'X'.
  LS_EVENT_EXIT-AFTER  = 'X'.
  APPEND LS_EVENT_EXIT TO LT_EVENT_EXIT.

START-OF-SELECTION.

  SELECT *
  FROM LFA1
  CLIENT SPECIFIED
  INTO TABLE IT_LFA1
  UP TO 100 ROWS
  WHERE MANDT = SY-MANDT.

END-OF-SELECTION.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM      = 'ZTEST_IT'
      I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
      I_STRUCTURE_NAME        = 'LFA1'
      IT_EVENT_EXIT           = LT_EVENT_EXIT
    TABLES
      T_OUTTAB                = IT_LFA1[]
    EXCEPTIONS
      PROGRAM_ERROR           = 1
      OTHERS                  = 2.

  IF SY-SUBRC <> 0.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  ENDIF.


*&---------------------------------------------------------------------*

*&      Form  USER_COMMAND

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->P_COMMAND    text

*      -->RS_SELFIELD  text

*----------------------------------------------------------------------*

FORM USER_COMMAND USING P_COMMAND  TYPE SY-UCOMM

                       RS_SELFIELD TYPE SLIS_SELFIELD.


  CASE P_COMMAND.

    WHEN '&INFO'.

      CALL FUNCTION 'DSYS_SHOW_FOR_F1HELP'

        EXPORTING

          DOKCLASS   = 'RE'

          DOKNAME    = 'ZTEST_IT'

          SHORT_TEXT = 'X'

        EXCEPTIONS

          OTHERS     = 1.

  ENDCASE.

ENDFORM.                    "USER_COMMAND

Read only

0 Likes
2,206

I have tried your version - it works! thanks for that!

There is only one problem: I work with oo-alv grid. How does it work with an oo-alv? Is there any method that I can call like 'REUSE_ALV_GRID_DISPLAY' and give the method the parameters, which you are give to the fm?

Edit:

I found a solution based on your proposal in oo-way:

    handle_user_command

       FOR EVENT  before_user_command OF cl_gui_alv_grid

        IMPORTING e_ucomm.

-----------------------------------------------------------------------------------

METHOD handle_user_command.

   
CASE e_ucomm.
     
WHEN  '&INFO'.
       
CALL FUNCTION 'DSYS_SHOW_FOR_F1HELP'
         
EXPORTING
            dokclass  
= 'RE'
            dokname   
= 'Z_Test'
            short_text
= 'X'
         
EXCEPTIONS
           
OTHERS     = 1.
   
ENDCASE.
 
CALL METHOD grid1->set_user_command
   
EXPORTING
      i_ucomm
= SPACE.

 
ENDMETHOD.

---------------------------------------

it works for the i-button above the alv-grid.

@all thanks for your help and patience!

Message was edited by: Julia Hans