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: 

Template for SE38

former_member189059
Active Contributor
0 Kudos
1,821

Hello Experts,

whenever a program is created, something like this is put into it


*&---------------------------------------------------------------------*
*& Report  ZTEST1234
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT  ZTEST1234.

I need to find a way to edit this

ie make it something like this


*&---------------------------------------------------------------------*
*& Report  ZTEST1234
*&
*&---------------------------------------------------------------------*
*& Author     :
*& Date        : 
*& Purpose   : 
*-----------------------------------------------------------------------*
* Date      Changed by Tag   Description
*
*&---------------------------------------------------------------------*
REPORT  ZTEST1234.

I have found a user-exit SEU00001 but it doesn't seem to get called at that point

1 ACCEPTED SOLUTION

Former Member
0 Kudos
350

Hi Kris,

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.



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.

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........

Regards,

Samson Rodrigues.

21 REPLIES 21

Former Member
0 Kudos
350

hi,

You can do it manually y r u going for the user-exit.

0 Kudos
350

Hi Roja,

because i want it to happen automatically for anyone who makes a program in the system

0 Kudos
350

Hi,

U can do this by changing the setting of se38 t-code in its program by inserting different template in it.

Regards,

Ameet

Former Member
0 Kudos
350

Hai Kris,

Try with this, SEUED001.

<b>Please don't forget to reward if found helpfull</b>

Cheers,

Rakesh.

0 Kudos
350

Hello Rakesh,

I checked out SEUED001 and the only exit code reached from there is 'EXIT_SAPLSEDTATTR_010'

these are the parameters of that function

*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"       IMPORTING
*"             VALUE(PROGRAM) LIKE  TRDIR-NAME
*"             VALUE(OPERATION)
*"       EXCEPTIONS
*"              CANCELLED
*"----------------------------------------------------------------------

there is no table type paramter in which to insert / edit the required code

0 Kudos
350

You can create something like this

Utilities --> More Utilities --> Edit Patterns --> Create Pattern

write the format here

now goto SE38,

press Ctrl+F6

chose the option Other Pattern --> Press F4 --> Chose the pattern and Hit Enter.

Regards

Gopi

0 Kudos
350

Hi,

These many exits are there,

EXIT_SAPLEDITOR_001 - User Exit for $$ Editor (Dynamic Pattern

EXIT_SAPLEDITOR_002 - User's Own Function Codes for $$ Editor:

EXIT_SAPLLOCAL_EDT1_001 - User Exit for Editor (Dynamic Pattern)

EXIT_SAPLLOCAL_EDT1_002 - User's Own Function Code in ABAP E

EXIT_SAPLS38E_001 - Exit for ABAP Editor

EXIT_SAPMSEDT_001 - User Exit for Editor (Dynamic Patt

EXIT_SAPMSEDT_002 - User's Own Function Code in ABAP Editor

Cheers,

Rakesh.

0 Kudos
350

Yes Rakesh.. i put breakpoints in all of them and only one was reached (as i posted earlier) during program creation

Gopi.. i want it to be automated and not done manually everytime

and it needs to get the name of the current program as well

0 Kudos
350

Hello,

I think this EXIT_SAPLWBABAP_010 will do the job for you. Be sure that the project is active, then only it will hit in the break-point.

Regards,

Rakesh.

0 Kudos
350

Rakesh,

If i use EXIT_SAPLWBABAP_010 then where do i put the

*& Author :

*& Date :

*& Purpose :

code ?

0 Kudos
350

Hi Kris,

I can only give you information about exits. Regarding the coding point of view you have to try it. Please try with the exits i gave you,and check the internal tables available at the break point.

Sorry for the inconvenience.

<b>Reward all helpfull answers</b>

Regards,

Rakesh.

VXLozano
Active Contributor
0 Kudos
350

Take a look at this link:

http://www.sapsuperusers.com/forums/showthread.php?t=4869

(you must be registered at www.sapsuperusers.com to get access to it, sadly)

There Rich Harper, using information from Rob Dielemans and Matt G. from that site.

0 Kudos
350

Hello Vicenç,

Unfortunately i am not a member of that site and for some reason i cannot even join it

Can you please paste whatever you found there over here

VXLozano
Active Contributor
0 Kudos
350

It's a loooong piece of text + code + images I cannot copy'n'paste easily. I will ask the site's owner to provide non-registered access to the Knowledge Corner the link belongs to.

<b>Rich's Knowledge Corner

0019 - Editor Patterns</b>

<u>Source Code Patterns.</u>

In the ABAP editor there is the functionality to insert code into your program using what is called a pattern. You use this functionality each time you insert a function call for example. This menu option is reached via the menu path SE38->Edit->Pattern

By entering a function module name, or selecting one of the other options SAP will automatically enter the correct code into your program enabling you to just "fill in the blanks".

One of the things that I do when I get to a new site is to enter my own program header and procedure headers as a pattern using the Pattern Editor (SE38->Utilities->More Utilities->Edit Pattern. You provide a pattern name (such as 'Header'), enter the text using SE38, save it and then use it. By selecting the 'Other Pattern' radio button in the pattern selection window shown above and entering your pattern name in the relevant field, the lines of text you have defined will be entered into your source code at the current cursor location.

This works well for static patterns, Ie patterns that do not have any variable text in them. However, Rob Dielemans (Rob) has sent in some code that allows you to define a dynamic pattern, again a header which automatically fills in various fields.

This has been tested in 4.6c, but not on any other versions although the pattern editor has been around since 3.1 so you might be lucky.....

Whilst this has been written to produce a program header, SAP when inserting a pattern looks for a function module that contains the name of your pattern followed by the string '_editor_exit'. This is then called allowing you to do whatever processing you require before returning any results back to the editor where they are dumped into your source code.

To implement this, create your pattern in the pattern editor as described above. The pattern should contain only one line of text:

[code]----


*$&$MUSTER

-


[/code]

The next thing to do is to create the function module that is called. Create a new function group first (because I can see this becoming extremely useful.....) and then insert a new function module into the group. This function module should have a single table parameter of structure 'ABAPSOURCE'.

Anything that you place in this table will be copied back to your own source.

Taking Robs example function, he is inserting the user name, department and a few other bits and bobs into the header:

[code]FUNCTION ZIPS_MODEL_HEADER_EDITOR_EXIT.

*"----


""Local 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.[/code]

Activate the function and away you go!

Entering the pattern name 'ZIPS_MODEL_HEADER' into the pattern name field produces the following output in the ABAP Editor:

[code]*#######################################################################

  • Report :

  • Version : 1.00

  • Author : BCUSER - Richard Harper

  • Function : ABAP Programmer Department : My Office

  • Date : 18.06.2004

*----


  • Title :

  • Purpose :

  • Details :

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

  • Change History

*----


  • Correction on version : 1.00

  • New version : 1.01

  • Author :

  • Date :

  • Reason :

  • Change :

*#######################################################################[/code]

Neat huh ??

Thanks Rob!

Further to this, Mattg has also been doing some research into editor patterns and has come up with the following:

If the pattern contains *$&$EXIT at the start of line 1, then a standard user exit is called.

The userexit enhancement is SEUED001, the component to change is EXIT_SAPLLOCAL_EDT1_001.

Now this allows you to add the code from before. This is the UE code;

[code]CASE KEYWORD.

WHEN 'MATTG_HEADER'.

PERFORM MATTG_HEADER TABLES BUFFER.

WHEN 'MATTG_HISTORY'.

CALL FUNCTION 'ZZMATT_HISTORY_EDITOR_EXIT'

TABLES

BUFFER = BUFFER.

ENDCASE.[/code]

Just the change the function call to a perform, as above, BUFFER has type ABAPSOURCE.

If you want to get the Transport Request information for the object you are editing try the following code;

[code] TABLES: E07T. "WBO and Transport: Short Texts for Requests/Tasks

DATA: WA_BUFFER TYPE ABAPSOURCE,

ORDERNUM LIKE E070-TRKORR,

L_PROGFIELD LIKE BDCDATA-FNAM.

FIELD-SYMBOLS: <TRDIR> LIKE TRDIR,

<TRKEY> LIKE TRKEY.

  • Additional:, although using the comment character '"', the system

  • converts it to '*'

CONCATENATE '"----


'

'----


*'

INTO L_COMMENTLINE2.

PERFORM GET_DEVELOPER_NAME USING SY-UNAME

CHANGING L_FIRSTNAME

L_LASTNAME

L_FUNCTION

L_DEPARTMENT.

WRITE SY-DATUM DD/MM/YYYY TO L_DATUM.

CONCATENATE '* Date:' L_DATUM

'Author:' SY-UNAME '-' L_FIRSTNAME L_LASTNAME

INTO WA_BUFFER SEPARATED BY SPACE.

IF WA_BUFFER+71(1) = SPACE.

WA_BUFFER+71(1) = '*'.

ENDIF.

APPEND WA_BUFFER TO BUFFER.

L_PROGFIELD = '(SAPLS38E)TRDIR'.

ASSIGN (L_PROGFIELD) TO <TRDIR>.

IF SY-SUBRC EQ 0.

CALL FUNCTION 'RS_CORR_INSERT'

EXPORTING

OBJECT = <TRDIR>-NAME

OBJECT_CLASS = 'ABAP'

  • MODE = ' '

  • GLOBAL_LOCK = ' '

  • DEVCLASS = ' '

  • KORRNUM = ' '

  • AUTHOR = ' '

  • MASTER_LANGUAGE = ' '

  • GENFLAG = ' '

  • PROGRAM = ' '

  • OBJECT_CLASS_SUPPORTS_MA = ' '

  • EXTEND = ' '

IMPORTING

  • DEVCLASS =

  • KORRNUM = "Task number

ORDERNUM = ORDERNUM "Request number

  • NEW_CORR_ENTRY =

  • AUTHOR =

  • TRANSPORT_KEY =

  • NEW_EXTEND =

EXCEPTIONS

CANCELLED = 1

PERMISSION_FAILURE = 2

UNKNOWN_OBJECTCLASS = 3

OTHERS = 4

.

IF SY-SUBRC = 0.

IF NOT ORDERNUM IS INITIAL.

SELECT SINGLE * FROM E07T

WHERE TRKORR = ORDERNUM.

IF SY-SUBRC <> 0.

CLEAR E07T.

ENDIF.

CONCATENATE '*' ORDERNUM E07T-AS4TEXT

INTO WA_BUFFER SEPARATED BY SPACE.

ELSE.

L_PROGFIELD = '(SAPLS38E)TRANSPORT_KEY'.

ASSIGN (L_PROGFIELD) TO <TRKEY>.

CONCATENATE '* Development class;' <TRKEY>-DEVCLASS

'WYTK9&$&$' INTO WA_BUFFER SEPARATED BY SPACE.

ENDIF.

ELSE.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

L_PROGFIELD = '(SAPLS38E)TRANSPORT_KEY'.

ASSIGN (L_PROGFIELD) TO <TRKEY>.

CONCATENATE '* Development class;' <TRKEY>-DEVCLASS

'WYTK9&$&$' INTO WA_BUFFER SEPARATED BY SPACE.

ENDIF.

ELSE.

L_PROGFIELD = '(SAPLS38E)TRANSPORT_KEY'.

ASSIGN (L_PROGFIELD) TO <TRKEY>.

CONCATENATE '* Development class;' <TRKEY>-DEVCLASS

'WYTK9&$&$' INTO WA_BUFFER SEPARATED BY SPACE.

ENDIF.

IF WA_BUFFER+71(1) = SPACE.

WA_BUFFER+71(1) = '*'.

ENDIF.

APPEND WA_BUFFER TO BUFFER.

  • L_PROGFIELD = '(SAPLS38E)KORRNUM'.

  • ASSIGN (L_PROGFIELD) TO <KORRNUM>.

WA_BUFFER = '* Description: '.

WA_BUFFER+71(1) = '*'.

APPEND WA_BUFFER TO BUFFER.

CLEAR WA_BUFFER.

WA_BUFFER+00(1) = '*'.

WA_BUFFER+71(1) = '*'.

APPEND WA_BUFFER TO BUFFER.

APPEND WA_BUFFER TO BUFFER.

APPEND L_COMMENTLINE2 TO BUFFER.[/code]

The FORM GET_DEVELOPER_NAME is just the code from your existing example.

This is on a 4.6B system (patch level 7), so should be usable by most people.

<b>4.7 Enterprise</b>

This functionality is still available in 4.7, the modifications required to the function module have been sent in by jpb2001. The only change required is that the table BUFFER must be of type RSWSOURCET instead of ABAPSOURCE to cope with the extra line size allowed in Enterprise.

-


Remember, all the work was done by Rob Dielemans and MattG, compiled and tested by Richard Harper, from www.sapsuperusers.com

Former Member
0 Kudos
350

Hi,

Execute the following program in T-Code: SE38.

&----


*& Report ZTEMPLATE

*&

&----


  • Description: The purpose of the program is to generate a template file

  • depending on the user selections on the selection screen.

  • This will enable the uniformity in the documentation of

  • programs across the users in a project.

&----


REPORT Z_SLN_TEMPLATE

MESSAGE-ID PC.

----


  • Internal Tables

----


DATA: BEGIN OF ITAB OCCURS 0,

LINE(72),

END OF ITAB.

DATA: V_UNAME(40).

----


*Tables

----


TABLES:USR21.

----


  • Selection Screen

----


  • Program header

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE B1TIT.

  • Program Name

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(26) B1T01.

PARAMETERS P_REPID LIKE SY-REPID DEFAULT 'ZXXXXXXX' OBLIGATORY.

SELECTION-SCREEN END OF LINE.

  • Line Size

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(26) B1T02.

PARAMETERS P_LINSZ LIKE SY-LINSZ DEFAULT 80.

SELECTION-SCREEN END OF LINE.

  • Line Count

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(26) B1T03.

PARAMETERS P_LINCT LIKE SY-LINCT DEFAULT 64.

SELECTION-SCREEN END OF LINE.

  • Message ID

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(26) B1T04.

PARAMETERS P_MSGID LIKE T100A-ARBGB DEFAULT 'ZZ'.

SELECTION-SCREEN END OF LINE.

  • No Standard Page Header

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(26) B1T05.

PARAMETERS: P_STDHD AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN END OF LINE.

  • Title

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(26) B1T06.

PARAMETERS: P_TITLE(70) DEFAULT 'Test Program' LOWER CASE OBLIGATORY.

SELECTION-SCREEN END OF LINE.

  • Copyright

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(26) B1T08.

PARAMETERS: P_CPRT(70) LOWER CASE

DEFAULT '@ copyright 2007 by Intelligroup Inc.'.

SELECTION-SCREEN END OF LINE.

  • User

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(26) B1T07.

PARAMETERS: P_UNAME(50) DEFAULT SY-UNAME LOWER CASE OBLIGATORY.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK B1.

  • Sections

SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE B2TIT.

  • Tables, Info Types & Type Pools

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS P_TSECT AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN COMMENT 3(24) B2T01.

PARAMETERS P_OSECT AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN COMMENT 30(24) B2T10.

PARAMETERS P_LSECT AS CHECKBOX." DEFAULT 'X'.

SELECTION-SCREEN COMMENT 57(23) B2T11.

SELECTION-SCREEN END OF LINE.

  • Constants, Variables & Structures

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS P_CSECT AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN COMMENT 3(24) B2T02.

PARAMETERS P_VSECT AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN COMMENT 30(24) B2T03.

PARAMETERS P_SSECT AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN COMMENT 57(23) B2T04.

SELECTION-SCREEN END OF LINE.

  • Internal Tables, Ranges & Field Symbols

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS P_ISECT AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN COMMENT 3(24) B2T05.

PARAMETERS P_RSECT AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN COMMENT 30(24) B2T06.

PARAMETERS P_FSECT AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN COMMENT 57(23) B2T07.

SELECTION-SCREEN END OF LINE.

  • Field Groups, Selection Screen

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS P_GSECT AS CHECKBOX." DEFAULT 'X'.

SELECTION-SCREEN COMMENT 3(24) B2T08.

PARAMETERS P_PSECT AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN COMMENT 30(24) B2T09.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK B2.

  • Events

SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE B3TIT.

  • Initialization & At Selection screen output

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS P_IEVEN AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN COMMENT 3(35) B3T01.

PARAMETERS P_OEVEN AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN COMMENT 42(35) B3T02.

SELECTION-SCREEN END OF LINE.

  • At Selection screen value request & At selection screen help request

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS P_VEVEN AS CHECKBOX." DEFAULT 'X'.

SELECTION-SCREEN COMMENT 3(35) B3T03.

PARAMETERS P_HEVEN AS CHECKBOX." DEFAULT 'X'.

SELECTION-SCREEN COMMENT 42(35) B3T04.

SELECTION-SCREEN END OF LINE.

  • At selection screen & Start of selection

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS P_SEVEN AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN COMMENT 3(35) B3T05.

PARAMETERS P_GEVEN AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN COMMENT 42(35) B3T06.

SELECTION-SCREEN END OF LINE.

  • End of selection & Top of page

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS P_PEVEN AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN COMMENT 3(35) B3T07.

PARAMETERS P_TEVEN AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN COMMENT 42(35) B3T08.

SELECTION-SCREEN END OF LINE.

  • End of page & At line selection

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS P_EEVEN AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN COMMENT 3(35) B3T09.

PARAMETERS P_LEVEN AS CHECKBOX." DEFAULT 'X'.

SELECTION-SCREEN COMMENT 42(35) B3T10.

SELECTION-SCREEN END OF LINE.

  • At user command & At PFn

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS P_UEVEN AS CHECKBOX." DEFAULT 'X'.

SELECTION-SCREEN COMMENT 3(35) B3T11.

PARAMETERS P_FEVEN AS CHECKBOX." DEFAULT 'X'.

SELECTION-SCREEN COMMENT 42(35) B3T12.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK B3.

  • Formatting Options

SELECTION-SCREEN BEGIN OF BLOCK B4 WITH FRAME TITLE B4TIT.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS: P_UPPER RADIOBUTTON GROUP OPT.

SELECTION-SCREEN COMMENT 3(15) B4T02.

PARAMETERS: P_LOWER RADIOBUTTON GROUP OPT DEFAULT 'X'.

SELECTION-SCREEN COMMENT 21(15) B4T03.

SELECTION-SCREEN COMMENT 39(29) B4T01.

PARAMETERS: P_CFILL TYPE C DEFAULT '-' OBLIGATORY.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK B4.

  • Download File Parameter

SELECTION-SCREEN BEGIN OF BLOCK B5 WITH FRAME TITLE B5TIT.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(15) B5T01.

PARAMETERS P_FNAME LIKE IBIPPARMS-PATH

DEFAULT 'C:\Template.TXT' OBLIGATORY.

SELECTION-SCREEN COMMENT 65(2) B5T03.

PARAMETERS P_OVERW AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN COMMENT 70(10) B5T02.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK B5.

----


  • Initialization

----


INITIALIZATION.

  • Set Selection screen labels

PERFORM SET_LABEL_TEXTS.

----


  • At Selection screen on value request

----


  • File Lookup for PC File Name

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.

PERFORM GET_PC_FILE CHANGING P_FNAME.

----


  • At selection Screen

----


AT SELECTION-SCREEN.

  • Validate Program name

PERFORM VALIDATE_PROGRAM_NAME.

  • Validate Message Class

PERFORM VALIDATE_MESSAGE_CLASS.

  • Validate PC File name

IF P_OVERW IS INITIAL.

PERFORM VALIDATE_PC_FILE.

ENDIF.

----


  • Start of selection

----


START-OF-SELECTION.

  • Populate Report Statement

PERFORM POPULATE_REPORT_HEADER.

  • Populate Program Documentation

PERFORM POPULATE_PROGRAM_DETAILS.

  • Populate sections

PERFORM POPULATE_SECTIONS.

  • Populate events

PERFORM POPULATE_EVENTS.

----


  • End of selection

----


END-OF-SELECTION.

  • Download Template

PERFORM DOWNLOAD_TEMPLATE.

IF SY-SUBRC EQ 0.

MESSAGE S011 WITH 'Template Downloaded to File'.

ELSE.

MESSAGE S011 WITH 'Unable download Template to File'.

ENDIF.

EXIT.

&----


*& Form POPULATE_REPORT_HEADER

&----


  • Populate Report Statement

----


FORM POPULATE_REPORT_HEADER.

  • Local Variable

DATA: V_CHAR(10) TYPE C. " For Converting INT to CHAR

  • Populating Report statement

CONCATENATE 'Report' P_REPID INTO ITAB-LINE SEPARATED BY ' '.

APPEND ITAB.

CLEAR ITAB.

  • Line Size

IF NOT P_LINSZ IS INITIAL.

WRITE P_LINSZ TO V_CHAR LEFT-JUSTIFIED.

CONCATENATE 'Line-size' V_CHAR INTO ITAB-LINE+7 SEPARATED BY ' '.

APPEND ITAB.

CLEAR ITAB.

ENDIF.

  • Line Count

IF NOT P_LINCT IS INITIAL.

WRITE P_LINCT TO V_CHAR LEFT-JUSTIFIED.

CONCATENATE 'Line-count' V_CHAR INTO ITAB-LINE+7 SEPARATED BY ' '.

APPEND ITAB.

CLEAR ITAB.

ENDIF.

  • Message ID

IF NOT P_MSGID IS INITIAL.

CONCATENATE 'Message-id' P_MSGID INTO ITAB-LINE+7 SEPARATED BY ' '.

APPEND ITAB.

CLEAR ITAB.

ENDIF.

  • No Standard Page Heading

IF NOT P_STDHD IS INITIAL.

ITAB-LINE+7 = 'No Standard Page Heading'.

APPEND ITAB.

CLEAR ITAB.

ENDIF.

  • End Last statement with '.'

DESCRIBE TABLE ITAB LINES SY-TABIX.

READ TABLE ITAB INDEX SY-TABIX.

CONCATENATE ITAB-LINE '.' INTO ITAB-LINE.

MODIFY ITAB INDEX SY-TABIX.

  • Check whether the template is required in uppercase

IF NOT P_UPPER IS INITIAL.

LOOP AT ITAB.

TRANSLATE ITAB TO UPPER CASE.

MODIFY ITAB.

ENDLOOP.

ENDIF.

ENDFORM. " POPULATE_REPORT_HEADER

&----


*& Form INSERT_HEADER

&----


  • Header comments

----


  • -->P_TEXT HEADER TEXT *

----


FORM INSERT_HEADER USING VALUE(P_TEXT) TYPE C.

PERFORM FORMAT_LINE.

IF NOT P_UPPER IS INITIAL.

TRANSLATE P_TEXT TO UPPER CASE.

ENDIF.

ITAB-LINE+0(1) = '*'.

ITAB-LINE+2 = P_TEXT.

ITAB-LINE+71(1) = '*'.

APPEND ITAB.

CLEAR ITAB.

PERFORM FORMAT_LINE.

ENDFORM. " INSERT_HEADER

&----


*& Form FORMAT_LINE

&----


  • Format Comment Line according to the user requirement

----


FORM FORMAT_LINE.

ITAB-LINE+0(1) = '*'.

ITAB-LINE+71(1) = '*'.

DO 70 TIMES.

ITAB-LINE+SY-INDEX(1) = P_CFILL.

ENDDO.

APPEND ITAB.

CLEAR ITAB.

ENDFORM. " FORMAT_LINE

&----


*& Form POPULATE_PROGRAM_DETAILS

&----


  • Populate Program Information

----


FORM POPULATE_PROGRAM_DETAILS.

  • Local Variable

DATA: V_DATE(10) TYPE C. " Convert Date to CHAR format

WRITE SY-DATUM TO V_DATE.

  • Program Details

  • CONCATENATE V_UNAME ' (Intelligroup)' INTO V_UNAME.

IF NOT P_CPRT IS INITIAL.

PERFORM INSERT_COPYRIGHT USING 'Copyright statement'.

ENDIF.

PERFORM INSERT_HEADER USING 'Program Details'.

PERFORM INSERT_LABEL USING: 'Program Name:' P_REPID,

'Date :' V_DATE,

'Author :' P_UNAME,

'Description :' P_TITLE,

'Transport No:' ' '.

  • Change Log

PERFORM INSERT_HEADER USING 'Change Log'.

PERFORM INSERT_LABEL USING: "'Change No :' ' ',

'Date :' ' ',

'Author :' ' ',

'Description :' ' ',

'Transport No:' ' '.

ENDFORM. " POPULATE_PROGRAM_DETAILS

&----


*& Form INSERT_LABEL

&----


  • Insert Labels

----


  • -->P_LABEL LABEL NAME *

  • -->P_VALUE LABEL VALUE *

----


FORM INSERT_LABEL USING VALUE(P_LABEL) TYPE C

P_VALUE TYPE C.

CONCATENATE '*' P_LABEL P_VALUE INTO ITAB-LINE SEPARATED BY ' '.

IF NOT P_UPPER IS INITIAL.

TRANSLATE ITAB-LINE TO UPPER CASE.

ENDIF.

APPEND ITAB.

CLEAR ITAB.

ENDFORM. " INSERT_LABEL

&----


*& Form SET_LABEL_TEXTS

&----


  • Set Selection screen Labels

----


FORM SET_LABEL_TEXTS.

PERFORM GET_USERNAME.

CONCATENATE P_UNAME ' (Intelligroup)' INTO P_UNAME.

B1TIT = 'Program'.

B1T01 = 'Program Name'.

B1T02 = 'Line Size'.

B1T03 = 'Line Count'.

B1T04 = 'Message Class'.

B1T05 = 'No Standard Page Heading'.

B1T06 = 'Program Title'.

B1T07 = 'Author'.

B1T08 = 'Copyright Statement'.

B2TIT = 'Sections'.

B2T01 = 'Tables'.

B2T02 = 'Constants'.

B2T03 = 'Variables'.

B2T04 = 'Structures'.

B2T05 = 'Internal Tables'.

B2T06 = 'Ranges'.

B2T07 = 'Field Symbols'.

B2T08 = 'Field Groups'.

B2T09 = 'Selection Screen'.

B2T10 = 'Info Types'.

B2T11 = 'Type Pools'.

B3TIT = 'Events'.

B3T01 = 'Initialization'.

B3T02 = 'At Selection Screen Output'.

B3T03 = 'At Selection Screen Value Request'.

B3T04 = 'At Selection Screen Help Request'.

B3T05 = 'At Selection Screen'.

B3T06 = 'Start of Selection'.

B3T07 = 'End of Selection'.

B3T08 = 'Top of Page'.

B3T09 = 'End of Page'.

B3T10 = 'At Line Selection'.

B3T11 = 'At User Command'.

B3T12 = 'At PFn'.

B4TIT = 'Comments in'.

B4T01 = 'Filler Character for Comments'.

B4T02 = 'Upper Case'.

B4T03 = 'Mixed Case'.

B5TIT = 'Download to File'.

B5T01 = 'PC Filename'.

B5T02 = 'Overwrite'.

B5T03 = ' '.

ENDFORM. " SET_LABEL_TEXTS

&----


*& Form POPULATE_SECTIONS

&----


  • Populate Sections

----


FORM POPULATE_SECTIONS.

  • Tables

IF NOT P_TSECT IS INITIAL.

PERFORM INSERT_HEADER USING 'Tables'.

PERFORM INSERT_DETAIL USING 'Tables: xxxx.' 0.

ENDIF.

  • Info Types

IF NOT P_OSECT IS INITIAL.

PERFORM INSERT_HEADER USING 'Infotypes'.

PERFORM INSERT_DETAIL USING 'Infotypes: xxxx.' 0.

ENDIF.

  • Type Pools

IF NOT P_LSECT IS INITIAL.

PERFORM INSERT_HEADER USING 'Type Pools'.

PERFORM INSERT_DETAIL USING 'Type-Pools: xxxx.' 0.

ENDIF.

  • Constants

IF NOT P_CSECT IS INITIAL.

PERFORM INSERT_HEADER USING 'Constants'.

PERFORM INSERT_DETAIL USING 'Constants: xxxx like yyyy.' 0.

ENDIF.

  • Variables

IF NOT P_VSECT IS INITIAL.

PERFORM INSERT_HEADER USING 'Variables'.

PERFORM INSERT_DETAIL USING 'Data: xxxx like yyyy.' 0.

ENDIF.

  • Structures

IF NOT P_SSECT IS INITIAL.

PERFORM INSERT_HEADER USING 'Structures'.

PERFORM INSERT_DETAIL USING 'Data: Begin of yyyy,' 0.

PERFORM INSERT_DETAIL USING ' End of xxxx.' 0.

ENDIF.

  • Internal Tables

IF NOT P_ISECT IS INITIAL.

PERFORM INSERT_HEADER USING 'Internal Tables'.

PERFORM INSERT_DETAIL USING 'Data: Begin of yyyy occurs 0,' 0.

PERFORM INSERT_DETAIL USING ' End of xxxx.' 0.

ENDIF.

  • Ranges

IF NOT P_RSECT IS INITIAL.

PERFORM INSERT_HEADER USING 'Ranges'.

PERFORM INSERT_DETAIL USING 'Ranges: xxxx for yyyy.' 0.

ENDIF.

  • Field Symbols

IF NOT P_FSECT IS INITIAL.

PERFORM INSERT_HEADER USING 'Field Symbols'.

PERFORM INSERT_DETAIL USING 'Field-symbols: <fs_xxxx>.' 0.

ENDIF.

  • Field Groups

IF NOT P_GSECT IS INITIAL.

PERFORM INSERT_HEADER USING 'Field Groups'.

PERFORM INSERT_DETAIL USING 'Field-groups: xxxx.' 0.

ENDIF.

  • Selection Screen

IF NOT P_PSECT IS INITIAL.

PERFORM INSERT_HEADER USING 'Selection Screen'.

PERFORM INSERT_DETAIL USING :

'Selection-screen begin of block b1 with frame title xxxx.' 0,

' Select-options: xxxx for yyyy.' 0,

' Parameters: xxxx like yyyy.' 0,

'Selection-screen end of block b1.' 0.

ENDIF.

ENDFORM. " POPULATE_SECTIONS

&----


*& Form INSERT_DETAIL

&----


  • Insert Detail Line

----


  • -->P_TEXT DETAIL TEXT *

  • -->P_POSI POSITION *

----


FORM INSERT_DETAIL USING VALUE(P_TEXT) TYPE C

VALUE(P_POSI) TYPE I.

IF NOT P_UPPER IS INITIAL.

TRANSLATE P_TEXT TO UPPER CASE.

ENDIF.

ITAB-LINE+P_POSI = P_TEXT.

APPEND ITAB.

CLEAR ITAB.

ENDFORM. " INSERT_DETAIL

&----


*& Form POPULATE_EVENTS

&----


  • POPULATE EVENTS

----


FORM POPULATE_EVENTS.

PERFORM INSERT_EVENT USING: 'P_IEVEN', " Initialization

'P_OEVEN', " At Selection Screen Output

'P_VEVEN', " At Selection Screen Value

'P_HEVEN', " At Selection Screen Help

'P_SEVEN', " At Selection Screen

'P_GEVEN', " Start of Selection

'P_PEVEN', " End of Selection

'P_TEVEN', " Top Of Page

'P_EEVEN', " End of Page

'P_LEVEN', " At Line Selection

'P_UEVEN', " At User command

'P_FEVEN'. " At PFn

ENDFORM. " POPULATE_EVENTS

&----


*& Form INSERT_EVENT

&----


  • Insert Event

----


  • -->P_FIELD FIELD NAME *

----


FORM INSERT_EVENT USING VALUE(P_FIELD) TYPE C.

  • Field Symbol for storing the Field Name

FIELD-SYMBOLS: <FS_FLD>.

  • Assign field to Field symbol

ASSIGN (P_FIELD) TO <FS_FLD>.

  • If the field contains value insert respective event

IF NOT <FS_FLD> IS INITIAL.

CASE P_FIELD.

  • Initialization

WHEN 'P_IEVEN'.

PERFORM INSERT_HEADER USING 'Initialization'.

PERFORM INSERT_DETAIL USING 'Initialization.' 0.

  • At selection screen output

WHEN 'P_OEVEN'.

PERFORM INSERT_HEADER USING 'At Selection Screen Output'.

PERFORM INSERT_DETAIL USING 'At selection-screen output.' 0.

  • At selection screen value request

WHEN 'P_VEVEN'.

PERFORM INSERT_HEADER USING

'At Selection Screen On Value Request'.

PERFORM INSERT_DETAIL USING

'At selection-screen on value-request for xxxx.' 0.

  • At selection screen help request

WHEN 'P_HEVEN'.

PERFORM INSERT_HEADER USING

'At Selection Screen On Help Request'.

PERFORM INSERT_DETAIL USING

'At selection-screen on help-request for xxxx.' 0.

  • At selection screen

WHEN 'P_SEVEN'.

PERFORM INSERT_HEADER USING 'At Selection Screen'.

PERFORM INSERT_DETAIL USING 'At selection-screen.' 0.

  • Start of selection

WHEN 'P_GEVEN'.

PERFORM INSERT_HEADER USING 'Start Of Selection'.

PERFORM INSERT_DETAIL USING 'Start-of-selection.' 0.

  • End of selection

WHEN 'P_PEVEN'.

PERFORM INSERT_HEADER USING 'End Of Selection'.

PERFORM INSERT_DETAIL USING 'End-of-selection.' 0.

  • Top of page

WHEN 'P_TEVEN'.

PERFORM INSERT_HEADER USING 'Top Of Page'.

PERFORM INSERT_DETAIL USING 'Top-of-page.' 0.

  • End of page

WHEN 'P_EEVEN'.

PERFORM INSERT_HEADER USING 'End Of Page'.

PERFORM INSERT_DETAIL USING 'End-of-page.' 0.

  • At line selection

WHEN 'P_LEVEN'.

PERFORM INSERT_HEADER USING 'At Line Selection'.

PERFORM INSERT_DETAIL USING 'At line-selection.' 0.

  • At user command

WHEN 'P_UEVEN'.

PERFORM INSERT_HEADER USING 'At User Command'.

PERFORM INSERT_DETAIL USING 'At user-command.' 0.

  • At PFn

WHEN 'P_FEVEN'.

PERFORM INSERT_HEADER USING 'At Pfn'.

PERFORM INSERT_DETAIL USING 'At pfn.' 0.

ENDCASE.

ENDIF.

ENDFORM. " INSERT_EVENT

&----


*& Form VALIDATE_PROGRAM_NAME

&----


  • Validate Program Name

----


FORM VALIDATE_PROGRAM_NAME.

TABLES: TRDIR.

  • Check whether the program with the given name already exists

SELECT SINGLE NAME

INTO TRDIR-NAME

FROM TRDIR

WHERE NAME = P_REPID.

  • If program already exists display error

IF SY-SUBRC EQ 0.

MESSAGE E011 WITH 'Program Already Exists'.

ELSEIF P_REPID0(1) NE 'Z' AND P_REPID0(1) NE 'Y'.

MESSAGE E011 WITH 'Program Name has to start with Z or Y'.

ENDIF.

ENDFORM. " VALIDATE_PROGRAM_NAME

&----


*& Form VALIDATE_MESSAGE_CLASS

&----


  • Validate Message Class

----


FORM VALIDATE_MESSAGE_CLASS.

TABLES: T100A.

  • Check whether the message class exists

SELECT SINGLE ARBGB

INTO T100A-ARBGB

FROM T100A

WHERE ARBGB = P_MSGID.

  • If message class not available display error

IF SY-SUBRC NE 0.

MESSAGE E011 WITH 'Invalid Message Class'.

ENDIF.

ENDFORM. " VALIDATE_MESSAGE_CLASS

&----


*& Form VALIDATE_PC_FILE

&----


  • Validate Pc file name

----


FORM VALIDATE_PC_FILE.

  • Local Variables

DATA: L_RESULT. " Stores result of Function Module

  • Check whether PC File Exists

CALL FUNCTION 'WS_QUERY'

EXPORTING

  • ENVIRONMENT = ' '

FILENAME = P_FNAME

QUERY = 'FE'

  • WINID = ' '

IMPORTING

RETURN = L_RESULT

EXCEPTIONS

INV_QUERY = 1

NO_BATCH = 2

FRONTEND_ERROR = 3

OTHERS = 4.

  • If File already exists

IF L_RESULT EQ '1'.

MESSAGE E011 WITH 'PC File already Exists, Check file name'.

ENDIF.

ENDFORM. " VALIDATE_PC_FILE

----


  • Form GET_PC_FILE

----


  • Get PC File Name with Path

----


  • <--P_L_DFILE PC File Name Including Path

----


FORM GET_PC_FILE CHANGING P_L_DFILE LIKE IBIPPARMS-PATH.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-REPID

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = 'P_DFILE'

IMPORTING

FILE_NAME = P_L_DFILE

EXCEPTIONS

OTHERS = 1.

ENDFORM. " GET_PC_FILE

&----


*& Form DOWNLOAD_TEMPLATE

&----


  • Download template to PC File

----


FORM DOWNLOAD_TEMPLATE.

  • Local Variables.

DATA: L_FNAME LIKE RLGRAP-FILENAME.

L_FNAME = P_FNAME.

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

FILENAME = L_FNAME

FILETYPE = 'ASC'

TABLES

DATA_TAB = ITAB

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_WRITE_ERROR = 2

INVALID_FILESIZE = 3

INVALID_TABLE_WIDTH = 4

INVALID_TYPE = 5

NO_BATCH = 6

UNKNOWN_ERROR = 7

OTHERS = 8.

IF SY-SUBRC = 0.

CALL FUNCTION 'WS_EXECUTE'

EXPORTING

COMMANDLINE = L_FNAME

PROGRAM = 'NOTEPAD'

EXCEPTIONS

FRONTEND_ERROR = 1

NO_BATCH = 2

PROG_NOT_FOUND = 3

ILLEGAL_OPTION = 4

GUI_REFUSE_EXECUTE = 5

OTHERS = 6.

IF SY-SUBRC <> 0.

MESSAGE I011 WITH 'Error in opening notepad'.

STOP.

ENDIF.

ENDIF.

ENDFORM. " DOWNLOAD_TEMPLATE

&----


*& Form INSERT_COPYRIGHT

&----


  • text

----


FORM INSERT_COPYRIGHT USING P_TEXT.

PERFORM FORMAT_LINE.

IF NOT P_UPPER IS INITIAL.

TRANSLATE P_TEXT TO UPPER CASE.

ENDIF.

ITAB-LINE+0(1) = '*'.

ITAB-LINE+2 = P_TEXT.

ITAB-LINE+71(1) = '*'.

APPEND ITAB.

CLEAR ITAB.

ITAB-LINE+0(1) = '*'.

ITAB-LINE+2 = P_CPRT.

ITAB-LINE+71(1) = '*'.

APPEND ITAB.

CLEAR ITAB.

PERFORM FORMAT_LINE.

ENDFORM. " INSERT_COPYRIGHT

&----


*& Form GET_USERNAME

&----


  • GET USERNAME

----


FORM GET_USERNAME.

CLEAR : V_UNAME,USR21.

DATA:V_FNAME(40),V_LNAME(40).

SELECT SINGLE * FROM USR21 WHERE BNAME = P_UNAME.

IF SY-SUBRC = 0.

SELECT SINGLE NAME_FIRST NAME_LAST INTO (V_FNAME,V_LNAME)

FROM ADRP

WHERE PERSNUMBER = USR21-PERSNUMBER.

IF SY-SUBRC NE 0.

P_UNAME = SY-UNAME.

ELSE.

CONCATENATE V_FNAME V_LNAME INTO P_UNAME SEPARATED BY SPACE.

ENDIF.

ENDIF.

ENDFORM. " GET_USERNAME

.

Regards,

Bhaskar

0 Kudos
350

Vicenc, the program is useful but still requires one to go to the pattern option

The answer by Bhaskar is useful for generating a template into a text file and then copying that into a program

Whilst these are handy, it still does not meet my requirement properly

still waiting for the 10 point answer...

Former Member
0 Kudos
351

Hi Kris,

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.



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.

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........

Regards,

Samson Rodrigues.

0 Kudos
350

Yes Samson,

that was the 10 point answer that i was looking for

thanks

Former Member
0 Kudos
350

The same requirement i am also doing. can please give me the details how you have solved this one.

i am able to get from SE38-> Pattern-> others->pattern name.

but i am trying to get this pattens directly when u entrerd into SE38 Straight away.

Regards, Sri

Former Member
0 Kudos
350

Hi Kris,

Do u find any solution for your requirement becoz that exit Function module ever call before that Text line editing code.

Regards,

Anuj jain

Former Member
0 Kudos
350

Thanks Samson ,

Solved..