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: 

Problem in SAVE_TEXT function module

Former Member
0 Kudos
562

Hi all,

I am facing problem in updating the text to PO when using the FM SAVE_TEXT. The first line of the header text is being populated but not second line. I am putting sqnumber as 2, but still it is not populating. I am using correct object name , id and etc..

any idea.

Sri

6 REPLIES 6

jayanthi_jayaraman
Active Contributor
0 Kudos
83

Hi,

Check this link.You can find the code sample.

http://www.ct-software.com/reports/z_ie_showpic.htm

Former Member
0 Kudos
83

Hi sri

Just go thru the code below

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

HEADER = ITAB_HEADER

SAVEMODE_DIRECT = 'X'

TABLES

LINES = ITAB_LINES.

ITAB_HEADER-TDNAME = <obj name>

ITAB_HEADER-TDID = <object id>

ITAB_HEADER-TDSPRAS = SY-LANGU.

ITAB_HEADER-TDLINESIZE = 72.

*First line

ITAB_LINES-TDFORMAT = '*'.

ITAB_LINES-TDLINE = < first 72 char>

append ITAB_LINES.

  • for 2nd line u hv to use '/'

ITAB_LINES-TDFORMAT = '/'.

ITAB_LINES-TDLINE = < 2nd 72 char>

append ITAB_LINES.

ITAB_LINES-TDFORMAT = '/'.

ITAB_LINES-TDLINE = < 3rd 72 char>

append ITAB_LINES.

andreas_mann3
Active Contributor
0 Kudos
83

Hi,

have a look to that link:

regards Andreas

Former Member
0 Kudos
83

i never worked in your field (PO), but i have used save_text as follow

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

CLIENT = SY-MANDT

HEADER = w_thead

INSERT = 'X'

SAVEMODE_DIRECT = 'X'

  • OWNER_SPECIFIED = ' '

  • LOCAL_CAT = ' '

  • IMPORTING

  • FUNCTION =

  • NEWHEADER =

TABLES

LINES = ltxttab2

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

OBJECT = 4

OTHERS = 5

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

i can give u one suggestion, goto SE37 type save_text and click 'where used list' , you will find many example related to your topic

regards.

Former Member
0 Kudos
83

Hi,

Try something like:

FORM update_text USING fp_rec_text TYPE ty_text

fp_rec_vbeln_vbeln TYPE vbeln_va.

*Local declaration

DATA: l_header TYPE thead, "Header text

l_rec_line TYPE tline. "Text

DATA: l_i_line TYPE STANDARD TABLE OF tline

INITIAL SIZE 0. " Internal Table for l_line

l_header-tdobject = c_object.

l_header-tdname = fp_rec_vbeln_vbeln.

l_header-tdid = fp_rec_text-tdid.

l_header-tdspras = c_lang.

l_rec_line-tdformat = c_format.

l_rec_line-tdline = fp_rec_text-tdline.

APPEND l_rec_line TO l_i_line.

*Call subroutine to modify text

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

client = sy-mandt

header = l_header

savemode_direct = c_flag

TABLES

lines = l_i_line

EXCEPTIONS

id = 1

language = 2

name = 3

object = 4

OTHERS = 5.

IF sy-subrc <> 0.

MESSAGE i000 WITH 'Standard text not saved'(075).

LEAVE SCREEN. "Leave screen

ELSE.

*Commit the Save of the Text

CALL FUNCTION 'COMMIT_TEXT'

EXPORTING

name = l_header-tdname

savemode_direct = c_flag.

ENDIF.

ENDFORM. " update_text

Former Member
0 Kudos
83

Easiest thing is to publish your code.