quinta-feira, 4 de março de 2010

How to Access or change variables that are not passed in user exit

Many times we are faced with scenarios that require some SAP standard parameters to be changed or accessed. However, these parameters are not always available in user-exit's interface. This is peculiar to versions earlier than ECC where enhancement spot concept was not available.

In these cases, the parameter can be accessed and the value can be changed using the concept of pointers in ABAP. Here we assume that the parameter is declared either in the parent program, or in some other extrnal program (which has been triggered before user-exit call), but the parameter is not passed to the available user-exit.

The idea is to get the reference of the memory area of the required parameter and then assign a local pointer to access this memory area. Following example demonstrates this method:


data: wv_table(50) type c.

field-symbols: ‹wf_table› type any ,
‹wf_reference› type table.
DATA: wo_ref TYPE REF TO DATA.
wv_table = '(SAPLFPAYM_DE)DTADDEZ[]'.
ASSIGN (wv_table) TO ‹wf_table›.
GET REFERENCE OF ‹wf_table› INTO wo_ref.
ASSIGN wo_ref-›* TO ‹wf_reference›.
IF sy-subrc IS INITIAL.
loop at DTADDEZ.
* Manipulate the value of standard parameter here
* Then update to pass back the value
modify from dtaddez.
endloop.
endif.

Sem comentários:

Enviar um comentário