2008 Sep 25 10:55 AM
Hi experts ,
i wote code for displaying sales text but it goes to short dump when debugging the code also when it reaches FM it goes to Dump
TABLES:VBAK.
SELECT-OPTIONS : S_VBELN FOR VBAK-VBELN.
DATA: BEGIN OF ITAB_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
ARKTX LIKE VBAP-ARKTX,
END OF ITAB_VBAP.
data: begin of itab occurs 0,
text type string,
end of itab.
SELECT VBELN POSNR ARKTX FROM VBAP INTO TABLE ITAB_VBAP WHERE VBELN IN S_VBELN.
LOOP AT ITAB_VBAP.
WRITE: / ITAB_VBAP-VBELN,ITAB_VBAP-POSNR,ITAB_VBAP-ARKTX.
ENDLOOP.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = '0001'
LANGUAGE = SY-LANGU
NAME = 0000004969000010
OBJECT = 'VBBP'
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
TABLES
LINES = itab
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 sy-subrc EQ 0.
loop at itab.
write: / itab-text.
endloop.
ELSE.
WRITE:/ 'Sy-Subrc = ', sy-subrc.
ENDIF.
2008 Sep 25 11:30 AM
Find your code corrected now..
REPORT ZTEST1 NO STANDARD PAGE HEADING LINE-SIZE 255.
TABLES:VBAK.
SELECT-OPTIONS : S_VBELN FOR VBAK-VBELN.
DATA: BEGIN OF ITAB_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
ARKTX LIKE VBAP-ARKTX,
END OF ITAB_VBAP.
*data: begin of itab occurs 0,
*text type string,
*end of itab.
data : itab type standard table of TLINE with header line.
data : v_name type THEAD-TDNAME.
data : v_id type THEAD-TDID.
data : v_object type THEAD-TDOBJECT.
v_name = '0000004969000010'.
v_id = '0001'.
v_object = 'VBBP'.
SELECT VBELN POSNR ARKTX FROM VBAP INTO TABLE ITAB_VBAP WHERE VBELN IN S_VBELN.
LOOP AT ITAB_VBAP.
WRITE: / ITAB_VBAP-VBELN,ITAB_VBAP-POSNR,ITAB_VBAP-ARKTX.
ENDLOOP.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
id = v_id
language = 'E'
name = v_name
object = v_object
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
tables
lines = itab
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 sy-subrc EQ 0.
loop at itab.
write: / itab.
endloop.
ELSE.
WRITE:/ 'Sy-Subrc = ', sy-subrc.
ENDIF.
Regards,
Prashant
2008 Sep 25 10:58 AM
Hi,
Compare your program with this sample code
REPORT z_test1.
TABLES:
thead.
PARAMETERS:
p_vbeln TYPE vbak-vbeln.
PARAMETERS:
p_textid TYPE thead-tdid.
DATA:
BEGIN OF t_thead OCCURS 0.
INCLUDE STRUCTURE thead.
DATA:
END OF t_thead.
DATA:
w_line TYPE i,
w_idx TYPE i,
w_flag TYPE i.
DATA:
BEGIN OF t_tline OCCURS 0.
INCLUDE STRUCTURE tline.
DATA:
END OF t_tline.
DATA:
w_test TYPE thead-tdname.
START-OF-SELECTION.
w_test = p_vbeln.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = p_textid
language = sy-langu
name = w_test
object = 'VBBK'
TABLES
lines = t_tline
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 NE 0.
MESSAGE 'HEADER TEXT NOT FOUND' TYPE 'I'.
ENDIF.
END-OF-SELECTION.
LOOP AT t_tline.
WRITE: / t_tline-tdline.
ENDLOOP.
Regards
Abhijeet
2008 Sep 25 10:59 AM
Hi,
NAME = '0000004969000010'
instead of
NAME = 0000004969000010
Regards, Dieter
Your itab isn't correct. Try this:
DATA: ITAB TYPE TABLE OF TLINE WITH HEADER LINE.
Regards, Dieter
Edited by: Dieter Gröhn on Sep 25, 2008 12:06 PM
2008 Sep 25 11:00 AM
hi,
u cannot pass values directly to that fm.
use this.
data : W_THEAD LIKE THEAD.
data:it_tline like tline occurs 0 with header line.
W_THEAD-TDSPRAS = 'EN'.
W_THEAD-TDID = 'ST'.
W_THEAD-TDOBJECT = 'TEXT'.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
id = W_THEAD-TDID
language = W_THEAD-TDSPRAS
name = VAR
object = W_THEAD-TDOBJECT
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
tables
lines = it_tline
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
.
2008 Sep 25 11:00 AM
Hi,
You haven't mentioned the error that you are getting, I guess that it is a type conflict when calling the function module. If this is the case use variables of the correct type when passing the parameters to the function e.g.
form show_text using i_object i_id i_iqnum i_posnr.
data: ls_thead type thead,
lv_name type tdobname.
clear gt_lines.
concatenate i_iqnum i_posnr into lv_name.
ls_thead-tdid = i_id.
ls_thead-tdname = lv_name.
ls_thead-tdobject = i_object.
ls_thead-tdspras = sy-langu.
call function 'READ_TEXT'
exporting
id = ls_thead-tdid
language = ls_thead-tdspras
name = ls_thead-tdname
object = ls_thead-tdobject
importing
header = ls_thead
tables
lines = gt_lines
exceptions
not_found = 4
others = 8.
endform.
Regards,
Darren
2008 Sep 25 11:01 AM
Hi,
1. Where do want to get text? At header level or Item level?
At header level Text Object VBBK
At item level Text Object VBBP.
2. Uncomment the EXCEPTIONS, Handle exceptions.
Regards,
Raju.
2008 Sep 25 11:04 AM
Hi,
maybe itab has a wrong definition.
Try
data itab type table of tline.
2008 Sep 25 11:10 AM
Hi,
Dump due to of incorrect declaration of itab.
Please check,
Regards
jana
2008 Sep 25 11:11 AM
2008 Sep 25 11:16 AM
Hi,
Check the type of LINE .
Table you are passing in the FM should have the same structure of LINE unless it will go to DUMP.
2008 Sep 25 11:30 AM
Find your code corrected now..
REPORT ZTEST1 NO STANDARD PAGE HEADING LINE-SIZE 255.
TABLES:VBAK.
SELECT-OPTIONS : S_VBELN FOR VBAK-VBELN.
DATA: BEGIN OF ITAB_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
ARKTX LIKE VBAP-ARKTX,
END OF ITAB_VBAP.
*data: begin of itab occurs 0,
*text type string,
*end of itab.
data : itab type standard table of TLINE with header line.
data : v_name type THEAD-TDNAME.
data : v_id type THEAD-TDID.
data : v_object type THEAD-TDOBJECT.
v_name = '0000004969000010'.
v_id = '0001'.
v_object = 'VBBP'.
SELECT VBELN POSNR ARKTX FROM VBAP INTO TABLE ITAB_VBAP WHERE VBELN IN S_VBELN.
LOOP AT ITAB_VBAP.
WRITE: / ITAB_VBAP-VBELN,ITAB_VBAP-POSNR,ITAB_VBAP-ARKTX.
ENDLOOP.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
id = v_id
language = 'E'
name = v_name
object = v_object
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
tables
lines = itab
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 sy-subrc EQ 0.
loop at itab.
write: / itab.
endloop.
ELSE.
WRITE:/ 'Sy-Subrc = ', sy-subrc.
ENDIF.
Regards,
Prashant
2008 Sep 25 11:34 AM
2008 Sep 25 12:00 PM
Hi Gupta ,
i got the answr but how to display the sales text for all sales orders which given values of selection options
2008 Sep 25 12:46 PM
Loop around all the sales orders selected and then read the text for each finally moving the results to another internal table.
Dont forget you will need to refresh all internal tables and variables within the loop. Once you come out of the loop you will have the sales text for all given orders. There is no way of doing this with 1 call.
2008 Sep 25 1:00 PM
2008 Sep 25 1:20 PM
Hi Surendra,
I checked the code you are getting single text because in the name field you are passing single combination of vbeln and posnr.
create an internal table with the field name.
Now concatenate vbeln and posnr into name field of internal table.
Append all combination into internal table.
Now inside Loop ....endloop of that internal table call READ_TEXT and pass the name field of internal table to the name field of the READ_TEXT FM.
Now for each combination of VBELN and POSNR it will run READ_TEXT and store the text in line internal table.
An dyou will get all teh corresponding text of sales order.
2008 Sep 25 1:29 PM
2008 Sep 25 1:33 PM
Hi surendra,
I have created what i said in my previous thread, But you have to pass the ID and OBJECT according to your requirements.
check this -
TABLES:VBAK.
SELECT-OPTIONS : S_VBELN FOR VBAK-VBELN.
DATA: BEGIN OF ITAB_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
ARKTX LIKE VBAP-ARKTX,
END OF ITAB_VBAP.
data : itab type table of TLINE with header line.
data : begin of fs_name,
v_name type THEAD-TDNAME,
end of fs_name.
Data:t_name like table of fs_name.
SELECT VBELN POSNR ARKTX FROM VBAP INTO TABLE ITAB_VBAP WHERE VBELN IN S_VBELN.
LOOP AT ITAB_VBAP.
WRITE: / ITAB_VBAP-VBELN,ITAB_VBAP-POSNR,ITAB_VBAP-ARKTX.
concatenate itab_vbap-vbeln itab_vbap-posnr into fs_name-v_name.
append fs_name to t_name.
clear fs_name.
ENDLOOP.
Clear fs_name.
Loop at t_name into fs_name.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = '0001'
LANGUAGE = sy-langu
NAME = fs_name-v_name
OBJECT = 'VBBP'
*ARCHIVE_HANDLE = 0
*LOCAL_CAT = ' '
*IMPORTING
*HEADER =
TABLES
LINES = itab
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 NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endloop.
IF sy-subrc EQ 0.
loop at itab.
write: / itab-TDFORMAT,
itab-TDLINE.
endloop.
ELSE.
WRITE:/ 'Sy-Subrc = ', sy-subrc.
ENDIF.
I am not sure whether ID or OBject field to be changed accordingly or not .
Hope it will help you.
Regards,
sujit
2008 Sep 25 12:00 PM