GoodleAds

READ STANDARD TEXT USING READ_TEXT FUNCTION MODULE

READ STANDARD TEXT USING READ_TEXT FUNCTION MODULE:

READ_TEXT is the function module which is used to read the standard text information which is defined in SO10 transaction.

1. Execute transaction SO10.
2. Provide text name   eg: Z_DEMO_TEXT.
3. Click on create.


4. Provide standard text as below and click on save.


5. Create a program to read the standard text which is defined in SO10 transaction.

REPORT Z_READ_TEXT_FM.
data : lt_head type TABLE OF THEAD,
       lS_head 
type  THEAD,
       IT_TLINES 
type table of TLINE,
       Is_TLINES 
type TLINE,
       LV_CHAR
(132TYPE C.
*   Text object
    lS_head-tdobject 
'TEXT'.
*   Standard text name
    lS_head-tdname 
'Z_DEMO_TEXT'.
*   Text id
    lS_head-tdid 
'ST'.
*   Language
    lS_head-tdspras 
'E'.


    LV_CHAR 
'This is STANDARD TEXT'.
    Is_TLINES
-TDFORMAT '*'.
    Is_TLINES
-TDLINE LV_CHAR.
    
APPEND  Is_TLINES TO IT_TLINES.
*  Populate the standard text with table data
    
CALL FUNCTION 'SAVE_TEXT'
      
EXPORTING
        
header                lS_head
        
insert                'X'
        savemode_direct       
'X'
      
TABLES
        
lines                 IT_TLINES
     
EXCEPTIONS
       
id                    1
       
language              2
       name                  
3
       object                
4
       
OTHERS                5
              
.
    
IF sy-subrc <> 0.
    
ENDIF.
*******Example for reading a text from SO10.
*Link to get in deatil. READ_TEXT
*******
    
refresh IT_TLINES.
    
CALL FUNCTION 'READ_TEXT'
      
EXPORTING
*       CLIENT                        = SY-MANDT
        
ID                            =  'ST'
        
LANGUAGE                      =  'E'
        NAME                          
=  'Z_DEMO_TEXT'
        OBJECT                        
=  'TEXT'
*       ARCHIVE_HANDLE                = 0
*       LOCAL_CAT                     = ' '
*     IMPORTING
*       HEADER                        =
      
TABLES
        
LINES                         =  IT_TLINES
*     EXCEPTIONS
*       ID                            = 1
*       LANGUAGE                      = 2
*       NAME                          = 3
*       NOT_FOUND                     = 4
*       OBJECT                        = 5
*       REFERENCE_CHECK               = 6
*       WRONG_ACCESS_TO_ARCHIVE       = 7
*       OTHERS                        = 8
              
.
    
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    
ENDIF.

    
read table IT_TLINES into Is_TLINES index 1.
    
write Is_TLINES-TDLINE.


OUTPUT:



No comments:

Post a Comment