关联带出字段内容
TYPES: BEGIN OF TYP_HELP, F1 TYPE VBAK-VBELN, F2 TYPE CHAR10, END OF TYP_HELP. DATA: TD_HELP TYPE TABLE OF TYP_HELP, TH_HELP LIKE LINE OF TD_HELP. DATA: TD_FIELD TYPE TABLE OF DFIES, TH_FIELD LIKE LINE OF TD_FIELD, TD_MAP TYPE TABLE OF DSELC, TH_MAP LIKE LINE OF TD_MAP. DATA: W_INDEX TYPE SY-INDEX, W_HLP(60) TYPE C, W_TABNAME TYPE DD03P-TABNAME, W_FIELDNAME TYPE DFIES-LFIELDNAME. DATA: ST_DTELINFO TYPE DTELINFO. FIELD-SYMBOLS <FS> TYPE ANY. PARAMETERS P_FIELD1 TYPE CHAR10. PARAMETERS P_FIELD2 TYPE CHAR10. INITIALIZATION. AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FIELD1. REFRESH: TD_HELP, TD_MAP, TD_FIELD. TH_HELP-F1 = 'AA'. TH_HELP-F2 = '11'. APPEND TH_HELP TO TD_HELP. TH_HELP-F1 = 'BB'. TH_HELP-F2 = '22'. APPEND TH_HELP TO TD_HELP. TH_MAP-FLDNAME = 'F1'. TH_MAP-DYFLDNAME = 'P_FIELD1'. APPEND TH_MAP TO TD_MAP. TH_MAP-FLDNAME = 'F2'. TH_MAP-DYFLDNAME = 'P_FIELD2'. APPEND TH_MAP TO TD_MAP. DO. W_INDEX = SY-INDEX. ASSIGN COMPONENT W_INDEX OF STRUCTURE TH_HELP TO <FS>. IF SY-SUBRC <> 0. EXIT. ENDIF. DESCRIBE FIELD <FS> HELP-ID W_HLP. SPLIT W_HLP AT '-' INTO W_TABNAME W_FIELDNAME. CALL FUNCTION 'DDIF_FIELDINFO_GET' EXPORTING TABNAME = W_TABNAME LFIELDNAME = W_FIELDNAME ALL_TYPES = 'X' IMPORTING DFIES_WA = TH_FIELD EXCEPTIONS NOT_FOUND = 1 INTERNAL_ERROR = 2 OTHERS = 3 . CHECK SY-SUBRC = 0. DESCRIBE DISTANCE BETWEEN TH_HELP AND <FS> INTO TH_FIELD-OFFSET IN BYTE MODE. CLEAR TH_FIELD-TABNAME. TH_FIELD-POSITION = W_INDEX. IF W_INDEX = 1. TH_FIELD-FIELDNAME = 'F1'. ELSE. TH_FIELD-FIELDNAME = 'F2'. ENDIF. * TH_FIELD-MASK+2(1) = 'X'. * CLEAR: * TH_FIELD-f4availabl, * ST_DTELINFO. * CALL FUNCTION 'DDIF_NAMETAB_GET' * EXPORTING * TABNAME = TH_FIELD-ROLLNAME * ALL_TYPES = 'X' * IMPORTING * DTELINFO_WA = ST_DTELINFO * EXCEPTIONS * OTHERS = 0. * TH_FIELD-f4availabl = ST_DTELINFO-F4AVAILABL. APPEND TH_FIELD TO TD_FIELD. CLEAR TH_FIELD. ENDDO. CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' EXPORTING RETFIELD = 'KKYCD' DYNPPROG = SY-CPROG DYNPNR = SY-DYNNR DYNPROFIELD = 'P_FIELD1' WINDOW_TITLE = 'HELP' VALUE_ORG = 'S' TABLES VALUE_TAB = TD_HELP FIELD_TAB = TD_FIELD * RETURN_TAB = DYNPFLD_MAPPING = TD_MAP EXCEPTIONS PARAMETER_ERROR = 1 NO_VALUES_FOUND = 2 OTHERS = 3 . IF SY-SUBRC <> 0. MESSAGE 'error!!' TYPE 'E'. ENDIF.