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

Retrieving values selected in a dropdown list

Former Member
0 Likes
2,948

Hello Experts,

I have one field "JOBCD" on the Infotype screen. there is no search help attached to this field. so i am populating required values in internal table and passing internal table to FM "F4IF_INT_TABLE_VALUE_REQUEST".

Using this FM i am getting F4 functionality but when i am selecting the one of the value from the list of values from POP-UP window, that value is not coming in screen field "JOBCD".

how to get the selected value from list into screen field?

Thanks & Regards,

Saurabh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,128

Dear ,

do like this.

DATA : T_NAME2_VAL TYPE STANDARD TABLE OF DDSHRETVAL WITH HEADER LINE.

FORM help_xref1 USING P_AGENCY_LOW.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • ddic_structure = 'KNA1'

retfield = 'ZZNAME1'

  • PVALKEY = ' '

dynpprog = 'ZFIR_BILLING'

dynpnr = sy-dynnr

dynprofield = 'AGENCY'

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

value_org = 'S'

MULTIPLE_CHOICE = 'X'

  • DISPLAY = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

TABLES

value_tab = T_NAME2

  • FIELD_TAB =

RETURN_TAB = T_NAME2_VAL

  • DYNPFLD_MAPPING =

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3

.

IF sy-subrc = 0.

REFRESH AGENCY.

LOOP AT T_NAME2_VAL.

AGENCY-SIGN = 'I'.

AGENCY-OPTION = 'EQ'.

AGENCY-LOW = T_NAME2_VAL-FIELDVAL.

APPEND AGENCY.

  • CLEAR AGENCY.

ENDLOOP.

ENDIF.

ENDFORM. " help_xref1

Regards

vijay

Edited by: vijay dwivedi on Feb 26, 2009 11:24 PM

4 REPLIES 4
Read only

Former Member
0 Likes
1,128

check if UR reading the field value ..

read table lt_return into ls_return

with key fieldname = 'JOBCD'.

if sy-subrc eq 0.

JOBCD = ls_return-fieldval.

endif.

Read only

Former Member
0 Likes
1,129

Dear ,

do like this.

DATA : T_NAME2_VAL TYPE STANDARD TABLE OF DDSHRETVAL WITH HEADER LINE.

FORM help_xref1 USING P_AGENCY_LOW.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • ddic_structure = 'KNA1'

retfield = 'ZZNAME1'

  • PVALKEY = ' '

dynpprog = 'ZFIR_BILLING'

dynpnr = sy-dynnr

dynprofield = 'AGENCY'

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

value_org = 'S'

MULTIPLE_CHOICE = 'X'

  • DISPLAY = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

TABLES

value_tab = T_NAME2

  • FIELD_TAB =

RETURN_TAB = T_NAME2_VAL

  • DYNPFLD_MAPPING =

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3

.

IF sy-subrc = 0.

REFRESH AGENCY.

LOOP AT T_NAME2_VAL.

AGENCY-SIGN = 'I'.

AGENCY-OPTION = 'EQ'.

AGENCY-LOW = T_NAME2_VAL-FIELDVAL.

APPEND AGENCY.

  • CLEAR AGENCY.

ENDLOOP.

ENDIF.

ENDFORM. " help_xref1

Regards

vijay

Edited by: vijay dwivedi on Feb 26, 2009 11:24 PM

Read only

Former Member
0 Likes
1,128

Hi,

Instead of Function Module you can use the codes below.Function Module will hamper the performance of your program because at run time whole function modules memory will be loaded into the program

Use At selection-screen for value-request for name.

PARAMETERS: Name(20) type C.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR name.

CALL SCREEN 100 STARTING AT 10 5

ENDING AT 50 10.

MODULE value_list OUTPUT.

SUPPRESS DIALOG.

LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.

SET PF-STATUS space.

NEW-PAGE NO-TITLE.

name = 'Gurpreet'.

Write : / name.

hide name.

name = 'RAM'.

Write : / name.

hide name.

ENDMODULE.

AT LINE-SELECTION.

CHECK NOT name IS INITIAL.

LEAVE TO SCREEN 0.

OR,

Refer to :

[F4_TABLE|https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/f4helpofonefielddependsonotherfield]

Regards,

Gurpreet.

Read only

awin_prabhu
Active Contributor
0 Likes
1,128

Hi friend,

U have to use 'DYNP_VALUES_UPDATE' function after ur FM 'F4IF_INT_TABLE_VALUE_REQUEST' for updating screen field with the selected value.

Add below code after ur FM 'F4IF_INT_TABLE_VALUE_REQUEST' :

(Note: g_tret is return table from FM 'F4IF_INT_TABLE_VALUE_REQUEST' which contains selected value)

data: t_dynpro_val TYPE TABLE OF dynpread,

wa_dynpro LIKE LINE OF t_dynpro_val.

LOOP AT g_tret INTO g_wret.

wa_dynpro-fieldname = g_wret-fieldname.

wa_dynpro-fieldvalue = g_wret-fieldval.

APPEND wa_dynpro TO t_dynpro_val.

ENDLOOP.

wa_dynpro-fieldname = 'JOBCD'.

APPEND wa_dynpro TO t_dynpro_val.

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

dyname = sy-repid

dynumb = sy-dynnr

TABLES

dynpfields = t_dynpro_val

EXCEPTIONS

invalid_abapworkarea = 1

invalid_dynprofield = 2

invalid_dynproname = 3

invalid_dynpronummer = 4

invalid_request = 5

no_fielddescription = 6

undefind_error = 7

OTHERS = 8.

Hope helps u.

Thanks..

Edited by: Sap Fan on Feb 27, 2009 12:08 PM