Code: Alles auswählen.
parameters p_num type vbap-vbeln.
parameters p_pos type vbap-posnr.
Code: Alles auswählen.
*** Dynprowerte lesen
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
REQUEST = 'A'
TABLES
DYNPFIELDS = LT_DYN
EXCEPTIONS
OTHERS = 10.
*** Feldwerte aus dem Dynpro zuweisen
IF SY-SUBRC = 0.
LOOP AT LT_DYN.
CASE LT_DYN-FIELDNAME.
WHEN 'P_VKORG'.
LV_VKORG = LT_DYN-FIELDVALUE.
WHEN 'P_VTWEG'.
LV_VTWEG = LT_DYN-FIELDVALUE.
WHEN 'P_SPART'.
LV_SPART = LT_DYN-FIELDVALUE.
ENDCASE.
ENDLOOP.
ENDIF.
*** F4-Suchhilfe-Definition lesen
CALL FUNCTION 'F4IF_GET_SHLP_DESCR'
EXPORTING
SHLPNAME = 'ZZZZ_SHLP'
SHLPTYPE = 'SH'
IMPORTING
SHLP = TF4_SHLP.
*** Anpassung VKORG
READ TABLE TF4_SHLP-INTERFACE INTO LF4_INTERFACE
WITH KEY SHLPFIELD = 'VKORG'.
IF SY-SUBRC = 0.
LF4_INTERFACE-VALFIELD = 'ZZZZ-VKORG'.
LF4_INTERFACE-VALUE = LV_VKORG.
MODIFY TF4_SHLP-INTERFACE FROM LF4_INTERFACE INDEX SY-TABIX.
ENDIF.
*** Anpassung VTWEG
READ TABLE TF4_SHLP-INTERFACE INTO LF4_INTERFACE
WITH KEY SHLPFIELD = 'VTWEG'.
IF SY-SUBRC = 0.
LF4_INTERFACE-VALFIELD = 'ZZZZ-VTWEG'.
LF4_INTERFACE-VALUE = LV_VTWEG.
MODIFY TF4_SHLP-INTERFACE FROM LF4_INTERFACE INDEX SY-TABIX.
ENDIF.
*** Anpassung SPART
READ TABLE TF4_SHLP-INTERFACE INTO LF4_INTERFACE
WITH KEY SHLPFIELD = 'SPART'.
IF SY-SUBRC = 0.
LF4_INTERFACE-VALFIELD = 'ZZZZ-SPART'.
LF4_INTERFACE-VALUE = LV_SPART.
MODIFY TF4_SHLP-INTERFACE FROM LF4_INTERFACE INDEX SY-TABIX.
ENDIF.
*** Anpassung VKBUR
READ TABLE TF4_SHLP-INTERFACE INTO LF4_INTERFACE
WITH KEY SHLPFIELD = 'VKBUR'.
IF SY-SUBRC = 0.
LF4_INTERFACE-VALFIELD = 'ZZZZ-VKBUR'.
LF4_INTERFACE-VALUE = LV_VKBUR.
MODIFY TF4_SHLP-INTERFACE FROM LF4_INTERFACE INDEX SY-TABIX.
ENDIF.
*** F4-Wertehilfe starten
CALL FUNCTION 'F4IF_START_VALUE_REQUEST'
EXPORTING
SHLP = TF4_SHLP
CUCOL = SY-CUCOL
CUROW = SY-CUROW
IMPORTING
RC = gv_SUBRC
TABLES
RETURN_VALUES = TF4_VAL.
IF gv_SUBRC = 0.
*** Werte aus F4-Hilfe übernehmen
LOOP AT TF4_VAL.
CASE TF4_VAL-FIELDNAME.
WHEN 'VKORG'.
P_VKORG = TF4_VAL-FIELDVAL.
WHEN 'VTWEG'.
P_VTWEG = TF4_VAL-FIELDVAL.
WHEN 'SPART'.
P_SPART = TF4_VAL-FIELDVAL.
WHEN 'VKBUR'.
FC_VKBUR = TF4_VAL-FIELDVAL.
ENDCASE.
ENDLOOP.
ENDIF.