Monday, September 21, 2020

Details about Internal Table in SAP ABAP.

Details about Internal Table in SAP ABAP.



Internal Table:

Ø Internal table is a temporary table created in RAM in Application Server

Ø It is created & filled with data during run time (execution time)

Ø Once execution is performed it is rolled out (or) discarded

 

Note:

Use Internal table for storing multiple records during run time

 

Difference between Database table & Internal table:

                   Database Table                                          Internal Table

1.     It is created in Database Server ------- 1. It is created in Application Server

2.     It holds data permanently                   ------- 2. It holds data temporarily

3.     It holds only specific type of data ----- 3. It holds data of different tables of at one place

 

Que: What is exact purpose of Internal table. Do you think should be created in ABAP

         programming?

Ans: In real time we are creating Internal table for storing different types of application data

         from different tables at one place

 

Every Internal table is having 2 parts

They are:

1.     Internal Table Body

2.     Header Line

 

1. Internal Table Body:

The name Internal table itself specifies body of Internal table & it holds multiple records

 

2. Header Line:

It is a default Work Area & holds single record

 

Note:

Header Line is system defined Work Area & Work Area is user defined Header Line

 

Syntax:

DATA:  BEGIN    OF   it_kna1   OCCURS   0,

              customer(20)    TYPE   C,

              name(20)          TYPE   C,

              city(20)            TYPE   C,

              END       OF    it_kna1.


 

Note:

1.     With above syntax an Internal table it_kna1 is crated in Application Server

2.     You can provide any name. But in real time Internal table should always begins with it_ (or) i_ followed by table name

3.     With BEGIN option Header Line is created & OCCURS option Body is created

4.     0, 1, 2, 3, …..9 is called Size Category

5.     Both Header Line & Body name is same (it_kna1)

 

Flow of Data in Internal Table:

1.     Database Table ----à Body---à Header Line--à Virtual Page ---à Presentation Server

2.     Database Table ---à Body---à Presentation Server

VOFM ROUTINE IN SAP ABAP.

 VOFM ROUTINE.



VOFM ROUTINE EXAMPLE IN SAP ABAP.

You always have to activate a new routine before using it. Each routine for requirements and formulas, copying requirements and data transfers is stored in a separate program. For each new routine an entry is added in table TFRM and TFRMT. For each routine, a long text can be stored as a text module.

Standard program required to run VOFM routine RV80HGEN

Standard program to activate in case of any error in VOFM routines RV80GHEN

And also apply OSS notes   : 598475.

Then go to edit- Then activate and deactivate subroutine

Maintenance obq3 m/08 ad v/08

 

4. Enhancements to make text edit or non-edit mode business requirements to add and include the enhancements to

Standard include LV70TFT3 and do enhancements 

    BREAK ROH.
    
IF SY-UNAME 'ROHAND SY-TCODE 'VL02N' OR SY-TCODE 'VL03N'.
  
CALL METHOD GV_TEXT_EDITOR->SET_READONLY_MODE
  
EXPORTING
    READONLY_MODE 
GV_TEXT_EDITOR->FALSE


    
EXCEPTIONS
              ERROR_CNTL_CALL_METHOD 
1
              INVALID_PARAMETER      
2
              
OTHERS                 3.


   
ENDIF.

 

LV61AA55 this in include we can enhancement pricing routines va01

ENHANCEMENT 1  ZSD_PRICING_ENHAMENTS1.    "active version
BREAK rohinik
.
  
data lv_flag1 type c.
DATAlv_kwert like xkomv-kwert,
      lv_value 
like xkomv-kwert.
  
LOOP AT XKOMV WHERE kschl 'PR00'.
     
IF SY-subrc 0.
      lv_kwert 
Xkomv-KWERT / 10.
    
ENDIF.
  
ENDLOOP.
  
LOOP AT XKOMV WHERE kschl 'ZNOY'.
    
IF SY-subrc 0.
      lv_value 
= ( XKOMV-kbetr / 100 * lv_kwert.
      Xkomv
-kwert lv_value.
    
MODIFY XKOMV transporting kwert.

        DATA lv_flag1 TYPE C.
        
DATAlv_kwert LIKE xkomv-kwert,
              lv_value 
LIKE xkomv-kwert.
        
LOOP AT XKOMV WHERE kschl 'PR00'.
          
IF SY-subrc 0.
            lv_kwert 
Xkomv-KWERT / 10.
          
ENDIF.
        
ENDLOOP.
        
LOOP AT XKOMV WHERE kschl 'ZNOY'.
          
IF SY-subrc 0.
            lv_value 
= ( XKOMV-kbetr / 10 * lv_kwert.
            Xkomv
-kwert lv_value.
            
MODIFY XKOMV TRANSPORTING kwert.
 



         ENDIF.
        
ENDLOOP.


    
ENDIF.
  
ENDLOOP.

I done enhancements to include programs LV61AA55 to get accurate values as per the request

VOFM Routine is very important with help of you can create your condition

exit NAME: LV69AF40 Put this code for getting data

 break ROH.

 data lv_value1 LIKE xkomv-kwert.
 
import lv_value1 from MEMORY id 'ZKWERT'.
    
LOOP AT XKOMV WHERE kschl 'BASB'.
    
IF SY-subrc 0.
    Xkomv
-kwert lv_value1.
    
MODIFY XKOMV TRANSPORTING kwert WHERE kschl 'BASB'.
    
ENDIF.
    
ENDLOOP.  

 

and exit name for seeting the code

exit NAME: LV69AF41 Put this code for getting data

    break roh.
    
DATA lv_value1 LIKE xkomv-kwert.
    
IMPORT lv_value1 FROM MEMORY ID 'ZKWERT'.
    
LOOP AT XKOMV WHERE kschl 'BASB'.
      
IF SY-subrc 0.
        Xkomv
-kwert lv_value1.
        
MODIFY XKOMV TRANSPORTING kwert WHERE kschl 'BASB'.
      
ENDIF.
    
ENDLOOP.

 BREAK ROH.

  DATAlv_kwert LIKE komv-kwert,
        lv_value 
LIKE xkomv-kwert,
        lv_value1 
LIKE xkomv-kwert.
    
CLEARlv_valuelv_value1.
  
IF KOMV-kschl =     'PB00'.
    
IF SY-subrc 0.
      lv_value 
komv-KAWRT.
    
ENDIF.
  
ENDIF.
  
IF KOMV-kschl =     'FRA1'.
    
IF SY-subrc 0.
      lv_value 
komv-kwert.
    
ENDIF.
    
ENDIF.
  
LOOP AT XKOMV WHERE kschl 'BASB'.
    
IF SY-subrc 0.
      lv_VALUE1 
lv_value + komv-KAWRT.
      
IF lv_value1 is INITIAL.
*         lv_value1 = 50400000.
        
TYPESBEGIN OF ty_ekko,
          ebeln 
TYPE ebeln,
          knumv 
TYPE  knumv,
        
END OF ty_ekko.

        
TYPESBEGIN OF ty_konv,
          knumv 
TYPE knumv,
          KSCHL 
TYPE kschl,
          KAWRT 
TYPE kawrt,
        
END     OF ty_konv.
   
DATA LV_EKKO TYPE TY_EKKO,
          LV_KONV 
TYPE TY_KONV.
           SELECT SINGLE ebeln knumv FROM ekko into lv_ekko 

                    WHERE ebeln '4500018438'"lv_ekko-ebeln.


      
SELECT SINGLE knumv kschl kawrt FROM konv INTO lv_konv 

                                                                                     WHERE knumv lv_ekko-knumv
                                                              
AND kschl  'FRA1'.
      lv_value1 
= ( lv_konv-kawrt * 100 + lv_konv-kawrt.
       
endif.
      Xkomv
-kwert lv_value1.
      
MODIFY XKOMV TRANSPORTING kwert WHERE kschl 'BASB'.
      
export lv_value1 to MEMORY id 'ZKWERT'.
    
ENDIF.
  
ENDLOOP.

This document belong to purchases documents header data as per the requirements be can created purchase documents header data 

Sunday, September 13, 2020

Differences between Normal Reports and ALV Reports in SAP ABAP.

What are the differences between Normal Reports and ALV Reports?



  • Classical reports
  • ALV Reports

1. Simple reports using the WRITE statements within the loops.

1. The system generated Functions start with REUSE* are used to display the data.

=================================================================

2. Performance is not as good as ALV Reports since the LOOP statement must be used to display the data.

2. Performance is good since the data is displayed using the function modules outside of the loops.

=================================================================

3. Not possible to edit the Fields in the Output.

3. It can be possible to edit the Fields in the Output.

=============================================================

4. It is difficult to display the LOGOS in the output.

4. It is so EASY to display the LOGOS in the output.

==========================================================

5. It is COMPLEX to Align the Columns.

5. Column Alignment is done by the system.

Which techniques used to identify the record which was clicked by the user in the previous list in SAP ABAP.

Which techniques used to identify the record which was clicked by the user in the previous list?



Ans: HIDE & GET-CURSOR

HIDE: This statement is used to hide the selected field value which can be passed to the corresponding drill down list to filter the unwanted records. It is used to capture the selected field values to the next drill down list. Hide statement provides Single drill down list.

GET-CURSOR: This statement is used to capture the selected field values & field names based on the cursor position. This statement provides drill multiple down lists.

What are the types of execution modes in SAP ABAP.

What are the types of execution modes?


 Execution modes in SAP ABAP.

Ans: There are 2 types of execution mode to execute a program or the transaction codes.

1. Foreground: It is used to execute the programs or the transaction codes directly by pressing execute icon or F8 function key. It requires user interaction.

2. Background: This execution mode is used to execute the programs or the transaction codes periodically such as Hourly, Daily, Weekly, Monthly etc in background. It doesn’t require any user interaction. The variants must be created before the programs are scheduled in back ground.

 The T-code SM36 is used to define the background jobs &

 The T-code SM37 is used to check the status of the background jobs.

The standard function modules JOB_OPEN -> To open back ground job

JOB_SUBMIT -> To submit job in back ground

JOB_CLOSE -> To close scheduled job.

Debug Background Jobs in SAP ABAP.

How to debug Background Jobs?


Debug Background Jobs in SAP ABAP.

Ans: The Background jobs can be debug using the command ‘JDBG’.

 Execute the T-code SM37

 Check the required background job to be debug.

 Enter JDBG in the Command field & Press Enter

 Keep on pressing F7 until the required program is stopped.

 Use the Function keys F5/F6/F7 to check the program Line by line/Block by Block once it is reached.

Explain about Debugger, Break points and Watch points in SAP ABAP.

Explain about Debugger, Break points and Watch points?



Debugger, Break points and Watch points in SAP ABAP.

Ans :- Debugger :- This tool is used to check the program line by line & block by block for finding and rectifying errors or bugs.

Break Points:- These are Statement based. They are used to stop the program in the debugger tool for checking line by line or block by block.

 Break points are of 4 types. We can place up to 30 break points in the program.

1. Session Break Point: An icon set/delete breakpoint icon or click on statement line at gray color vertical selection in the source code.

2. Static Break Point: The ABAP statement BREAK-POINT/BREAK <user_name> is used to set the Static break point. In the real time the ABAP statement BREAK-POINT should not be used since all the users are stopped.

3. Dynamic Break Point: They are used to check the program in case of not possible to find a location. The command /H is used to set dynamic break points. The program is stopped at the first statement line of the performed action.

4. External Break Point: They are used to check the cross application components such as RFC, BAPI from one system to another. An icon set or delete external break-points is used to set or delete external break-points.

Watch Points: - These are Condition based. They are used to stop the program once the set condition is reached. The Watch points can be set inside the debugger tool. We can place up to 9 watch points in the program. We can reduce debugging time using watch points.

Memories, explain about them in SAP ABAP.

What are the types of Memories, explain about them?



Ans :- The Memory concept is used to access the data across the internal or External Sessions.

 There are 2 types of memories.

1. SAP Memory: - It is used to access the data from one session to another session through Parameter ID or Memory ID.

 The ABAP statements SET PARAMETER ID and GET PARAMETER ID are used to work with the SAP memory.

 SET PARAMETER ID is used to pass the field value from an application program into the specified SAP Memory ID or Parameter ID.

 GET PARAMETER ID is used to get the data from the specified memory ID or Parameter ID into filed of an application program.

 The Parameter ID’s are maintained at Data Element level under Further Characteristics.

2. ABAP memory: - It is used to access the data across internal sessions. The ABAP statements IMPORT & EXPORT are used to work with the ABAP Memory.

 The IMPORT statement is used to import the data from the specified memory ID into data variable.

 The EXPORT statement is used to export the data into the specified memory ID from the program.

Control Break Statements, explain about them in SAP ABAP.

What are the Control Break Statements, explain about them?



Control Break Statements, explain about them in SAP ABAP.

Ans :-

Control Break statements: - They are used to control the data flow of an internal table.

 The Control break statements start with AT and ends with ENDAT.

 These statements should be used within the LOOP statements only

 Following are the different types of Control break statements.

AT FIRST: - This event is triggered at the first record of an internal table. This is used to display the Header information.

AT NEW: - This event is triggered at the first record of each block. This is used to display the individual headings.

AT END OF: - This event is triggered at the last record of each block. This is used to display the total/sub totals in the internal table.

AT LAST: - This event is triggered at the last record of an internal table.

ON CHANGE OF: - It is a special control break statement which can be used outside of the loop statement also.

 It is almost similar to AT NEW statement but it doesn't consider the preceding fields.

 It can be used on the multiple fields using SET operators (AND, OR, BETWEEN).

Explain about the events associated with Classical Reports in SAP ABAP.

Explain about the events associated with Classical Reports?



Events associated with Classical Reports in SAP ABAP.

Ans :- Following are the EVENTS associated with the Classical Reports .

 LOAD-OF-PROGRAM : This event triggers at the time of loading the program

into a memory.

INITIALIZATION: This event is triggered before the selection screen is displayed. It is used to clear & refresh the data variables and used to pass the default values to the selection fields.

AT SELECTION-SCREEN: This event is triggered after providing the input in the selection screen.

START-OF-SELECTION: It is the default event & mandatory to execute any executable program. It is used to fetch the data from the DB. If no event is used in the executable program, the entire program will be triggered under

Start-Of-Selection.

END-OF-SELECTION: This event is triggered after Start-Of-Selection event is processed. It is used to specify the data process statements.

TOP-OF-PAGE: This event is triggered with the first ULINE/WRITE/SKIP/NEW PAGE statement in START_OF-SELECTION event in the program. It is used to display the column headings.

END-OF-PAGE: This event is triggered at the end of each page. It is used to display the footer details of a page such as totals etc..The report addition

LINE-COUNT must be specified to trigger this event.

Explain about Loop termination statements in SAP ABAP.

 Explain about Loop termination statements?



 Loop termination statements in SAP ABAP.

Ans :- The following statements are used to come out of the loops and continue with the next

loop statements.

EXIT: - This statement is used to come out of the loop statement and continue with the next statement line outside of the loop statements in the program.

STOP: - This statement is used to stop the Loop process along with the next part of the loop statement.

CONTINUE: - This statement is used to stop the current loop process and continue with the next loop process.

CHECK: - This statement is used to check the specified conditions and continue with the next loop process.

 CHECK = CONDITION + CONTINUE.

Friday, September 11, 2020

Disadvantage Of Using Batch Input Session Method in SAP ABAP.

What Is The Biggest Disadvantage Of Using Batch Input Session Method?



Session Method Disadvantage in SAP ABAP.

When dealing with batch input sessions, there is a timing issue involving the creation of a batch input session and the processing of a batch input session. The creation and processing of batch input sessions are distinct or two different actions; therefore, they occur at different times.

Between the time a batch input session is created and the time it is processed, changes might have been made to the SAP database. These changes may result in errors when processing the batch input session.

For example, a BDC program creates a batch input session to insert 10000 materials into the SAP database. Before the session is processed, a SAP user inserts 20 of these materials into the SAP system. When the batch input session is finally processed, these 20 materials will result in errors because they cannot be inserted into the SAP database more than once. Also Batch Input Sessions cannot be run in parallel and hence are not fast.

Search Help in SAP ABAP.

What are the Search Help, types and explain about them?



Search Help

Ans: - It is used to provide all the possible entries to the input variable as search help.

1) Elementary Search help:

 - It is created using one base table.

2) Collective Search help:

 - It is the collection of Elementary Search help.

Search Help Exit: It is a Function module to filter possible entries of a search help.

It is used to modify the F4 values at run time.

Differences between Check table and Value table in SAP ABAP.

 What are the differences between Check table and Value table?



Check table VS Value table

1. It is maintained at the TABLE level.

1. It is maintained at the DOMAIN level.

--------------------------------------------------

2. It can be used to extract the data in the programs.

2. It can't be used to extract data since it is linked with the domain.

---------------------------------------------------

3. The Search Help is displayed from the Check table on the foreign key field of a foreign key table.

3. The Search Help is displayed on each field which is linked with the same domain of the Value table.

----------------------------------------------------

4. It forces the user to select any one of the check table field entries

4. It does not force the user since it has empty value by default.

Types of Views and explain in SAP ABAP.

What are the types of Views and explain about them?



View in SAP ABAP.

Ans: - Views are the virtual/imaginary tables. It does not contain the data permanently.

View contains the data at Run time only.

1) Database View: - 

It is used to combine the multiple tabled data by joining them. It can be used to extract the data in the programs.

2) Maintenance View: - 

It is used to maintain multiple tables data using the T-code SM30 (TMG).

3) Help View: 

- It is used in the selection method in an Elementary Search Help to provide the

list of possible entries from the multiple tables.

4) Projection View

: - It is used to HIDE the unwanted fields of the table. It can be

defined using one table only.