Monday, September 21, 2020

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 

No comments:

Post a Comment