2007 Oct 25 6:34 AM
hi all,
I want to display the text for corresponding po number in simple report.
below is sample codding . but when i execute it , it goes in infinity loop and not executed . so pls suggest me that hw can i get the text for this report.
thanks in advance .
data :ctr(3) type n value 1.
DATA:F_TDOBJECT LIKE THEAD-TDOBJECT,
F_TDNAME LIKE THEAD-TDNAME,
F_TDID LIKE THEAD-TDID,
ITAB_LINES LIKE TLINE OCCURS 0 WITH HEADER LINE.
DATA:BEGIN OF ITAB1 OCCURS 10,
ebeln like ekpo-ebeln ,
DESC(72),
END OF ITAB1.
data : begin of itab occurs 0 ,
ebeln like ekko-ebeln,
bedat like ekko-bedat ,
lifnr like ekko-lifnr ,
sr_no1(3) type n ,
name1 like lfa1-name1 ,
batxt like T161T-batxt ,
bsart like ekko-bsart ,
tdline like tline-tdline ,
end of itab .
format intensified color = 5 .
format intensified off .
select * from ekko into corresponding fields of itab where bedat in date and FRGKE ne 'R' .
itab-sr_no1 = ctr .
append itab .
ctr = ctr + 1 .
endselect .
loop at itab .
select single * from T161T into corresponding fields of itab where BSART = itab-BSART and SPRAS = 'E' and BSTYP = 'F' .
modify itab TRANSPORTING batxt.
select single * from lfa1 into corresponding fields of itab where lifnr = itab-lifnr .
modify itab TRANSPORTING name1.
endloop .
clear itab .
*select * from ekpo into corresponding fields of i_ekpo where ebeln = i_ekko-ebeln .
*append i_ekpo .
loop at itab .
F_TDID = 'F01'.
F_TDNAME = itab-ebeln .
F_TDOBJECT = 'EKKO' .
*endloop .
call function 'READ_TEXT'
exporting
client = sy-mandt
id = F_TDID
language = 'E'
name = F_TDNAME
object = F_TDOBJECT
tables
lines = ITAB_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.
DESCRIBE TABLE ITAB_LINES LINES SY-TFILL.
IF SY-TFILL > 0.
LOOP AT ITAB_LINES.
ITAB1-ebeln = itab-ebeln.
ITAB1-DESC = ITAB_LINES-TDLINE.
APPEND ITAB.
CLEAR ITAB.
ENDLOOP.
ENDIF.
endloop .
read table it6 index 1.
**loop at it6.
*itab-TDLINE = IT6-TDLINE.
**MODIFY i_ekko TRANSPORTING TDLINE.
loop at itab .
write : /3 itab-sr_no1, 10 sy-vline , 11 itab-ebeln , 21 sy-vline , 22 itab-bedat , 33 sy-vline , 34 itab-lifnr , 48 sy-vline , 49 itab-name1 , 100 sy-vline , 101 itab-BATXT , 118 sy-vline , 119 ITAB1-DESC.
HIDE : Itab-EBELN .
endloop .
*CLEAR IT6.
*FREE IT6.
ULINE .
top-of-page .
format intensified color = 8.
format intensified off .
write : /3 'DATE :', SY-DATUM , 35 ' PURCHASE ORDER TO BE RELEASED', 90 'PAGE NO :' ,SY-PAGNO ,
/36 'FROM' , DATE-LOW , 'TO' , DATE-HIGH .
ULINE .
format intensified color = 3.
format intensified off .
write : /3 'SR. NO' , 10 sy-vline , 11 'PO NUMBER' , 21 sy-vline , 22 'PO DATE' , 33 sy-vline , 34 'SUPPLIER CODE' , 48 sy-vline , 49 'SUPPLIERS NAME' , 100 sy-vline , 101 'DOC. TYPE' , 118 sy-vline .
ULINE .
AT LINE-SELECTION .
set parameter ID 'BES' FIELD Itab-EBELN .
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN .
hi all,
I want to display the text for corresponding po number in simple report.
below is sample codding . but when i execute it , it goes in infinity loop and not executed . so pls suggest me that hw can i get the text for this report.
thanks in advance .
data :ctr(3) type n value 1.
DATA:F_TDOBJECT LIKE THEAD-TDOBJECT,
F_TDNAME LIKE THEAD-TDNAME,
F_TDID LIKE THEAD-TDID,
ITAB_LINES LIKE TLINE OCCURS 0 WITH HEADER LINE.
DATA:BEGIN OF ITAB1 OCCURS 10,
ebeln like ekpo-ebeln ,
DESC(72),
END OF ITAB1.
data : begin of itab occurs 0 ,
ebeln like ekko-ebeln,
bedat like ekko-bedat ,
lifnr like ekko-lifnr ,
sr_no1(3) type n ,
name1 like lfa1-name1 ,
batxt like T161T-batxt ,
bsart like ekko-bsart ,
tdline like tline-tdline ,
end of itab .
format intensified color = 5 .
format intensified off .
select * from ekko into corresponding fields of itab where bedat in date and FRGKE ne 'R' .
itab-sr_no1 = ctr .
append itab .
ctr = ctr + 1 .
endselect .
loop at itab .
select single * from T161T into corresponding fields of itab where BSART = itab-BSART and SPRAS = 'E' and BSTYP = 'F' .
modify itab TRANSPORTING batxt.
select single * from lfa1 into corresponding fields of itab where lifnr = itab-lifnr .
modify itab TRANSPORTING name1.
endloop .
clear itab .
*select * from ekpo into corresponding fields of i_ekpo where ebeln = i_ekko-ebeln .
*append i_ekpo .
loop at itab .
F_TDID = 'F01'.
F_TDNAME = itab-ebeln .
F_TDOBJECT = 'EKKO' .
*endloop .
call function 'READ_TEXT'
exporting
client = sy-mandt
id = F_TDID
language = 'E'
name = F_TDNAME
object = F_TDOBJECT
tables
lines = ITAB_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.
DESCRIBE TABLE ITAB_LINES LINES SY-TFILL.
IF SY-TFILL > 0.
LOOP AT ITAB_LINES.
ITAB1-ebeln = itab-ebeln.
ITAB1-DESC = ITAB_LINES-TDLINE.
APPEND ITAB.
CLEAR ITAB.
ENDLOOP.
ENDIF.
endloop .
read table it6 index 1.
**loop at it6.
*itab-TDLINE = IT6-TDLINE.
**MODIFY i_ekko TRANSPORTING TDLINE.
loop at itab .
write : /3 itab-sr_no1, 10 sy-vline , 11 itab-ebeln , 21 sy-vline , 22 itab-bedat , 33 sy-vline , 34 itab-lifnr , 48 sy-vline , 49 itab-name1 , 100 sy-vline , 101 itab-BATXT , 118 sy-vline , 119 ITAB1-DESC.
HIDE : Itab-EBELN .
endloop .
*CLEAR IT6.
*FREE IT6.
ULINE .
top-of-page .
format intensified color = 8.
format intensified off .
write : /3 'DATE :', SY-DATUM , 35 ' PURCHASE ORDER TO BE RELEASED', 90 'PAGE NO :' ,SY-PAGNO ,
/36 'FROM' , DATE-LOW , 'TO' , DATE-HIGH .
ULINE .
format intensified color = 3.
format intensified off .
write : /3 'SR. NO' , 10 sy-vline , 11 'PO NUMBER' , 21 sy-vline , 22 'PO DATE' , 33 sy-vline , 34 'SUPPLIER CODE' , 48 sy-vline , 49 'SUPPLIERS NAME' , 100 sy-vline , 101 'DOC. TYPE' , 118 sy-vline .
ULINE .
AT LINE-SELECTION .
set parameter ID 'BES' FIELD Itab-EBELN .
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN .
2007 Oct 25 6:38 AM
Hi Prasad,
You have not following standard coding guidelines.
Please change following:
1. Select query should not be with SELECT ENDSELECT.. remove ENdselect.. retrieve all the data into internal table without endselect
select * from ekko into table itab where bedat in date and FRGKE ne 'R' .ctr = 1.
loop at itab.
itab-sr_no1 = ctr .
ctr = ctr + 1 .
modify itab.
endloop.2. Select query should not be inside a Loop. Instead use FOR ALL ENTRIES
if not itab[] is initial.
select * from mara
into table imara
for all entries in itab
where matnr = itab-matnr.
endif.
2007 Oct 25 6:39 AM
Hi
Since you are fetching the Header text for the PO
keep it in the EKKO table Internal table Loop and append to the same internal table
into a last text field Or read the it_ekko and pass the EBELn field to this fun module OBJECTNAME field
Regards
Anji
2007 Oct 25 6:57 AM
There is an error in the SELECT query
select * from ekko into corresponding fields of itab where bedat in date and FRGKE ne 'R' .
itab-sr_no1 = ctr .
append itab .
ctr = ctr + 1 .
endselect .
(bedat in date) what is the value of date, its not passed anywhere.
Another thing I noted is you have written
LOOP AT itab.
LOOP AT itab_lines.
APPEND itab.
ENDLOOP.
ENDLOOP.
Its possible that itab gets added with values everytime and there is no way the loop can stop.
Check on the looping. Otherwise the report works fine. To check on that comment the SELECT query mentioned above you can see the result for yourself.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |