You are on page 1of 1

Access values outside the SAP customer exit

When implementing a customer exit (i.e. field, user etc) have you ever wanted to be
able to read additional field values available in the main SAP program but not available
in your exit. Now with the use of field-symbols you can have access to any field
available in the main SAP program. The code below demonstrates how this is done
within a field exit on BSTNR which can be tested using transaction ME21. Information
on creating field exits can be found here.

FUNCTION field_exit_bstnr.
*"--------------------------------------------------------------------
--
*"*"Local interface:
*" IMPORTING
*" REFERENCE(INPUT)
*" EXPORTING
*" REFERENCE(OUTPUT)
*"--------------------------------------------------------------------
--
* create field symbol
FIELD-SYMBOLS: <status>.

* Assign value of variable from calling prog to field symbol


ASSIGN ('(SAPMM06E)RM06E-BSART') TO <status>.

* Display value retrieved in message


* Note: Messages of type i and w are not allowed
IF sy-subrc = 0.
MESSAGE e003(zr) WITH <status> 'kkk'.
ENDIF.

ENDFUNCTION.

You might also like