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: 

Function module READ_TEXT related problem

former_member187748
Active Contributor
0 Kudos

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.

44 REPLIES 44

nabheetscn
Active Contributor
0 Kudos

Hi Sanjeev

What you can do is in your smartfrom change your text element to Include text and pass these text id details there it will automatically print the text in the designated column. No need to read here.

Just do it in your smartform in main table loop.

Nabheet

0 Kudos

Dear Nabheet,

i have done this coding inside my smartform itself, i have tried in my driver program also

in which i created an internal table with header line and passes the values in it, and then

i passes it through tables in smartform, and the place where i wants it values to get printed

i loop the internal table , but not suceeded....

What are you saying, i didn't get it.......please elaborate it more...........

0 Kudos

Go to your smartform inside main loop. Create a text element as shown below

Pass your read text values here as variable &V_NAM&

0 Kudos

Hi-

Just more details than what Nabheet has provided.

In above screen shot gv_vbeln is nothing but your Order Number, if you would like to read text from line item level you need pass GV_VBELN = Order Number + Line item number. To achieve this you can make use of Program Lines.

-Venkat

0 Kudos

Dear Nabheet,

i ahve done the same but, this time i am getting too short text , more less than previous.

0 Kudos

Can you please attach a screen shot of text and output with differences highlighted

0 Kudos

Hi-

Now are you able to display the complete text that was in order? If yes is this text getting displayed in a shorter length? Then what you can do is either increase your table cell or decrease the font size for this text so that it can fit into your table cell.

Steps:

*Create a smart style with a paragraph format there you can select required font family, size etc.

*Assign the same smart style in your text under Output Options -> Style.

*Assign the paragraph format which you have selected in Standard Paragraph under general attributes of your text.

-Venkat

0 Kudos

Dear Nabheet,

here is the screenshot in which one is the value of text during debugging

and in the second screenshot you can see a short text within description.

I have changes in smartstyle its font and other things, but you can see

the difference in output.

One thing more that i have to print material no. too in the same block

followed by its description, so i thing your previous sujjestion will not work

here. Please tell me the required changes.

Thanks in advance.

0 Kudos

Hi Venkat,

thanks for your reply, yes i get shorter text in output,

I have already done what yoy have sujjested, but not getting whole output.

I have kept the same paragraph format for which we have taken its outpout in other

programs, and there is is fetching whole text.

So i think i have to solve it another way.

0 Kudos

Hi Sanjeev

First of all you are printing your data MAIN window in a table i believe. You must have created line  type with 5 columns. So when your loop of IT_MAIN starts for the line type you have 5 different cells. In first cell you will pass WA_MAIN-MANTR and in second you will concatenate po and po item and display text so it will work.

Seconldy where you are concatenation the po and po item please put a hardcoded break point so that after that you can check in standard how include text is being read.

Nabheet

0 Kudos

Hi-

I would like you to give a trial by creating a new Paragraph format(with decreased font length) and assign the same in your include text.

This is where I am referring in your Include text:

-Venkat

0 Kudos

Dear Nabheet,

now i have written my READ_TEXT inside my driver program,

in which i am getting my text as shown in screenshot,

and my program is as below,

now by doing this i gets my output for all the three line items as "GHI".

Please tell me how could i print text accordingly, inside my smartform i have

loop at it_sdesc in the text.

LOOP AT it_ekpo INTO wa_ekpo.

   CONCATENATE WA_EKPO-EBELN WA_EKPO-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.

   IF NOT dt_lines[] IS  INITIAL.

        LOOP AT DT_LINES.

          if not dt_lines-tdline is initial.

            it_sdesc-text  = dt_lines-tdline.

           it_sdesc-indc  = 'B'.                 "dt_lines-indc.

           append it_sdesc.

           ENDIF.

           ENDLOOP.

           CLEAR DT_LINES[].

ENDIF.

ENDLOOP.

0 Kudos

Hi-

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

Modify your code like below:

LOOP AT it_ekpo INTO wa_ekpo.

   CONCATENATE WA_EKPO-EBELN WA_EKPO-EBELP INTOV_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.

   IF NOT dt_lines[] IS  INITIAL.

        LOOP AT DT_LINES.

          if not dt_lines-tdline is initial.

            it_sdesc-text  = dt_lines-tdline.

           it_sdesc-indc  = 'B'.                 "dt_lines-indc.

         it_sdesc-tdname = v_nam.

           append it_sdesc.

           ENDIF.

           ENDLOOP.

           CLEAR DT_LINES[].

ENDIF.

ENDLOOP.

Inside your Smart form-> Tables -> Main Area -> Under cell here you would like to display your text -> Create a loop on it_sdesc with condition tdname = v_nam (v_nam -> Order + Line Item combination write the logic in program lines ).

-> Inside the loop create a text with: &wa_sdesc-text&.

-Venkat

0 Kudos

Hello Venkat,

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.

IF NOT dt_lines[] IS  INITIAL.

        LOOP AT DT_LINES.

          if not dt_lines-tdline is initial.

            it_req-vname1 = v_nam.

            it_req-text  = dt_lines-tdline.

            append it_req.

           ENDIF.

           ENDLOOP.

           CLEAR DT_LINES[].

ENDIF.

ENDLOOP.

0 Kudos

Hi-

Please follow below steps:

->  Check your driver program for entries in it_req table.

-> Put a hard-coded break point BREAK <your user-id> in INITIALIZATION code under Global Definitions. And check for the same entries in it_req in smart form.

-> After above step we are sure that data is available in smart form.

-> Create a new workarea by referring to it_req table, under global data tab of Global definitions.

     wa_rea TYPE it_req.

-> I hope your table is running on it_ekpo. Inside your main area 3rd cell create a program line with code like:

CLEAR v_nam.

CONCATENATE wa_ekpo-ebeln wa_ekpo-posnr INTO v_nam.

CONDENSE v_nam NO-GAPS.

NOTE: Don't forget to give v_nam in output parameters. You can debug this place too.

->Create a loop under program line:

-> You can also put an additional condition under conditions tab like: v_name NE space.

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

-Venkat

0 Kudos

Dear Venkat,

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

Now i have written program lines as shown below

And inside loop i have created like this

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.

0 Kudos

Sanjeev one simple question what was the issue with include text there was no need to do this stuff..?

0 Kudos

Dear Nabheet,

issue was same as i am struggling yet,

this is the screenshot just to show all the text,

but when i used include text, i gets all the text in output as "GHI"

Here is the output,

Please tell me the modification, which i have to perform.

0 Kudos

Do a small thing. Go to Se37 and put a break point in SSFRT_READ_INCLUDE_TEXT. If you are using include text program will stop here check the keys and no lines returned by it.

0 Kudos

Dear Nabheet,

while debugging i gets only details of last line item

i.e. for 6000000034 and for line item 30,

so what to do next because i wants that all line item text should get printed

accordingly...

Please clarify this.........

0 Kudos

For testing purpose in your include text replace &v_nam& with the combination of order and item directly(600000003400001). 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.

0 Kudos

You want  text for each individual line to be printed in each row..or all of the text of the line items at onego?

0 Kudos

Dear Nabheet,

obviously i wants to print each line item text in its corresponding row individually.

0 Kudos

Sanjeev then lets say your PO has five items.  For each line this include text will be called and it will print. As you said it is picking up for line 0030 only not for others that you have to check in your smartform logic why it is not picking other line item

0 Kudos

Dear Venkat,

yes when i have kept text name as "600000003400010", 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 as

LOOP AT it_final INTO wa_final.

   CONCATENATE WA_FINAL-EBELN WA_FINAL-EBELP INTO V_NAM.

ENDLOOP.

and then used the include text,in include text i passes "v_nam"

then it prints all the rows the same values which is for last

line item text "GHI", and this is the problem , please tell me how could i print each line item text

separately in each row.

0 Kudos

I have given the same suggestion.

0 Kudos

Dear Nabheet,

i have written these simple code lines, but it is picking only last values; lets say

if i have three line items, then it is printing 3rd line item text values in each line item text.

SELECT EBELN EBELP EMATN TXZ01 MEINS KTMNG ADRNR ADRN2 WERKS LGORT

   FROM EKPO

   INTO CORRESPONDING FIELDS OF TABLE IT_FINAL

   WHERE EBELN = WA_EKKO-EBELN.

LOOP AT it_final INTO wa_final.

   CONCATENATE IT_FINAL-EBELN IT_FINAL-EBELP INTO V_NAM.

ENDLOOP.

and i have passed &V_NAM& as Text Name.

0 Kudos

Sanjeev i assume it_final is the looping table in your main window.

LOOP AT it_final INTO wa_final.

   CONCATENATE WA_FINAL-EBELN WA_FINAL-EBELP INTO V_NAM.--> Use work area

ENDLOOP.

So where you are concatenating put a break point there and see what value of purchase order and item is coming in each iteration before being passed to the include text

0 Kudos

I have tried the same and it's working perfectly. Anyways just delete your loop and re-create:)

Declare your v_name as type stxh-tdname.

In your program lines make sure you have given v_nam in output parameters.


-Venkat

0 Kudos

Dear Venkat,

i ahve tried al possibilities here, in debugging got data as shown below in it_req

which contains all the line item text, but in my smartform please see what i am

droping, because i didn't get any text this time, here i am sending you my SF,

please see the TABLE1 inside third cell.

Please tell me what is missing.......

vimalv
Active Participant
0 Kudos

Sanjeev, make sure the include text is under a Cell in a Table and not in a Template.

0 Kudos

Hi-

In is what I have found. you have created text cell under the loop for it_req it should be inside the loop and not under the loop.

Below screen shot is of your uploaded form:

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.

Good Luck!!

-Venkat

0 Kudos

Dear Venkat,

thanks a lot for your support, actually i have tried by taking it inside loop,

but the problem i was getting is , i was not able to match data inside loop

now i have changed my driver program to match it .

And i get my desired result.

One more thing, i have to concatenate one more command here in the same text where i am printing this text,

in the same page

but if i will use the other command here, then it will print as many times as the line

splits (means if my long text is splited into three lines, then through my command

for other details in the same field will also print three times, any solution for it)

0 Kudos

Hi-

Could you please elaborate your requirement.

Would you like to concatenate some other text to an already existing long text at the line item level? If so you can create a new text cell underneath your loop correct?

-Venkat

0 Kudos

Yes,

i wants to coccatenate a text (not long, just material description with this long text).

If i concatenate it, then it prints as many times the long text splits itself,

means as the long text is splitted in 132 length, so it will spread in many lines,

and thats why as it is in a loop, so if i will concatenate any other command in the same cell

then it will also prints as many times long text print itself in multiple of 132.

0 Kudos

Hi-

You should not concatenate material description with the long text. What you have to do is create a new text cell above/under the loop for your long text, please note not inside the loop. In this text cell pass your material description.

-Venkat

0 Kudos

Hi Venkat,

i have solved this issue other way,

anyhow thanks a lot again for your support.

praveenboss
Participant
0 Kudos

Hy Sanjeev,

DT_LINES Table contains 3 lines which you want to print.

I Also Use This FM.

Please Make sure your window/template size in smart form is sufficient,

i done this for only first 3 lines.

LOOP At DT_LINES INTO W3_LIN.

     INT = INT + 1.

     if int BETWEEN 1 AND 3.

       CONCATENATE CONS W3_LIN-TDLINE INTO CONS SEPARATED BY ' '.

     ENDIF.

if int = 4.

       cons4 = w3_lin-tdline.

     endif.

     if int = 5.

       cons5 = w3_lin-tdline.

     endif.

ENDIF.


i AM USING DIFFERENT VARIABLES TO PRINT EVERY SINGLE LINE IN DIFFERENT TEMPLATES.

YOU CAN USE AS YOU WANT.

THANKS

PRAVEN>>


0 Kudos

Dear Praveen,

i can't restrict my user to put text upto certain lines...

and that's why it's not desirable.....