Você está na página 1de 9

25th MARCH----Logical Databases

Logical Databases : is a special type of programming technique used to increse the


effiency of the report.

* state the Following satatement is true/false.


Logical Data base uses Tree strucutre to add its nodes.
ANS : true.
* state the Following satatement is true/false.
Logical Data base uses standard selection-screen for its GUI.
ANS : true.

Use Following Navigations to create LDB.

SLDB (tcode) -> name the Logical Data base (ZLDB19301) -> Click on Create -> opens
an interface , Enter description for LDB ( any ) -> Click on Create -> Save the LDB
under a package -> Opens Another Interface -> Name the Node ( MARA[node name and
table name must be same])
-> Enter Description for the Node -> ASSIGN THE DATA BASE TABLE (MARA) ->
Click on Continue -> Opens LDB editor -> Select the Node -> Click on Selections
pushbutton from Application toolbar to add GUI for the Node -> Prompts a message ,
click on yes to create -> say no to the search help -> click on continue -> Opens LPS
screen with List of Checkboxes -> select all Checkboxes -> click on Transfer -> Open
ABAP editor with Code Generated by SAP. SAP prompts a message as code generated
should be modified by abaper, with * Replace the ? with suitable variable name
* activate GUI statements ( Select-options, parameters )
* Save the Code
* Activate the code
-> COME BACK -> select the Node -> Click on Source Code to add Select statement
code for the node -> Click on yes to Create -> Opens ABAP editor with Two Include files
-> double click on Top Include file , declare an internal table as

DATA : ITAB LIKE MARA OCCURS 0 WITH HEADER LINE.


-> save the data -> activate -> come back ->
click on "NXXX" file to generate code for the Node -> Opens another abap editor with 3
include files -> Double Click on Node Include File -> Replace the select statement as
Follows.
SELECT * FROM MARA INTO ITAB WHERE MATNR IN MATNUM.
PUT MARA.
APPEND ITAB.
ENDSELECT.
LOOP AT ITAB.
WRITE : / ITAB-MATNR , ITAB-MBRSH , ITAB-MTART , ITAB-MEINS.
ENDLOOP.
-> Save the editor -> activate -> come back.
Note : PUT is the statement is used For the Logical database node select statement to add
selected infomation into Node, to be accessed by the Presentation layer. Unless untile
selected inforamtion is added into Node, abaper can't fetch data from LDB.

* use Following Navigations to Use LDB for the programs

* create a program using SE38 -> Enter the Title ( any ) -> set the type of program as
"Executable" -> Name the Logical Data base ( ZLDB19301) -> GENERATE THE CODE
AS FOLLOWS ->

REPORT ZINVOKE_LDB_930.
NODES MARA.
GET MARA.
-> SAVE -> ACTIVATE -> EXECUTE.

Advantage of LDB :
Using this special Programming technique Report effiency is very faster.

MACROS : Definging own statements in ABAP is the Concept of Macros.

SYNTAX OF MACRO.
DEFINE <STMT_NAME>.
ABAP STATEMENTS.
END-OF-DEFINITION.
PROGRAM 1 : ABAP INCLUDE FILE WITH OWN MACROS AS USER DEFINE
STATEMENTS.
DEFINE PRINTF.
WRITE &1.
END-OF-DEFINITION.
DEFINE INCREMENT.
ADD 1 TO &1.
END-OF-DEFINITION.
DEFINE DECREMENT.
SUBTRACT 1 FROM &1.
END-OF-DEFINITION.

PROGRAM 2 : ABAP INVOKING CODE.


REPORT ZINVOKE_LDB_930.

INCLUDE ZINCL_PRG.
DATA : A TYPE I VALUE 100.
PRINTF 'WELECOME TO C STATEMENT IN ABAP'.
INCREMENT A.
INCREMENT A.
INCREMENT A.
INCREMENT A.
PRINTF A.
DECREMENT A.
DECREMENT A.
PRINTF A.

26th APRIL----RUNTIME ANALYSIS

ABAP Runtime Analysis

SE30 : Is the tcode used to Test the Coding efficiency of programs , Transactions or
Function modules.

Use Following navigations to Test a program efficiency.

* The program to be tested must be in active status.


SE30 -> Select the radio button as "program" -> Name the Program to be tested
( ZPRG_RATEST ) -> Click on Execute -> SAP Executes the program and starts the
measurements -> Come back -> Click on "Analyze" pushbutton see the report of
measurements -> By default SAP displays time taken for ABAP code, Data base
Execution Time and Application server process time along with overall time for
executing program in micro seconds -> come back.

SAP QUERY/ ABAP QUERY

SQ01 : Is also One of the tool to generate a report by sap based on Info Sets.
Using this tool SAP Generates a report based on fields selections, while selecting fields
abaper can select fields to be listed in lps and fields list for GUI.

SQ01 -> NAME THE QUERY ( Z930QRY1 ) -> Click on Create -> Opens an interface
with List of Infoset objects -> select the required infoset from the list -> Enter the title
( any ) -> Click on basic List From application toolbar -> Displays the list of tables which
are added to the infoset -> expand the required table -> select the required fields to be
listed in LPS and fields list for GUI ( selection-screen ) -> To test the code -> Click on
"Test" pushbutton from application toolbar -> Opens an interface -> Click on Continue ->
Opens the selection screen GUI -> Click on Execute to the report.

Note : using this tool if the report is created, output type is basic ALV ( GRID
DISPLAY).
This output is similer to REUSE_ALV_GRID_DISPLAY function module output.

Using this tool abaper can't generate Classical Reports , Group Reports , Interactive
reports , Interactive ALV reports and Graphical reports.

Use following Navigations to create InfoSets.


Infoset is the object in SAP as collection of Fields for specified table[s], used by SAP
Query for generating Reports.

SQ02 -> Name the Infoset ( ZIS930 ) -> click on Create -> Opens an interface -> Enter
description in Name field (any) -> Specify table to be assigned for Infoset -> Click on
Continue -> Opens another Interface with list of Fields in the specified table -> select the
required fields to be added in infoset -> save the info set under a package -> come back
-> Click on "generate" from application toolbar to activate the infoset -> When ever
infosets are activated these can be used by "SAP Query" for report generations.

Report - reports Communications can be generated using the statement called as


"SUBMIT".

By default current program output is redirect to specified program output, if we need to


execute the current code of the program use "AND RETURN" option.

example code.

SUBMIT ZPRG_DEMO AND RETURN.


SUBMIT ZPRG_DEMO1.

DB view
Projection Views

Maintenance views : is used to allow DML Operations and also DRL operations on
Multiple tables.

1. CREATE maintenance view -> activate the view -> Click on utilities menu -> table
maintenace generator -> Opens an interface -> set the authorization Group as "ATES" so
every body can access the view code ->Name the Function Group to be created
( ZFGM930 ) -> select maintenance step as "one step" -> Number the screen to be
created ( 654 ) -> Click on Create From Application Toolbar -> Save the Function Group
under a package -> Prompts a message as code generated without any error.

2. Test the code created by SAP using "SE54" tcode.

SE54 -> NAME THE VIEW TO BE TESTED ( ZMV930 ) -> CLICK ON "TEST"
PUSHBUTTON -> OPENS ANOTHE INTERFACE -> CLICK ON MAINTAIN
PUSHBUTTON -> OPENS THE ACTUAL SCREEN GENERATED BY SAP -> CLICK
ON NEW ENTRIES FROM APPLICATION TOOLBAR -> ACCEPT THE DATA ->
SAVE THE ENTIRES -> DATA IS INSERTED INTO SPECIFIED TABLES.

3. CHECK THE DATA FROM SPECIFIED TABLE USING SE16/SE11 TCODES.


Topics to be completed
1. Enhancements (user exits)
2. BADI
3. Lock Objects.
4. Get parameters/ Set parameters

27th MAY ENHANCEMENTS

User exits ( Enhancements ).


If abaper can make changes for the Field Labels on Existing application of SAP is
called
as "Field Exits" or Field Enhancements.

All GUI Screens in abap are created with Lables refering to The Data elements Field
Labels.
if we make any changes to the Fields lables of Data element, these will be reflected in all
screens of SAP.

The data elements created by SAP can't be customized directly , unless until we have
access key.

If ABAPer is making changes for the objects in SAP using "CMOD" tcode, for each
objects sap creates a customer version. The changes which are performed are in Customer
version. Original code of object remains same in SAP data base. If we need to see the
changes then ABAPer has to load SAP with customer versions, else if the sap is loaded
with SAP versions original settings will be added by SAP.

Use Following navigations to make changes for the Field lables using Data elements.

CMOD ( TCODE ) -> NAME THE PROJECT ( ZPR9301) -> CLICK ON CREATE ->
OPENS AN INTERFACE -> ENTER DESCRIPTION ( ANY ) -> SAVE THE OBJECT
UNDER A PACKAGE -> COME BACK -> Click on GOTO menu -> Text
Enhancements -> key words -> Change -> Opens an interface -> name the data element
to be modified ( customized ) ( MATNR ) -> Click on Continue -> opens the label
screen of the data element in change mode -> Change Long Field label ( enter proper
description ) -> save the Entries -> assign with a request Number -> Close the Interface
-> Activate the project.

* Load the SAP Software with Customer version Changes to effect these changes on
Screen.
CMOD -> GOTO menu -> Text Enhancements -> keywords -> Restore Customer
Version -> SET THE RELEASE VERSION AS "620" -> Click on Continue -> Sap
Executes one background job with name as "SAPUSER22:16:54" ( USERNAME WITH
APPLICATION SERVER SYSTEM TIME ) -> Click on Continue.

* Check the status of background job , if the status is finished , see the changes in SAP
applications.

SM36 ( tcode) -> Click on Own Jobs to the status of background job -> By default
display all job status -> Find for the JOB name (SAPUSER22:16:54) -> if the status is
"finished" then see the changes in SAP Applications.

* If we need to reload SAP orginal Screens then

CMOD -> GOTO menu -> Text Enhancements -> Keywords -> Restore SAP Version ->
Set the Release version as ( 620) -> click on Continue -> Sap Executes a background job
, when ever job is finished orginal setting will be added to all SAP applications.

28th MAY User exits and BADIs

User Exits
* Field Customization or Field Exits.
Making Chagens of the Field lables on SAP Applications is called as Field Exits.

* Making Changes for The Function Modules in SAP Using CMOD is called as
Function Exits.
* If we make changes for Existing Applications menu using CMOD is called as Menu
Exits.
* If we make the changes for the Screen Using The CMOD is called as Screen Exits.

As the Customer is making modifications for Fields , Menus , Function modules and
Screen using CMOD these are called customer Exits or User Exits.

Exit is a predefined program in SAP to make customization for SAP Applications.

Use Following Navigations to Find Exits which are predefined in SAP.

CMOD -> Click onUtilities menu -> Select SAP Enhancements -> Opens an Inter to see
the list of Exits used for Customizing SAP Applications -> specify name of Exit ( * ) ->
Set Number of Entries as (2500) -> Click on execute from Application toolbar -> Display
a report with all Exit names in SAP , Based on The Description Provided we can identify
the exit is for type of Application ( This knowledge is known to Function Consultants
who has Technical Experience ) -> Note down Name of Exit from the List ( BG000001:
User Exit for Warrent Check ) -> Come back .
* To customize the Exit Defined by SAP use Following Navigations.

CMOD -> Name the project ( zprj9303) -> Click on Create -> Enter Short Text (any) ->
Save the Project Under a package -> Click on Enhancment Assignments pushbutton from
application toolbar -> Name the Enhancements to be customized ( BG000001 ) -> Click
on Components From Application toolbar -> Opens the List of Function which are
assigned to The user exit -> Double Click on Function Module name -> Opens SE37
editor with Function Module Code , internally Generated with an include file starting
with "Z". As Z programs can be customized in by the ABAPer , double click on program
name -> opens the Source code of the program , make the changes according the
company Requirements -> save -> activate -> come back.

z programs or y progarms in sap are called as "zee" programs in industries.


For the customer defined programs we need to use the name "z" for transportable
objects.
"y" for Local objects.

As the program developed in Developement Environment are transported to Production


systems using the Request number which are assigned to the objects.

BADI's are advanced concepts of User Exits. user exits are used to Customize the
Existing Program with help of Exit names using CMOD.

SE18 AND SE19 ARE the tcodes for BADI creation and Implementations.

CLASSES : IS THE USER DEFINED DATA TYPE IN SAP AS COLLECTION OF


METHODS AND METHOD BODY USING CLASS IMPLEMENTATION.

INTERFACES : IS ALSO A USER DEFINED DATA TYPE WITH ONLY


COLLECTION OF METHODS IN SAP.

Use Following Navigations to create a BADI in the form of Interface.

SE18 -> NAME THE BADI (Z9301BADI) -> CLICK ON CREATE -> ENTER
DESCRIPTION FOR BADI -> SAVE THE OBJECT UNDER A PACKAGE -> CLICK
ON INTERFACE TAB BUTTON -> DOUBEL CLICK ON INTERFACE NAME
GENERATED BY SAP ( ZIF_EX_9301BADI ) -> OPENS SE24 TCODE -> DEFINE A
METHOD FOR INTERFACE -> NAME THE METHOD ( TOUPPER ) -> SET THE
LEVEL AS "Instance Method" -> CLICK ON PARAMETERS PUSHBUTTON ->
DEFINE THE ARGUMENT AS "STR" -> SET THE TYPE AS "Changing" -> SET THE
ASSOCIATED TYPE AS TYPE "C" -> SAVE THE INTERFACE ->ACTIVATE ->
COME BACK.
* Generate the code for the method defined in Inteface using "SE19" tcode.

SE19 -> Name the Implementation ( Z9301BADI ) -> click on Create -> assign the
Definition ( Z9301BADI ) -> click on Continue -> Enter description for Implementation (
any ) -> Click on Interface tab button -> Double click on method name -> Click on Yes
to create the Object -> Save the Object under a package -> Opens the method code
Interface -> Generate the code between method and endmethod as follows
method ZIF_EX_9301BADI~TOUPPER .
TRANSLATE STR TO UPPER CASE.
endmethod.
-> SAVE THE OBJECT -> COME BACK -> ACTIVATE THE Interface.

Use the BADI for SE38 programs as Follows.


REPORT ZPRG_INVOKE_BADI.
data : s1(30) value 'Testing BADI functionality'.
write : s1 color 4.
data : OBJ TYPE REF TO ZIF_EX_9301BADI.
* FOLLOWING STATEMENT ALLOCATES MEMORY * FOR OBJECT WHICH IS
DEFINED
* FOR AN INTERFACE .
CALL METHOD CL_EXITHANDLER=>GET_INSTANCE
CHANGING
INSTANCE = OBJ.
CALL METHOD OBJ->TOUPPER
CHANGING
STR = S1.
WRITE : / 'AFTER BADI METHOD ', S1.

=> : IS THE ACCESS SPECIFIED USED TO SPECIFY METHOD TYPE IS A


CONSTRUCTOR.

* When ever we need to communicate the variable data between different programs we
can use SET PARAMETER ID AND GET PARAMETER ID STATEMENTS.

SET PARAMETER ID STATEMENT SETS A VALUE TO THE MEMORY ID


SPECIFIED IN PROGRAM AT APPLICATION SERVER SERVER SHARED
MEMORY.

SYNTAX:
SET PARAMETER ID <PID> FIELD <VAR>.
GET PARAMETER ID IS USED TO GET THE STORED VALUE FROM SHARED
MEMORY INTO CURRENT PROGRAM.
SYNTAX:
GET PARAMETER ID <PID> FIELD <VAR>.

EXAMPLE CODE.
* FIRST PROGRAM
REPORT ZP1 NO STANDARD PAGE HEADING.
DATA : STR(20) TYPE C VALUE 'SUBBARAO'.
SET PARAMETER ID 'AAA' FIELD STR.
WRITE : STR.

* SECOND PROGRAM.
REPORT ZP2 .
DATA : S1(20).
GET PARAMETER ID 'AAA' FIELD S1.
WRITE : S1.

* In the same program even if values are cleared then data should be retrived.

EXPORT IS THE STATEMENT IN ABAP TO STORE A VARIABLE TO GLOBAL


MEMORY IN THE SAME PRESENTATION LAYER MEMORY TO USE THE VALUE
FOR OTHER SCREENS OR FOR MULTIPLE TIMES IN THE SAME PROGRAM.

IMPORT IS THE STATEMENT USED TO GET THE VALUES FROM MEMORY


STORED USING "EXPORT" STATEMENT.
SYNTAX:
EXPORT <VAR> TO MEMORY ID <MID>.
IMPORT <VAR> FROM MEMORY ID <MID>.

EXAMPLE CODE.
data : str(20) value 'india is great'.
write : str.
EXPORT STR TO MEMORY ID 'AA'.
clear str.
write : / ' CHECK ', str COLOR 6.
IMPORT STR FROM MEMORY ID 'AA'.
WRITE : / STR COLOR 7.

Você também pode gostar