If you wish to display text in any of your reports that needs to be printed, then you can make use of text elements. It is a good practice not to hard code the text in the programs. If the text is maintained centrally, then it can be called in any report and redundancy can be avoided. Moreover if the text needs to be changed then it can be done at one place rather than changing every instance if it is hard coded.
Text element maintenance can be done in the ABAP Workbench. It is used to maintain program text in different languages. The text that program uses can be maintained centrally for a program.
Transaction SE38 (ABAP Editor)
Menu Path >>>>> Goto--------TEXT ELEMENTS---------------Selection Text
Please check the screen shots below.
Thursday, January 24, 2008
Logon to SAP
SAP database has numerous tables. For viewing the content of a particular table SAP has provided a tool which can be accessed using some transactions. An ABAP programmer can display the data of a particular table using a report but this cab be easily achieved using the tools provided by SAP. As an ABAP programmer if you wish to quickly view the contents of a particular table the best way is to use this tool and the corresponding transactions.
Enter Transaction Code SE11.
Note that transaction SE11 can be used to Display/Change/Create database tables. Other transactions for ABAP dictionary are as follows
SE12 Display Database Tables View Data Types Domain Search Help Lock Objects
SE11 Display/Change/Create Database Tables View Data Types Domain Search Help Lock Objects
SE16 and SE16N Data Browser
Enter the Table name in this case VBAK
Click on Display.
Click on COntents as shown below or use shortcut CTRL+SHIFT+F10
Enter the desired data. In this case the sales order number.
The data is displayed as shown below.
Wednesday, January 23, 2008
Retrieve the data from the SAP database using the select statement and the where clause.
For database programming writing queries to retrieve the data from SAP database is essential. This is achieved with the help of the SELECT statement. There are various ways of writing the SELECT statement and we have given you a few examples below. The most essential part of the SELECT statement apart from the syntax is that the data should be selected as per the desired result. There should not be any redundancy also the efficiency of the query should be taken care of, that means the report should run quickly in the most efficient way without overloading the system.
Some examples of SAP - ABAP SELECT Statement.
SELECT * INTO wa FROM (name) CLIENT SPECIFIED WHERE mandt = '000'. WRITE: / wa-carrid, wa-carrname. ENDSELECT.
SELECT * INTO wa FROM scarr UP TO 4 ROWS. WRITE: / wa-carrid, wa-carrname. ENDSELECT.
For more examples pleas refer to SAP help click on the links given below.
If your job is to write ABAP programs/ reports you need to familiarize yourself with various functionalities of SAP. The SAP Sales and Distribution module (SD) allows you to create a Sales order. As an ABAPer you need to know at least the basics of Sales order creation. The transaction for creating a sales order is VA01, to Edit Sales order is VA02 and just to display a sales order is VA03. In case you are unable to create a sales order you can play around with an existing one in the development server. First open the sales order in the display mode and understand the fields that need to be extracted. Make a note of the tables.
In this program we will display the sales order header data.
Following fields will be displayed
Sales Order number
Sold to party number
Ship to party
Buyer
Net Value
Payment Terms
Focus
1) Retrieve the data from the SAP database using the SELECT statement and the WHERE clause 2) Selecting SINGLE rows 3) Using SELECT-OPTIONS 4) Displaying data from tables using SE11 5) Using TEXT ELEMENTS 6) Data Declaration 7) Table Declaration 8) Using the WRITE statement 9) Using the debugger 10) Using double click to display the table
Tables used
VBAK Sales Document Header Data VBPA Sales Document Partner VBKD Sales Document Business Data
To get help on any of the statements in SAP, move the cursor on the statement and press F1
Fully Functional Sample Code for the Program.
**************************************************************************************************** *ABAP Report to display Sales Order Data ****************************************************************************************************
REPORT ZEXERCISE_1 .
Tables: VBAK, " Sales Document: Header Data VBPA, " Sales Document: Partner VBKD. " Sales Document: Business Data
Select vbeln netwr waerk into (vbak-vbeln, vbak-netwr, vbak-waerk) from vbak where vbeln in s_VBELN.
endselect.
select single kunnr into d_buyer from vbpa where parvw = 'BU' or parvw = 'RE' and vbeln = S_VBELN-LOW. select single kunnr into d_billto from vbpa where parvw = 'BP' or parvw = 'WE' and vbeln = S_VBELN-low. select single kunnr into d_soldto from vbpa where parvw = 'SP' or parvw = 'AG' and vbeln = S_VBELN-low . select single kunnr into d_shipto from vbpa where parvw = 'SH' and vbeln = S_VBELN-low .
Creating the first program in ABAP is easy. First you need to create a user account using transaction SU01. You can also ask the SAP basis person to create a user account for you with the appropriate authorizations. Also a developer key needs to be generated this can be taken care by the basis person. The first program should be created with the following things in mind. It should be simple, and should run as quickly as possible. It should familiarize you with all the steps involved in creating any ABAP report as it is called.
Steps to create a simple program in ABAP. 1) Login to SAP. 2) Enter the transaction code SE38 as shown in the figure. 3) Hit enter. You will then be taken to the ABAP Editor initial screen.
Enter the name starting with Y or Z as shown below. Let the source code radio button be selected and then press create.
See the attributes dialog box below.
Click on Save
Enter $tmp in development class and click on save button
Saturday, January 5, 2008
SAP ABAP
ABAP (Advanced Business Application Programming) is a programming language for developing applications for the SAP R/3 system, a widely-installed business application subsystem. The latest version, ABAP Objects, is object-oriented programming. SAP will run applications written using ABAP/4, the earlier ABAP version, as well as applications using ABAP Objects. ABAP is used extensively to build, customize and tune SAP as per the users requirements. ABAP is uswd for developing custom reports, Sap Scripts, Adobe Forms, Smart Forms, Interfaces, and many other applications that are specific to a particular business.
Always use Pretty Printer and Extended Program Check before releasing the code.
Do not leave unused code in the program. Comment the code thoroughly. Align the comments and the Code. Follow the SAP Standards and SAP Best Practices guidelines. It’s a good practice to take a dump of the code on your local drive.