Monday, April 25, 2022

SOME IMPORTANT STANDARD TABLES IN SAP

 SOME IMPORTANT STANDARD TABLES IN SAP


1. MARA MATERIAL MASTER TABLE

2. MARC MATERIAL PLANT

3. MAKT MATERIAL DESCRIPTION

4. MARD MATERIAL STORAGE LOCATION

5. KNA1 CUSTOMER MASTER TABLE

6. LFA1 VENDOR MASTER TABLE

7. EKKO PURCHASE ORDER HEADER

8.  EKPO PURCHASE ORDER ITEM

9.  VBAK SALES ORDER HEADER

10. VBAP SALES ORDER ITEM

11. VBRK BILLING DOCUMENT HEADER

12. VBRP BILLING DOCUMENT ITEM

13. LIKP DELIVERY HEADER

14. LIPS DELIVERY ITEM

CONTROL STATEMENTS IN SAP ABAP

 CONTROL STATEMENTS IN SAP ABAP. 

Control statements are nothing but loops. The property of the loop is to rotate by it self until loop is terminated. There are 4 types of control statements in SAP. They are

DO.

..

..

ENDDO.


DO N  TIMES.

..

..

ENDDO.


WHILE  <CONDITION>.

..

..

ENDWHILE.


CASE  <VARIABLE>.

WHEN <VALUE1>.

 ..

 ..

WHEN <VALUE2>.

 ..


WHEN OTHERS.

 ..


ENDCASE.


Exit statement is used to terminate the loop. SY-INDEX is a system variable which gives present loop iteration number. These both things we use in coming program to see how they act in the loop.

SYSTEM VARIABLES IN SAP ABAP

SYSTEM VARIABLES IN SAP ABAP. 


1. sy-datum   --      Date

2. sy-uzeit     --      Time

3. sy-mandt   --      Logon client number

4. sy-uname   --      Logon user name

5. sy-repid     --       Report program name

6. sy-cprog    --       Current program name

7. sy-dynnr    --       Screen number

8. sy-tcode     --       Transaction code

9. sy-pagno     --       Page number

Sample program with these system variable is.


*&---------------------------------------------------------------------*

*& Report  ZSAMPLE                                                     *

*&                                                                     *

*&---------------------------------------------------------------------*

*&                                                                     *

*& SYSTEM VARIABLES                                                    *

*&---------------------------------------------------------------------*


REPORT  ZSAMPLE                                  .

write / sy-datum.

write / sy-uzeit.

write / sy-uname.

write / sy-repid.

write / sy-cprog.

write / sy-mandt.

write / sy-dynnr.

write / sy-pagno.

Write / sy-tcode.

MODULARIZATION IN SAP ABAP

 MODULARIZATION IN SAP ABAP. 


It is a technique of  splitting larger code into smaller block of code. It is done for easy understanding, easy debugging and to decrease the code. We can achieve this in SAP using 4 concepts.

Events

Subroutines

Include programs

Function modules


SMART FORMS IN SAP ABAP

 SMART FORMS IN SAP ABAP. 

It is enhanced version to SAP scripts. Transaction code is smartforms.


First we discuss about the differences scripts and smart forms.


Scripts are client dependent but smart forms are client independent.

Scripts are not self executable i.e. print program is compulsory, but smart forms are self executable. On executing the smart form system generates function module.

We can not write the logic in scripts but we can write the logic in smart forms.

Main window is compulsory in scripts but it is optional in smart forms.

Background logo is not possible in scripts but it is possible in smart forms.

There are character and paragraph formats in scripts but there are no character and  paragraph formats in smart forms

Labels are present in scripts but no labels in smart forms.


When ever you enter into smartforms under global settings you get three things.

Form attributes

Form interface

Global definitions

FORM ATTRIBUTES:-  It gives the history and technical attributes of smart form


FORM INTERFACE: - The variables that are needed to be populated at run time should be declared here.


GLOBAL DEFINITIONS:-  The variables that are needed in the smart form should be declared here. 

  


Now we discuss about the steps in creation of smart forms.


T-code smartforms

Press create button

To create logo window right click o page create( Graphic

Give the logo name

The variables that are needed to be populated at run time should be declared under form interface

The variables that are needed to be populated at run time should be declared under Global definitions.

To write the select query or logic select the window right click create( flow logic ( program lines

It is mandatory to give input parameters and output parameters

To write loop select the code Right click create( flow logic -( loop

To write the output select  loop Right click Create ( Text

Check for errors

Activate and Execute

Function module will be generated. Execute it

Give printer name LP01 (Default Printer)

Press print preview to see output

Saturday, April 23, 2022

What is ENHANCEMENTS in SAP.

 ENHANCEMENTS in SAP ABAP. 

These are used to add extra intelligence to SAP standard programs to suit the business requirements. If we want to add extra code to SAP standard programs, if we go for change mode system asks for access key. Instead of this, SAP has provided hooks where we can write the code. These hooks are enhancement spots. If a code is written in theses spots along with the normal program the code written in these spots is also executed. There are two ways to enhance the SAP standard code.

User Exits

BADIS (Business Addins)


If user exits are used one time in any project it can not be reused. But Badis can 

be used any no of times.



There are 4 types user exits.

Function module exit

Field exit

screen exit

Menu exit


Exits are defined at package level. So we want to enhance any T-code first we 

have to find out the package for that T-code. Then we have to find out the exits present in that package. For finding the exits present in a package we have to use SMOD T-code. After finding the suitable exit for writing the code we have to use CMOD T-code.


USER EXITS I N SAP ABAP.

USER EXITS IN SAP ABAP. 

There are four types of USER EXITS

Function Module exits

Screen exits

Menu exits

Fields exits


Function Module exits:

In this we will use FUNCTION MODULE, to enhance, SAP standard program.

Screen exits:

They are used to add extra FIELDS in SAP standard screens.

Menu exits:

It is used to add extra MENU ITEMS to SAP standard screens.


Field exits:

It is used to add extra VALIDATIONS to SAP standard screen fields

STEPS IN CREATION OF STANDARD TEXT IN SAP.

STEPS IN CREATION OF STANDARD TEXT IN SAP. 


T-code SO10

Give name and press create

Give the text

Press save


STES IN INSERTING THE STANDARD TEXT IN FOR WINDOW


Go to Se71. 

Open form in change mode

Select the window where standard text is needed to be inserted

Press Text elements button

Insert( text( standard

Give text name

Press enter


System adds this code in the editor

How to upload a logo in SAP.

STEPS IN UPLOADING LOGO INTO SAP. 

Prepare a Bitmap Image

T-Code SE78

Expand graphics

Double click BMP.

Press import button

Give the path where image is present in you system

Give name to logo

Give description

Specify color image or Black and white image

Press enter


The image will be uploaded into SAP with the name you have given in 7th step.

If the image is of  .TIF format we have to run the standard program RSTXLDMC to upload the image into SAP. The image will be stored on document server. All the images will be stored in STXBITMAPS table.


Now my requirement is to insert the logo in one of the windows of the form that I have designed .


TYPES OF TABLES IN SAP ABA

TYPES OF TABLES IN SAP ABAP. 


There are three types of tables.

1. Transparent Tables

2. Clustered Tables

3. Pooled Tables.


TRANSPARENT TABLES:-  For every table created in Data dictionary (DDIC) there will be table created in database with same name, same no of fields, fields having same names and the order of the fields will be same. That means for every same replica of table or mirror image will be created in Data base. That means it is having one to one relation. By default every table created will be Transparent Table.


CLUSTERED TABLES:- Many tables created in DDIC are stored in single table in data base called table cluster. That means it is having many to one relation. All the tables present in table cluster will have primary key in common.


POOLED TABLES:- In  case also many tables created in DDIC are stored in single table in database called table pool. Hence it also  having many to one relation. Here the tables present in table pool many have primary key in common.

TYPES OF DATA IN SAP

 TYPES OF DATA IN SAP


There are three types of data in SAP.


Customized data

Master data

Transactional data.


CUSTOMIZED DATA:-  The data which never changes is called Customised data. This data is not created  but configured by functional consultant using SPRO tranction.


MASTER DATA: The data which changes very rarely is called Master data.


TRANSACTIONAL DATA:-  The data which changes very frequently is called Transactional data.

Friday, April 22, 2022

EVENTS IN MODULE POOL PROGRAM IN SAP ABAP.

EVENTS IN MODULE POOL PROGRAM IN SAP ABAP. 


Process before output (PBO)

Process after input (PAI)

Process on value-request (POV)

Process on help-request (POH)


PROCESS BEFORE OUTPUT:-  This event is triggered before the screen is displayed. This event is used to assign some default values to screen fields. With those values the field will be displayed.


PROCESS AFTER INPUT:-  This event is triggered after giving input to the screen fields. This is used to handle user action actions on the screen.


PROCESS ON VALUE-REQUEST:- This is used to give F4 help to screen fields.


PROCESS ON HELP-REQUEST:- This is used to give F1 help to screen fields.


The in the module pool program should be written between module and endmodule.


AT EXIT-COMMAND:- It is used to go to the leave the screen or process some logic even though some of the mandatory fields of a screen not filled.


SY-UCOMM:- It is a system variable used to catch the  function code that is triggered for user actions on the screen.


OK_CODE:- It is used as substitute for sy-ucomm.


DIFFERENCES BETWEEN AT NEW AND ON CHANGE IN SAP ABAP.

DIFFERENCES BETWEEN AT NEW  AND ON CHANGE OF IN SAP ABAP. 


At new should be used inside the loop, but on change of can be used outside the loop also.

At new takes only one field, but on change of can take multiple fields.

Let us assume that an internal table is having f1, f2, f3 , f4 and f5 fields and if  at new is applied on f3 field it will be triggered for every change in f1, f2 and f3 fields, but on change of will be triggered for only changes in f3.

DIFFERENCES BETWEEN AT NEW AND AT END OF IN SAP ABAP.

DIFFERENCES BETWEEN AT NEW <FIELD> AND AT END OF <FIELD>.


Both are used to find out subtotals but the difference is point of triggering.


At new is triggered at the starting of new record, but at last is triggered at the end of the record.

At new checks previous record, but at last checks next record.

Pre-requisites for using Control break statements


Pre-requisites for using Control break statements in sap. 

Pre-requisites for using Control break statements Control break statements should be used in side the loop but on change of can be used outside the loop. Before using the control break statement the internal table should be sorted by the field on which control break statement is going to be used.

 

AT FIRST:- This is triggered at the first record of the internal table. This is triggered only once. It is usually used to write the heading to columns while displaying the records of internal table.


AT LAST:- This is also triggered only once at the last record of the internal table. This is used to find out grand totals of numeric values.


AT NEW <FIELD>:- This is triggered at the starting of every new record based on a particular field. It is used to calculate sub totals.


AT END OF <FIELD>:- This is triggered at the end of every new record based on a particular field. It is also used to find out sub totals.

SUBROUTINES IN SAP ABAP

SUBROUTINES IN SAP. How we used in SAP. Details About SUBROUTINES IN SAP ABAP. 



When ever same logic is needed to be executed many times in a program, create a subroutine and call the subroutine when ever the logic is needed to be executed.

Perform statement is used to create the subroutine and to call the subroutine. 

A subroutine can be created with passing the variables and without passing the variables. The logic of the subroutine is written between form and endform. It is not required to start the subroutine name with Z OR Y.

The variables that are passed into subroutine are called global variables or actual variables. The variables that are used to receive the values in subroutine from main program are called local variables or formal variables.

There are 3 ways to pass the variables into subroutine.


CALL BY VALUE

CALL BY REFERENCE

CALL BY VALUE AND RESULT


CALL BY VALUE:- In this new memory area is allocated for the local variables between form and endform. When the values of local variables are changed , they are changed in only or reflected in only newly created memory area. The original values of corresponding global variables are not changed. 


CALL BY REFERENCE:- In this no new memory area is created for the local variables between form and endform. They make use of memory of the corresponding global variables. Hence when the values of local variables are changed between form and endform immediately the corresponding global variables values are changed.


CALL BY VALUE AND RESULT:-  In this new memory area is created for local variables. When ever the values of local variables are changed between form and endform, the changes are reflected in only newly created memory area. But when the control is moving back from subroutine to main program, the values present in local memory are copied back to the corresponding global variables memory area.


Hence we can say that in CALL BY VALUE the values of global variables are never changed when corresponding local variables values are changed, in CALL BY REFERENCE the values of global variables are changed immediately. In CALL BY VALUE AND RESULT the values of corresponding global variables are changed control moves from subroutine to main program.  

EVENTS IN CLASSICAL REPORTS IN SAP ABAP

 


EVENTS IN CLASSICAL REPORTS


INITIALIZATION

AT SELECTION-SCREEN

AT SELECTION-SCREEN ON <FIELD>

AT SELECTION-SCREEN OUTPUT

AT SELECTION-SCREEN ON VALUE-REQUEST FOR <FIELD>

START-OF-SELECTION

TOP-OF-PAGE

END-OF-PAGE

END-OF-SELECTION


Now we discuss what are the uses of these events.


INITIALIZATION:- This is the first event to be triggered. This event is triggered before the selection-screen is displayed. This event is used to give default vales to selection-screen fields.


AT SELECTION-SCREEN:-  This event is triggered after giving input in selection-screen fields. This event is used to handle the user actions on the screen. This is also used to validate all the selection-screen fields.


AT SELECTION-SCREEN ON <FIELD>:- This is used to validate a particular field present on the selection-screen.


AT SELECTION-SCREEN OUTPUT:- This is used to change the selection-screen properties dynamically.


AT SELECTION-SCREEN ON VALUE-REQUEST FOR <FIELD>:- This  is used to give F4 help to a particular field resent on the selection-screen.


START-OF-SELECTION:-  Main logic of the program is written in this event. Usually write statement is recognized from this event.


TOP-OF-PAGE:- This is used to write something on top of every page. The first write statement or output statement (SKIP) of a page triggers this event.


END-OF-PAGE: -  This event is used to write something at end of every page. Last line of the page triggers this event. We have to allocate the line for end of page.


END-OF-SELECTION:- Usually program output is written in this event. This event is used to handle abnormal termination of the program. The stop statement written in start-of-selection event takes the control to end-of-selection event. 

Thursday, January 27, 2022

When do we go for call transaction method and when do we go for session method in SAP ABAP?


Call Transaction:

The Call transaction is used if you need the generated document number to be returned to the program. It is often used if you need to do some additional processing after your document is generated. It is usually a small data set because if you have large data, you might have a time out error.

Sessions Method:

Sessions are used when you are unsure when you will run the BDC... you could schedule it during the night.This is used when you are working with large numbers of transactions.

DMR mass creation BAPI Name.

 Which BAPI do they use for DMR mass creation?

 
BAPI Name: BAPI_BUSPROCESSND_CREATEMULTI
 
 

Which modules are used in BDC.

 

Which modules are used in BDC?

1.BDC_Open_group.

2.BDC_Insert.

3.BDC_Close_group

These three modules are primarily used in successfully transferring data in sequence using BDC.