Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Template for ABAP programs

Former Member
0 Likes
1,101

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

4 REPLIES 4
Read only

Former Member
0 Likes
663

hi

ur query is not so much clear

Read only

Former Member
0 Likes
663

Are you saying that you do not want to execute the INCLUDE program ZXSEUU08? If so, why not comment out this line of code.

*---INCLUDE program ZXSEUU08

Read only

Former Member
0 Likes
663

Hello Andreas

I the same include that you are creating your template(ZXSEUU08) check to see what type of program you are working with.



* Check to make sure program is type 1 before inserting template.
select single * from trdir where name = program.
check: sy-subrc = 0.
if trdir-subc = '1'
... some code here - only executed if program is type 1 (executeable)....
endif.

Of course you can excldue incldudes by checking for subc = 'I'.

Regards

Greg Kern

Read only

0 Likes
663

Thanks Greg.

That's realy helpfull. I solved it in an other way but I give you some points for this solution.

BR

Andreas