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: 

READ_TEXT & SAVE_TEXT

Former Member
0 Kudos

Hi

I am using following function modules to change line item text of PO

This works perfectly for already generated PO. But it is giving error while creating new PO as

" Text not available in database or update memory. Use INIT_TEXT & SAVE_TEXT "

Pls. give me solution as this is very urgent.

DATA : l_name LIKE thead-tdname,

l_header TYPE thead,

lt_lines TYPE STANDARD TABLE OF tline WITH HEADER LINE.

LOOP AT it_ekpo INTO wa_ekpo.

CLEAR : lt_lines[], lt_lines, l_header, l_name.

CONCATENATE wa_ekpo-ebeln wa_ekpo-ebelp INTO l_name.

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = 'F01'

language = 'E'

name = l_name

object = 'EKPO'

IMPORTING

header = l_header

TABLES

lines = lt_lines

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.

CHECK lt_lines[] IS NOT INITIAL.

READ TABLE lt_lines WITH KEY tdformat = '*'.

CHECK sy-subrc <> 0.

lt_lines-tdformat = '*'.

MODIFY lt_lines transporting tdformat where tdformat eq space.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

client = sy-mandt

header = l_header

  • INSERT = ' '

savemode_direct = 'X'

  • OWNER_SPECIFIED = ' '

  • LOCAL_CAT = ' '

  • IMPORTING

  • FUNCTION =

  • NEWHEADER =

TABLES

lines = lt_lines

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.

ENDLOOP.

Regards

Harshada

1 ACCEPTED SOLUTION

former_member223537
Active Contributor
0 Kudos

READ_TEXT needs to be used, if the data is already stored in EKPO. During PO creation, its not stored & hence the error.

But a logic of check the tcode.

IF sy-tcode = ... "PO change

READ TEXT

SAVE TEXT

else if sy-tcode = .... "PO Creation

SAVE TEXT

ENDIF.

7 REPLIES 7

Former Member
0 Kudos

Hi !

After SAVE_TEXT you'll have to call the FM COMMIT_TEXT.

Otherwise the text is not written to the database !

... Not to forget a COMMIT WORK after that !

Regards

rainer

Some points would be nice

0 Kudos

thanks for the reply.

former_member223537
Active Contributor
0 Kudos

READ_TEXT needs to be used, if the data is already stored in EKPO. During PO creation, its not stored & hence the error.

But a logic of check the tcode.

IF sy-tcode = ... "PO change

READ TEXT

SAVE TEXT

else if sy-tcode = .... "PO Creation

SAVE TEXT

ENDIF.

0 Kudos

thanks for the reply

0 Kudos

as per ur logic

if i use read_text only if ekpo is not initail

then wht should i pass to parameter

<b>tables</b> in save_text

b'coz the table lines to be updated are coming from read_text.

pls. reply

0 Kudos

well, if you have nothing read, since EKPO was initial, what would you like to save then?

In your logic it makes no sense to save a text without having read one before.

Former Member
0 Kudos

Thanks all of you for the reply.

I got solution for this problem.

Now calling funtion modules only if ekpo-ebeln is not initail (PO not created)