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

F4 help for function module

Former Member
0 Likes
470

Hi experts

Is it possible to place F4 help for the function module import parameter like If we excute the FM from se37 the input box should need the F4 help.

if possible , let me know the sample code

thanks

sai

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
395

yes you can do that..

in side the source code ..

write the select statement according to requirement and pass the internal table to below function moduel and return field to yor help field..

call the below fm inside the function module..

'POPUP_WITH_TABLE_DISPLAY' or 'REUSE_ALV_POPUP_TO_SELECT'

see the sample code...


FUNCTION Z_MFG_PLANTS_F4 .
"----------------------------------------------------------------------
"*"Local Interface:
"  IMPORTING
"     REFERENCE(W_WERKS) TYPE WERKS OPTIONAL
"  IMPORTING
"      REFERENCE(W_MATNR)    TYPE MANTR OPTIONAL
"----------------------------------------------------------------------


* Alv popup display
DATA : gc_selfield     TYPE slis_selfield,
       gt_fieldcat_drd TYPE slis_t_fieldcat_alv WITH HEADER LINE.

p_werks = W_WERKS.

data : begin of t_marc occurs 0,
            werks type werks,
            matnr type matnr,
        end of t_marc

select matnr werks from marc into table t_marc where werks = p_werks.

  IF t_disp[] IS NOT INITIAL.

  gt_fieldcat_drd-seltext_m = 'Material'.
  gt_fieldcat_drd-fieldname = 'MATNR'.
  APPEND gt_fieldcat_drd.
  CLEAR : gt_fieldcat_drd.

  gt_fieldcat_drd-seltext_m = 'WERKS'.
  gt_fieldcat_drd-fieldname = ''WERKS'.
  APPEND gt_fieldcat_drd.
  CLEAR : gt_fieldcat_drd.


* Allow the user to select the required plant
  CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
    EXPORTING
      i_title               = 'Material Selection for Plant'
      i_selection           = 'X'
      i_screen_start_column = 5
      i_screen_start_line   = 5
      i_screen_end_column   = 70
      i_screen_end_line     = 20
      i_tabname             = 'T_MARC'
      it_fieldcat           = gt_fieldcat_drd[]
    IMPORTING
      es_selfield           = gc_selfield
    TABLES
      t_outtab              = t_MARC
    EXCEPTIONS
      program_error         = 1
      OTHERS                = 2.
  IF sy-subrc <> 0.
  ENDIF.

  READ TABLE t_MARC INDEX gc_selfield-tabindex.
  IF sy-subrc = 0.
        w_matnr = t_matnr-matnr.
  ENDIF.

ENDIF.



ENDFUNCTION.

Prabhudas

Edited by: Prabhu Das on May 21, 2009 7:35 PM

1 REPLY 1
Read only

Former Member
0 Likes
396

yes you can do that..

in side the source code ..

write the select statement according to requirement and pass the internal table to below function moduel and return field to yor help field..

call the below fm inside the function module..

'POPUP_WITH_TABLE_DISPLAY' or 'REUSE_ALV_POPUP_TO_SELECT'

see the sample code...


FUNCTION Z_MFG_PLANTS_F4 .
"----------------------------------------------------------------------
"*"Local Interface:
"  IMPORTING
"     REFERENCE(W_WERKS) TYPE WERKS OPTIONAL
"  IMPORTING
"      REFERENCE(W_MATNR)    TYPE MANTR OPTIONAL
"----------------------------------------------------------------------


* Alv popup display
DATA : gc_selfield     TYPE slis_selfield,
       gt_fieldcat_drd TYPE slis_t_fieldcat_alv WITH HEADER LINE.

p_werks = W_WERKS.

data : begin of t_marc occurs 0,
            werks type werks,
            matnr type matnr,
        end of t_marc

select matnr werks from marc into table t_marc where werks = p_werks.

  IF t_disp[] IS NOT INITIAL.

  gt_fieldcat_drd-seltext_m = 'Material'.
  gt_fieldcat_drd-fieldname = 'MATNR'.
  APPEND gt_fieldcat_drd.
  CLEAR : gt_fieldcat_drd.

  gt_fieldcat_drd-seltext_m = 'WERKS'.
  gt_fieldcat_drd-fieldname = ''WERKS'.
  APPEND gt_fieldcat_drd.
  CLEAR : gt_fieldcat_drd.


* Allow the user to select the required plant
  CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
    EXPORTING
      i_title               = 'Material Selection for Plant'
      i_selection           = 'X'
      i_screen_start_column = 5
      i_screen_start_line   = 5
      i_screen_end_column   = 70
      i_screen_end_line     = 20
      i_tabname             = 'T_MARC'
      it_fieldcat           = gt_fieldcat_drd[]
    IMPORTING
      es_selfield           = gc_selfield
    TABLES
      t_outtab              = t_MARC
    EXCEPTIONS
      program_error         = 1
      OTHERS                = 2.
  IF sy-subrc <> 0.
  ENDIF.

  READ TABLE t_MARC INDEX gc_selfield-tabindex.
  IF sy-subrc = 0.
        w_matnr = t_matnr-matnr.
  ENDIF.

ENDIF.



ENDFUNCTION.

Prabhudas

Edited by: Prabhu Das on May 21, 2009 7:35 PM