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

Help Needed for F4 Help

Former Member
0 Likes
765

Dear Friends,

I am using On Value Help Function Module F4IF_INT_TABLE_VALUE_REQUEST for having F4 help. I am able to see the pssoible values of the field on selection screen after executing this FM but I am not able to select value from this.

I am using this FM in the following way :

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'XPHASE'

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'XPHASE'

value_org = 'S'

TABLES

value_tab = t_phase

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3

I need to select the values and pass the same on the selection screen. Can any one help me in this.

Regards,

Lalit Kabra

1 ACCEPTED SOLUTION
Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
737

Hi,

Refer this demo code:-


PARAMETERS : p_belnr TYPE belnr,
             p_bukrs TYPE bukrs.
 
DATA : BEGIN OF itab OCCURS 0,
         belnr TYPE belnr,
       END OF itab.
 
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_belnr.
 
  PERFORM f4_belnr_help USING p_belnr.
 
*&---------------------------------------------------------------------*
*&      Form  f4_belnr_help
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_BELNR text
*----------------------------------------------------------------------*
FORM f4_belnr_help USING p_belnr.
  
  SELECT belnr from <db_table> INTO TABLE itab.
 
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield               = 'BELNR' "internal table field
      dynpprog               = 'Z_F4' "program name
      dynpnr                 = '1000' "screen number
      dynprofield            = 'P_BELNR' "screen field name
      value_org              = 'S'
    TABLES
      value_tab              = itab "internal table
    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.
  ENDIF.
 
ENDFORM.                    " f4_belnr_help

Hope this helps you.

Regards,

Tarun

Dear Friends,

I am using On Value Help Function Module F4IF_INT_TABLE_VALUE_REQUEST for having F4 help. I am able to see the pssoible values of the field on selection screen after executing this FM but I am not able to select value from this.

I am using this FM in the following way :

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'XPHASE'

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'XPHASE'

value_org = 'S'

TABLES

value_tab = t_phase

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3

I need to select the values and pass the same on the selection screen. Can any one help me in this.

Regards,

Lalit Kabra

4 REPLIES 4
Read only

venkat_o
Active Contributor
0 Likes
737

Hi, You are not reading t_phase table from function module. read that and pass the value from that to screen field. <li>After function module call, need to do the below one

IF sy-subrc EQ 0.
    READ TABLE t_phase INTO w_phase INDEX 1.
    IF sy-subrc EQ 0.
      XPHASE = wa_return-fieldval. "XPHASE should be screen field for which you  want f4 help.
    ENDIF.
  ENDIF.
<li>check the reference program

  REPORT ztest_notepad.

DATA: BEGIN OF it_marc OCCURS 0,
        matnr TYPE marc-matnr,
        werks TYPE marc-werks,
      END OF it_marc.
DATA:it_dynpread TYPE TABLE OF dynpread,
     wa_dynpread LIKE LINE OF it_dynpread.
DATA: it_return_tab TYPE ddshretval OCCURS 0,
      wa_return LIKE LINE OF it_return_tab.
PARAMETERS:
        p_werks TYPE marc-werks,
        p_matnr TYPE marc-matnr.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.

  wa_dynpread-fieldname = 'P_WERKS'.
  APPEND wa_dynpread TO it_dynpread.
  CLEAR  wa_dynpread.
 "DYNP_VALUES_READ read screen
  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname     = sy-repid
      dynumb     = sy-dynnr
    TABLES
      dynpfields = it_dynpread.
  READ TABLE it_dynpread INTO wa_dynpread INDEX 1.
  p_werks = wa_dynpread-fieldvalue.
  IF it_marc[] IS INITIAL.
    SELECT * FROM marc INTO CORRESPONDING FIELDS OF TABLE it_marc WHERE werks = p_werks.
  ENDIF.
  "F4 help F4IF_INT_TABLE_VALUE_REQUEST
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield    = 'MATNR'
      dynpprog    = sy-repid
      dynpnr      = sy-dynnr
      dynprofield = 'P_MATNR'
      value_org   = 'S'
    TABLES
      value_tab   = it_marc
      return_tab  = it_return_tab.
  IF sy-subrc EQ 0.
    READ TABLE it_return_tab INTO wa_return INDEX 1.
    IF sy-subrc EQ 0.
      p_matnr = wa_return-fieldval.
    ENDIF.
  ENDIF. 
Thanks Venkat

Read only

Former Member
0 Likes
737

Hi,

TYPES: BEGIN OF t_valuehelp,

y TYPE ztable-y,

xTYPE ztable-x

END OF t_valuehelp.

DATA :i_valuehelp TYPE STANDARD TABLE OF t_valuehelp,

wa_valuehelp TYPE t_valuehelp

SELECT x y

FROM table INTO TABLE i_valuehelp

WHERE x EQ 1.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ' '

retfield = 'table field name'

  • PVALKEY = ' '

dynpprog = sy-cprog

dynpnr = sy-dynnr

dynprofield = 'Screen field name'

value_org = 'S'

TABLES

value_tab = i_valuehelp.

Hope this helps.

Jithin

Edited by: jithin james on Sep 30, 2009 12:05 PM

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
738

Hi,

Refer this demo code:-


PARAMETERS : p_belnr TYPE belnr,
             p_bukrs TYPE bukrs.
 
DATA : BEGIN OF itab OCCURS 0,
         belnr TYPE belnr,
       END OF itab.
 
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_belnr.
 
  PERFORM f4_belnr_help USING p_belnr.
 
*&---------------------------------------------------------------------*
*&      Form  f4_belnr_help
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_BELNR text
*----------------------------------------------------------------------*
FORM f4_belnr_help USING p_belnr.
  
  SELECT belnr from <db_table> INTO TABLE itab.
 
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield               = 'BELNR' "internal table field
      dynpprog               = 'Z_F4' "program name
      dynpnr                 = '1000' "screen number
      dynprofield            = 'P_BELNR' "screen field name
      value_org              = 'S'
    TABLES
      value_tab              = itab "internal table
    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.
  ENDIF.
 
ENDFORM.                    " f4_belnr_help

Hope this helps you.

Regards,

Tarun

Read only

Former Member
0 Likes
737

Hi,


REPORT  YKC_SEARCH_HELP.

*internal table made to populate the value of werks when pressing f4
DATA: BEGIN OF IT_FINAL OCCURS 0,
      WERKS TYPE MARC-WERKS,
      END OF IT_FINAL.

data: IT_RETURN LIKE DDSHRETVAL OCCURS 0 WITH header line.

parameters: p_werks(10) type c.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_werks.

  select  werks from marc
  into table IT_FINAL.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
*   DDIC_STRUCTURE         = ' '
      RETFIELD               = 'WERKS'   "field of internal table
     VALUE_ORG              = 'S'
    TABLES
      VALUE_TAB              = IT_FINAL
*   FIELD_TAB              =
     RETURN_TAB             = IT_RETURN
            .
 WRITE IT_RETURN-FIELDVAL TO P_WERKS.
  REFRESH IT_FINAL.

Thanks,

Krishna