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

Function Module Read_text related problem

Former Member
0 Likes
3,363

Hi all,

i am using READ_TEXT function module to read long text for line items, i have used these code lines

which is giving whole text in debugging but it is in splitted lines, so if i have lets say three line items

and my first line items contains a very long text then it splits into three lines, and unfortunately when i'm

using these long text to get printed in my smartforms ,it only printing some text from last.

My code is written below, please anybody tell me the required changes i have to perform

here to get whole long text (i am using command  &WA_FINAL-TXZ05& to print the long text and TXZ05 is of type

tline-tdline).I know tline-tdline can hold only 132 char length, so not getting how could i achieve this.

DATA:BEGIN OF DT_LINES OCCURS 0,

     TDFORMAT LIKE TLINE-TDFORMAT,

     TDLINE LIKE TLINE-TDLINE.

DATA:END OF DT_LINES.

LOOP AT it_final INTO wa_final.

CONCATENATE WA_FINAL-EBELN WA_FINAL-EBELP INTO V_NAM.

CALL FUNCTION 'READ_TEXT'

       EXPORTING

*   CLIENT                        = SY-MANDT

         ID                            = 'A01'

         LANGUAGE                      = SY-LANGU

         NAME                          = V_NAM

         OBJECT                        = 'EKPO'

*   ARCHIVE_HANDLE                = 0

*   LOCAL_CAT                     = ' '

* IMPORTING

*   HEADER                        =

       TABLES

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

CLEAR DS_LINES.

LOOP AT DT_LINES INTO DS_LINES.

   WA_FINAL-TXZ05 = DS_LINES-TDLINE.

   MODIFY IT_FINAL FROM WA_FINAL TRANSPORTING TXZ05 .

ENDLOOP.

ENDLOOP.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,935

Hi

Go to your smartform inside main loop. Create a text element & Pass your read text values here as variable.


Regards:

Sumit

12 REPLIES 12
Read only

Former Member
0 Likes
2,936

Hi

Go to your smartform inside main loop. Create a text element & Pass your read text values here as variable.


Regards:

Sumit

Read only

0 Likes
2,935

Hi

I have tried it but still not working.

Read only

0 Likes
2,935

Hi

Include a field tdname in your it_sdesc table, which holds line item specific texts.

Modify your as per loop with modification.

Read only

0 Likes
2,935

i have written like this, and inside smartforms i have loop through IT_REQ INTO IT_REQ

and put the conditions as shown in screenshot, and i put it_req-text in the command

inside text, but nothing changes, please tell me what should i do.

While debugging i gets text according to v_nam, but i am unable to print the same.

Read only

0 Likes
2,935

Hi Ashish,


In below code, you are overwriting all the previous lines .


Please try changing the code as below and see if it helps.




DATA:BEGIN OF DT_LINES OCCURS 0,

     TDFORMAT LIKE TLINE-TDFORMAT,

     TDLINE LIKE TLINE-TDLINE.

DATA:END OF DT_LINES.

LOOP AT it_final INTO wa_final.

CONCATENATE WA_FINAL-EBELN WA_FINAL-EBELP INTO V_NAM.

CALL FUNCTION 'READ_TEXT'

       EXPORTING

*   CLIENT                        = SY-MANDT

         ID                            = 'A01'

         LANGUAGE                      = SY-LANGU

         NAME                          = V_NAM

         OBJECT                        = 'EKPO'

*   ARCHIVE_HANDLE                = 0

*   LOCAL_CAT                     = ' '

* IMPORTING

*   HEADER                        =

       TABLES

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

CLEAR DS_LINES.

LOOP AT DT_LINES INTO DS_LINES.

   concatenate WA_FINAL-TXZ05 DS_LINES-TDLINE. into WA_FINAL-TXZ05. ( Please make sure that WA_FINAL-TXZ05. is long enough to hold all the lines)

ENDLOOP.


   MODIFY IT_FINAL FROM WA_FINAL TRANSPORTING TXZ05 .

ENDLOOP.



Thanks

Sri

Read only

0 Likes
2,935

-> Make sure to create a text inside the loop not under the loop. In your text -> select editor -> Goto Change editor -> &wa_req-text&.

Read only

0 Likes
2,934

i'm getting my text in smartform itself  for each vname1 (it contains ebeln+ebelp).




And to print text values i am using the command &IT_REQ-TEXT& or &wa_req-text&.

But now the text field is coming to be blank,

please tell me where i am wrong.

Read only

0 Likes
2,934

For testing purpose in your include text replace &v_nam& with the combination of order and item. And check in your output whether you are able to display the complete text. Note: Here text for line item 1 will be displayed for the other line items too.

Read only

0 Likes
2,934

yes when i have kept text name as , it prints the long text in each row,

please tell me how could i achieve it, if i write a code to concatenate the ebeln and ebelp

before include text

Read only

0 Likes
2,934

Hi

you have created text cell under the loop for it_req it should be inside the loop and not under the loop.

What you need to do is create inside the loop, right click on loop -> Create -> Text. This will insert text cell inside the loop and here try to pass text details.

This change needs to be done only if you are using it_req to display text. No changes required if you are using include text.

Read only

Former Member
0 Likes
2,934

Hi,

Loop  internal table which you  from FM read_text.

Copy the  lines into another internal table.

Pass this internal table to smartforms through the TABLES parameter.

Try using INCLUDE_TEXT.

Thanks

Vijay

Read only

former_member202818
Active Contributor
0 Likes
2,934

HI Ashish,

No need to use read_text to display text in smartform.

Create a Include text element in smartform to do this.

*Ensure that text element is not placed inside a template. In such case full text will not get printed.

Regards

Sreekanth