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

Measurement Document - Long Text Indicator

Former Member
0 Likes
2,818

Hi All,

In my code I am trying to create a Measurement Document.

Then I am creating Long Text for it. For this I am using SAVE_TEXT FM.

But the problem I am facing is that the Long Text Indicator is not being set.

How can I achieve this?

Regards

Ankur

Hi All,

In my code I am trying to create a Measurement Document.

Then I am creating Long Text for it. For this I am using SAVE_TEXT FM.

But the problem I am facing is that the Long Text Indicator is not being set.

How can I achieve this?

Regards

Ankur

10 REPLIES 10
Read only

Former Member
0 Likes
2,262

Hi Ankur,

Check this link for sample code for SAVE_TEXT.

http://wiki.scn.sap.com/wiki/display/ABAP/How+to+Upload+Long+Text+into+SAP+Using+Excel+Sheet+and+SAV...

Or else try using CREATE_TEXT.

Please maintain the language as dynamically like the below code.

   DATA : V_LAN TYPE THEAD-TDSPRAS. " Language

CALL FUNCTION 'CREATE_TEXT'
    EXPORTING
      FID               = 'PLPO'
      FLANGUAGE         = V_LAN
      FNAME             = RESULT
      FOBJECT           = 'ROUTING'
      SAVE_DIRECT       = 'X'
*     FFORMAT           = '*'
    TABLES
      FLINES            = TLINES1
   EXCEPTIONS
     NO_INIT           = 1
     NO_SAVE           = 2
     OTHERS            = 3

Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
2,262

Do one thing when you create measurement document via standard(if any tcode is there) and create the long text check what is being passed to READ_TEXT/SAVE_TEXT pass the same key.

Read only

Former Member
0 Likes
2,262

HI,

The long text indicator  automatic reflected if Measurement Document long text is save.

After SAVE_TEXT function check sy-subrc EQ 0 or not?

Read only

Former Member
0 Likes
2,262

Hi ,

Check this document Use of SAVE_TEXT FM

Regard's

Smruti

Read only

Former Member
0 Likes
2,262

Hi All,

After execution of SAVE_TEXT, sy-subrc is 0. Still it is not working.

I used CREATE_TEXT also - Same issue.

The issue seems specific to Measurement Document. Can somebody try a sample program and try to achieve this requirement?

Regards

Ankur

Read only

0 Likes
2,262

Hi Ankur

Did you use commit afterwards or save mode direct as X.

Please paste your sample code

Read only

0 Likes
2,262

Hi-

Call FM 'COMMIT_TEXT' after SAVE_TEXT.

-Venkat

Read only

0 Likes
2,262

Hi,

After sy-subrc Eq 0.

U craete a BDC  beasuse i m try  use SAVE_TEXT but   is alway blank.

           ls_bdcdata-program = 'SAPLIMR0'.
           ls_bdcdata-dynpro  = '1210'.
           ls_bdcdata-dynbegin = 'X'.
           APPEND ls_bdcdata TO lt_bdcdata.
           CLEAR ls_bdcdata.
           ls_bdcdata-fnam = '
BDC_CURSOR'.
           ls_bdcdata-fval = .'
IMRG-MDOCM'.
           APPEND ls_bdcdata TO lt_bdcdata.

         CLEAR ls_bdcdata.
           ls_bdcdata-fnam =
BDC_OKCODE'.
           ls_bdcdata-fval = .'
/00'.

           APPEND ls_bdcdata TO lt_bdcdata.

          CLEAR ls_bdcdata.

          ls_bdcdata-program = 'SAPLIMR0'.
           ls_bdcdata-dynpro  = '
5210'.
           ls_bdcdata-dynbegin = 'X'.
           APPEND ls_bdcdata TO lt_bdcdata.

          CLEAR ls_bdcdata.
           ls_bdcdata-fnam = '
BDC_CURSOR'.
           ls_bdcdata-fval = .'
IMRG-MDTXT'.

           APPEND ls_bdcdata TO lt_bdcdata.

         CLEAR ls_bdcdata.
           ls_bdcdata-fnam =
BDC_OKCODE'.
           ls_bdcdata-fval = .'
=TXDO'.

           APPEND ls_bdcdata TO lt_bdcdata.

          CLEAR ls_bdcdata.

          ls_bdcdata-program = '.SAPLSTXX'.
           ls_bdcdata-dynpro  = '1100'.
           ls_bdcdata-dynbegin = 'X'.
           APPEND ls_bdcdata TO lt_bdcdata.

          CLEAR ls_bdcdata.
           ls_bdcdata-fnam = '
BDC_CURSOR'.
           ls_bdcdata-fval = .'
RSTXT-TXLINE(01)'.

           APPEND ls_bdcdata TO lt_bdcdata.

         CLEAR ls_bdcdata.
           ls_bdcdata-fnam =
BDC_OKCODE'.
           ls_bdcdata-fval = .'
=TXBA'.

           APPEND ls_bdcdata TO lt_bdcdata.

         CLEAR ls_bdcdata.

          ls_bdcdata-program = 'SAPLIMR0'.
           ls_bdcdata-dynpro  = '
5210'.
           ls_bdcdata-dynbegin = 'X'.
           APPEND ls_bdcdata TO lt_bdcdata.

          CLEAR ls_bdcdata.
           ls_bdcdata-fnam = '
BDC_CURSOR'.
           ls_bdcdata-fval = .'
IMRG-MDTXT'.

           APPEND ls_bdcdata TO lt_bdcdata.

         CLEAR ls_bdcdata.
           ls_bdcdata-fnam =
BDC_OKCODE'.
           ls_bdcdata-fval = .'
=BU'.

           APPEND ls_bdcdata TO lt_bdcdata

           CALL TRANSACTION 'IK12' USING lt_bdcdata MODE 'E'.

Read only

Former Member
0 Likes
2,262

Hi All,

I have not tried the bdc approach yet.

But I tried Commit_text approach. also commit work. Please see my sample code below:

Please try to execute it in your system and see why it is not working.

data: ls_header TYPE thead.
DATA: lv_tline like TLINE,
lt_tline like STANDARD TABLE OF lv_tline.

ls_header-tdobject = 'IMRG'.
ls_header-tdname   = '00000000000000000029'.
ls_header-tdid     = 'LTXT'.
ls_header-tdspras  = sy-langu.
ls_header-tdform = 'SYSTEM'.
ls_header-tdfuser = sy-uname.


clear: lv_tline.
refresh lt_tline.

lv_tline-TDLINE = 'somg12673'.
APPEND lv_tline to lt_tline.

CALL FUNCTION 'SAVE_TEXT'
   EXPORTING
     insert          = ''
     header          = ls_header
     savemode_direct = abap_true
   TABLES
     lines           = lt_tline
   EXCEPTIONS
     id              = 1
     language        = 2
     name            = 3
     object          = 4
     OTHERS          = 5.
IF sy-subrc <> 0.
*        do nothing
ENDIF.

commit work.

CALL FUNCTION 'COMMIT_TEXT'
  EXPORTING
    OBJECT                = 'IMRG'
    NAME                  = '00000000000000000029'
    ID                    = 'LTXT'
    LANGUAGE              = sy-langu
    .

Regards

Ankur Malhotra

Read only

0 Likes
2,262

Hi-

I have tried with your code and it worked for me. However I have commented two lines in your code:

data: ls_header TYPE thead.

DATA: lv_tline like TLINE,

lt_tline like STANDARD TABLE OF lv_tline.

ls_header-tdobject = 'IMRG'.

ls_header-tdname   = '00000000000000000182'.

ls_header-tdid     = 'LTXT'.

ls_header-tdspras  = sy-langu.

clear: lv_tline.

refresh lt_tline.

lv_tline-TDLINE = 'somg12673'.

APPEND lv_tline to lt_tline.

CALL FUNCTION 'SAVE_TEXT'

    EXPORTING

      insert          = ''

      header          = ls_header

      savemode_direct = abap_true

    TABLES

      lines           = lt_tline

    EXCEPTIONS

      id              = 1

      language        = 2

      name            = 3

      object          = 4

      OTHERS          = 5.

IF sy-subrc <> 0.

*        do nothing

ENDIF.

Thanks,

Venkat