2013 Mar 27 9:20 AM
Hi All,
I am using the FM Read_Text for reading text from S010 but its behaving strangely. With the same data if i execute the FM in SE37 transaction, i am getting proper results but while executing in ABAP , its not returning any data as well as no exception. Below is the code written, please suggest if i am lacking something.
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: name like THEAD-TDNAME,
object LIKE THEAD-TDOBJECT,
ID like THEAD-TDID.
CLEAR TEXTHEADER.
ID = '0001'.
name = GS_HD_REF-ORDER_NUMB.
object = 'VBBK'.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
id = ID
language = sy-langu
name = name
object = object
* 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
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
I checked the values while debugging & executed the FM with same values in SE37 which displays the correct results but in the program i am not getting any results.
regards
Sumit
Hi All,
I am using the FM Read_Text for reading text from S010 but its behaving strangely. With the same data if i execute the FM in SE37 transaction, i am getting proper results but while executing in ABAP , its not returning any data as well as no exception. Below is the code written, please suggest if i am lacking something.
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: name like THEAD-TDNAME,
object LIKE THEAD-TDOBJECT,
ID like THEAD-TDID.
CLEAR TEXTHEADER.
ID = '0001'.
name = GS_HD_REF-ORDER_NUMB.
object = 'VBBK'.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
id = ID
language = sy-langu
name = name
object = object
* 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
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
I checked the values while debugging & executed the FM with same values in SE37 which displays the correct results but in the program i am not getting any results.
regards
Sumit
2013 Mar 27 9:25 AM
If the FM performs fine in SE37, execute it in debug mode and check the exact format of received parameters, SE37 will perform conversion-exit between your input and actual exported parameters, and not your report.
Check GS_HD_REF-ORDER_NUMB format/length vs THEAD-NAME? I suppose something like a wrong right justify padded with 0 ?
Regards,
Raymond
2013 Mar 27 11:32 AM
Hi Sumit,
First you said you want to read a text from SO10, but in your code you are using:
id = '0001'.
object = 'VBBK'.
This object are not related to SO10, it is a standard text from Sales Order Header.
In this scenario you should use VBAK-VBELN in your "name" variable.
Regards,
Frisoni
2013 Mar 27 12:31 PM
Hi Frisoni,
I want to read the Sales Order Header only & i am getting it correct in SE37. Problem is with the program, i am still checking that.
regards
Sumit
2013 Mar 27 12:36 PM
Well, possible errors are missing leading zeros at left in VBELN number, or wrong language. Are you logging in SAP in the same language that text was written?
Frisoni
2013 Mar 27 12:49 PM
Hi Sumit,
Try to pass the same value as you input in the FM READ_TEXT.
Get the exact values from TEXT HEADER as given in the sample screenshot.
Most probably it's should be because of leading zeros issue.
Regards,
Amit
2013 Mar 28 9:57 AM
Hi Amit,
I checked the transaction SE37 & header data, its same as while debugging. Screenshots are attached but still not getting the data in abap program.
regards
Sumit
2013 Mar 28 10:35 AM
Dear Sumit,
I tested your program code and it's working fine.
If you are passing the correct values then there should not be any issue.
Please check again.
Regards,
Amit
2013 Mar 28 12:22 PM
2013 Mar 28 1:06 PM
Sy-langu is single character hence 'E' is fine.
Sumit,
there is nothing wrong with your code. try with different test cases.
Regards,
Amit
2013 Mar 28 1:51 PM
I have used this function module but declared my table differently.
data: lines type table of tline.
That's the only difference I notice between your code and mine.
2013 Mar 28 2:07 PM
hello sumit,
follow this code:
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: name like THEAD-TDNAME,
object LIKE THEAD-TDOBJECT,
ID like THEAD-TDID.
CLEAR TEXTHEADER.
ID = 'ST'.
name = 'ZSABYA'.
object = 'TEXT'.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
id = ID
language = sy-langu
name = name
object = object
* 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
.
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 LINES.
WRITE😕 LINES-TDLINE.
ENDLOOP.
Hope it will be helpfull......
Thanks
Sabyasachi
2013 Mar 28 2:45 PM