Template for ABAP programs

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

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

Similar Messages

  • How do i create a header template for ABAP programs?

    Hi all.
    Need a little bit of help here. When you create a new program you get a template with space for comments at the top of the program and basic stuff. If I want to change this template to add areas that we want to have comments on for every program we make at work. How do I do that?
    Instead of :
    I want to have in a way similar to this:
    *     Author:                         *
    *     Function:                    *
    And so on…
    I want the words to be there when our developers creates the program.
    How can I do that?
    BR
    Kalle

    After I create a new report program, I delete everything but the REPORT line.  I then put this code in for my skeleton.
    * Created By:            Walter Industries (Paul Chapman)
    * Created On:            02/29/2008
    * Tran Code:             ZLMxx
    * Program Name:          YPTC_REPORT_SKELETON        " replace New Progam Name herer
    * Program Descr:         Configurable Leads Data Query
    *                         Modification Log
    * Programmer   :Issue:   Date   : Chg Req. : Description
    * Paul Chapman :00000:02/29/2008:DEVK000000:New Program
    REPORT yptc_report_skeleton MESSAGE-ID zleads_msg.      " replace New Progam Name herer
    *_________________________________________________ Tables
    TABLES: zpca, cepc, zlmlead.
    *_________________________________________________ Constants
    CONSTANTS:
      line_length      TYPE i VALUE 100,
      c_tab            TYPE x VALUE 9,                          " x'09'
      c_crlf           TYPE x VALUE 3338.  " x'ODOA'
    *_________________________________________________ Types
    TYPES: BEGIN OF scr_text_line,
             line(line_length) TYPE c,
           END OF scr_text_line.
    *_________________________________________________ DATA
    DATA:
      curr_screen_tab(4) TYPE n.
    *_________________________________________________ ALV Area
    *_________________________________________________ Ranges
    RANGES:
      r_branch       FOR zpca-branch.
    *_________________________________________________ Selection Screen
    SELECTION-SCREEN:
      BEGIN OF TABBED BLOCK tabs FOR 36 LINES,
        TAB (20) tab1   USER-COMMAND push1 DEFAULT SCREEN 1010,
        TAB (20) tab2   USER-COMMAND push2 DEFAULT SCREEN 1020,
      END OF BLOCK tabs.
    * Tab1 Options            S E L E C T I O N    S C R E E N S    Tab 01 *
    SELECTION-SCREEN BEGIN OF SCREEN 1010 AS SUBSCREEN.
    SELECTION-SCREEN: BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS:
       sdiv      FOR cepc-prctr MATCHCODE OBJECT zdivjwh,
       ssbrch    FOR zlmlead-branch.
    SELECTION-SCREEN: END OF BLOCK blk1.
    SELECTION-SCREEN: BEGIN OF BLOCK bl10 WITH FRAME TITLE text-010.
    PARAMETERS:
      cparm1   AS CHECKBOX USER-COMMAND sel,
      cparm2   AS CHECKBOX USER-COMMAND sel,
      cparm3   AS CHECKBOX USER-COMMAND sel,
      cparm4   AS CHECKBOX USER-COMMAND sel,
      cparm5   AS CHECKBOX USER-COMMAND sel.
    SELECTION-SCREEN: END OF BLOCK bl10.
    SELECTION-SCREEN END OF SCREEN 1010.
    * Tab 2 Options            S E L E C T I O N    S C R E E N S   Tab 02 *
    SELECTION-SCREEN BEGIN OF SCREEN 1020 AS SUBSCREEN.
    SELECTION-SCREEN: BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
    SELECT-OPTIONS:
       sctype      FOR zlmlead-ctype,
       sprfcnt     FOR zlmlead-prefcont.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(25)   text-201.
    SELECTION-SCREEN POSITION 30.
    PARAMETERS:  rb_opt1 RADIOBUTTON GROUP gr20.
    SELECTION-SCREEN COMMENT 34(03)  text-991. " Yes
    SELECTION-SCREEN POSITION 40.
    PARAMETERS:  rb_opt2 RADIOBUTTON GROUP gr20.
    SELECTION-SCREEN COMMENT 44(03)  text-992. " No
    SELECTION-SCREEN POSITION 50.
    PARAMETERS:  rb_opt3 RADIOBUTTON GROUP gr20.
    SELECTION-SCREEN COMMENT 54(06)  text-993. " Either
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN: END OF BLOCK blk2.
    SELECTION-SCREEN: BEGIN OF BLOCK bl20 WITH FRAME TITLE text-020.
    PARAMETERS:
      cb_opt1   AS CHECKBOX,
      cb_opt2   AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN: END OF BLOCK bl20.
    SELECTION-SCREEN END OF SCREEN 1020.
    *____________________________________________ Screen Actions
    AT SELECTION-SCREEN OUTPUT.
      PERFORM what_tab_am_i_on.
      CASE curr_screen_tab.
        WHEN '1010'.                                            " Tab 1
        WHEN '1020'.                                            " Tab 2
        WHEN OTHERS.
      ENDCASE.
      PERFORM tab_hide_unhide.
    *___________________________________________  Initialization
    INITIALIZATION.
    * Tab Text
      tab1  = 'Tab 1'.
      tab2  = 'Tab 2'.
    *_________________________________________________ Load of Program
    LOAD-OF-PROGRAM.
    *_________________________________________________ Start of Selection
    START-OF-SELECTION.
      PERFORM set_up_branch_range.
    *_________________________________________________ End of Selection
    END-OF-SELECTION.
    *&      Form  what_tab_am_i_on
    FORM what_tab_am_i_on.
      LOOP AT SCREEN.
        IF     screen-name CS 'BLOCK_1010'.
          curr_screen_tab = '1010'.
        ELSEIF screen-name CS 'BLOCK_1020'.
          curr_screen_tab = '1020'.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " what_tab_am_i_on
    *&      Form  tab_hide_unhide
    FORM tab_hide_unhide.
      LOOP AT SCREEN.
        CHECK screen-group3 = 'TAB'.
        CASE screen-name.
          WHEN 'TAB1'.
    *        IF
    *          screen-active = 1.
    *          screen-required = 1.
    *          screen-input = 1.
    *          screen-output = 1.
    *          screen-intensified = 1.
    *          screen-invisible = 1.
    *        ELSE.
    *          screen-active = 0.
    *          screen-required = 0.
    *          screen-input = 0.
    *          screen-output = 0.
    *          screen-intensified = 0.
    *          screen-invisible = 0.
    *        ENDIF.
          WHEN 'TAB2'.
    *        IF
    *          screen-active = 1.
    *        ELSE.
    *          screen-active = 0.
    *        ENDIF.
        ENDCASE.
        MODIFY SCREEN.
      ENDLOOP.
    ENDFORM.                    " tab_hide_unhide
    *&      Form  set_up_branch_range
    FORM set_up_branch_range.
      r_branch[]  = ssbrch[].
      CHECK NOT sdiv  IS INITIAL.
      r_branch     = 'IEQ'.
      SELECT branch INTO r_branch-low
        FROM zpca
        WHERE region = 'JWHCO'
          AND division IN sdiv.
        APPEND r_branch.
      ENDSELECT.
      SORT r_branch.
      DELETE ADJACENT DUPLICATES FROM r_branch.
    ENDFORM.                    " set_up_branch_range

  • KT TEMPLATE for ABAP

    Hi All
    I am also looking for a template for Knowledge Transition for a support project, which contains the various activities involved in it along with relative levels of KT needed.
    if any of u have KT Template for ABAP. kindly mail me. Any help would be appreciated.
    My mail id is: [email protected]
    Regards

    Hi
    I saw ur posting during my search for similar (KT) template
    If u have got any template kindly mail me at [email protected]
    regards
    sada

  • Import issue for ABAP program in Production Server ?

    Hi Experts,
    I have an ABAP program which gets executed properly in BW Development server but getting the following error when I am trying to execute it in the BW Production while  I could activate the program successfully.
    Kindly help me to resolve this issue.
    Thanks in advance !!!
    Regards,
    Gokulkumar RD

    Hi Golkul,
    Can you debug the program while execute?
    I think there is some hardcoding in the program for checkiing the client and then raised a custom message in the program.
    Can you share the coding of the prorgam if possible?
    Try to check for any messages raised in the program. Also click on the on the message pop up and see the details on the message and let us know.
    Thanks
    Amit

  • PHYSICAL FILES FOR ABAP PROGRAM

    hi friends
    i would like to know are there any physical files on os level for the ABAP programs.for example, when we create a customized report for sales in ABAP does SAP also create a corresponding copy on os level. if yes then in which file system .?
    we have ECC 5.0 on AIX & use oracle 9i.
    thanks in advance.
    regards.

    imran mohd wrote:
    > hi friends
    >
    > i would like to know are there any physical files on os level for the ABAP programs.for example, when we create a customized report for sales in ABAP does SAP also create a corresponding copy on os level. if yes then in which file system .?
    >
    >
    > we have ECC 5.0 on AIX & use oracle 9i.
    >
    > thanks in advance.
    >
    > regards.
    The code you write in ABAP is not stored on OS-level (at least not in an ABAP-stack system) - it's contained in the database. As for the 'copies' your management wishes (for some ambigous reason) to have - there's no need. The code you write is versionised, so that every change made to the code is automatically documented when you press 'Save'.
    That was answering a 'basic' question - but you have made me very curious now: would you mind to explain why you would want a 'copy' of your custom code on OS-level? Any special reason??
    Edited by: Mylène Dorias on Jun 9, 2010 1:37 PM typo

  • How to get Access key for ABAP Program development in HANA Studio

    Hi,
    I have got instance for ABAP on HANA development system.
    But while creating new program it is asking me for Access key, since I do not have user id pwd for service market place I couldnt able to create the access key.
    Can any one suggest the way to create ACCESS KEY??
    Thanks,
    Ram

    Dear Ram,
    it seems that you need to follow the chapter 6.1 in the documentation...:
    Kind regards, Stephan

  • TCode for abap program performance testing

    Hi
    I have tuned a abap program which was consuming lot of time. I still have the old version with diff name. I would like to know the tcodes where in i could see the performance of the program.
    regards
    Balaji

    Hi balaji,
    This is kiran Kumar.G.I will give some steps.you better to follow those steps to get ur report performance.
    If u r satisfy with my answer give me REWARD POINTS.
                HAVE A NICE DAY.
    STEPS:
    1.OPEN UR REPORT IN SE38 TRANSACTION.
    2.SELECT THE MENU PATH
      UTILITIES-->MORE UTILITIES-->RUNTIME ANALYSIS
    3.SELECT THE PROGRAM RADIO BUTTON AND GIVE UR REPORT NAME THERE.AND CLICK <b>EXECUTE</b> BUTTON
    4.IT WILL TAKE U TO ANOTHER SCREEN THERE U CAN EXECUTE UR REPORT AND COME BACK.
    5.CLICK ON ANALYZE BUTTON.(PRESENT IN BELOW OF THE SCREEN).
    THEN U WILL GET ONE GRAPH
    NOTE:
    1.IF IT IS RED UR PROGRAM IS HAVING VERY POOR PERFORMANCE
    2.IF IT IS GREEN IT IS OK.
    ABAP GRAPH : TELLS UR CODING IN THE REPORT.
    DATABASE  GRAPH : U R RETREIVE DATA FROM DATABASE IN UR REPORT..
    SOME STEPS USED TO IMPROVE UR PERFORMANCE:
    1.     Avoid using SELECT...ENDSELECT... construct and use SELECT ... INTO TABLE.
    2.     Use WHERE clause in your SELECT statement to restrict the volume of data retrieved.
    3.     Design your Query to Use as much index fields as possible from left to right in your WHERE statement
    4.     Use FOR ALL ENTRIES in your SELECT statement to retrieve the matching records at one shot.
    5.     Avoid using nested SELECT statement, SELECT within LOOPs.
    6.     Avoid using INTO CORRESPONDING FIELDS OF TABLE. Instead use INTO TABLE.
    7.     Avoid using SELECT * and Select only the required fields from the table.
    8.     Avoid nested loops when working with large internal tables.
    9.     Use assign instead of into in LOOPs for table types with large work areas
    10.     When in doubt call transaction SE30 and use the examples and check your code
    11.     Whenever using READ TABLE use BINARY SEARCH addition to speed up the search. Be sure to sort the internal table before binary search. This is a general thumb rule but typically if you are sure that the data in internal table is less than 200 entries you need not do SORT and use BINARY SEARCH since this is an overhead in performance.
    12.     Use "CHECK" instead of IF/ENDIF whenever possible.
    13.     Use "CASE" instead of IF/ENDIF whenever possible.
    14.     Use "MOVE" with individual variable/field moves instead of "MOVE-
    CORRESPONDING", creates more coding but is more effcient.
    Regards,
    Kiran Kumar.G

  • Transport for ABAP Program

    Hello,
    Can anyone tell me how I can create a transport for and ABAP Program. It is currently in DEV but needs to go to test.
    Thanks

    I think you must have created this object as a Local Object. You need to do 2 things here :
    Reassign the Development Class to a Z Dev Class.
    Use trx code SE38. On the first screen, specify the program name & click on Goto-->Object Directory Entry.
    You will get a popup here, change the Dev Class to whatever you have on your side, this will prompt you for a Workbench Transport request. Follow up with Basis to get it to Test.

  • Can I use logical databases in a WebDynpro for ABAP program?

    can I use logical databases in a WebDynpro ABAP program?
    I need to build a WDA screen that is similar to the SAPDBPNP selection screen (user can find the personnel number based on several criteria, such as last_name/first_name of the employee).  So it seems that the exisinting logical databases have already many nice features already built (like the selection screens, the logic behind the screens etc). So I was wondering if/how I can use them in my WDA application.

    Hi
    Please let me also know the solution to this. I am a beginner to WebDynpro  and want to know if I can make use of LDB's as we do in our normal HR programming do develop a WDA in HR.
    Thanks and regards,
    Uma.

  • Client export for ABAP programs, repository objects cross client objects

    Hello,
    Let me first explain the scenario here. Our Development system crashed we are rebuilding the development system from a client export of the production. Client does not want migration etc so the only way we want to do it is through client export.
    Now the question is whether cross client objects can really be imported through client export KT, KO, KX requests?
    I thought it was possible but after successfully importinng the client export (which was taken using profile SAP_EXPC) of the Production client all the customizing has been imported but non of the ABAP programs have been imported.
    Can anyone explain how this is done and if it is possible?
    Steps I performed:
    1] Exported Production client with profile SAP_EXPC
    2] Imported the 3 requests KT, KO, KX using command line
    tp import <KT req> <SID> U2 client=<my client> pf=<profile path>
    tp import <KX req> <SID> U2 client=<my client> pf=<profile path>
    tp import <KO req> <SID> U2 client=<my client> pf=<profile path>
    3] After successful import ran scc7 which finished successfully
    Thank you

    You can transport client independent customizing, read sap note [24853 - CC-INFO: Client copy, functionality|https://service.sap.com/sap/support/notes/24853].
    But you cannot transport abap repository objects (abap programs) with a client copy.
    Can you explain what you mean by "Our Development system crashed". If you still can happily do client copies to that system, then i really wonder what you mean by crashed...
    Cheers Michael

  • Authentication or Security Checks for ABAP programs

    Dear experts,
         Please tell me where do we give the authentication or security checks to our ABAP programs and how do we do that. ( Do not allow all to execute our developed programs).
    Regards,
    Maanasa

    If you know the authorization group u can use the following ways.
    1. In the Attributes u can specify the authorization gourp name
    2. AT SELECTION-SCREEN
    AUTHORITY-CHECK OBJECT 'Z_TABU_DIS'
                ID 'ACTVT' FIELD '03'
               ID 'CUSTTYPE' FIELD v_class
                ID 'TABLENAME' FIELD p_dbtble.
      CASE SY-SUBRC.
       WHEN 0.
        WHEN OTHERS.
    Error message
         message I419(MO).
         STOP.
      ENDCASE.

  • Table for ABAP programs

    Hi ,
    Is there some table where I can find the list of ABAP programs?
    Thanks
    FedeX

    please visit this this will be use ful to u
    http://www.sap-img.com/abap.htm

  • Expression problem for ABAP program

    Hi everyone,
    Once i have saw a expression in ABAP program. as follows.
    DATA:drag_object TYPE REF TO lcl_dragdrop_dataobject.
    CATCH SYSTEM-EXCEPRIONS move_cast_error = 1.
    drag_object ?= dragdrop_object->object.
    ENDCATCH.
    IF sy-subrc = 1.
    CALL METHOD dragdrop_object->abort.
    EXIT.
    ENDIF.
    I don't know what is "?=" .
    Please help me.
    Thanks Advanced !

    DATA: airplane TYPE REF TO lcl_airplane,
                cargo_airplane TYPE REF TO lcl_cargo_airplane,
                cargo_airplane2 TYPE REF TO lcl_cargo_airplane.
          CREATE OBJECT cargo_airplane.
          airplane = cargo_airplane.
          cargo_airplane2 ?= airplane.
                 The type of case described above is known as a widening cast because it changes the
                 view to one with more details. The instance assigned (a cargo plane in the above
                 example) must correspond to the object reference (cargo_airplane in the above example),
                 that is, the instance must have the details implied by the reference. This is also known as
                 a u201Cdown castu201D. The widening cast in this case does not cause an error because the
                 reference airplane actually points to an instance in the subclass lcl_cargo_airplane. The
                 dynamic type is therefore u2018REF TO lcl_cargo_airplaneu2019.
    The widening cast logically represents the opposite of the narrowing cast. The widening cast cannot be checked statically, only at runtime. The Cast Operator u201C?=u201D (or the equivalent u201CMOVE ... ?TO u2026u201D) must be used to make this visible.

  • ABAP Objects template for HR programs

    Is there a template to use Objects in HR programs the way we had with HR-macros ? It used to be like this when using PNP LDB:
    <b>INITIALIZATION</b>
    <i><initialize buffer></i>
    <b>START-OF-SELECTION</b>
    <i><initial setup></i>
    <b>GET PERNR
    rp-provide-from-last <i><pNNNN></i> space low_date high_date.</b>
    <i><store in an internal table></i>
    <b>...
    END-OF-SELECTION</b>
    <i><process the internal table></i>
    Is there an ABAP Objects equivalent of calling standard FM/macros in HR? What are the most usefull Classes to process HR employee master data (ie. IT0000-IT0999) ? Any usefull refrences/links will be helpful.
    Thanks.

    Hi,
    This is still the approved method so stick with this.
    It works perfectly ok so there is no view to changing it.
    Cheers
    Colin

  • How to copy wd for abap program?

    Hi SAP GEARS!
    I'm developing a program (wd) in Minisap when i have not a net connection. How can i copy the wd program from this minisap to a real workplace?
    A solution is caching  data and cofile files but in standard minisap instalation the transport layers are not configured
    so, there is someone with enough goodness to help me with this thread?
    Tanks!

    Hello,
    If you want to download a Web Dynpro Component to your PC for moving between systems that aren't connected via transport, then I suggest that you look at SAPLink: http://saplink.org
    SAPLink is an Open Source community project for downloading and uploading ABAP development objects in XML format via simple report instead of the transport system. There is a plug-in for SAPLink that supports Web Dynpro Components.
    Hope this helps!
    Regards,
    Srilatha M

Maybe you are looking for

  • Mail not working, terminal not launching

    Hello, I'm currently running Mavericks on a 2011 MacBook Pro. Everything was going well, until this morning. I used CleanMyMac, during which I was prompted to install something called Lipo (the message was like : "the Lipo command requires etc."). I

  • Safari doens't show background Image when sliding page left

    I display a web page with a large-width photo (say 2000 pixels jpg file) & a repeat small background image in mobile Safari & the right part of photo is beyond the screen. I touch & slide the page left to see right part but found there's no backgroun

  • What is the use of E/F tables?

    What is the use of E/F tables?

  • Classes & Methods

    Hi Experts,                       Please see the following requirement in Classes & Methods, which I have to develop.I need this logic , Please send me the logic based up on old logic which i had given below.   The following needs to be created once,

  • Change the units in the Notification Messages to hours

    I want to change the units in the Notification Messages to hours . "RETURN_UNITS=1" do I have to put this ("RETURN_UNITS=1") in the option.dat file? Would it be possible to change this value only for one channel?