Skip to Content
0
Former Member
Jun 03, 2008 at 06:27 AM

Template for ABAP programs

437 Views

Hi all.

I've implemnted the following soultion for our SAP system.

Go to TCODE CMOD,

Create a new Project like ZSE38 as follows.

Check the 'Enhancements Assignments' Radio button, click create and add SEUED001 ( for Editor )

now SAVE, click on Components and select the User Exit that you want to use.

EXIT_SAPLS38E_001 <-- this is a function module.

inside this FM there is an INCLUDE program ZXSEUU08.
double click on it, when a warning message appears in the status bar below press ENTER
to create the program.

write the code you want inside this program. or add the following code.
code

DATA: it_code(256) TYPE c OCCURS 0.
DATA: wa_code like line of it_code.
DATA: it_new_code(256) TYPE c OCCURS 0.
DATA: lv_linecount TYPE i.

IF OPERATION = 'EDIT'.

read report program into it_code.

DESCRIBE TABLE it_code LINES lv_linecount.

IF lv_linecount LE 10.

read table it_code into wa_code index 5.
if wa_code(9) '*& Author'.

read table it_code into wa_code index 1.
append wa_code to it_new_code.
read table it_code into wa_code index 2.
append wa_code to it_new_code.
read table it_code into wa_code index 3.
append wa_code to it_new_code.

clear wa_code.
wa_code = '*&---------------------------------------------------------------------*'.
append wa_code to it_new_code.
clear wa_code.
wa_code = '*& Author :'.
append wa_code to it_new_code.
clear wa_code.
wa_code = '*& Date :' .
append wa_code to it_new_code.
clear wa_code.
wa_code = '*& Purpose :'.
append wa_code to it_new_code.
clear wa_code.
wa_code = '*&---------------------------------------------------------------------*'.
append wa_code to it_new_code.
clear wa_code.
wa_code = '*& Date Changed by Tag Description'.
append wa_code to it_new_code.
clear wa_code.
wa_code = '*&'.
append wa_code to it_new_code.
clear wa_code.
wa_code = '*&---------------------------------------------------------------------*'.
append wa_code to it_new_code.

data: lv_firstline type i.

loop at it_code into wa_code from 4 to 8.
if wa_code = ''.
lv_firstline = sy-tabix.
endif.
endloop.

loop at it_code into wa_code from lv_firstline.
append wa_code to it_new_code.
endloop.

insert report program from it_new_code.
ENDIF.
ENDIF.
ENDIF.
[/code]

After this, activate the include program.

then go back to CMOD transaction and activate the PROJECT that you've just created.

and you're ready to go........

Everything is working fine except that i do not want this template to be implemented when I do an include.

What changes do i need to do?

BR

Andreas