06-17-2013 2:28 PM
HI Guys,
I am facing an issue. I need to call texts from SO10 in the program. Now i went through some threads regarding this and develpoed the code accordingly, but in my case its not displaying the text.
Basically the text is an error message to check validation, which should be shown when the selection field is left blank.
I wrote the following code but its not displaying the message.
DATA BEGIN OF TEXTHEADER.
INCLUDE STRUCTURE THEAD.
DATA END OF TEXTHEADER.
DATA BEGIN OF LINES OCCURS 10.
INCLUDE STRUCTURE TLINE.
DATA END OF LINES.
DATA: l_TNAME LIKE THEAD-TDNAME,
lw_tline LIKE LINE OF lines.
CLEAR TEXTHEADER.
l_tname = 'VALIDATE_SALES_ORG'.
IF *zv3321128_mat_v-vkorg IS INITIAL.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
id = 'ST'
language = 'P' "sy-langu'
name = l_tname
object ='TEXT'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
IMPORTING
HEADER = TEXTHEADER
tables
lines = lines
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME =3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
.
LOOP AT lines INTO lw_tline.
IF lw_tline-tdline ne ' '.
WRITE: lw_tline-tdline.
ENDIF.
ENDLOOP.
Please state if anything wrong with this code.
Thanks.
06-17-2013 3:38 PM
Did you try debugging it? is *zv3321128_mat_v-vkorg empty? is table 'lines' filled after calling the FM?
06-17-2013 3:54 PM
Hello Dharmin Doshi,
Please check the ID, name, language, object, parameters correct or not.
06-18-2013 6:46 AM
hii Wallagh,
yes i debugged and checked.. the lines is getting filled with the message from SO10
06-17-2013 3:52 PM
Hi,
After the FM executes table values are filling?
Go to SE37,Type READ_TEXT in it and select where used list,
Thann you will see the difference why that is working and yours not working.
Regards,
Ravi Shankar L
06-17-2013 4:37 PM
Hi,
Try to run FM 'READ_TEXT' through se37 by giving the same input which you are passing into above code.
If it giving any error then problem will be with your input and if it returns the output then compare this with your program o/p and check in debugging step by step.
Thanks.
06-18-2013 6:47 AM
hi neha
i checked in se37.. the table entry shows the message over there.. and while debugging also.. the lines table gets filled with the text from SO10..
06-17-2013 4:39 PM
Hi Dharmin,
In all probability you must be passing wrong parameters to the FM READ_TEXT. Please check in the transaction or tell us the transaction whose SO10 text you want to show. If you do not know the transaction go to SO10 and see the text properties as,
Now pass these 4 properties and you will surely get actual text in table.
BR.
06-18-2013 6:50 AM
HI Ankit,
the text is coming in the table, but its not getting displayed..that is where I am stuck..
06-18-2013 7:03 AM
Hi Dharmin,
If text is coming in 'lines' table then debug and see why Write is not working since
LOOP AT lines INTO lw_tline.
IF lw_tline-tdline ne ' '.
WRITE: lw_tline-tdline.
ENDIF.
ENDLOOP.
Seems correct. Also you can try
LOOP AT lines. "its an internal table with header line according to your declaration
IF lines-tdline ne ' '. " or try if lines-tdline ne space.
WRITE: lw_tline-tdline.
ENDIF.
ENDLOOP.
But still i do not understand why your code will not work.
BR.
06-18-2013 7:36 AM
HI Ankit, i debugged, value is coming in lw_tline-tdline .. it passes through WRITE statement but not displaying. How would i come to know if WRITE statement is working or not since value is coming in lw_tline-tdline?
06-18-2013 7:43 AM
06-18-2013 7:54 AM
Hi Dharmin,
It would not come as pop-up.
Write your code in End-of-selection Event.
End-of-selection.
LOOP AT lines INTO lw_tline.
IF lw_tline-tdline ne ' '.
WRITE: lw_tline-tdline.
ENDIF.
ENDLOOP.
BR.
06-18-2013 11:35 AM
HI ,
Since it is inside a module, using end of selection is giving me error to end the module before using it..
06-18-2013 12:37 PM
What is your requirement ? If it is to show the Long Text as the Report Output then call the module in the End-of-Selection Event.
End-of-selection.
perform <name>.
Form <name>.
*-- Your code of above loop
endform.
BR.
06-18-2013 12:47 PM
Hi,
You said it is in module? What module is it? are you writing in function module or using module pool?
Regards,
Swarna
06-18-2013 12:58 PM
see the requirement is there is one module created to validate fields.. now inside this module i am validating this field.. if the field entry is initial than it show pop up message that "enter field value".. this message as per requirement should be maintained in SO10. so under that condition i am calling this FM read_text.. so now how do i use end-of-selection over here since i am using everything inside a module. I hope i am able to explain properly..
06-18-2013 1:00 PM
06-18-2013 3:32 AM
Hi.
There are 7 inbuilt exceptions
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME =3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
Whats the sy-subrc you get?
Cheers,
Arindam
06-18-2013 7:38 AM
06-18-2013 6:20 AM
Hi Doshi,
Provide correct language in export parameters.
problem in language specification.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
id = 'ST'
language = 'P' "sy-langu'
name = l_tname
object ='TEXT'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
IMPORTING
HEADER = TEXTHEADER
tables
lines = lines
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME =3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
.
06-18-2013 7:28 AM
Hi,
If the table 'Lines' is getting filled then debug the loop and write statement and check whether it is going to write statement or not?
Regards,
Swarna
06-18-2013 7:45 AM
Hi
What is the language you are passing?
language = 'P' "sy-langu'
Try with sy-langu.
Regards,
Venkat
06-18-2013 7:50 AM
Hi,
P is the language code for Portuguese. So assuming he has maintained the text in that language.
Cheers,
Arindam
06-18-2013 8:31 AM
Hi,
Yes I have maintained text in Portuguese language..but i also maintained it in English language and passed language as 'E' over there but still no use..
06-18-2013 12:55 PM
Check the window where you are passing and writing the text. Write some fixed text and see if that appears.
Cheers,
Arindam
06-18-2013 7:57 AM
Hi Dharmin,
when I play with READ_TEXT, I always first check if the text exist using a SELECT statement on the table STXH. (header text)
You will be able to check if text exit, if text exist in an other language, ...
regards
Fred
06-18-2013 10:40 AM
Hi Frederic,
The text is getting fetched in the table "lines" in loop statement.. but its not getting displayed..!
06-18-2013 12:42 PM
maybe it's simply because your forget "/"
do 10 times.
write : / "Toto".
enddo.
Regards
Fred
06-18-2013 8:00 AM
Hi,
Is this is only code in your program? May not be the reason, but can you keep this '/' after write statement.
LOOP AT lines INTO lw_tline.
IF lw_tline-tdline ne ' '.
WRITE: / lw_tline-tdline.
ENDIF.
ENDLOOP.
Regards,
Swarna
06-18-2013 8:12 AM
Hi Doshi,
At the standard text creating time which language are given.
The same language is give in function module.
For Ex :- We use 'EN' at the creation time.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
id = 'ST'
language = 'E' "sy-langu'
name = l_tname
object ='TEXT'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
IMPORTING
HEADER = TEXTHEADER
tables
lines = lines
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME =3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
.
06-18-2013 8:49 AM
Dear Doshi,
Here, the language P defines the Portuguese language, so the object which you made should also be in P language so please you check it in SO10 first.
Many Thanks / Himanshu Gupta
06-18-2013 10:36 AM
HI himanshu,
Yes i hav maintained text in Portuguese language..I hav even maintained it in English language and i changed and passed language as 'E' over there.. but still not displaying...
06-18-2013 12:26 PM
Hi,
Have you check the layout text position and the window size in which the text is displayed.
Cheers,
Arindam
06-18-2013 1:39 PM
Hi Dharmin,
you should use 'SYST' in place of 'ST' for id in function module.
Many Thanks / Himanshu Gupta
06-18-2013 1:47 PM
Hi Himanshu,
Please verify before you advice. Advice should be ideally correct. It should be 'ST' only. You can check the same in SO10 or in my screenshot above.
Please try to give correct guidelines.
BR.
06-18-2013 1:48 PM
The code seems correct, but where is it called, in a module pool ?
Try to add a LEAVE TO LIST-PROCESSING [AND RETURN TO SCREEN dynnr] after the LOOP/ENDLOOP with WRITE statements.
Regards,
Raymond
06-18-2013 1:56 PM
Hi Raymond,
I think it's a very simple things : write : / ...
regards
Fred
06-18-2013 2:07 PM
If the problem was only the missing of “NEW-LINE” in the write statement, at least one line would appear. When I read the initial message, I understand that nothing appears ?
Can Dharmin Doshi explain the "context" of the problem ?
Regards,
Raymond
06-18-2013 2:53 PM
You can try statement "LEAVE TO LIST-PROCESSING" before LOOP... ENDLOOP.
LEAVE TO LIST-PROCESSING.
LOOP AT lines INTO lw_tline.
IF lw_tline-tdline ne ' '.
WRITE: lw_tline-tdline.
ENDIF.
ENDLOOP.
Regards,
Narendran.S