Tuesday, October 30, 2012


Creation of a Logical Database


Go to transaction  'SE36' or 'SLDB'. 
 
Enter the logical database name as shown above . 
  
If we are using Logical Database for HR purpose, we should check the check Box “Info types (HR only). Press CREATE Button as shown above. 
It would prompt for package name and workbench request   .


Working with Table Maintenance Generator


Go to SE11 and enter the Z table name for which the table maintenance generator has to be generated. Click on Change. 
 
Click on Utilities à Table Maintenance Generator
 
 
Enter Authorization group (For e.g. &NC&)
Function group (go to SE80 for creating function group)



Creating a secondary index


There are two types of indexes: Primary index and secondary index. Primary index is automatically created using the primary keys defined. 
Secondary index could be created as per the user requirement. This article discusses about creating a secondary index. 
Go to transaction SE11. 
 
For our demo purpose, we have considered the table ZAUTHOR. 
To know if there are any secondary indexes available, click on Goto à Indexes
 
Following popup appears:

Creating Type Group and using it in the ABAP program

Introduction: This document explains the creation of type group and its use in ABAP program.
What is type group: There are several type groups available in SAP. For example ‘ABAP’ and ’SLIS’ etc. To use them in program we use key word ‘TYPE-POOLS’. It allows us to define non-predefined types. Combination of all such non-predefined types is knows as type-pool or type-group. In simple terms, if we want to use some custom types in various programs then we need not define them separately, we can simply create a type group in ABAP dictionary and use that in our programs.
Steps to create:
Go to transaction SE11; select the radio button ‘Type Group’. Click ‘Create’ button.
  
Note: - Maximum length of type-group name can be ‘5’.  
Provide some meaningful description in short text  

Creating Search Helps (Elementary and Secondary)

Go To SE11 T-code.
 
Select the radio button of search help.
 
Provide the search help name. Select the create button. 
 
Select ELEMENTARY search help.

Creating a Structure in ABAP Dictionary

Go to transaction SE11 and select the radio button “Data type”. Enter a structure name starting with Y or Z. 
Press create button. 
A pop-up screen appears with 3 different options. Select the radio button structure
 The screen will be displayed like this.
Provide the description and also components.
Then press SAVECHECK and ACTIVATE.
Structure Created Successfully.
Creation of Transparent Table

  1. Enter the table name and press Create
  2.  
    1. Enter the description, Delivery class and check on table maintenance allowed. Then click on the tab Fields.
    1. Enter the ZCHAR in fields tab and ZCHAR_DE in field type tab.
    1. Double click on ZCHAR_DE. Then it will ask for Save. Press ‘YES”.

Friday, September 21, 2012

String Operations

CONCATENATE – Combines 2 or more strings into one string.
DATA: s1(10) VALUE 'Hello',
      s2(10) VALUE 'ABAP',
      s3(10) VALUE 'World',
      result1(30),
      result2(30).

CONCATENATE s1 s2 s3 INTO result1.
CONCATENATE s1 s2 s3 INTO result2 SEPARATED BY '-'.

WRITE / result1.
WRITE / result2.
Output
String-Operations-1

Loops

DO – ENDDO – Unconditional Loop
DO can be used to execute a certain lines of codes specific number of times.
DO 5 TIMES.
  WRITE sy-index.  " SY-INDEX (system variable) - Current loop pass
ENDDO.
Output
Loops-1
WHILE ENDWHILE – Conditional Loop
WHILE can be used to execute a certain lines of codes as long as the condition is true.
WHILE sy-index < 3.
  WRITE sy-index.
ENDWHILE.

Control Statements

To control the flow of the ABAP program use the following statements.
IF – Branching Conditionally
IF statement – The code between IF and ENDIF is executed only if the condition is true.
DATA: a TYPE i VALUE 10.  " We can assign a value in the declaration 

IF a > 5.
  WRITE:/ 'Condition True'.
ENDIF.
Output
Control-Statements-1
IF-ELSE statement – The code between IF and ELSE is executed if the condition is true, the code between ELSE and ENDIF is executed if the condition is False.
DATA: a TYPE i VALUE 1.

IF a > 5.
  WRITE:/ 'Condition True'.
ELSE.
  WRITE:/ 'Condition False'.
ENDIF.