Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

help required in F4IF_INT_TABLE_VALUE_REQUEST

hi all,

I am using F4IF_INT_TABLE_VALUE_REQUEST function for F4 list , below is the code im using,

DATA : zmatnr TYPE zauvvselscr-matnr.

DATA: w_choice TYPE sy-tabix.

DATA: BEGIN OF i_values OCCURS 0,

werks TYPE zauvvselscr-werks,

matnr TYPE zauvvselscr-matnr,

maktx TYPE zauvvselscr-maktx,

j_3asean TYPE zauvvselscr-j_3asean,

/afs/collection TYPE zauvvselscr-/afs/collection,

mvgr5 TYPE zauvvselscr-mvgr5,

stock TYPE zauvvselscr-clabs,

END OF i_values.

DATA: screen_values TYPE TABLE OF dynpread ,

screen_value LIKE LINE OF screen_values.

DATA: lv_srch_str TYPE c LENGTH 20.

DATA: it_ret LIKE ddshretval OCCURS 0 WITH HEADER LINE.

DATA: BEGIN OF fieldtab_rt OCCURS 20.

INCLUDE STRUCTURE dfies. "field for ddif_fieldinfo_get

DATA: END OF fieldtab_rt.

DATA: dyn_tab TYPE TABLE OF dselc,

S_DYN TYPE DSELC.

s_dyn-fldname = 'MATNR'.

s_dyn-dyfldname = 'P_MATNR'.

APPEND s_dyn TO dyn_tab.

s_dyn-fldname = 'WERKS'.

s_dyn-dyfldname = 'P_WERKS'.

APPEND s_dyn TO dyn_tab.

fieldtab_rt-tabname = zauvvselscr.

fieldtab_rt-fieldname = 'MATNR'.

fieldtab_rt-position = '0001'.

APPEND fieldtab_rt.

fieldtab_rt-tabname = zauvvselscr.

fieldtab_rt-fieldname = 'WERKS'.

fieldtab_rt-position = '0002'.

APPEND fieldtab_rt.

screen_value-fieldname = 'ZMATNR' . " Field to be read

APPEND screen_value TO screen_values. "* Fill the table

REFRESH it_ret.

REFRESH fieldtab_rt.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = sy-cprog

dynumb = sy-dynnr

translate_to_upper = 'X'

TABLES

dynpfields = screen_values.

READ TABLE screen_values INDEX 1 INTO screen_value.

REPLACE ALL OCCURRENCES OF '*' IN screen_value-fieldvalue WITH space.

CONCATENATE screen_value-fieldvalue '%' INTO lv_srch_str.

REFRESH i_values.

CLEAR i_values.

SELECT DISTINCT matnr werks maktx j_3asean /afs/collection mvgr5 SUM( clabs ) AS stock

INTO CORRESPONDING FIELDS OF i_values FROM zauvvselscr WHERE matnr LIKE lv_srch_str

GROUP BY matnr werks maktx j_3asean /afs/collection mvgr5.

APPEND i_values.

ENDSELECT.

DELETE ADJACENT DUPLICATES FROM i_values.

SORT i_values BY matnr werks.

*&&--passing the above selected records to the selection

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'MATNR'

value_org = 'S'

TABLES

value_tab = i_values[]

field_tab = fieldtab_rt

return_tab = it_ret

dynpfld_mapping = dyn_tab

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc EQ 0.

LOOP AT it_ret.

screen_value-fieldvalue = it_ret-fieldval.

MOVE it_ret-fieldval TO zmatnr.

ENDLOOP.

ENDIF.

My requirement is , In my selection screen i have field ZMATNR , with the above coding i can get the selected MATNR into that, but in addition to the selected matnr i need to get the corresponding WERKS also, which needs to be passed to another variable for further usage, I tried various methods of using "dynpfld_mapping " field tab etc, but nowhere im getting the WERKS value, i dont know whether im doing it correctly. so kindly suggest me to achieve the requirement.

thanks and regs,

Raja

Tags:
Not what you were looking for? View more on this topic or Ask a question