Application Development 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: 

How to modify custom pattern?

vinod_vemuru2
Active Contributor
0 Kudos

Hi Frdz,

Can any one tell me how to change the pattern that we use while creating new objects.

eg: ZZMODLOG- When we call this pattern it will give one template of commented text like TR number, User ID, Date etc.

If i want to modify this where does the code exist for this?

I tried in this path but of no use.

SE38->Enterinto some program->utilities->more utilities->Edit

pattern->Change pattern

Here it is showing some thing like *$&$MUSTER(commented).

Please guide me to solve this problem.

Thanks,

Vinod.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

This is nothing but dynamic pattern.

Here is an example of making a dynamic pattern in SAP. This is quite useful for standard headers in your code.

First you have to create a pattern which contains only one line:

*$&$MUSTER

Then create a function module with the name of the pattern followed by '_editor_exit'

Then add a tables parameter.

parameter name: BUFFER

type spec.: LIKE

reference type: ABAPSOURCE

In the source you can add anything you like tot the buffer table, upon executing the pattern in your ABAP, it copies everything you put in it.

This is the result of the pattern I use:

*#######################################################################

  • Report :

  • Version : 1.00

  • Author :

  • Function : Developer Department :ABAP

  • Date : 05.05.2003

*----


  • Title :

  • Purpose :

  • Details :

*=======================================================================

  • Change History

*----


  • Correction on version : 1.00

  • New version : 1.01

  • Author :

  • Date :

  • Reason :

  • Change :

*#######################################################################

The code was written in R/3 4.6D.

Code

FUNCTION zips_model_header_editor_exit .

*"----


""Lokale interface:

*" TABLES

*" BUFFER STRUCTURE ABAPSOURCE

*"----


  • <DATA>

DATA: l_commentline1 LIKE LINE OF buffer,

l_commentline2 LIKE LINE OF buffer,

l_commentline3 LIKE LINE OF buffer,

l_firstname LIKE adrp-name_first,

l_lastname LIKE adrp-name_last,

l_function LIKE adcp-function,

l_department LIKE adcp-department,

l_datum(10).

  • <TABLES>

TABLES: usr21, "Assign user name address key

adrp, "Persons (central address administration)

adcp. "Person/Address assignment (central address administration)

*additional:, although using the comment charater '"', the system

  • converts it to '*'

CONCATENATE '"##############################'

'#########################################' INTO l_commentline1.

CONCATENATE '"----


'

'----


' INTO l_commentline2.

CONCATENATE '"=================================='

'=====================================' INTO l_commentline3.

buffer = l_commentline1.

APPEND buffer.

buffer = '* Report : '.

APPEND buffer.

buffer = '* Version : 1.00'.

APPEND buffer.

  • initialize first and last name, if not found in database

l_firstname = 'first name'.

l_lastname = 'last name'.

  • retrieval of first and last name in database

SELECT SINGLE * FROM usr21 WHERE bname = sy-uname.

IF sy-subrc = 0.

SELECT SINGLE * FROM adrp WHERE persnumber = usr21-persnumber.

IF sy-subrc = 0.

l_firstname = adrp-name_first.

l_lastname = adrp-name_last.

  • retrtieval of function and department of user

SELECT SINGLE * FROM adcp WHERE persnumber = usr21-persnumber.

IF sy-subrc = 0.

l_function = adcp-function.

l_department = adcp-department.

ENDIF.

ENDIF.

ENDIF.

CONCATENATE '* Author :' sy-uname' -' l_firstname l_lastname INTO

buffer SEPARATED BY space.

APPEND buffer.

CONCATENATE '* Function :' l_function

' Department :' l_department

INTO buffer SEPARATED BY space.

APPEND buffer.

WRITE sy-datum DD/MM/YYYY TO l_datum.

CONCATENATE '* Date : ' l_datum INTO buffer SEPARATED BY space.

APPEND buffer.

buffer = l_commentline2.

APPEND buffer.

buffer = '* Title : '.

APPEND buffer.

buffer = '* Purpose : '.

APPEND buffer.

buffer = '* Details : '.

APPEND buffer.

buffer = l_commentline3.

APPEND buffer.

buffer = '* Change History'.

APPEND buffer.

buffer = l_commentline2.

APPEND buffer.

buffer = '* Correction on version : 1.00'.

APPEND buffer.

buffer = '* New version : 1.01'.

APPEND buffer.

buffer = '* Author :'.

APPEND buffer.

buffer = '* Date :'.

APPEND buffer.

buffer = '* Reason :'.

APPEND buffer.

buffer = '* Change :'.

APPEND buffer.

buffer = l_commentline1.

APPEND buffer.

ENDFUNCTION.

2 REPLIES 2

Former Member
0 Kudos

Via transaction SE37, open Function Module: ZZMODLOG_EDITOR_EXIT and do your modifications.

Former Member
0 Kudos

This is nothing but dynamic pattern.

Here is an example of making a dynamic pattern in SAP. This is quite useful for standard headers in your code.

First you have to create a pattern which contains only one line:

*$&$MUSTER

Then create a function module with the name of the pattern followed by '_editor_exit'

Then add a tables parameter.

parameter name: BUFFER

type spec.: LIKE

reference type: ABAPSOURCE

In the source you can add anything you like tot the buffer table, upon executing the pattern in your ABAP, it copies everything you put in it.

This is the result of the pattern I use:

*#######################################################################

  • Report :

  • Version : 1.00

  • Author :

  • Function : Developer Department :ABAP

  • Date : 05.05.2003

*----


  • Title :

  • Purpose :

  • Details :

*=======================================================================

  • Change History

*----


  • Correction on version : 1.00

  • New version : 1.01

  • Author :

  • Date :

  • Reason :

  • Change :

*#######################################################################

The code was written in R/3 4.6D.

Code

FUNCTION zips_model_header_editor_exit .

*"----


""Lokale interface:

*" TABLES

*" BUFFER STRUCTURE ABAPSOURCE

*"----


  • <DATA>

DATA: l_commentline1 LIKE LINE OF buffer,

l_commentline2 LIKE LINE OF buffer,

l_commentline3 LIKE LINE OF buffer,

l_firstname LIKE adrp-name_first,

l_lastname LIKE adrp-name_last,

l_function LIKE adcp-function,

l_department LIKE adcp-department,

l_datum(10).

  • <TABLES>

TABLES: usr21, "Assign user name address key

adrp, "Persons (central address administration)

adcp. "Person/Address assignment (central address administration)

*additional:, although using the comment charater '"', the system

  • converts it to '*'

CONCATENATE '"##############################'

'#########################################' INTO l_commentline1.

CONCATENATE '"----


'

'----


' INTO l_commentline2.

CONCATENATE '"=================================='

'=====================================' INTO l_commentline3.

buffer = l_commentline1.

APPEND buffer.

buffer = '* Report : '.

APPEND buffer.

buffer = '* Version : 1.00'.

APPEND buffer.

  • initialize first and last name, if not found in database

l_firstname = 'first name'.

l_lastname = 'last name'.

  • retrieval of first and last name in database

SELECT SINGLE * FROM usr21 WHERE bname = sy-uname.

IF sy-subrc = 0.

SELECT SINGLE * FROM adrp WHERE persnumber = usr21-persnumber.

IF sy-subrc = 0.

l_firstname = adrp-name_first.

l_lastname = adrp-name_last.

  • retrtieval of function and department of user

SELECT SINGLE * FROM adcp WHERE persnumber = usr21-persnumber.

IF sy-subrc = 0.

l_function = adcp-function.

l_department = adcp-department.

ENDIF.

ENDIF.

ENDIF.

CONCATENATE '* Author :' sy-uname' -' l_firstname l_lastname INTO

buffer SEPARATED BY space.

APPEND buffer.

CONCATENATE '* Function :' l_function

' Department :' l_department

INTO buffer SEPARATED BY space.

APPEND buffer.

WRITE sy-datum DD/MM/YYYY TO l_datum.

CONCATENATE '* Date : ' l_datum INTO buffer SEPARATED BY space.

APPEND buffer.

buffer = l_commentline2.

APPEND buffer.

buffer = '* Title : '.

APPEND buffer.

buffer = '* Purpose : '.

APPEND buffer.

buffer = '* Details : '.

APPEND buffer.

buffer = l_commentline3.

APPEND buffer.

buffer = '* Change History'.

APPEND buffer.

buffer = l_commentline2.

APPEND buffer.

buffer = '* Correction on version : 1.00'.

APPEND buffer.

buffer = '* New version : 1.01'.

APPEND buffer.

buffer = '* Author :'.

APPEND buffer.

buffer = '* Date :'.

APPEND buffer.

buffer = '* Reason :'.

APPEND buffer.

buffer = '* Change :'.

APPEND buffer.

buffer = l_commentline1.

APPEND buffer.

ENDFUNCTION.