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: 

CS12 Longtext Issue

Former Member
0 Kudos

Hi,

I am facing issue one issue with CS12 T-Code.

There is one component which is used in different material, But when we are fetching text ( FM Read_Text is used ) .

CONCATENATE sy-mandt stb-stlty stb-stlnr stb-stlkn stb-stpoz INTO wa_name.

       CALL FUNCTION 'READ_TEXT'

         EXPORTING

          client                        = sy-mandt

           id                            = 'MPO'

           language                      = sy-langu

           name                          = wa_name

           object                        = 'BOM'

         TABLES

           lines                         = lt_lines

Now for different material Value in WA_NAME it is passing same value, So it is fetching same text although different text is maintained in both material.

So what should be different value to be passed in WA_NAME to get the text maintained in respective material.

Thanks

Ankesh Jindal

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Ankesh,

In this statement,

CONCATENATE sy-mandt stb-stlty stb-stlnr stb-stlkn stb-stpoz INTO wa_name.

you are passing the key fields of 'STPO' table i.e.


Here no where you are passing material so the text would not vary until and unless any of these values change. Also see the values which are present when we manually create texts via CS12 for different materials and pass the same to READ_TEXT and it will function properly.

Please ask if anything is not clear.

Regards,

Ankit.

5 REPLIES 5

marc_augustin2
Active Participant
0 Kudos

Hi Ankesh,

did you debug and look at wa_name what's inside before each FM call? Maybe you'll need a clear or you are passing the wrong values here? How is your stb structure filled?

Regards,

Marc

Former Member
0 Kudos

Hi Ankesh,

After above FM Call check below Sample Code ... for Retrieve Long text   to the Respective Material .

LOOP AT ITAB INTO WA.

CALL FUNCTION 'READ_TEXT'

.......

...

...

  TABLES

           lines                         = lt_lines

IF SY-SUBRC = 4.

      REFRESH  IT_Lines.

  ENDIF.

LOOP AT IT_Lines.

   IF SY-TABIX EQ '1'.

     WRITE :/2 WA-TDNAME, 20 SY-VLINE, 23 WA-TDSPRAS ,42 SY-VLINE ,45  IT_Lines-TDLINE.

   ELSE.

      WRITE :/20 SY-VLINE, 23 WA-TDSPRAS,42 SY-VLINE, 45  IT_Lines-TDLINE.

   ENDIF.

   AT LAST .

          WRITE :/1 SY-ULINE(249) .

          CLEAR : SY-TABIX,wa_name .

   ENDAT.

ENDLOOP.

   REFRESH : IT_Lines .

    CLEAR WA .

ENDLOOP.

Regard's

Smruti

Former Member
0 Kudos

Hi Ankesh,

In this statement,

CONCATENATE sy-mandt stb-stlty stb-stlnr stb-stlkn stb-stpoz INTO wa_name.

you are passing the key fields of 'STPO' table i.e.


Here no where you are passing material so the text would not vary until and unless any of these values change. Also see the values which are present when we manually create texts via CS12 for different materials and pass the same to READ_TEXT and it will function properly.

Please ask if anything is not clear.

Regards,

Ankit.

0 Kudos

Hi Ankit,

I have debugged it on the same day and found this issue only which you have mentioned above, the value of STLNR is same in case of both records.

Thanks

Ankesh Jindal

Former Member
0 Kudos

Hi Ankesh Jindal,

I have wrote the below code to get the long text from PR header.

I hope this will be helpful for your requirement.

LOOP AT i_pr_head INTO w_pr_head.

     w_pr_head-txtnm = w_pr_head-banfn.

     CALL FUNCTION 'READ_TEXT'
       EXPORTING
         id                      = 'B01'
         language                = sy-langu
         name                    = w_pr_head-txtnm
         object                  = 'EBANH'
       TABLES
         lines                   = lt_line
       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.

     LOOP AT lt_line INTO ls_line.
       w_pr_head-hdtxt = ls_line-tdline.
       MODIFY i_pr_head FROM w_pr_head TRANSPORTING hdtxt WHERE banfn = w_pr_head-banfn.
     ENDLOOP.
   ENDLOOP.

Try this and let us know if any other details required on the same.

With Regards,

Gurulakshmi