With this website we are trying to share many useful and real-time scenarios faced in projects as tutorials to help people. You can explore many tutorials, download many useful documents and materials, watch sap abap video tutorials and many more completely free. Simply subscribe our website and keep updated.

  • ABAP Online Training @ $50

    Now you can learn ABAP by watching and listening video classes by experienced consultant.

  • ABAP Tutorials N Materials

    Read, Surf and Download useful ABAP tips, tutorials, code and download many eBooks and documents free

  • Latest ABAP Job in India

    Get all latest opening for SAP ABAP and related jobs, vaccancies across India and apply for the same.

    Showing posts with label ABAP Programing. Show all posts
    Showing posts with label ABAP Programing. Show all posts

    Saturday, October 20, 2012



    Maintain the selection texts by selecting the "Selection texts" option in the Text Elements function ("GoTo >> Text elements" menu path).
    The text placed in the "Text" field for a parameter will be used on the selection screen instead of the name of the parameter.  Using selection texts allows you to create meaningful text on the selection screen


    Data declaration is one of the major part of any coding. In ABAP you can declare data with below keywords:

    Data : <Var name> TYPE <Reference Field name>.

    e.g. : LV_invoice_num type VBELN.

    A variable's name can be up to 30 characters in length. This name should begin with a letter and the remainder of the name should consist of letters, numbers, or an underscore.

    In case of constant declaration:

    CONSTANTS : <const name> TYPE <Reference Field name> VALUE <'Any value'>.
    e.g. : Lc_invoice_num type VBELN value '0001212121212'.

    If you attempt to change the value of a constant, a syntax error will occur. Constants are used to replace hard coding values in main code.

    Thursday, October 18, 2012

    The "SKIP <n>" statement creates <n> blank lines.

    WRITE '********************'.
    SKIP 2.
    WRITE:   'The date today is:', SY-DATUM,  'The current time is:', SY-UZEIT.
    WRITE '********************'.

    Out of this code will be :

    ********************
    The date today is: 12/30/1996 The current time is: 12:32:06
    ********************

    The "ULINE" statement creates an underline.
    You can specify the exact location for an underline by referencing a line feed, position, and/or length with the following statement:
    ULINE /<pos(len)>.

    WRITE: /10 'Ticket Time', SY-UZEIT.
    ULINE /10(60).

     Output of this code will be:
    Ticket Time 18:01:00
    -----------------------------------------------------
    Text Symbols are generally used to avoid hard coding while coding. Let's say you have to write a message more than 2-3 times based on different condition in the main code.

    Message may be : You have entered a wrong data

    Now instead of typing the same we can maintain the text in text symbol with reference to some number. then in main code we can use that number.

    Now you can simply use that 001 number in the main code.

    WRITE: / TEXT-001.



    Wednesday, October 17, 2012

    If you need to show an icon or a symbol in your report, then you can easily write that with include programs <ICON> and/or <SYMBOL> (the angle brackets are part of the name) with the "INCLUDE <include program>" statement. 

    You can also directly use TYPE-POOLS: icon for icon and TYPE-POOLS: sym for symbols.

    To write an icon to the report, use the following syntax:
    WRITE  <icon name>  AS ICON.
    To write a symbol to the report, use the following syntax:
    WRITE  <symbol name>  AS SYMBOL.

    To display the complete list of icons, execute the program "SHOWICON".  For symbols, execute the program "SHOWSYMB".  You can go to the initial screen of the ABAP Editor (transaction code "SE38") to execute these programs.

    Tuesday, October 16, 2012

    Every ABAP program created by you should start with Z or Y. Only SAP can create with any name. Also your project might have some other naming style without starting with Z or Y.

    While coding, few things to keep in mind:
    • Each statement must end with a period. (Full-stop)
    • Key words are always the first word in a statement
    • Words must be separated by at least one blank
    • ABAP statements can be indented and extend over several lines
    • ABAP programs must start with either the PROGRAM or REPORT statement.
    Always put comments in code section, so that everyone can understand what this coding is doing. Comments can be written by placing an asterisk (*) in column 1 or placing a double quotation mark (") within a line.

    Always make a flower box on top of every program. Above the PROGRAM or REPORT statement. This will not the executable statement, this will simply tell others what is this program and what will it do. And also other details like when created, who has created etc. This is a very common practice followed in every project.

    Wednesday, August 15, 2012

    Once you have declared the possible record types as field groups and defined their structure, you can fill the extract dataset using the following statements: EXTRACT. When the first EXTRACT statement occurs in a program, the system creates the extract dataset and adds the first extract record to it. In each subsequent EXTRACT statement, the new extract record is added to the dataset EXTRACT HEADER. When you extract the data, the record is filled with the current values of the corresponding fields. As soon as the system has processed the first EXTRACT statement for a field group, the structure of the corresponding extract record in the extract dataset is fixed. You can no longer insert new fields into the field groups and HEADER. If you try to modify one of the field groups afterwards and use it in another EXTRACT statement, a runtime error occurs. By processing EXTRACT statements several times using different field groups, you fill the extract dataset with records of different length and structure. Since you can modify field groups dynamically up to their first usage in an EXTRACT statement, extract datasets provide the advantage that you need not determine the structure at the beginning of the program.

    Tuesday, July 31, 2012

    A transaction that ends in the number below usually has the function of
    00 = main menu, 1 = ADD, 2 = MODIFY, 3 = DISPLAY


    If a transaction ends in a number, it may perform the function as listed to the left. For example:
    MR00 - INVOICE VERIFICATION MAIN MENU
    MR01 - ADD AN MM INVOICE
    MR02 - MODIFY A MM INVOICE
    MR03 - DISPLAY A MM INVOICE
    ME00 - PURCHASING MAIN MENU
    ME21 - CREATE A PURCHASE ORDER
    ME22 - CHANGE A PURCHASE ORDER
    ME23 - DISPLAY A PURCHASE ORDER
    MB00 - GOODS RECEIPT MAIN MENU
    VA00 - SALES MAIN MENU
    VF00 - BILLING MAIN MENU
    XK01 - CREATE A VENDOR CENTRALLY
    XD01 - CREATE A CUSTOMER CENTRALLY
    FS01 - CREATE A GENERAL LEDGER ACCOUNT


    Transactions beginning in are these types of transactions:
    F - Financial
    FK - Financial Vendor Master
    FS - Ledger Accounts
    FB - Shared Financial Transactions (Shared between A\P A\R Assets G\L)
    M - Material Management
    MK - Material Vendor Master
    MB - Goods Receipt – Inventory Management
    MR - MM Invoice Verification
    ME - Purchasing
    ME1 - Purchase Requisition
    ME2 - Purchase Order
    MM - Material Master
    V - Sales & Distribution
    VA - Sales Order
    VF - Billing
    XK - Central Vendor Master
    XD - Central Customer Master
    O - Usually configuration Transactions (Config transactions begin with various letters)




    Within transactions the following letters have meaning. These letters also refer to General Ledger account types and are used in naming system tables.




    A - Assets (first letter fo the German word Anlagengegenstand)
    D - Customer/ debit type transactions (first letter of German word Debitor)
    K - Vendor/credit type of transactions (first letter of German word Kredit)
    M - Material (first letter of German word Material)
    S - Ledger (first letter of the German word Soll)
    Examples of D, K, M, and S used in transactions - fill # in with D, K, M, or S.
    F#01 - CREATE FINANCIAL CUSTOMER, VENDOR, OR LEDGER,
    The F at the beginning denotes a financial transaction,
    The 1 at the end denotes CREATE.
    FD01 is create financial level customer accounts.
    FK01 is create financial level vendor accounts
    FS01 is create financial ledger accounts.


    SYSTEM TABLES - note in which letter the table ends
    BSIS - Open ledger items
    BSAS - Closed ledger items
    BSID - Open customer items
    BSAD - Closed customer items
    BSIK - Open vendor items
    BSAK - Closed vendor items




    FINANCIAL MAIN MENUS:
    F#MN - MAIN MENU where # = D for A\R (customer), K for A\P (vendor), S for G\L (ledger)
    FDMN ACCOUNTS RECEIVABLE (note the 2nd character is a D for customer)
    FKMN ACCOUNTS PAYABLE (note the 2nd character is a K for vendor)
    FSMN GENERAL LEDGER (note the 2nd character is a S for ledger)




    MISCELLANEOUS CONFIGURATION TRANSACTIONS:
    ORFB - MAIN FINANCIAL CONFIG TRANSACTION VERSION 2.2
    This transaction is from version 2.2 and does not contain paths to higer versions of SAP R/3 configuration.
    For higher versions SAP stresses that you use the IMG (TRAN: SPRO). Nonetheless, TRAN: ORFB is a fast
    and easy way to get to a lot of the configuration that you need.
    OLMB - MM INVENTORY MANAGEMENT CONFIGURATION MAIN MENU
    (NOTE - this transaction ends in MB which is the code for goods receipt)
    OLME - MM PURCHASING CONFIGURATION MAIN MENU
    (NOTE - this transaction ends in ME which is the code for purchasing)
    OLMR - MM INVOICE VERIFICATION MAIN CONFIG MENU
    (NOTE - this transaction ends in MR which is the code for MM Invoice Verfication)
    WEDI - EDI configuration and other EDI stuff.

    Friday, July 27, 2012

    This is a very common problem we face sometime in case of external debugging. Generally after testing any object we often get the problem is happening for 1 user but not for other one. But we don't have access to other users login id. In that how to set up a breakpoint for another user ?

    We can do that easily. Generally this type of issue happens in external debugging case. Lets say you have portal access for certain user TEST1. But for SAP login, TEST1 does not have SE38 access.

    In such scenario we can login to some id where SE38 access is there and set break point for ID TEST1.

    Go to settings and follow the below steps:
    Inline image 1

    Then choose the DEBUGGING tab
    Inline image 2

    Now change the USER ID to TEST1 and save the settings.

    Now if you set external break point and you can see break point will trigger for TEST1.

    Wednesday, July 25, 2012

    Selecting data from a database table is very easy. We can write many types of select. But the tough part here is to choose the right select statement as per requirement. But always we have to think the performance for long term.

    So we have to be cautious while writing SELECT query and need to remember the below points

    • Specify by all Key fields of tables while selection
    • For single record if all primary keys matches, use SELECT SINGLE
    • Otherwise use up to 1 rows
    • Avoid select within loops / select .. Endselect
    • Inner join / views better than nested selects / multiple selects
    • Take care ‘For All Entries in Table’initial or Not
    • Avoid fetching large number of records by SELECT *. Use specific fields
    • Avoid Into Corresponding Fields into Table
    These best practice rules are applicable in almost every project now a days to make the code safe for long term.


    Monday, July 23, 2012

    Report is a program which can provide user the specific information data that he/she is looking. Let's say, for a city everyday how much business is going on is need to check by the city Manager. So at the end of the day he will simply run a report with today's date and he can see the details.

    In ABAP we can create a report by SE38 transaction.

    Generally a report will not update or change any data in the database. It should have a selection screen where user can choose the criteria based on what he want the data to display. The output will be generally in a tabular format, like excel sheet display with columns & rows.


    Any program we have to create starting with Z.

    To create a report, go to SE38 transaction and provide any name starting with Z. Then press create, a pop up window will ope. We need to fill the details like below screen.


    Then click on save button and start writing your code inside the editor.


    After writing the code click on the activate button. You are done with the simplest ABAP code.

    Tuesday, July 17, 2012

    The Program Extended Syntax check is the simplest and least CPU-intensive analysis tool.

    It can be found from ABAP Editor by following the menu path:
     Program-> Check->Extended prog. 

    OR you can run the transaction SLIN.



    The check can be limited to specific options - for details on each one, select the option and hit F1.
    When you click the 'Perform check' pushbutton, an extended check will occur for all selected options (Switch on and off checks buttons are to select/deselect all).  

    Note - this check will take longer than a usual Syntax check, but once it has been performed once for a particular program, it is stored in memory and the time elapsed will improve

    The number of errors and warnings are listed in a table after the check has run.  To see these, double click on a line, and the details will be displayed.  Double clicking on the specific message will take you to the line of code in the ABAP Editor to which it refers.
    For further information see the online help on Extended Program Check

    Sunday, July 8, 2012

    By the term report we can understand a simple list of data which will give us some information. Reporting is very common and most important feature that every organization wants. Let's say a manager wants how much sale/production happened in a day. Or between a date range. To serve that purpose, we can create a report where he can enter the dates and get the details.


    In ABAP there are many types of report.


    Classical report:  This is the very basic report. It will simply return you the out as per the data selected by user.


    Interactive report: In an interactive report user can communicate with the display data. User can double click on any item and can get more specific information, which is hidden while overall display. User can send data in email format and many more extra features can be added.


    logical database : A logical database is a special type of ABAP/4 program which combines the contents of certain database tables. You can link a logical database to an ABAP/4 report program as an attribute. The logical database then supplies the report program with a set of hierarchically structured table lines which can be taken from different database tables.

     

    Alv Report: Alv is functionality which was provided by SAP only to enhance many features in a classical or interactive report. This improves the look of a report and provides many inbuilt easy to use features like summation by column, print report, sorting etc.          

    Sunday, July 1, 2012

    Simply go to se37 transaction and search with the lock object name.

    Here we have earlier created a lock object named : EADMI_CRIT

    Now click on the F4 help button.

    These are the 2 function modules created while activating a lock object.
    ENQUEUE_EADMI_CRIT : This FM will lock the entry when some will edit that
    DEQUEUE_EADMI_CRIT : This will release the lock, when someone left the transaction after editing

    Wednesday, June 13, 2012

    Line count in  ABAP programming tell us how many lines the report can have.
    SYNTAX: REPORT <rep> LINE-COUNT <length>[(<n>)].
    Here <length> will decide the length of complete report or list length. If this is 0 then complete window will be considered(standard length). If you mention <n> then besides output list, the report will store <n> lines for footer. If nothing is in footer, then only empty line will display.
    To understand better, go to se38 and create the below simple report.
    REPORT  ztest_first_report LINE-SIZE 40 LINE-COUNT 4(1).

    WRITE:  'SY-LINCT:', sy-linct.
    SKIP.

    DO 4 TIMES.
      WRITE / sy-index.
    ENDDO.

    Execute:

    Here total 5 pages created. We have mentioned in our line count as 4(1) . Means report can have max 4 lines in one page, where 1 line is reserved for footer.
    Now let's increase the length from 4 to 5.
    REPORT  ztest_first_report LINE-SIZE 40 LINE-COUNT 5(1).


    Now each page can hold 5 lines with 1 line as footer.

    Tuesday, June 12, 2012

    You can use the FM 'F4IF_INT_TABLE_VALUE_REQUEST' to call a F4 help screen.

     

    Call this screen at event :

    at selection-screen

    at selection-screen on value-request for FIELD.

     

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
          EXPORTING
            retfield    = Name of return field in FIELD_TAB

            dynpprog    = Current program name
            dynpnr      = screen number

            dynprofield = Name of screen field for value return
            value_org   = Value return: C: cell by cell, S: structured
          TABLES
            value_tab   = Table of values: entries cell by cell
            return_tab  = Return the selected value

    Tuesday, June 5, 2012

    First of all we have to open the program in se38. And follow any of the below step to enable enhancement.


    Or click on the spiral like button


    Enhancement enabled

    Search for implicit enhancement options


    It will show all the enhancement positions you can add code. Generally  implicit enhancement options are predefined at the following places:  Begin/End of an include/ Method/Function Module/Form Routine and   End of a structure/Private/Protected/Public Section of a local class .
    Now just put the cursor in the lines and right click
    Create implementation
    Choose enhancement implementation and press create
    You can create an enhancement earlier and then select here.
    Finally you will get an area to write code. After writing the code activate the enhancement.

    Sunday, June 3, 2012

    Earlier we learned, what is enhancement and how many kinds of enhancement can be possible. Besides those typical enhancement options, we can now an object using new enhancement techniques.

    Generally, there are two types of new enhancement options which is possible after ECC 6.0 versions only
      Explicit enhancement : It can be used by 2 types as well
    ENHANCEMENT-POINT: Defines a position in an ABAP program as an enhancement option, at which one or more source code plug-ins can be inserted.
    ENHANCEMENT-SECTION: Defines a section of an ABAP program as an enhancement option, which can be replaced by one or more source code plug-ins.

      Implicit enhancement : Implicit enhancement options are provided by the framework without any effort on the developer's part. The enhancement definition is for free, while, of course, the implementation has to be inserted. Implicit enhancements comprise class enhancements, function group enhancements and predefined enhancement points at particular predefined posit

    First of all enable the enhancement option of that program to enhance further like below:


    After that you can see, some portion of the code will look editable.

    Enhancement-point can be found in any standard code by looking for ENHANCEMENT-POINT. It's a point. It will tell here you can add your enhancement.

    Create your enhancement and write code in ENHANCEMENT and ENDENHANCEMENT.

    Similarly Enhancement section will also be found in similar way.

    Directly we can write code in b/w this section.

    For implicit enhancement, we can look for the enhancemet location by following the path

    Now, it will enable the enhancement area at last of the code. There just right click and select the create implementation.

    Saturday, May 26, 2012

    Step1:
    Go to SE38. Go to the menu item System -> Status


    Step2:
    Click on the program name.


    Step2:
    Now search the program with "Call Customer"  term


    Double click on that. It will navigate to a function module which is a user eixt FM. Now inside that a Z include program will be there. There we can write our code.
    There are several ways to find out a user exit. Let's take an example for transaction SE38.

    Step1: Go to SE38.

    Step2: Click on the program name.

    Step3: Go to the menu item Goto -> Object Directory Entry or Attributes


    Get the Package name.

    Step4: Go to the transaction SMOD.
    Check F4 Help for the Enhancement name.


    Step5:
    Click on "Information System" and enter the package name and execute. We get the list of Exit names for that particular package.


    Step6: Select that particular exit and click on display button.



    Step7:
    Go to "Components" tab to view all the exits for that transaction code.


    This is how we can find out the exits for a transaction code based on Package.

    Easy2learnabap.co.in @ 2012 All product names on this web site are trademarks of the companies that own them .

    Easy2learnabap.co.in is not affiliated with SAP AG in any way. SAP AG is the registered trademark holder of SAP, SAP R/3, mySAP, ABAP, xApps, NetWeaver, and other proprietary terms.

    The technical information on this site is verified to the greatest extent possible, however, any information found on this site is used at the site visitor's own risk. All the tutorials are collected from various sources, if anyone is having problem with the content, report this to us. We will take action accordingly.

    Easy2learnabap.co.in reserves the right to correct any errors or omissions in any portion of this site at any time without obligation.

    This website is created to teach people about ABAP technology. The Video contents provided in Premium service are completely owned by us and copyrighted.