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: 

Creating a long text using ABAP code.. fm SAVE_TEXT

Former Member
0 Kudos

When you create an order via IW31 one of the options is to click on the text button and create a long text. I am basically trying to mimic this action from within my ABAP code.

The text id details are as follows:

Text Name 500000015000046 which is (5000000 + order number)

Language EN

Text ID KOPF Order header text

Text Object AUFK Order text

If i manually create the text within the transaction i am then able to view and update it via function modules READ_TEXT and SAVE_TEXT. But if the text has not already been created READ_TEXT obviously returns nothing as it does not exist and SAVE_TEXT does not seem to created it!

Anyone know how i would go about creating this text using ABAP code?

Hope this make a bit of sense

Thanks in advance

Mart

6 REPLIES 6

Former Member
0 Kudos

Hi Mart,

Use INIT_TEXT and then use READ_TEXT, it will work.

Satish

0 Kudos

Hi Satish,

Thanks for the reply, unfortunately im having the same problem, in that init_text seems to work if the text has already been created but will not create one if it does not already exist. Any ideas?

Regards

Mart

Clemenss
Active Contributor
0 Kudos

Hi Mart,

depending on the situation and object ID you may have to use FM COMMIT_TEXT. See documentation of this module.

Regards,

Clemens

Former Member
0 Kudos

Thanks again for the replies,

If it helps, when i try to save data to a text that does not exist the save_text FM sometimes seems to hang!

Regards

Mart

Former Member
0 Kudos

hi

good

go through this link hope this would help you to solve your problem

http://help.sap.com/saphelp_40b/helpdata/en/d6/0db8ef494511d182b70000e829fbfe/content.htm

reward point if helpful.

thanks

mrutyun^

0 Kudos

I have implemented the code as i think it should be. See below, can any see what is wrong. If i add init_text it makes no difference and adding the commit_text just makes it hang

DATA: IT_TEXTS type standard table of TLINE,

wa_texts like line of it_texts,

wa_txtheader type THEAD.

wa_txtheader-TDID = 'KOPF'.

wa_txtheader-TDSPRAS = 'EN'.

wa_txtheader-TDNAME = '500000015000056'.

wa_txtheader-TDOBJECT = 'AUFK'.

wa_texts-tdformat = '*'.

wa_texts-tdline = 'hello'.

append wa_texts to it_texts.

wa_texts-tdformat = '*'.

wa_texts-tdline = 'hello'.

append wa_texts to it_texts.

wa_texts-tdformat = '*'.

wa_texts-tdline = 'hello'.

append wa_texts to it_texts.

wa_texts-tdformat = '*'.

wa_texts-tdline = 'hello'.

append wa_texts to it_texts.

wa_texts-tdformat = '*'.

wa_texts-tdline = 'hello'.

append wa_texts to it_texts.

wa_texts-tdformat = '*'.

wa_texts-tdline = 'hello'.

append wa_texts to it_texts.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

CLIENT = SY-MANDT

HEADER = wa_txtheader

INSERT = 'X'

  • SAVEMODE_DIRECT = ' '

OWNER_SPECIFIED = 'X'

  • LOCAL_CAT = ' '

  • IMPORTING

  • FUNCTION =

  • NEWHEADER =

TABLES

LINES = IT_TEXTS

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.