Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP: FN MODULE "SAVE_TEXT"

vallamuthu_madheswaran2
Active Contributor
0 Kudos

HAI FRIENDS,

I AM USING ON FUNCTION MODULE I.E "READ_TEXT".

HERE I GET THE IN TWO TYPES I.E

1) TO GET A MATERIAL WITH TEXT.

2) TO GET A MATERIAL WITHOUT TEXT.

NOW I WANT TO ADD SOME TEXT FOR WITHOUT TEXT MATERIAL

HERE I AM USING ON FUNCTION MODULE I.E "SAVE_TEXT".

MY DOUBT IS WHERE WE GIVE NEWTEXT FOR THE FOLLOWING FUCTION MODULE

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

CLIENT = SY-MANDT

HEADER = I_THEAD

INSERT = 'X'

SAVEMODE_DIRECT = 'X'

  • OWNER_SPECIFIED = ' '

  • LOCAL_CAT = ' '

  • IMPORTING

  • FUNCTION =

  • NEWHEADER =

TABLES

LINES = I_TLINE.

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • OBJECT = 4

  • OTHERS = 5

THANKS & REGARDS

VALLAMUTHU.M

1 ACCEPTED SOLUTION

Former Member

DATA: IT_TLINES LIKE TLINE OCCURS 0 WITH HEADER LINE.

Lets assume you have the text to be saved in the internal table IT_TEXT.

data : x_header TYPE thead.
to populate the data into SAVE_TEXT,you should know the values for the below fields.
  x_header-tdobject = 'VBBK'.  
  x_header-tdname   = lv_name . <--your material no
  x_header-tdid     = 'ZMAN'.
  x_header-tdspras  = 'E'.


LOOP AT IT_TEXT .
    IT_TLINES-TDFORMAT = '*'.
    IT_TLINES-TDLINE = IT_TEXT-LINE.
    APPEND IT_TLINES.
    CLEAR  IT_TLINES.
  ENDLOOP.

  CALL FUNCTION 'SAVE_TEXT'
    EXPORTING
      CLIENT                = SY-MANDT
      HEADER                = X_HEADER
*       INSERT                = ' '
      SAVEMODE_DIRECT       = 'X'
*       OWNER_SPECIFIED       = ' '
*       LOCAL_CAT             = ' '
*     IMPORTING
*       FUNCTION              =
*       NEWHEADER             =
    TABLES
      LINES                 = IT_TLINES
     EXCEPTIONS
       ID                    = 1
       LANGUAGE              = 2
       NAME                  = 3
       OBJECT                = 4
       OTHERS                = 5
            .
  IF SY-SUBRC <> 0.
*--ERROR.
  ELSE.
*--SUCCESS.
  ENDIF.

regards

Srikanth

but remember,if you use SAVE_TEXT all previous text will be overwritten with the new text from IT_TLINES table.

so before using this you should use READ_TEXT and append your new text to this IT_TLINES table and then call SAVE_TEXT.

check this link,for more info about this FM

Message was edited by: Srikanth Kidambi

4 REPLIES 4

Former Member

DATA: IT_TLINES LIKE TLINE OCCURS 0 WITH HEADER LINE.

Lets assume you have the text to be saved in the internal table IT_TEXT.

data : x_header TYPE thead.
to populate the data into SAVE_TEXT,you should know the values for the below fields.
  x_header-tdobject = 'VBBK'.  
  x_header-tdname   = lv_name . <--your material no
  x_header-tdid     = 'ZMAN'.
  x_header-tdspras  = 'E'.


LOOP AT IT_TEXT .
    IT_TLINES-TDFORMAT = '*'.
    IT_TLINES-TDLINE = IT_TEXT-LINE.
    APPEND IT_TLINES.
    CLEAR  IT_TLINES.
  ENDLOOP.

  CALL FUNCTION 'SAVE_TEXT'
    EXPORTING
      CLIENT                = SY-MANDT
      HEADER                = X_HEADER
*       INSERT                = ' '
      SAVEMODE_DIRECT       = 'X'
*       OWNER_SPECIFIED       = ' '
*       LOCAL_CAT             = ' '
*     IMPORTING
*       FUNCTION              =
*       NEWHEADER             =
    TABLES
      LINES                 = IT_TLINES
     EXCEPTIONS
       ID                    = 1
       LANGUAGE              = 2
       NAME                  = 3
       OBJECT                = 4
       OTHERS                = 5
            .
  IF SY-SUBRC <> 0.
*--ERROR.
  ELSE.
*--SUCCESS.
  ENDIF.

regards

Srikanth

but remember,if you use SAVE_TEXT all previous text will be overwritten with the new text from IT_TLINES table.

so before using this you should use READ_TEXT and append your new text to this IT_TLINES table and then call SAVE_TEXT.

check this link,for more info about this FM

Message was edited by: Srikanth Kidambi

Former Member
0 Kudos

put this FM in Loop .

loop at i_tab.
 loop at itab_text where matnr  = i_tab-matnr.
 append lines.
 endloop.

CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
HEADER = I_THEAD
INSERT = 'X'
SAVEMODE_DIRECT = 'X'
* OWNER_SPECIFIED = ' '
* LOCAL_CAT = ' '
* IMPORTING
* FUNCTION =
* NEWHEADER =
TABLES
LINES = I_TLINE.
* EXCEPTIONS
* ID = 1
* LANGUAGE = 2
* NAME = 3
* OBJECT = 4
* OTHERS = 5
endloop.

Former Member
0 Kudos

hi ,

chk this thread

Former Member
0 Kudos

H exper,

I used FM "SAVE_TEXT" but I do not  know  the value of  tdobject (object) , tdid of Sales text tab to input in program?

Please guide me .

Thanks alot.