INITIALIZATION.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_obj-low.
PERFORM f_help_object_class CHANGING s_obj.
*&---------------------------------------------------------------------*
*& Form F_HELP_OBJECT_CLASS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_P_OBJ text
*----------------------------------------------------------------------*
FORM F_HELP_OBJECT_CLASS CHANGING P_OBJ. " no definition of p_obj is required
TYPES : BEGIN OF ty_tab,
object TYPE CDOBJECTCL,
obtext TYPE CDOBTEXT,
END OF ty_tab.
DATA : lt_tab TYPE STANDARD TABLE OF ty_tab,
lt_ret TYPE STANDARD TABLE OF DDSHRETVAL,
lw_ret TYPE DDSHRETVAL.
"" Here lt_tab is the data you want to see in the output of the F4 help. It is populated using a select statement.
lt_ret is the standard table used for the FM
SELECT OBJECT OBTEXT from TCDOBT
INTO TABLE lt_tab
WHERE spras = 'EN'.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
RETFIELD = 'OBJECT' " This is the field name defined in the internal table you want to see in the output.
VALUE_ORG = 'S' " This is standard. 'C' or 'S' can be used. C didnot work.So 'S' :P
* IMPORTING
* USER_RESET =
TABLES
VALUE_TAB = lt_tab
RETURN_TAB = lt_ret
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
.
IF SY-SUBRC EQ 0.
READ TABLE lt_ret INTO lw_ret INDEX 1. " Index 1 is the data row you have selected once the pop up for the F4 help opens. The selected value is present in 'fieldval' field
p_obj = lw_ret-fieldval.
ENDIF.
ENDFORM. " F_HELP_OBJECT_CLASS
No comments:
Post a Comment