Posted: Sat Sep 22, 2007 6:36 pm Post subject: Updating value of another field on the screen
Code:
REPORT zvv.
TABLES tcurt.
DATA dyfields LIKE dynpread OCCURS 1 WITH HEADER LINE.
PARAMETERS: p_waers LIKE tcurt-waers, "Currency
p_ltext LIKE tcurt-ltext, "Long Text
p_ktext LIKE tcurt-ktext. "Short Text
*-----------------------------------------------------------------------
*--- Example of updating value of another field on the screen ----------
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_waers.
CLEAR: dyfields[], dyfields.
*--- select currency
CALL FUNCTION 'HELP_VALUES_GET'
EXPORTING
fieldname = 'WAERS'
tabname = 'TCURT'
IMPORTING
select_value = p_waers.
*--- get long text for the selected currency
SELECT SINGLE ltext FROM tcurt
INTO dyfields-fieldvalue
WHERE spras = sy-langu
AND waers = p_waers.
IF sy-subrc <> 0.
CLEAR dyfields-fieldvalue.
ENDIF.
*--- update another field
dyfields-fieldname = 'P_LTEXT'.
APPEND dyfields.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = sy-cprog
dynumb = sy-dynnr
TABLES
dynpfields = dyfields.
*-----------------------------------------------------------------------
*--- Example of reading value of another field -------------------------
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_ktext.
*--- read another field
CLEAR: dyfields[], dyfields.
dyfields-fieldname = 'P_WAERS'.
APPEND dyfields.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-cprog
dynumb = sy-dynnr
TABLES
dynpfields = dyfields.
READ TABLE dyfields INDEX 1.
*--- get short text and update current field
SELECT SINGLE ktext FROM tcurt
INTO p_ktext
WHERE spras EQ sy-langu
AND waers EQ dyfields-fieldvalue.
Age: 80 Joined: 04 Oct 2007 Posts: 1218 Location: Санкт-Петербург
Posted: Tue Jul 31, 2012 3:56 pm Post subject:
Детализация значения в тестовом поле
Code:
REPORT zvga_test.
PARAMETERS: p_bwart TYPE t157d-bwart DEFAULT '322' OBLIGATORY.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(20) text-020 FOR FIELD p_grund.
SELECTION-SCREEN POSITION 35.
PARAMETERS p_grund TYPE t157d-grund.
SELECTION-SCREEN COMMENT 41(20) text1.
SELECTION-SCREEN END OF LINE.
AT SELECTION-SCREEN OUTPUT.
IF p_grund IS INITIAL AND NOT p_bwart IS INITIAL.
SELECT SINGLE grund INTO p_grund
FROM t157d
WHERE bwart = p_bwart.
ENDIF.
IF NOT p_grund IS INITIAL.
CLEAR text1.
SELECT SINGLE grtxt INTO text1
FROM t157e
WHERE spras = sy-langu
AND bwart = p_bwart
AND grund = p_grund.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_grund.
*--- select currency
CALL FUNCTION 'HELP_VALUES_GET'
EXPORTING
fieldname = 'GRUND'
tabname = 'T157D'
IMPORTING
select_value = p_grund.
CLEAR text1.
SELECT SINGLE grtxt INTO text1
FROM t157e
WHERE spras = sy-langu
AND bwart = p_bwart
AND grund = p_grund.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.