Application Development and Automation 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 only

SAVE_TEXT not working

Former Member
0 Likes
5,157

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            =
          .

4 REPLIES 4
Read only

Former Member
0 Likes
2,989

This message was moderated.

Read only

guilherme_frisoni
Contributor
0 Likes
2,989

Hi,

I just did a test here, using save text to include a text that didn't exists before.

CLIENT             500

HEADER-TDOBJECT    EKKO

HEADER-TDNAME      4500398988

HEADER-TDID        F01

HEADER-TDSPRAS     PT

INSERT             X

SAVEMODE_DIRECT    X

It works perfectly. And didn't have to call any other function.

Check your parameters and test in SE37 tcode.

Hope it helps,

Guilherme Frisoni

Read only

Former Member
0 Likes
2,989

Please pad the PO number with Zeros and then try .

Read only

Former Member
0 Likes
2,989

Hello.

There is no need of using others FM, just use CREATE_TEXT, it is enough.

remember to append the text table, check that.

It works wihout problems.

data: lt_text like TLINE occurs 0 with header line.

lt_text-TDLINE = 'Esta es una prueba 222'.

append lt_text.

 

  CALL FUNCTION 'CREATE_TEXT'

    EXPORTING

      fid               = 'F01'

      flanguage         = 'S'

      fname             = '4000027297'

      fobject           = 'EKKO'

      SAVE_DIRECT       = 'X'

     FFORMAT           = '*'

    TABLES

      flines            = lt_text.


Doing that the PO 4000027297 will have the text.

Create a new program on SE38 and do it.

Regards