Thursday, May 26, 2022

BDC FIELD AND RECORDING DETAILS IN SAP ABAP.

BDCDATA structure is having following 5 fields.

Program

Dynpro

Dynbegin

Fnam

Fval.


There are 2 methods to upload the from legacy system to sap system.

Direct input method

Batch input recording

In each of these methods we are having internally 3 methods.

Call transaction method

Session Method

LSMW (Legacy System Migration Workbench)


Now we see the steps in recording BDC. 


SHDB

Press New Recording

Giving recording name

Give T-code to be recorded

Press start recording

Execute the T-code until save

Save the tabular format generated

Back

Select the recording name

Press program button

Give program (System will generate the program with that name)

Select radio button transfer from recording

Enter

Give Title

Press source code

Give package and save

Enter (You can see the program generated)

Select the program from the line after perform open_group.

Till a line above transaction code and copy

Paste it between loop at endloop in the program which you have written for uploading the data from flat file to internal table. 

Copy the from the include present in the recorded program and paste at the bottom of the program.


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.


EVENTS IN INTERACTIVE REPORTS IN SAP ABAP

EVENTS IN INTERACTIVE REPORTS IN SAP ABAP. 

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

AT LINE-SELECTION

AT USER-COMMAND

TOP-OF-PAGE DURING LINE-SELECTION


AT LINE-SELECTION:- This event is used to generate an interactive list when ever particular in the out is double clicked.

TOP-OF-PAGE DURING LINE-SELECTION:- This event is used to write some thing on top of every page of individual secondary lists. Top-of-page event is used 

 to write something on only basic list.


AT USER-COMMAND:- This is used to handle user action on the screen when ever standard menu bar and application tool are changed.


In these interactive lists we take the help of HIDE table.  Hide is an intermediate memory area which is used to hold the values that are used for generation of next secondary list. Hide statement should be used after write statement. Then only you will get correct results. Other wise you will get wrong values. Hide table values you cant see even in debug mode.


SY-LSIND:- This is also a system variable which gives present processing list number. Its value will be 0 for basic list and 1 to 20 for secondary lists. We will make use of this sy-lsind in our next program to tell the system about which logic should be executed while going to a particular list..


SY-LILLI:- This is a system variable which will hold the clicked line number.


SY-LISEL:-  This is also a system variable which will hold all the contents of  clicked line.


SY-UCOMM:- This system variable is used to hold the function code that is triggered for the user actions on the screen

TYPES OF REPORTS IN SAP ABAP

TYPES OF REPORTS IN SAP ABAP. 

There are three types of reports.

Classical Reports

Interactive Reports

Drill down Reports


CLASSICAL REPORT:-  A report which can generate only one list, that is Basic List,  is called classical report. First List of a report is called BASIC LIST.


INTERACTIVE REPORT:-  A report which can generate one basic list and upto 20 interactive lists is called an interactive report. First list is called Basic List and Interactive lists are called Secondary Lists.


DRILL DOWN REPORTS:- In these reports the output will be in tree format.


INTERNAL TABLES In SAP ABAP

INTERNAL TABLES In SAP ABAP. 

Internal table is an intermediate table. It can hold multiple records at a time. It is a temporary table. The memory for the internal table will be allocated at runtime and de allocated after the execution of the program automatically by the system. The changes that made to the records of internal table are temporary. The changes are not reflected in data base until some DML commands are written. Hence original data is retained in data base. There are three types of internal tables.


Standard Internal Tables

Sorted Internal Tables

Hashed Internal Tables.

There two ways to declare the Internal tables.

Internal Tables with Header line.

Internal tables without Header line.

TYPES OF TABLES IN SAP ABAP.

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.


SE11 T-Code is used to create  data base objects which includes tables.


A table can be client dependent or client independent. Table data only client dependent or client independent, but table structure is client independent.


CLIENT:- Client is SAP specific which contains its own master data and its own set of  records. All SE38 programs are client independent programs. That means if a program is written in one client it can be seen all the clients present in the system.

To see all the clients present in a system T-code is SCC4.


If first field of the table is MANDT the table becomes client dependent table, otherwise it becomes client independent table. If the table is client dependent table the data that you enter in one client can not be seen in other clients. If the table is client independent table the data that is entered in one client can be seen all other clients. That means if the table is client independent all table in all clients contain same data.

Every table should have at least one primary key or foreign key. All primary key fields and foreign key fields of a table should be declared first.


Every table field should have DATA ELEMENT and DOMAIN. 


DATA ELEMENT:-  It gives semantic attributes of table field.

Eg:- Short description of table field.


DOMAIN:-   It gives technical attributes of the table fields. Domain is the more reusable component than data element.

Eg:- Type of data it is going to hold.

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.

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.

SYSTEM VARIABLES IN SAP. 

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.


Thursday, May 12, 2022

Details About Smart forms in SAP ABAP

Details About Smart forms in SAP ABAP

Smart forms are used to design the business documents such as purchase order, sales order, 

invoice, Performa etc.

Smart forms are introduced from 4.6c version onwards. It also supports output mode as ‗EMAIL‘.

Components of Smart forms:

1. Smart form layout.

2. Function module.

3. Print layout.

Components of the smart forms layout:

1. Global settings.

2. Pages and windows.

Components of Global settings:

1. Form attributes

2. Form interface

3. Global definition

Form attributes:

Form attributes contain header information i.e.

Form name

Language 

Page format 

Created by…………..

Form interface: this is used to declare the variables, work area and internal tables which we need to 

transfer the data from print program to layout.

Global definition: this is used to declare the variables, work-area and internal table which are used to 

implement the logic in the layout.

PAGES: page is the physical area where we place the window. We can‘t print the text in the page.

WINDOWS: we can place the same window in ‗n‘ number of pages but we can‘t print the data directly 

on the window.

Procedure of Smart Form:

1. Based on the client requirement we design the smart form layout by using SMARTFORMS t-

code.

2. After activating the smart form it generates a function module.

3. Based on the function module we develop the print program.

NOTE: Printing the data on the page window is always through symbols.

There are four types of symbols.

1. Program symbols

2. System symbols

3. Standard symbols

4. Text symbols.

Each symbol starts with ‗&‘ ends with ‗&‘.

Details About Function Module And Subroutine in SAP.

 1.Attributes:-

Attributes specify the type of the function module, normal or remote. 

We can access the normal function module with in the server only, where as we 

can access remote function modules with in the server as well as outside the server 

also.

2. Import acts like using in the subroutine.

3. Export acts like changing the subroutine.

4. Changing acts like both import & export.

5. Tables acts like both import & export only for internal tables.

6. Exception use to handle the errors.

7. Source code – the logic related to function module.

Differences between function module & subroutine:-

 Function module Subroutine 

1. Function modules are global, i.e., 

we can access the function module 

with in the server as well as outside 

the server also.

2. We can test the function module 

independently.

3. We can handle the errors in 

function module.

4. Function modules are defined by 

using SE37 transaction code.

1. Subroutines are local, i.e., we can 

access the subroutine with in the 

server only.

2. We can‘t test the subroutine 

independently without calling the 

subroutine.

3. We can‘t handle the errors in 

subroutine.

4. Subroutines are defined by using 

SE38 transaction code.

Steps to create function module:-

 Execute SE37.

 Provide your function module name.

 Create.

 Provide function group name & short description.

 Save.

Note:-

Function modules return single values, multiple single value

How to create Function Group in SAP

 Steps to create Function group:-

 Execute SE37.

 In the menu bar – goto – function groups – create group.

 Provide your function group name.

 Provide short description.

 Save – local object.

Steps to activate the function group:-

 Execute SE37.

 In the menu bar – environment – inactive objects.

 Expand your function group.

 Select your function group.

 Click on activate (in ECC 6.0 – select function group – right click – activate).

Components of the function module:-

1. Attributes.

2. Import.

3. Export.

4. Changing.

5. Tables.

6. Exception.

7. Source code.

Differences between Macros & Subroutines in SAP

Differences between Macros & Subroutines:-

 Macros Subroutines

1. In macro definition should be the 

first & the calling should be the next. 

2. The definition of the macro as 

well as the calling of the macro in 

the same program.

3. Macros can take up to 9 place 

holders. 

4. We can place any executable 

statements after the definition of the 

macro.

5. Macros are used in HR ABAP.

1. In subroutine calling should be the 

first & definition should be the next.

2. The definition of the subroutine as 

well as the calling of the subroutine 

may or may not be in the same 

program.

3. Subroutines can take any number 

of place holders.

4. We can‘t place any executable 

statements after the definition of the 

macro.

5. Subroutines are used in both 

ABAP & HR ABAP.

Global data:-

 Subroutines can access the global declarations in which they are 

defined.

When ever the changes occurred in the subroutine those changes will be reflected 

to global declarations. 

Note:-

LOCAL is the keyword to avoid the changes in subroutines.Differences between Macros & Subroutines:-

 Macros Subroutines

1. In macro definition should be the

first & the calling should be the next.

2. The definition of the macro as

well as the calling of the macro in

the same program.

3. Macros can take up to 9 place

holders.

4. We can place any executable

statements after the definition of the

macro.

5. Macros are used in HR ABAP.

1. In subroutine calling should be the

first & definition should be the next.

2. The definition of the subroutine as

well as the calling of the subroutine

may or may not be in the same

program.

3. Subroutines can take any number

of place holders.

4. We can‘t place any executable

statements after the definition of the

macro.

5. Subroutines are used in both

ABAP & HR ABAP.

Global data:-

 Subroutines can access the global declarations in which they are

defined.

When ever the changes occurred in the subroutine those changes will be reflected

to global declarations.

Note:-

LOCAL is the keyword to avoid the changes in subroutines.