Monday, September 21, 2020

How you can maintain Logs (or) Error records in Session method in SAP ABAP.

 

How you can maintain Logs (or) Error records in Session method?



Answer:

In Session method SAP is providing a Log file by default

No need to create a Log file for handling error records

You can find Log file by using SM35

Ø Go to SM35

Ø Select your session

Ø Select Log option (F7)

Ø Select your session

Ø Select Display button

Difference between Implicit & Explicit Enhancement In SAP ABAP.

Ques: What is the difference between Implicit & Explicit Enhancement?


Implicit & Explicit Enhancement in SAP ABAP.

Answer:

 Under implicit enhancement you can write your own code

 Adding Z-enhancement in already existing one is called Explicit enhancement

Example:

 Go to SE93

 Transaction Code: VA01

 Display

 Double click on Program Name

 You will find a spot given by SAP

 Enhance

 Right click ES_SAPMV45A

 Enhancement Implementation ----Create Implementation

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