SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS:
p_name TYPE xubname,
p_creat TYPE xuaname.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_name.
PERFORM f4_search.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_creat.
PERFORM f4_search.
*&---------------------------------------------------------------------*
*& Form f4_search
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f4_search.
DATA: BEGIN OF ls_users,
indx TYPE cntr_de,
bname TYPE xubname,
aname TYPE xuaname,
END OF ls_users,
lt_users LIKE TABLE OF ls_users,
lt_return TYPE ddshretval OCCURS 0 WITH HEADER LINE,
lt_fields TYPE TABLE OF dynpread,
l_counter TYPE i VALUE 1.
FIELD-SYMBOLS: <fs_user> LIKE ls_users,
<fs_field> TYPE dynpread.
SELECT bname aname
FROM usr02
INTO CORRESPONDING FIELDS OF TABLE lt_users.
LOOP AT lt_users ASSIGNING <fs_user>.
<fs_user>-indx = l_counter.
l_counter = l_counter + 1.
ENDLOOP.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'INDX'
value_org = 'S'
TABLES
value_tab = lt_users
return_tab = lt_return
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3
.
IF sy-subrc = 0 AND lt_return[] IS NOT INITIAL.
READ TABLE lt_users INDEX lt_return-fieldval ASSIGNING <fs_user>.
APPEND INITIAL LINE TO lt_fields ASSIGNING <fs_field>.
<fs_field>-fieldname = 'P_NAME'.
<fs_field>-fieldvalue = <fs_user>-bname.
APPEND INITIAL LINE TO lt_fields ASSIGNING <fs_field>.
<fs_field>-fieldname = 'P_CREAT'.
<fs_field>-fieldvalue = <fs_user>-aname.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
TABLES
dynpfields = lt_fields.
ENDIF.
ENDFORM. "f4_search
Share it with your friends:
Related
Finally functional example!