2014 Jan 07 5:14 AM
Hi All,
for reading long text , for the description of a material i am using
READ_TEXT function module, but the problem is for a single PO,
there may have many line items, and the texts can be of any length,
I have to print it in my smartforms, where i may have many PO's
and its related any no of line items.
Now the problem is that, through READ_TEXT, it is showing
only one line (probably upto 255 char long text).
But my texts could be so long, that it may splits into many lines,
So please tell me how could i get the long text for each line items
of all PO.
2014 Jan 07 5:42 AM
Hi Srikant,
please create a structure in your program, with a variable of type string, ebeln, ebelp ,
and declare these code
data:begin of dt_lines occurs 0,
tdformat like tline-tdformat,
tdline like tline-tdline,
data:end of dt_lines.
Again, create a internal table of the same type as of the structure created earlier,
lets say the internal table is it_tab1,
then collect all these stuff in the internal table and, inside the text in your smartforms
loop into the internal table, you have created, you will get the desired result.
Hi,
i have tried by using this concept, but at the same place i have to show the text related to material
as its short texts too, so not working
2014 Jan 07 5:17 AM
READ_TEXT returns internal table "lines" which contains the whole text, so looping through the table will give all the text. However, smartforms also give option of "include text" in text node where you can give text name as variable, text object and text id and the long text is printed accordingly.
Regards
2014 Jan 07 5:28 AM
Hi,
Your READ_TEXT FM returns the tables parameters lines.
data item_text(500) your varaible to display in form
LOOP at i_lines
CONCATENATE item_text i_lines-tdline into item_text
separated by space.
endloop.
2014 Jan 07 7:15 AM
Hi Kiran,
i have done as you have sujjested, but still it is showing only one line of text in output.
2014 Jan 07 7:21 AM
Hi,
put the break point on the statement and debug!
whether the item text is contains the all lines are not!
how you are displaying in smartform? can you paste the screen shot
2014 Jan 07 7:40 AM
Hi Kiran,
I have written these code lines, actaully i have some texts associated with these materials, which have to concatenate with READ_TEXT texts.
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.
SELECT SINGLE TXZ01
FROM EKPO
INTO V_TXZ01
WHERE EMATN = IT_EKPO-EMATN.
LOOP AT DT_LINES.
if not dt_lines-tdline is initial.
it_req-ebeln = wa_ekpo-ebeln.
it_req-txz01 = wa_ekpo-txz01.
it_req-vname1 = v_nam.
it_req-text = dt_lines-tdline.
append it_req.
ENDIF.
ENDLOOP.
CLEAR DT_LINES[].
ENDIF.
ENDLOOP.
2014 Jan 07 8:18 AM
Hi Srikant
Can you please rephrase what exactly is the issue..? In case you want to print text for each line you can simply use include text or read_text and print it after every line in Main window inside table
Nabheet
2014 Jan 07 8:39 AM
Hi Nabheet,
i have a smartform in which i have to show all line items details, related to each PO
for a single PR, now for each line items, it has a material field matnr and its short
descriptions as txz01.
Now for each line item material i have some added text in terms of remarks that i wants
to read through READ_TEXT, but it could be of any length.
Now when i am going to print its text, it is printing only one line.
And for the same scenario i am struggling till now.
2014 Jan 07 8:45 AM
try using text node with type"include text" as shown in attached image.
2014 Jan 07 9:07 AM
For each line item which you are printing you must be looping on IT_EKPO in smartform table. so just need to read text and concatenate WA_EKPO-TXZ01.
After that make a loop in smartform on it_req and inside it write using text element
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.
SELECT SINGLE TXZ01
FROM EKPO
INTO V_TXZ01
WHERE EMATN = IT_EKPO-EMATN.
LOOP AT DT_LINES.
if not dt_lines-tdline is initial.
it_req-ebeln = wa_ekpo-ebeln.
it_req-txz01 = wa_ekpo-txz01.
it_req-vname1 = v_nam.
it_req-text = dt_lines-tdline.
append it_req.
ENDIF.
ENDLOOP.
CLEAR DT_LINES[].
ENDIF.
2014 Jan 07 9:13 AM
Hi,
i have tried by using this concept, but at the same place i have to show the text related to material
as its short texts too, so not working
2014 Jan 07 9:17 AM
Hi Nabheet,
should i use the addition of ebelp field in the following code or not, if not then how will i get it line item wise. As sujjested by
LOOP AT DT_LINES.
if not dt_lines-tdline is initial.
it_req-ebeln = wa_ekpo-ebeln.
it_req-ebelp = wa_ekpo-ebelp.
it_req-txz01 = wa_ekpo-txz01.
it_req-vname1 = v_nam.
it_req-text = dt_lines-tdline.
append it_req.
ENDIF.
ENDLOOP.
CLEAR DT_LINES[].
2014 Jan 07 9:25 AM
Hi Srikant
It depens on at what place you are determining the text. If you are determining it before loop of MAIN table then you need PO line item so that you can print the test for that line item. If you are determining it inside loop for each line item then you only need to do read_text and proceed ahead
Nabheet
2014 Jan 07 5:37 AM
Hi,
you can define a variant with STRING type. Then using Kumar's suggestion loop the internal table and concatenate the lines to the variant.
Hope it help you.
Yawa
2014 Jan 07 5:42 AM
Hi Srikant,
please create a structure in your program, with a variable of type string, ebeln, ebelp ,
and declare these code
data:begin of dt_lines occurs 0,
tdformat like tline-tdformat,
tdline like tline-tdline,
data:end of dt_lines.
Again, create a internal table of the same type as of the structure created earlier,
lets say the internal table is it_tab1,
then collect all these stuff in the internal table and, inside the text in your smartforms
loop into the internal table, you have created, you will get the desired result.
2014 Jan 07 7:40 AM
Hi Sanjeev,
i have done as you have sujjested, through it, also i am not able to get my problem resolved.
Please tell me what to do next, i have loop into the internal table having all texts.
I have written these code lines, actaully i have some texts associated with these materials, which have to concatenate with READ_TEXT texts.
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.
SELECT SINGLE TXZ01
FROM EKPO
INTO V_TXZ01
WHERE EMATN = IT_EKPO-EMATN.
LOOP AT DT_LINES.
if not dt_lines-tdline is initial.
it_req-ebeln = wa_ekpo-ebeln.
it_req-txz01 = wa_ekpo-txz01.
it_req-vname1 = v_nam.
it_req-text = dt_lines-tdline.
append it_req.
ENDIF.
ENDLOOP.
CLEAR DT_LINES[].
ENDIF.
ENDLOOP.
2014 Jan 07 8:56 AM
Hi Srikant,
i have seen your code, you have missed one thing, while creating internal table where your all
texts you are appending, please take consideration of line items fields too.
Please modify your code as shown below
LOOP AT DT_LINES.
if not dt_lines-tdline is initial.
it_req-ebeln = wa_ekpo-ebeln.
it_req-ebelp = wa_ekpo-ebelp.
it_req-txz01 = wa_ekpo-txz01.
it_req-vname1 = v_nam.
it_req-text = dt_lines-tdline.
append it_req.
ENDIF.
ENDLOOP.
CLEAR DT_LINES[].
Now debug your code, and see is your internal table it_req has all the text inside it.
If yes, go to your smartform, and under the text where you are showing your long text, create
a Program lines, before this create a variable ltext of type string,
Use these programs lines to show your whole text for each line items
LOOP AT IT_REQ INTO IT_REQ WHERE EBELN = WA_FINAL-EBELN
and EBELP = WA_FINAL-EBELP .
CONCATENATE ltext IT_REQ-TEXT INTO ltext SEPARATED BY space.
ENDLOOP.
And in the general attribute of the text tab where you are showing these long text
use <ext&
Hope you will get your requirements.
2014 Jan 07 1:12 PM
2014 Jan 07 6:09 AM
HIII,
data: v_lines2 type table of ty_tline,
w_lines2 type ty_tline.
data: v_name2 type stxh-tdname,
tdspras2 type stxh-tdspras,
tdid2 type stxh-tdid,
tdobject2 type stxh-tdobject.
data: text type CHAR1000.
tdobject2 = 'EKKO'.
tdid2 = 'F01'.
tdspras2 = 'EN'.
v_name2 = '5500000012'.
call function 'READ_TEXT'
exporting
id = tdid2
language = tdspras2
name = v_name2
object = tdobject2
tables
lines = v_lines2
exceptions
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
others = 8.
loop at v_lines2 into w_lines2.
concatenate TEXT w_lines2-tdline into TEXT separated by space.
condense TEXT.
endloop.
This may helps u....
2014 Jan 07 9:41 AM
2014 Jan 07 9:44 AM
Another approach can be you create two text elements one is include text pass your text ids etc and beneath it have another text where you will print TXZ01 value A simple approach.
Thanks Raymond solution seem simpler now
2014 Jan 07 1:13 PM
Hi Raymond,
actually i have to show, one more text in the same place, so it was not useful (or i m not getting how to do it with include text)
Anyhow thanks a lot.
2014 Jan 07 1:22 PM
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |