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. Code Fix Help

Former Member
0 Likes
1,150

Hello all,

I have the code which should display 2 fields in the F4 help through program.

I am facing 2 problems.

1. Only one field is displayed on F4 popup window

2. When selecting any row, the data is not coming on the selection screen.

Any help?

The code is below for your reference..

===============


REPORT  Z_F4_HELP.

TABLES: VDARL.        "Loans


*----------------------------------------------------------------------*
* Selection Screen                                                     *
*----------------------------------------------------------------------*

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-100.
  SELECT-OPTIONS : S_GSART   FOR   VDARL-GSART.     " Product Type
SELECTION-SCREEN END OF BLOCK B1.

*************************************

AT SELECTION-SCREEN ON  VALUE-REQUEST FOR S_GSART-LOW.

  DATA : V_DYNFIELD TYPE HELP_INFO-DYNPROFLD.
  V_DYNFIELD = 'S_GSART' .

  DATA : BEGIN OF IT_HELP OCCURS 0,
          PTYPE LIKE VDARL-GSART,
          TEST(30) TYPE C,
         END OF  IT_HELP.
  DATA : IT_FIELD TYPE STANDARD TABLE OF DFIES .

  DATA : BEGIN OF IT_HELP2 OCCURS 0,
   PTYPE LIKE VDARL-GSART,
   TEST(30) TYPE C,
  END OF  IT_HELP2.




  SELECT GSART FROM TZPAB INTO TABLE IT_HELP WHERE BUKRS = '1000'.
  IF NOT IT_HELP[] IS INITIAL.
    SELECT GSART LTX FROM TZPAT INTO TABLE IT_HELP2 FOR ALL ENTRIES IN IT_HELP WHERE GSART = IT_HELP-PTYPE AND SPRAS = 'E' .
      SORT IT_HELP2 BY TEST.
      DELETE IT_HELP2 WHERE TEST IS INITIAL.
  ENDIF.


*data : ret_field type DFIES-FIELDNAME.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      RETFIELD        = 'S_GSART'
      DYNPPROG        = SY-REPID
      DYNPNR          = SY-DYNNR
      DYNPROFIELD     = V_DYNFIELD
      VALUE_ORG       = 'S'
    TABLES
      VALUE_TAB       = IT_HELP2
    EXCEPTIONS
      PARAMETER_ERROR = 1
      NO_VALUES_FOUND = 2
      OTHERS          = 3.

Edited by: Vijay Babu Dudla on Jan 14, 2009 7:50 AM

11 REPLIES 11
Read only

Former Member
0 Likes
1,125

hi,

Check the below code ..

DATA:
    lt_select_values  LIKE STANDARD TABLE OF ddshretval,
    l_select_values  LIKE  ddshretval.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield        = 'VJAHR'
      dynpprog        = sy-repid
      dynpnr          = sy-dynnr
      window_title    = 'Year'                              "#EC NOTEXT
      value_org       = 'S'
    TABLES
      value_tab       = i_year_tab
      return_tab      = lt_select_values
    EXCEPTIONS
      parameter_error = 1
      no_values_found = 2
      OTHERS          = 3.
  IF sy-subrc EQ 0.
    CLEAR l_select_values.
    READ TABLE lt_select_values INTO l_select_values INDEX 1.
    IF sy-subrc EQ 0.
      p_year = l_select_values-fieldval.
    ENDIF.
  ENDIF.

Read only

0 Likes
1,125

Its not working by this as well.

Basically, I am not getting any return value.

So nothing is getting assigned to the screen field.

The popup window is also showing single field.

Read only

faisalatsap
Active Contributor
0 Likes
1,125

hi,

Please Go through the following Threads you will find you Answer

Replay if any Issue.

Kind Regards,

Faisal

Read only

0 Likes
1,125

Hello,

I have searched the forum but my problem is not resolved. So I thought of pasting the code.

I guess there is some minor thign which I have missed.

Thanks anyways.

Read only

0 Likes
1,125

If you read the documentation for F4IF_INT_TABLE_VALUE_REQUEST you will see a section that says:

"DYNPPROG and DYNNR cannot be passed as SY-REPID and SY-DYNNR because they are only analyzed after the function module has been called. Instead, first copy the SY fields to local variables and then pass them to the function module."

... however you don't need to set them in your call as it will work it out for you... as for the return field, you probably need to add "-LOW" to your logic...


  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
    exporting
      retfield        = 'S_ACTION-LOW'  "select-options range
      window_title    = 'Select Action'
      value_org       = 'S'
    tables
      value_tab       = lt_value
      return_tab      = lt_return
    exceptions
      parameter_error = 1
      no_values_found = 2
      others          = 3.

Jonathan

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,125

Hello,

I will like to add to what the previous post has stated to use S_GSART-LOW in the FM.

In your AT SELECTION-SCREEN ON VALUE REQUEST event you have used:


AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_GSART-LOW.
"You have used the screen field S_GSART-LOW and not S_GSART

So ideally in the F4 help FM you should pass S_GSART-LOW & not S_GSART.


CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'S_GSART-LOW' "--> Do not use 'S_GSART'
* DYNPPROG = SY-REPID "As mentioned you should not use SYST fields directly in the FM
* DYNPNR = SY-DYNNR
DYNPROFIELD = V_DYNFIELD
VALUE_ORG = 'S'
TABLES
VALUE_TAB = IT_HELP2
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3.

BR,

Suhas

Read only

faisalatsap
Active Contributor
0 Likes
1,125

hi, Pranu

Try with your following code it is working fine now little change in it,

TABLES: vdarl.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-100.
SELECT-OPTIONS : s_gsart FOR vdarl-gsart. " Product Type
SELECTION-SCREEN END OF BLOCK b1.

*************************************

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_gsart-low.
DATA: i_return TYPE ddshretval OCCURS 0 WITH HEADER LINE,
      c TYPE c VALUE 'S'.
  DATA : v_dynfield TYPE help_info-dynprofld.
  v_dynfield = 'S_GSART' .

  DATA : BEGIN OF it_help OCCURS 0,
  ptype LIKE vdarl-gsart,
  test(30) TYPE c,
  END OF it_help.
  DATA : it_field TYPE STANDARD TABLE OF dfies .

  DATA : BEGIN OF it_help2 OCCURS 0,
  ptype LIKE vdarl-gsart,
  test(30) TYPE c,
  END OF it_help2.
*BREAK-POINT .

  SELECT gsart FROM tzpab INTO TABLE it_help WHERE bukrs = '1000'.
  IF it_help[] IS INITIAL.
    SELECT gsart ltx FROM tzpat INTO TABLE it_help2 FOR ALL ENTRIES IN it_help WHERE gsart = it_help-ptype AND spras = 'E' .
    SORT it_help2 BY test.
    DELETE it_help2 WHERE test IS INITIAL.
  ENDIF.

BREAK-POINT .
*data : ret_field type DFIES-FIELDNAME.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield        = 'PTYPE'
      dynpprog        = sy-repid
      dynpnr          = sy-dynnr
      dynprofield     = 'PTYPE'
      value_org       = c
    TABLES
      value_tab       = it_help2
      return_tab  = i_return
    EXCEPTIONS
      parameter_error = 1
      no_values_found = 2
      OTHERS          = 3.

Replay if still there is any Issue,

Kind Regards,

Faisal

Read only

0 Likes
1,125

Its not working with all the options above.

If the piece of code working in your system?

Is it got to do with version? I am on ECC6

I dont know bit its not working.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,125

Hello,

Plz add the code as followa:


  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      RETFIELD        = 'S_GSART-LOW'
*      DYNPPROG        = SY-REPID
*      DYNPNR          = SY-DYNNR
      DYNPROFIELD     = V_DYNFIELD
      VALUE_ORG       = 'S'
    TABLES
      VALUE_TAB       = IT_HELP2
    EXCEPTIONS
      PARAMETER_ERROR = 1
      NO_VALUES_FOUND = 2
      OTHERS          = 3.

  IF SY-SUBRC = 0.

    READ TABLE IT_HELP2 INDEX 1.
    IF SY-SUBRC = 0.
      S_GSART-LOW =  IT_HELP2-PTYPE.
    ENDIF.
  ENDIF.

It is working on my system.

BR,

Suhas

Read only

0 Likes
1,125

Hi ,

You have to use the "field_tab = int_field" in the function module 'F4IF_INT_TABLE_VALUE_REQUEST'. Here you can decalre the fields which you want to be displayed in the output. YOu can even add some more fields.

Sample code:-

Add the following code o your program -

DATA : int_field TYPE TABLE OF dfies,

wa_field TYPE dfies.

wa_field-fieldname = 'PTYPE'.

wa_field-leng = 6.

wa_field-intlen = 6.

wa_field-outputlen = 6.

wa_field-datatype = 'CHAR'.

wa_field-inttype = 'C'.

wa_field-scrtext_s = 'PTYPE'.

wa_field-scrtext_m = 'PTYPE'.

wa_field-scrtext_l = 'PTYPE'.

APPEND wa_field TO int_field.

CLEAR wa_field.

wa_field-fieldname = 'TEST'.

wa_field-offset = 6.

wa_field-leng = 60.

wa_field-intlen = 60.

wa_field-outputlen = 60.

wa_field-datatype = 'CHAR'.

wa_field-inttype = 'C'.

wa_field-scrtext_s = 'TEST'.

wa_field-scrtext_m = 'TEST'.

wa_field-scrtext_l = 'TEST'.

APPEND wa_field TO int_field.

CLEAR wa_field.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'PTYPE'

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'PTYPE'

value_org = 'S'

TABLES

value_tab = it_help2

field_tab = int_field

return_tab = i_return

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

Edited by: Krishna Adabala on Jan 14, 2009 11:56 AM

Read only

faisalatsap
Active Contributor
0 Likes
1,125

Hi, Pranu

Just Change as follow,

DATA : BEGIN OF IT_HELP2 OCCURS 0,
PTYPE LIKE VDARL-GSART,
TEST(30) TYPE C,         " Replace this Line with the Bellow Line
END OF IT_HELP2.


DATA : BEGIN OF IT_HELP2 OCCURS 0,
PTYPE LIKE VDARL-GSART,
TEST like tzpat-ltx        " Like This
END OF IT_HELP2.

It will solve you problem i have tested,,

also Replace the following Fountion line with the Bellow line.

retfield        = 'S_GSART'   "Replace this line

retfield        = 'PTYPE' " With This one

Reply if any Problem, I am waiting from you.

Kind Regards,

Faisal

Edited by: Faisal Altaf on Jan 14, 2009 4:46 PM