Do's and Dont's of ABAP Programming

Can anybody give me the list of Do's and Dont's of ABAP programmings

Go to Transaction SE30 an press the button Tips & Tricks.
Also have a look at below links:
http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp
http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm
http://www.sapdevelopment.co.uk/perform/performhome.htm
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/afbad390-0201-0010-daa4-9ef0168d41b6
http://www.erpgenie.com/abap/performance.htm
I hope it helps.
Best Regards,
Vibha
*Please mark all the helpful answers

Similar Messages

  • How to use SET BIT and GET BIT in ABAP Programming

    Hi,
    Our team is currently working for an Upgrade  project which is using a tool automatically upgrades when we supplly the code. fine, But now the requirement is , we need to write different test cases for the available key words in ABAP. Now we r looking for the usage of  " BIT ", keyword. so , kindly provide any program or code using this key word.
    Please find the description Provided and give some relative ABAP code to satisfy the given description.
    The data object byte_string must be byte-type. The statement reads the bit at the bit position BITPOS of the variable byte_string and assigns its value to the variable val. A default mode can be specified if required *
    Thanks & Regards,
    P.N.Kumar.

    What on earth are you testing? That ABAP still works? I think SAP might have run that through rigourous testing themselves.
    If you want sample code, why not read the ABAP help, and work some out for yourself?
    matt

  • How to get a parameter from BPC and use it in ABAP program

    Hello gurus!
    I got a problem...
    SAP BPC will send parameters such as year, division, category, company code and so on via script logic to SAP BW.
    I need to get these parameters from BPC and use them in a ABAP program as a filter.
    This ABAP program will do several routines and return new values to BPC. It must be made on ABAP and I need to filter data to avoid performance issues.
    Does anybody knows how to do it? or have a example of it?
    Thank you in advance.
    Regards,
    Rubens Kumori

    Hello, I'm looking for a suggest.
    I need to pass two parameters (users can input them in a data manager package in bpc) to a BAdI.
    In this BAdI I write a code that store those parameters in a InfoObject.
    The problem is:
    - one parameter is for CATEGORY value. CATEGORY is a dimension of the application and I read the value with a code like this:
          READ TABLE it_cv INTO l_s_it_cv
               WITH TABLE KEY dim_upper_case = 'C_CATEGORY'.
    - other parameter is a generic DATE. this parameter is not a dimension of the application and I don't know how I can retrieve this value in BAdI.
          READ TABLE it_cv INTO l_s_it_cv
               WITH TABLE KEY dim_upper_case = '.....'.
    The data manager dynamic script is:
    PROMPT(SELECTINPUT,,,,"%CATEGORY_DIM%")
    PROMPT(TEXT,%SELECTED_DAY%,"Write the date (format YYYYMMDD)",)
    I also have a dynamic constant that assign the name %CATEGORY_DIM% to "C_CATEGORY" value.
    Can anyone help me?
    thanks a lot
    Edited by: Luca Novali on Feb 13, 2012 3:49 PM

  • How can user attach file to interactive form, and be read by abap program?

    Hello,
    I created an abap interactive form, sent to the user, then user fills out the form fields, then it is uploaded back to sap, then my program reads this data and process it.
    It works.
    Now I want users to be able to attach any file they want, and the abap program to extract this file out of the PDF, to put it into SAP (or anywhere).
    I succeeded in attaching a file, I can "see" it via function module get_annotations, but I get the file in compressed form by Adobe (filter="FlateDecode").
    Do you know how to unzip the file, or is there another way to attach files in adobe reader/extract them via abap?
    I use acrobat reader 8.1.2
    Thx a lot!
    sandra
    Below is the xml obtained by GET_ANNOTATIONS. We see that there are other text annotations, and that the attached file has {length="98005"}, though real file (before "attach file" to the PDF, and also after "detach file") has length 111 995 bytes. It's why I deduced that there is a compression (I also tried to extract it as-is and open it with adobe but it doesn't work.
    <?xml version="1.0" encoding="UTF-8"?>
    <xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">
      <annots>
        <highlight rect="212.347,624.257996,252.979004,636.539978" creationdate="D:20080604100938+02'00'"
    name="2114308b-275d-4eca-8bfc-c8288ef4a77c" color="#FFFF00" flags="print"
    date="D:20080604100938+02'00'" title="mtresori" subject="Texte surligne "
    coords="215.432999,636.179016,249.893005,636.179016,215.432999,624.619019,249.893005,624.619019"
    page="0">
          <popup rect="595.276001,516.179016,775.276001,636.179016" flags="print,nozoom,norotate"
    open="no" page="0"/>
        </highlight>
        <fileattachment rect="15.345001,802.841003,29.345001,822.841003"
    creationdate="D:20080604101011+02'00'" name="f6e12648-c9b0-4cd1-b08b-82876c8300d7"
    color="#4055FF" flags="print,nozoom,norotate" date="D:20080604101019+02'00'" title="mtresori"
    subject="Piece jointe" file="SAP_WIDGETS2.pdf" mimetype="application/pdf"
    creation="D:20080603112937+02'00'" modification="D:20080603112937+02'00'" size="111995"
    checksum="9F846412B510089F7C6DBCC6527C6339" page="0">
          <contents-richtext>
            <body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"
    xfa:APIVersion="Acrobat:8.0.0" xfa:spec="2.0.2">
              <p>SAP_WIDGETS2.pdf</p>
            </body>
          </contents-richtext>
          <data MODE="raw" encoding="hex" length="98005" filter="FlateDecode">
    4889CC570B5414D719F651A38EC468D5C6A2980104E528BBF3B8F3B2626405242920020A0AA4AEBB
    C3B2BAECEAEEA2A018030A628C8FFA4A0F568F58426A1EF5118FB5266A8D9AA2B16A55044541C5
    A62656EBA315935AE8BDB3BBEC2C0BD9D5B39EB3671966FEFBFCE6BF
    ETC. (all hexa code is the attached file, but with compression by adobe)
          </data>
        </fileattachment>
        <text rect="96.187408,680.099976,116.186996,698.099976" creationdate="D:20080613144537+02'00'"
    name="73360fcf-f5e5-4d5b-9315-fe4c42924300" color="#FFFF00" flags="print,nozoom,norotate"
    date="D:20080613144617+02'00'" icon="Comment" title="srossi" subject="Note" page="0">
          <contents-richtext>
            <body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"
    xfa:APIVersion="Acrobat:8.0.0" xfa:spec="2.0.2">
              <p dir="ltr">
                <span dir="ltr" style="font-size:10.0pt;text-align:left;color:#000000;
    font-weight:normal;font-style:normal">
    ffffffffffffffffffffff
                </span>
              </p>
            </body>
          </contents-richtext>
          <popup rect="595.276001,578.099976,775.276001,698.099976" flags="print,nozoom,norotate"
    open="yes" page="0"/>
        </text>
        <text rect="100,82,120,100" creationdate="D:20080613144627+02'00'" state="Marked"
    name="d524b7d5-1a85-4b62-80b3-5875dd152c51"
    color="#FFFF00" flags="hidden,print,nozoom,norotate" date="D:20080613144627+02'00'"
    icon="Comment" title="srossi" subject="Note"
    inreplyto="73360fcf-f5e5-4d5b-9315-fe4c42924300" statemodel="Marked" page="0">
          <contents-richtext>
            <body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"
    xfa:APIVersion="Acrobat:8.0.0" xfa:spec="2.0.2">
              <p>Marked definie par srossi</p>
            </body>
          </contents-richtext>
          <popuprect="595.276001,-20,775.276001,100" flags="print,nozoom,norotate" open="no" page="0"/>
        </text>
        <text rect="100,82,120,100" creationdate="D:20080613144633+02'00'" state="Accepted"
    name="88af2cb6-7516-4f21-81e6-97edc7a85184"
    color="#FFFF00" flags="hidden,print,nozoom,norotate" date="D:20080613144633+02'00'" icon="Comment"
    title="srossi" subject="Note" inreplyto="d524b7d5-1a85-4b62-80b3-5875dd152c51" statemodel="Review"
    page="0">
          <contents-richtext>
            <body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"
    xfa:APIVersion="Acrobat:8.0.0" xfa:spec="2.0.2">
              <p>Accepted definie par srossi</p>
            </body>
          </contents-richtext>
          <popup rect="595.276001,-20,775.276001,100" flags="print,nozoom,norotate" open="no" page="0"/>
        </text>
        <text rect="100,82,120,100" creationdate="D:20080613144642+02'00'" state="Marked"
    name="a8c6b485-c3f9-44e2-ad53-c61b2766d9d5" color="#FFFF00" flags="hidden,print,nozoom,norotate"
    date="D:20080613144642+02'00'" icon="Comment" title="srossi" subject="Note"
    inreplyto="f6e12648-c9b0-4cd1-b08b-82876c8300d7" statemodel="Marked" page="0">
          <contents-richtext>
            <body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"
    xfa:APIVersion="Acrobat:8.0.0" xfa:spec="2.0.2">
              <p>Marked definie par srossi</p>
            </body>
          </contents-richtext>
          <popup rect="595.276001,-20,775.276001,100" flags="print,nozoom,norotate" open="no" page="0"/>
        </text>
        <text rect="100,82,120,100" creationdate="D:20080613144647+02'00'" state="Accepted"
    name="0136b689-575c-46b8-a21a-86e3c8d73904" color="#FFFF00" flags="hidden,print,nozoom,norotate"
    date="D:20080613144647+02'00'" icon="Comment" title="srossi" subject="Note"
    inreplyto="a8c6b485-c3f9-44e2-ad53-c61b2766d9d5" statemodel="Review" page="0">
          <contents-richtext>
            <body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"
    xfa:APIVersion="Acrobat:8.0.0" xfa:spec="2.0.2">
              <p>Accepted definie par srossi</p>
            </body>
          </contents-richtext>
          <popup rect="595.276001,-20,775.276001,100" flags="print,nozoom,norotate" open="no" page="0"/>
        </text>
        <text rect="100,82,120,100" creationdate="D:20080613144657+02'00'" state="Accepted"
    name="a21fc3c5-cf6a-4c6f-bc1f-328a91050b4e" color="#FFFF00" flags="hidden,print,nozoom,norotate"
    date="D:20080613144657+02'00'" icon="Comment" title="srossi" subject="Note"
    inreplyto="2114308b-275d-4eca-8bfc-c8288ef4a77c" statemodel="Review" page="0">
          <contents-richtext>
            <body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"
    xfa:APIVersion="Acrobat:8.0.0" xfa:spec="2.0.2">
              <p>Accepted definie par srossi</p>
            </body>
          </contents-richtext>
          <popup rect="595.276001,-20,775.276001,100" flags="print,nozoom,norotate" open="no" page="0"/>
        </text>
      </annots>
      <f href="acTempF-00000028453-00000000089"/>
      <ids original="03473EFED11DB2110A00000000000000" modified="959796E85292D54DB7FA558CAAD4A346"/>
    </xfdf>

    Hello everybody,
    I am sure you have an answer to my question above. It was :
    how is it possible for a user to ATTACH files to a PDF interactive form, and then be able to READ them via a program ? (I guess the solution to read them via ABAP or JAVA is quite the same?)
    Thx a lot !
    sandra

  • Identifying primery and secondary Indexes in ABAP Programs

    Hi all,
    i have used primary Index and Secondary Indexes in my ABAP program. my question is i want to identify Indexes which i used in my programs. how can i identify them? is there any method.tell me with great details.

    Switch on SQL trace (ST05), run the program, study the SQL trace.
    Thomas
    Good blog on the topic: The SQL Trace (ST05) – Quick and Easy

  • Dynamic Selection of fields and those 0uputs using ABAP Programming

      Dear All
    I have a requirement I searched but couldn't able to find the closest one,
    kindly help me in this...
    I have 100 fields in one text file which is placed in AL11 server....
    Requirement is
    User should be able to run a report , by selecting any of the listed field and see any difference between the data in 2 text fields of diff dates...
    Ex: in 100 fields Employee Group and Dept no..2 fields he selects in selection-screen output and selects 2 text files from AL11 Server...
    if he executes report should produce only those employees who has difference in Employee Subgroup and dept no changes...
    writing the logic is not a big deal...
    but 2 challenges
    1) Empno , empname are fixed but remaining field columns should be what ever user selects. on the selection-screen
    2) How to populate fields on selection-screen??
    Regards
    Sas

    Hi Srinivas,
    Drop down is to select one field at a time,
    I need to select as many as user want to see the difference.......
    Regards
    Satish.v

  • Execute InfoPackage in ABAP program and Pass Values at runtime

    Hi All,
       I want to execute an InfoPackage in an ABAP program. I am looking to execute the Infopackage in a loop passing in different values to 0FISCPER under Data Selection tab in the InfoPackage at run time. Please help. I would appreciate if someone has code.
    Thanks.
    Regards,
    bw_newbie

    you can do the same thing with routine in data selection. why do you want to do it with ABAP Program? any specific Reason?
    You can achive this using BAPI_IPAK_START and BAPI_IPAK_CHANGE FM in ABAP Program.
    You need to pass Fiscal Period values in BAPI_IPAK_CHANGE FM.
    Nagesh Ganisetti.
    Assign points if it helps.

  • Abap program to maintain variants in RSRPARAMETRIZA

    Hi,
    SAP provided an ABAP example to maintain 3.5 variants in NW04s
    Report Z_MASS_VARIANT_MAINTENANCE is available in the next u2018how tou2019 document.
    [http://www.sapadvisors.com/resources/HowtoInformationBroadcasting.pdf]
    This is only helpfull if you use 3.5 workbooks.
    7.0 workbook variants are not save in RSRVARIANT anymore. 7.0 variants are saved in table-field RSRPARAMETRIZA-STRING (xml field with selection values).
    I need to develop a program to maintain this variants. Can anybody save me some time and send me similar abap program for 7.0 workbooks ?
    Thanks,
    Pedro

    Hi,
    Bruno is right about class CL_RSR_PARA.
    This is an abap example is used to maintain 'ZRT_M4M_Q0016' Query variants. In this case variant BC_SALST001 is updated.
    If you need to update different report variant you have to change the 'form create_variant'.
    In this variant I'm updating:
    - 0S_MAT: empty
    - 0S_MATGR: 5300-5399
    - ZMM_STA2: Z0;ZZ
    *& Program to mass update BEx Variants within SAP Netwever 2004s
    REPORT Z_MASS_FR_BROADCAST_0003 .
    constants: C_PARAMNM type RSPARAMNM value 'BC_SALST001'.
    ---> TYPE DEFININTIONS --->
    NOTE: Ripped from class CL_RSR_PARA
    TYPES: BEGIN OF t_sx_int_var_value,
             vnam   TYPE rszvnam,
             data_prov TYPE string,
             range   TYPE STANDARD TABLE OF rrrange  WITH DEFAULT KEY
                                                     INITIAL SIZE 1,
       END OF  t_sx_int_var_value.
    TYPES: t_tx_int_var_value TYPE STANDARD TABLE OF t_sx_int_var_value
                                   WITH DEFAULT KEY
                                   INITIAL SIZE 1.
    <- TYPE DEFININTIONS <-
    DATA: l_s_rsrparametriza type rsrparametriza.
    DATA: l_s_range type rrrange.
    DATA: l_s_sx_int_var_value type t_sx_int_var_value.
    DATA: r_tsx_values type t_tx_int_var_value.
    perform create_variant.
    l_s_rsrparametriza-paramnm = c_paramnm.
    l_s_rsrparametriza-objvers = 'A'.
    l_s_rsrparametriza-parentcomponent = '1'.
    l_s_rsrparametriza-workbookid = ''.
    l_s_rsrparametriza-eltuid = 'ZRT_M4M_Q0016'.
    l_s_rsrparametriza-plnfuncnm = ''.
    l_s_rsrparametriza-template = ''.
    l_s_rsrparametriza-planningseqeunce = ''.
    l_s_rsrparametriza-version = ''.
    l_s_rsrparametriza-personal = ''.
    l_s_rsrparametriza-owner = sy-uname.
    CALL TRANSFORMATION
      id
      SOURCE page = r_tsx_values
      RESULT XML l_s_rsrparametriza-content.
    get time stamp field l_s_rsrparametriza-timestmp.
    l_s_rsrparametriza-conttimestmp = ''. " fix
    *For security reasons I just change existing variants field.
    update rsrparametriza
       set content = l_s_rsrparametriza-content
    where PARAMNM eq c_paramnm
       and OBJVERS eq 'A'.
    If sy-subrc eq '0'.
      Write: 'Update sucessfull'.
    else.
      Write: 'No update: Probably variant does not exist'.
    endif.
    form create_variant.
    *0S_MAT
      clear l_s_sx_int_var_value.
      l_s_sx_int_var_value-vnam = '0S_MAT'.
      l_s_sx_int_var_value-data_prov = 'DP_4'.
      " no selections
      append l_s_sx_int_var_value to r_tsx_values.
    *0S_MATGR
      clear l_s_sx_int_var_value.
      l_s_sx_int_var_value-vnam = '0S_MATGR'.
      l_s_sx_int_var_value-data_prov = 'DP_4'.
      clear l_s_range.
      l_s_range-sign = 'E'.
      l_s_range-opt = 'BT'.
      l_s_range-low = '5300'.
      l_s_range-high = '5399'.
      append l_s_range to l_s_sx_int_var_value-range.
      append l_s_sx_int_var_value to r_tsx_values.
    *ZMM_STA2
      clear l_s_sx_int_var_value.
      l_s_sx_int_var_value-vnam = 'ZMM_STA2'.
      l_s_sx_int_var_value-data_prov = 'DP_4'.
      clear l_s_range.
      l_s_range-sign = 'I'.
      l_s_range-opt = 'EQ'.
      l_s_range-low = 'ZO'.
      l_s_range-high = ''.
      append l_s_range to l_s_sx_int_var_value-range.
      l_s_range-low = 'ZZ'.
      append l_s_range to l_s_sx_int_var_value-range.
      append l_s_sx_int_var_value to r_tsx_values.
    That's all
    Pedro

  • Migration influence in ABAP program

    hi guys,
    We are going for migration from 4.6C (Op.sys - HP-Unix, DB-Oracle 8.0) to 4.6C(Op.sys-Solaris,DB-Oracle 9.0).
    We need to analyse what are the changes required to be considered before migration.
    I guess below things are basic things
    1-External command.
    2-OS level application execution command.
    3-OPEN file path(logical path,physical path)
    other than this is there any thing i have to considered for OS and Database difference inside ABAP programs.
    appreciate if you Can give me check list...if possible
    Pls suggest me.
    thanks.
    Ambi.

    MESSAGE  ext TYPE mtype ... .
    This variant sends a character string contained in text as a message of the message type specified in mtype. You can enter a character-type data object text, which will be used as a short text for the message. Only the first 300 characters in text are taken into account. No long text can be defined for a message of this type.
    For mtype, a character-type data object is expected, which must contain the message type in capital letters. Invalid message types generate an untreatable exception.
    Notes
    : In this variant, the additions WITH and INTO are not allowed in message_options.
    If field symbols or formal parameters of the type any or data are specified for text, these must be of character type when the statement is executed. The syntactically identical variant MESSAGE oref cannot be executed with generically typed field symbols or formal parameters.
    Because the system fields sy-msgid and sy-msgno are filled unspecifically when a character string is entered, this variant should only be used on rare occasions if the content of the system fields is not required for identification of the message. Otherwise, in all cases in which messages are transferred (for example, from function modules) or logged (for example, in batch input) using these system fields, language-independent access to the message text would be lost.
    Example
    : Output of an exception text as an information message.
    DATA: oref TYPE REF TO cx_sy_arithmetic_error,
          text TYPE string.
    TRY.
      CATCH cx_sy_arithmetic_error INTO oref.
        text = oref->get_text( ).
        MESSAGE text TYPE 'I'.
    ENDTRY.

  • Backup ABAP Programs

    Hi Everyone,
    I need your help.
    I am working on a tool that can backup the ABAP source codes and tables.
    I am using the READ REPORT to get the source code and store the result in a text file,
    my question is, if I want to give this tool to a client , what kind of authorization a user need to be able
    to run the tool and backup all the ABAP programs of the SAP system ?
    Can any ABAP developer use the "READ REPORT" and read the source code written by
    other ABAP developer ?
    Thanks

    REPORT zdownload.
    TABLES: trdir.
    SELECT-OPTIONS name FOR trdir-name NO INTERVALS.
    PARAMETERS: path TYPE c LENGTH 50 DEFAULT 'C:\USERS\SCHWAB\PROGRAMS'.
    START-OF-SELECTION.
      LOOP AT name.
        PERFORM download_program USING name-low.
      ENDLOOP.
    FORM download_program
    FORM download_program USING value(i_name) LIKE trdir-name.
      DATA: BEGIN OF lt_data_tab OCCURS 0,
             line(72),
            END OF lt_data_tab,
            l_filename TYPE string.
      CONCATENATE path '\' i_name '.TXT' INTO l_filename.
      READ REPORT i_name INTO lt_data_tab.
      IF lines( lt_data_tab ) = 0.
        MESSAGE e001(uc) WITH TEXT-TK0.
      ENDIF.
      CALL METHOD cl_gui_frontend_services=>gui_download
        EXPORTING
          filename = l_filename
        CHANGING
          data_tab = lt_data_tab[]
        EXCEPTIONS
          OTHERS   = 0.
      IF sy-subrc <> 0.
        MESSAGE e001(uc) WITH TEXT-K01.
      ENDIF.
    ENDFORM.                    "download_program
    AT SELECTION-SCREEN ON name.
      check name-low <> space.
      SELECT SINGLE * FROM trdir WHERE name = name-low.
      IF sy-subrc <> 0.
        MESSAGE e001(uc) WITH TEXT-K02.
      ENDIF.

  • I want the Definitaion fo  Class and its Components  in ABAP . With Example

    Gowri

    <b>Classes</b>
    Classes are templates for objects. Conversely, you can say that the type of
    an object is the same as its class. A class is an abstract description of an object. You could say that it is a set of instructions for building an object. The attributes
    of objects are defined by the components of the class, which describe the
    state and behavior of objects.
    <b>
    Local and Global Classes</b>
    Classes in ABAP Objects can be declared either globally or locally. You define global classes and interfaces in the Class Builder (Transaction SE24) in the
    ABAP Workbench. They are stored centrally in class pools in the class library
    in the R/3 Repository. All of the ABAP programs in an R/3 System can access the global classes. Local classes are defined within an ABAP program. Local classes and interfaces can only be used in the program in which they are defined. When you use a class in an ABAP program, the system first searches for a local class with the specified name. If it does not find one, it then looks for a global class. Apart from the visibility question, there is no difference between using a global class and using a local class.
    There is, however, a significant difference in the way that local and global classes are designed. If you are defining a local class that is only used in a single program, it is usually sufficient to define the outwardly visible components so that it fits into that program. Global classes, on the other hand, must be able to be used anywhere. This means that certain restrictions apply when you define the interface of a global class, since the system must be able to guarantee that any program using an object of a global class can recognize the data type of each interface parameter.
    The following sections describe how to define local classes and interfaces in an ABAP program. For information about how to define local classes and interfaces, refer to the  Class Builder section of the ABAP Workbench Tools documentation.
    <b>Defining Local Classes</b>
    Local classes consist of ABAP source code, enclosed in the ABAP statements CLASS ... ENDCLASS. A complete class definition consists of a declaration part and, if required, an implementation part. The declaration part of a class <class> is a statement block:
    CLASS <class> DEFINITION.
    ENDCLASS.
    It contains the declaration for all components (attributes, methods, events) of the class. When you define local classes, the declaration part belongs to the global program data. You should therefore place it at the beginning of the program.
    If you declare methods in the declaration part of a class, you must also write an implementation part for it. This consists of a further statement block:
    CLASS <class> IMPLEMENTATION.
    ENDCLASS.
    The implementation part of a class contains the implementation of all methods of the class. The implementation part of a local class is a processing block. Subsequent coding that is not itself part of a processing block is therefore not accessible.
    <b>Structure of a Class</b>
    <u>The following statements define the structure of a class:</u>
    A class contains components
    Each component is assigned to a visibility section
    Classes implement methods
    The following sections describe the structure of classes in more detail.
    <b>Class Components</b>
    The components of a class make up its contents. All components are declared in the declaration part of the class. The components define the attributes of the objects in a class. When you define the class, each component is assigned to one of the three visibility sections, which define the external interface of the class. All of the components of a class are visible within the class. All components are in the same namespace. This means that all components of the class must have names that are unique within the class.
    There are two kinds of components in a class - those that exist separately for each object in the class, and those that exist only once for the whole class, regardless of the number of instances. Instance-specific components are known as instance components. Components that are not instance-specific are called static components.
    In ABAP Objects, classes can define the following components. Since all components that you can declare in classes can also be declared in interfaces, the following descriptions apply equally to interfaces.
    <b>Attributes</b>
    Attributes are internal data fields within a class that can have any ABAP data type. The state of an object is determined by the contents of its attributes. One kind of attribute is the reference variable. Reference variables allow you to create and address objects. Reference variables can be defined in classes, allowing you to access objects from within a class.
    <b>Instance Attributes</b>
    The contents of instance attributes define the instance-specific state of an object. You declare them using the DATA statement.
    <b>Static Attributes</b>
    The contents of static attributes define the state of the class that is valid for all instances of the class. Static attributes exist once for each class. You declare them using the CLASS-DATA statement. They are accessible for the entire runtime of the class.
    All of the objects in a class can access its static attributes. If you change a static attribute in an object, the change is visible in all other objects in the class.
    <b>Methods</b>
    Methods are internal procedures in a class that define the behavior of an object. They can access all of the attributes of a class. This allows them to change the data content of an object. They also have a parameter interface, with which users can supply them with values when calling them, and receive values back from them The private attributes of a class can only be changed by methods in the same class.
    The definition and parameter interface of a method is similar to that of function modules. You define a method <met> in the definition part of a class and implement it in the implementation part using the following processing block:
    METHOD <meth>.
    ENDMETHOD.
    You can declare local data types and objects in methods in the same way as in other ABAP procedures (subroutines and function modules). You call methods using the CALL METHOD statement.
    <b>Instance Methods</b>
    You declare instance methods using the METHODS statement. They can access all of the attributes of a class, and can trigger all of the events of the class.
    <b>Static Methods</b>
    You declare static methods using the CLASS-METHODS statement. They can only access static attributes and trigger static events.
    <b>Special Methods</b>
    As well as normal methods, which you call using CALL METHOD, there are two special methods called CONSTRUCTOR and CLASS_CONSTRUCTOR, which are automatically called when you create an object (CONSTRUCTOR) or when you first access the components of a class (CLASS_CONSTRUCTOR).
    <b>Events</b>
    Objects or classes can use events to trigger event handler methods in other objects or classes. In a normal method call, one method can be called by any number of users. When an event is triggered, any number of event handler methods can be called. The link between the trigger and the handler is not established until runtime. In a normal method call, the calling program determines the methods that it wants to call. These methods must exist. With events, the handler determines the events to which it wants to react. There does not have to be a handler method registered for every event.
    The events of a class can be triggered in the methods of the same class using the RAISE EVENT statement. You can declare a method of the same or a different class as an event handler method for the event <evt> of class <class> using the addition FOR EVENT <evt> OF <class>.
    Events have a similar parameter interface to methods, but only have output parameters. These parameters are passed by the trigger (RAISE EVENT statement) to the event handler method, which receives them as input parameters.
    The link between trigger and handler is established dynamically in a program using the SET HANDLER statement. The trigger and handlers can be objects or classes, depending on whether you have instance or static events and event handler methods. When an event is triggered, the corresponding event handler methods are executed in all registered handling classes.
    <b>Instance Events</b>
    You declare instance events using the EVENTS statement. An instance event can only be triggered in an instance method.
    <b>Static Events</b>
    You declare static events using the CLASS-EVENTS statement. All methods (instance and static methods) can trigger static events. Static events are the only type of event that can be triggered in a static method.
    <u>See also Triggering and Handling Events.</u>
    <b>Types</b>
    You can define your own ABAP data types within a class using the TYPES statement. Types are not instance-specific, and exist once only for all of the objects in a class.
    <b>Constants</b>
    Constants are special static attributes. You set their values when you declare them, and they can then no longer be changed. You declare them using the CONSTANTS statement. Constants are not instance-specific, and exist once only for all of the objects in a class.
    <b>Visibility Sections</b>
    You can divide the declaration part of a class into up to three visibility areas:
    CLASS <class> DEFINITION.
      PUBLIC SECTION.
      PROTECTED SECTION.
      PRIVATE SECTION.
    ENDCLASS.
    These areas define the external visibility of the class components, that is, the interface between the class and its users. Each component of a class must be assigned to one of the visibility sections.
    <b>Public Section</b>
    All of the components declared in the public section are accessible to all users of the class, and to the methods of the class and any classes that inherit from it. The public components of the class form the interface between the class and its users.
    <b>
    Protected Section</b>
    All of the components declared in the protected section are accessible to all methods of the class and of classes that inherit from it. Protected components form a special interface between a class and its subclasses. Since inheritance is not active in Release 4.5B, the protected section currently has the same effect as the private section.
    <b>Private Section</b>
    Components that you declare in the private section are only visible in the methods of the same class. The private components are not part of the external interface of the class.
    <b>Encapsulation</b>
    The three visibility areas are the basis for one of the important features of object orientation - encapsulation. When you define a class, you should take great care in designing the public components, and try to declare as few public components as possible. The public components of global classes may not be changed once you have released the class.
    For example, public attributes are visible externally, and form a part of the interface between an object and its users. If you want to encapsulate the state of an object fully, you cannot declare any public attributes. As well as defining the visibility of an attribute, you can also protect it from changes using the READ-ONLY addition.
    "Example  :
    CLASS C_COUNTER DEFINITION.
      PUBLIC SECTION.
        METHODS: SET_COUNTER IMPORTING VALUE(SET_VALUE) TYPE I,
                 INCREMENT_COUNTER,
                 GET_COUNTER EXPORTING VALUE(GET_VALUE) TYPE I.
      PRIVATE SECTION.
        DATA COUNT TYPE I.
    ENDCLASS.
    CLASS C_COUNTER IMPLEMENTATION.
      METHOD SET_COUNTER.
        COUNT = SET_VALUE.
      ENDMETHOD.
      METHOD INCREMENT_COUNTER.
        ADD 1 TO COUNT.
      ENDMETHOD.
      METHOD GET_COUNTER.
        GET_VALUE = COUNT.
      ENDMETHOD.
    ENDCLASS.
    The class C_COUNTER contains three public methods - SET_COUNTER, INCREMENT_COUNTER, and GET_COUNTER. Each of these works with the private integer field COUNT. Two of the methods have input and output parameters. These form the data interface of the class. The field COUNT is not outwardly visible.
    Reward   points  if it is usefull...
    Girish

  • Passing of parameters to custom abap program

    I need to be able to have some parameters i submit off a script and pass then to SAP
    The abap that is run is a custom abap and takes 3 parameters.
    I add a new parameter in the script definition I_LAUFD
    with the value for the parameter i want to pass the custom abap.
    When i submit the job i recieve
    <unknown>: argument I_LAUFD not found
    use the following name=value pairs
    ABAP_RUN
    ABAP_RUN_PRINT etc etc
    I want to submit a parameter to cutom abap how do i go about it? is is possible?
    Thanks in advance
    Joe

    Parameters for ABAP programs are most of the time passed to the ABAP program using a VARIANT. In transaction SE38 you can check which parameters can be set on the VARIANT for your custom ABAP program.
    If you need to set these parameters dynamically before the job starts, you can submit a job to change these values for you from CPS and then start the ABAP program in the next step.
    Which version of CPS are you using?

  • ABAP program to take input parameter from variant, execute KSB1 and export

    Hi Friends,
    My client asking  change request in CO
    The Change request is "ABAP program to take input parameter from variant, execute KSB1 and export the output into an excel sheet and park the document in a designated location"
    Pls let me know  actually i am a FICO consultant what i can do in this change request
    Thanks,
    Santi

    Hi
    First I dont you would need to create a ABAP to generate the report in Excel.
    You can look at this option. Execute the report Go to->Change Layout, Click on the view option, On the Preferred View Select Microsoft Excel, Save the layout, provide a layout name with /XYZ.
    Now when you want to execute KSB1 with excel, just execute KSB1 with /XYZ layout, it would open in Excel, export to which ever location you want.
    Or just simply save the report as Excel using the Excel button on the tool bar.
    Regards,
    Suraj

  • How to create schedule job and event trigger in XI to start a ABAP program?

    Dear All:
    Here are what i need to do:
    1.To run a ABAP program to start an XI scenario per hour.
    2.To run a ABAP program to start an XI scenario per day at 6 PM.
    3.To run a ABAP program used event trigger to make sure that XI scenario has finished the process and after that wait for 10 min later and run again.
    only i know is used sm36 & sm37 to set up a schedule job.
    but what i don't know is how to do it step by step.
    especially point 3.
    are there any step by step example can show me how?
    it better be simple and details...
    thanks you all
    Regards
    Jack Lee

    Hi,
    If you want to trigger the event manually from within SAP, use transaction
    SM64
    in SAP this is done by scheduling a job
    once a new customer is entered
    your scheduled report sends customer master data
    you can schedule your report (TCODE - BD12 I think) to one day or every 5 minutes... it depend on your needs and the system performence
    Regards,
    Surya

  • Read an XML file into an ABAP program and manipulate it.

    I would like to know if it is possible to do the following in an ABAP program:
    1) Read an XML file into an ABAP internal table
    2) Call an XSLT transformation on the source file and store the results in an ABAP table.
    Is this possible to do? I have used ABAP XSLT in PI, but never in an ABAP program. I see you can use the CALL TRANSFORMATION command, but I have never used it in an ABAP program.
    Kind Regards,
    Tony.

    Check out these blogs.
    XML DOM Processing in ABAP part I -  Convert an ABAP table into XML file using SAP DOM Approach.
    XML DOM Processing in ABAP part II - Convert an XML file into an ABAP table using SAP DOM Approach.

Maybe you are looking for

  • CC Apps on Windows 8 / Modify Install

    Hi -- I have just installed Photoshop CC and Illustrator CC on my machine running Windows 8. I noticed that both 32 bit and 64 bit versions of Photoshop and Illustrator are installed. Since I'm using Windows 64-bit do I need both? I'm assuming I don'

  • Windows Update on iMac Using Parallels Fails

    Hi All: I hope you can offer some assistance with this. I have a user who recently purchased an iMac. He loves it but he also needed to use it for work when not in the office, so he installed Parallels and Windows XP Pro/Office 2003. He has not been

  • Problem with XML document created by JDBC Sender adapter

    We are using a sender JDBC adapter to publish data out of a DB2 table.  The message generated by the XI sender adapter seems to have 2 extra characters that break our mapper.  You can see the characters (the dashes on lines 2 and 4) in the XML docume

  • How do I open a ZIP file?

    I received a ZIP file (.xlsx) from a PC user, dragged it to a folder on the desktop, and used my downloaded Unarchiver to open it. It created a new folder within the original folder. The new folder has a file (.xml) and three folders in it. I don't k

  • Can't add AP to new controller

    Morning, I just added a new controller to our wireless environment to support AP's in our remote offices. These offices will host public hotspots so we wanted to use a 2125 controller so we could apply different security policies around it. Our corpo