Skip to Content
0
Mar 12, 2013 at 10:24 AM

SAVE_TEXT not working

1288 Views

Hi all,

As per requirement, while rejecting a PO / PR, user will give comments. These comments will be coming from non-SAP system. So, the comments are importing param for the RFC. I used SAVE_TEXT alone didn't worked. Later, used the combination of READ_TEXT & SAVE_TEXT function modules. Later tried with SAVE_TEXT & COMMIT_TEXT. While debigging, the SY-SUBRC of the function call is 0 but, the exporting text table is empty always. And when I checked in ME23N, I couldn't get the text saved.

Referred to posts in SDN.They were helpful. But, couldn't get the text saved in the PO /PR. Please, suggest how to get the text saved.

The logic is:

ls_head-tdobject = 'EKKO'.
ls_head-tdname = lv_po_number.
ls_head-tdid = 'F01'.
ls_head-tdspras = sy-langu.

lt_text-tdline = reason.
CALL FUNCTION 'CREATE_TEXT'
EXPORTING
fid = 'F01'
flanguage = 'E'
fname = ls_head-tdname
fobject = 'EKKO'
SAVE_DIRECT = 'X'
* FFORMAT = '*'
TABLES
flines = lt_text
EXCEPTIONS
NO_INIT = 1
NO_SAVE = 2
OTHERS = 3
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
header = ls_head
INSERT = 'X'
SAVEMODE_DIRECT = 'X'
* OWNER_SPECIFIED = ' '
* LOCAL_CAT = ' '
* IMPORTING
* FUNCTION =
* NEWHEADER =
TABLES
lines = lt_text
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.

CALL FUNCTION 'COMMIT_TEXT'
EXPORTING
OBJECT = '*'
NAME = '*'
ID = '*'
LANGUAGE = '*'
SAVEMODE_DIRECT = 'X'
* KEEP = ' '
* LOCAL_CAT = ' '
* IMPORTING
* COMMIT_COUNT =
* TABLES
* T_OBJECT =
* T_NAME =
* T_ID =
* T_LANGUAGE =
.