Application Development 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: 

Use of field_tab in F4IF_INT_TABLE_VALUE_REQUEST

Former Member
0 Kudos

if i'm passing the itab with no standard columns, then how to modify the column heading in f4 help window?

getting the error- ASSIGN WITH LENGTH 0 in program 'SAPLSDH4'.

My CODE:-

PARAMETERS:

          p_name   TYPE char10,

          p_date    TYPE dats.

types: BEGIN OF ty_f4help,

                name          TYPE    char10,

                date        TYPE    dats,

           END OF ty_f4help.


DATA : it_f4help         TYPE TABLE OF   ty_f4help,

         wa_f4help         TYPE            ty_f4help .



DATA:

       it_dynpmap TYPE STANDARD TABLE OF dselc,

       wa_map TYPE dselc.

DATA: lw_field_tab  TYPE dfies,

     li_field_tab  type STANDARD TABLE OF dfies.



  wa_map-fldname = 'F0001'. "Field for Position 1

   wa_map-dyfldname = 'P_name'.

   APPEND wa_map TO it_dynpmap.

   wa_map-fldname = 'F0002'. "Field for Position 2

   wa_map-dyfldname = 'P_date'.

   APPEND wa_map TO it_dynpmap.


lw_field_tab-fieldname = 'F0001'.

   lw_field_tab-position = 1.

   lw_field_tab-fieldtext = 'F0001'.     "Field name you want to give

   lw_field_tab-reptext   = 'Name'.                "Field name you want to give

   APPEND lw_field_tab TO li_field_tab.

   lw_field_tab-fieldname = 'F0002'.

   lw_field_tab-position = 2.

   lw_field_tab-fieldtext = 'F0002'.     "Field name you want to give

   lw_field_tab-reptext   = 'Date'.                "Field name you want to give

   APPEND lw_field_tab TO li_field_tab.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

     EXPORTING

       retfield        = 'name'

       dynpprog        = sy-repid

       dynpnr          = sy-dynnr

       dynprofield     = 'P_name'

       value_org       = 'S'

     TABLES

       value_tab       = it_f4help

       dynpfld_mapping = it_dynpmap

       return_tab      = it_return_tab

      field_tab = li_field_tab

     EXCEPTIONS

       parameter_error = 1

       no_values_found = 2

       OTHERS          = 3.

   IF sy-subrc = 0.

*     Do nothing

   ENDIF.

5 REPLIES 5

former_member182915
Active Contributor
0 Kudos

Hi ,

every thing is ok error due to

*  lw_field_tab-fieldname = 'F0001'.
*  lw_field_tab-position = 1.
*  lw_field_tab-fieldtext = 'F0001'.     "Field name you want to give
*  lw_field_tab-reptext   = 'Name'.                "Field name you want to give
*  APPEND lw_field_tab TO li_field_tab.

*  lw_field_tab-fieldname = 'F0002'.
*  lw_field_tab-position = 2.
*  lw_field_tab-fieldtext = 'F0002'.     "Field name you want to give
*  lw_field_tab-reptext   = 'Date'.                "Field name you want to give
*  APPEND lw_field_tab TO li_field_tab.

Comment those line

and use

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_name for value help .

you found for column 1 it shows f0001 and for column 2 Date only because of data element in case of 2nd it pick form DDIC but for 1st it is help less . if u want use name1 for 1 column and check.

former_member182915
Active Contributor
0 Kudos

Hi ,

Test code

TABLES: usr02.

parameters: p_bname LIKE usr02-bname,

p_class LIKE usr02-class.



AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_bname.

PERFORM f_valuerequest_vbeln.

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

*& Form f_valuerequest_vbeln

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

* text

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

* --> p1 text

* <-- p2 text

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

FORM f_valuerequest_vbeln.



DATA: BEGIN OF t_data OCCURS 1,

data(20),

END OF t_data.



DATA: lwa_dfies TYPE dfies.



data h_field_wa LIKe dfies.

data h_field_tab like dfies occurs 0 with header line.

data h_dselc like dselc occurs 0 with header line.



SELECT * FROM usr02.

t_data = usr02-bname. APPEND t_data.

t_data = usr02-class. APPEND t_data.

ENDSELECT.



PERFORM f_fieldinfo_get USING 'USR02'

'BNAME'

CHANGING h_field_wa.

APPEND h_field_wa TO h_field_tab.

PERFORM f_fieldinfo_get USING 'USR02'

'CLASS'

CHANGING h_field_wa.

APPEND h_field_wa TO h_field_tab.



h_dselc-fldname = 'BNAME'.

h_dselc-dyfldname = 'P_BNAME'.

APPEND h_dselc.

h_dselc-fldname = 'CLASS'.

h_dselc-dyfldname = 'P_CLASS'.

APPEND h_dselc.



DATA: ld_repid LIKE sy-repid.

ld_repid = sy-repid.

BREAK-POINT.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'P_BNAME'

dynpprog = ld_repid

dynpnr = '1000'

dynprofield = 'P_BNAME'

* multiple_choice = ''

* value_org = 'S'

TABLES

value_tab = t_data

field_tab = h_field_tab

* return_tab = return_tab

DYNPFLD_MAPPING = h_dselc

EXCEPTIONS

OTHERS = 0.



ENDFORM. " f_valuerequest_vbeln





FORM f_fieldinfo_get USING fu_tabname

fu_fieldname

CHANGING fwa_field_tab.





CALL FUNCTION 'DDIF_FIELDINFO_GET'

EXPORTING

TABNAME = fu_tabname

FIELDNAME = fu_fieldname

LFIELDNAME = fu_fieldname

IMPORTING

DFIES_WA = fwa_field_tab

EXCEPTIONS

NOT_FOUND = 1

INTERNAL_ERROR = 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. " f_fieldinfo_get

0 Kudos

Actually in the test code you can change the

parameters: p_bname LIKE usr02-bname to

parameters: p_bname type char10,

because of

PERFORM f_fieldinfo_get USING 'USR02' 'BNAME' CHANGING h_field_wa.

it fetch desc. from data element so name is coming even after using char10 using.

Hope this will help you.


0 Kudos

What if I want to give some custom names to the columns of f4help and if i'm using Char10 and Dats as the data types for the internal table.???

0 Kudos

Hi ,


Actually in the test code you can change the

parameters: p_bname LIKE usr02-bname to

parameters: p_bname type char10,

 

because of

PERFORM f_fieldinfo_get USING 'USR02' 'BNAME' CHANGING h_field_wa.

it fetch desc. from data element so name is coming even after using char10 using.

Hope this will help you.

Fine if u use any custom Data type then system failed to pick the heading so we do the as

PERFORM f_fieldinfo_get USING 'USR02' 'BNAME'  ==>From where we want to pick heading

CHANGING h_field_wa.

APPEND h_field_wa TO h_field_tab.  ==> Append to internal table  h_field_tab.

pass the internal table to table parameter of

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

table

field_tab = h_field_tab

So that System handle.