Determining the Transaction Code at Runtime

Use

You want to transfer data and some of this data has already been created in the system. At runtime, you want to decide whether to create or modify the data.

Procedure

Example: Customer master

Insert the following under Global Data:

TABLES: KNA1.

Insert the following code for the field BKN00-TCODE:

Select count(*) from kna1 where kunnr = <alte_kundennummer>.
if sy-dbcnt = 0.
   bkn00-tcode = 'XD01'.
else.
   bkn00-tcode = 'XD02'.
endif.