Wednesday, November 18, 2020

What is Parallel Cursor in SAP ABAP ? How to increase Performance using Parallel Cursor?

 Parallel Cursor Algorith- Parallel cursor is a technique to increase performance of ABAP Programs .

Suppose in Any program you have to use nested loop i.e loop inside loop , and if we use nested loop in  ABAP report it will take lot of time .So to avoid that we use Parallel Cursor .

Verdict: Use the parallel cursor method whenever there is a need to process data in a nested loop.

In Parallel cursor we avoid where clause and set sy-tabix instead of where clause .

Program Without Parallel Cursor Algorithm .

LOOP AT IT_MARA INTO WA_MARA.

  LOOP AT IT_MVKE INTO WA_MVKE WHERE MATNR = WA_MARA-MATNR.

    WRITE:/ WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MATKL, WA_MVKE-VKORG, WA_MVKE-VTWEG.

  ENDLOOP.

ENDLOOP.

Program With Parallel Cursor Algorithm .

DATA V_INDEX TYPE SY-TABIX.

LOOP AT IT_MARA INTO WA_MARA.

  READ TABLE IT_MVKE INTO WA_MVKE WITH KEY MATNR = WA_MARA-MATNR BINARY SEARCH.

  IF SY-SUBRC = 0.

    V_INDEX = SY-TABIX.

    LOOP AT IT_MVKE INTO WA_MVKE FROM V_INDEX. "Avoiding Where Clause

      IF WA_MVKE-MATNR <> WA_MARA-MATNR.

        EXIT.

      ENDIF.

      WRITE:/ WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MATKL, WA_MVKE-VKORG, WA_MVKE-VTWEG.

    ENDLOOP.

  ENDIF.

  CLEAR: WA_MARA, WA_MVKE.

ENDLOOP.



What is Logical Database (LDB) in SAP ABAP HR ? How it is advantageous over normal report ?

 1. LBD is a hierarchical structured table that retrieves several tables collectively and brings them and stores them in RAM to filter the selected output.


2. The T-code is SE36.

3. The three main concepts involved in LDB are :

a )Selection screen


b )Authorization check


c )Fetching up of data.


Advantage of Logical databases:


1-Less coding s required to retrieve data compared to normal internal tables.


2-Tables used LDB are in hierarchical structure.


Types of LDBs

PNP

PNP is a logical database in SAP ABAP HR which is mainly used for administering human resources, time management of human resources and payroll processes.


PNPCE

This is a customized version of PNP which handles the payroll, time management and administration of human resources with concurrent employment functions.


PCH

This SAP ABAP HR logical database handles data pertaining to organizational management, event management, and training & personality development duties of an organization.


PAP

This is a logical database in SAP ABAP HR which is dedicated to the recruitment process of human resources.

Sample structure of basic ABAP-HR report program


REPORT zreport.


INFOTYPES: 0001.       “This is the info type declaration area


TABLES: pernr.         “Key fields for Personnel Admin infotypes


START-OF-SELECTION.



GET PERNR.             “Get PERNR gets all data related to a PERNR


PROVIDE * FROM P0001 BETWEEN PN-BEGDA AND PN-ENDDA.


WRITE:/ P0001-PERNR,


        P0001-STELL,


        P0001-BEGDA.


ENDPROVIDE.


Infotypes are basically used to group related together. They provide information and store data for specific time periods. In the above sample program the INFOTYPE statement declares an internal table which is populated at the GET PERNR event.


For example if we have


INFOTYPE: 0001.


This instruction creates an internal table with structure p0001 and which is filled at the GET PERNR event. We also add MODE N to this instruction.


INFOTYPE: 0001 MODE N.


The addition of MODE N restricts data from filling into the internal table at GET PERNR.


GET PERNR statement is basically an event which triggers the data read operation into respective infotypes which have declared by using the INFOTYPES statement for each PERNR (Personnel Number) that satisfies the selection criteria.


Tuesday, November 17, 2020

Type and Like in SAP ABAP

 TYPE : It will allocate memory during execution (object type).

       TYPE will improve performance.
       It is used when userdefined object link with SAP system data type.
       TYPE refers to the user defined data types
       TYPE,assign datatype directly to the data object while declaring.
     
LIKE :  Tt will allocate memory immediatly.
        It is when data object link with the other data object.
        LIKE refers to existing data type of data object
        LIKE,you assign the datatype of another object to the declaring data object. The datatype is referenced indirectly.

DATA : name TYPE char10. (Here the variable ‘name’ takes the property or character length 10 ).
DATA : myname LIKE name (myname refers to the property of name and thus gets assigned with character length 10).
Note: char10 here is data type not data object.

Wednesday, November 11, 2020

Parallel Processing in Workflow

 Q-What is Parallel Processing in Workflow?

A-Suppose you want to do two activity at same time parallely ,so for this we use 'FORK' step in Workflow .Exmple Sending mail to Employee and Manager at same time ,for that we use Parallel Processing .

LUW and SAP LUW

 Q-What is LUW ? What is the use of it ? What is SAP LUW?

A-A “LUW” (logical unit of work) is the span of time during which any database updates must be performed Either they are all performed ( committed ) , or  they are all thrown away ( rolled back ).

It can be 5 sec or 3 sec .

Database LUW and SAP LUW - 

1- SAP LUW > Database LUW .

2- DB LUW is small it do small changes ,but to bundle all changes we use SAP LUW .

3- Suppose in Module pool screen three screen involves and my requirement is to update all the tables when data is consistent in all three screen ,otherwise roll back all the changes done to the table .

So To achieve this we use SAP LUW .

We can achive this using CALL FUNCTION… IN UPDATE TASK statement .

COMMIT-WORK Statement

 Q-What is COMMIT-WORK Statement ? Why it is used ? What if we don't Use it?

A- COMMIT-WORK statement is used to updated the database base changes .Suppose you write 

statement without commit statement like 

modify ZTEST FROM WA_TEST .

Here in this statement ZTEST table will get modify implicity .Means SAP Update the table but it is not visible to user .

But if we write 

modify ZTEST FROM WA_TEST .

COMMIT-WORK .

Here we are explicity defining to update the database table .

So if in nut shell ,if we want to perform series of changes like after one table update second table must update otherwise no table should get update ,we use COMMIT-WORK Statement .


Tuesday, November 10, 2020

CDS View in SAP ABAP ON HANA

 Q1-What is CDS Views? Why SAP Introduced CDS View ? What is the advantage of CDS Views over SE11 View ?

A-  Se11 Views-

1-It can be created from SAPGUI or Eclipse.
2. Calculated column are not possible.
3. Input Parameters are not possible.
4. Only Join is possible.
5. Grouping and aggregation are not possible.
6. Annotations are not possible.Annotations is used by UI5 Person in Front End .

CDS View 

. 1-It can only be created from Eclipse platform only.
2. Calculated columns are possible.

3-Following Functions are possible
A. Operator Function possible .
B. CDS Function possible
C. CASE Expression

D. Aggregated Functions

3. Input parameter is allowed and can be used  in calculated Columns
 4-Filtering Allowed .
4. Join and Union both are possible.
5. Grouping and aggregation are possible.
6. Annotation can be used to provide more metadata information to individual fields and Views.

So that's why SAP Introduced CDS Views.

In CDS Views

We are creating models in application layer (ECLIPSE) and it is going to create same in DB layer. Its like, we are using door of application layer to create objects/models in HANA DB.

Monday, November 9, 2020

Interface in SAP OO ABAP

 Q-What is  Interface?

A-An interface is not a class. It is an entity which can’t have implementation. In Interface we only declare method and in the implementating class we implement it .An interface can only contain empty method declaration and components .Interface methods are by default public ,but we can change the visibility in Implmentating class using ALIASES .Interface always statrs with 'IF' we want to create custom interface we use ZIF .

Ex-Here I am using Interface ZIF_EMP .We can create interface using Tcode SE24 .

Now to use interface methods GET_NAME,GET_EMIL we have to create implementing class in SE24 ,and then we can inherit methods in Implementing class ,here in my case it is 
ZCL_IF_DET2 .











Sunday, November 8, 2020

Visibility in SAP OO ABAP in Simple words

 Q-What is Visibility in OO ABAP?

A-

VISIBLITY SECTIONS:



1. PUBLIC SECTION:
The Components declared in Public are accessed within the class,Child class and also outside of class .

2. PROTECTED CLASS:
The Components declared in Public are accessed within the class,Child class and but not outside of class .

3. PRIVATE SECTION:
The Components declared in Public are accessed within the class only,not on Child class and not to outside of class .

Landscapes in SAP

 Q-What is Landscapes in SAP ?

A-Lanscapes are different instance of Server .

Example- Development Lanscapre call it as DET

Quality Lanscape call it as QET

Production Landscape call it as PET .

When we move any Transport Request it move though three Landscapes-

Development-->Quality-->Production

Procure to PAY Cycle

  SAP Tcodes in Procure to Pay ( P2P ): In the Procure-to-Pay (P2P) process in SAP ECC several transaction codes (T-codes) are commonly used...