2007 Nov 23 5:10 AM
hi can anybody help me regarding read_text FM ,iam using this FM in my report and want to print the text in ME41 in my sapscript, text is getting printed but only one text is getting printed for other items also ,where as it is different for other items . Ex for item no 0010 its text is AS PER SUPPLY and for item no 0020 it is HEAD : 45 but for item no 0020 it printing AS PER SUPPLY.
pls chek my coding
loop at itab .
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
id = 'A01'
language = 'E'
name = ITAB-TDNAME
object = 'EKPO'
IMPORTING
HEADER = TESTFLD
tables
lines = 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 <> 0.
ENDIF.
IF sy-subrc <> 0.
flag = 1.
ELSEIF sy-subrc = 0.
flag = 0.
if not tline[] is initial.
LOOP AT tline into wa_tline .
read table tline with key tdname.
TLINE-tdline = wa_tline-TDLINE.
append tline1.
ENDLOOP.
ENDIF.
ENDIF.
ENDLOOP.
and passing &tline& to sapscipt
Thank.
2007 Nov 23 5:14 AM
change this way:
if not tline[] is initial.
LOOP AT tline into wa_tline .
<call write form>
ENDLOOP.
ENDIF.
ENDIF.
in script put: &wa_tline&
reward if solved
2007 Nov 23 5:16 AM
You must be passing line item number inthe ITAB-TDNAME.
I think they are the last 5 digits.
Put this FM in the LOOP on your item details and pass the last 5 digits as the line item number.
Regards,
Naimesh Patel
2007 Nov 23 5:20 AM
iam passing
concatenate itab-ebeln itab-ebelp into ITAB-TDNAME.
i didnot get u iam passing tjis fm in loop only.
thanks
2007 Nov 23 5:23 AM
Ok.. Are you refreshing your table <b>tline[]</b> which brings you the text from the READ_TEXT?
Change this also:
(remove the read statment)
LOOP AT tline into wa_tline .
TLINE1-tdline = wa_tline-TDLINE. "<<
append tline1. " <<
ENDLOOP.
Regards,
Naimesh Patel
2007 Nov 23 5:24 AM
into the script u are passing &tline&
u have to pass either &tline-tdline& or &wa_tline&
although this wont make much difference,
try inside the loop before read_text , refresh tline internal table and see,
i suspect the FM fails to read data for second item
2007 Nov 23 5:34 AM
2007 Nov 23 5:56 AM
hi pl help me its urgent iam giving here my full coding pls check my loops.
REPORT ZLALI.
tables : ekko,ekpo.
data: begin of itab occurs 0,
ebeln like ekko-ebeln,
aedat like ekko-aedat,
angdt like ekko-angdt,
lifnr like ekko-lifnr,
bsart like ekko-bsart,
matnr like ekpo-matnr,
ebelp like ekpo-ebelp,
maktx like makt-maktx,
ktmng like ekpo-ktmng,
lmein like ekpo-lmein,
TXZ01 like ekpo-TXZ01,
name1 like lfa1-name1,
adrnr like lfa1-adrnr,
telf1 like lfa1-telf1,
telfx like lfa1-telfx,
WERKS LIKE EKPO-WERKS,
EINDT LIKE EKET-EINDT,
tline like TLINE-TDLINE,
TDNAME LIKE THEAD-TDNAME,
end of itab.
DATA:TDOBJECT LIKE THEAD-TDOBJECT,
TDNAME LIKE THEAD-TDNAME,
TDID LIKE THEAD-TDID ,
TDOBNAME LIKE THEAD-TDNAME,
TLINE LIKE TLINE occurs 0 WITH HEADER LINE .
data : wa_tline like tline occurs 0 with header line, tline1 like tline occurs 0 with header line,itab1 like itab occurs 0 with header line.
*data: testfld like thead.
li like tline-tdline,
tdname like thead-tdname.
*data: begin of tlinex occurs 0.
include structure tline.
*DATA: end of tlinex.
DATA : flag TYPE i VALUE 0.
******************************************************************************************
selection-screen : begin of block b1 with frame title text-001.
select-options: ebeln for ekko-ebeln,
lifnr for ekko-lifnr,
werks for ekpo-werks.
selection-screen:end of block b1.
******************************************************************************************
select ebeln lifnr aedat angdt
into (itab-ebeln,itab-lifnr,itab-aedat,itab-angdt)
from ekko
where ebeln in ebeln
and lifnr in lifnr
and bsart = 'AN'
and ekorg in ('9600','9500')
and ekgrp in ('951','952','953','954','955','956','957','961','962','964','965','966').
select ebeln matnr ebelp ktmng lmein aedat werks TXZ01 into (ITAB-ebeln ,ITAB-matnr,ITAB-ebelp,ITAB-ktmng,ITAB-lmein,ITAB-aedat,itab-werks,itab-TXZ01)
from ekpo
where ebeln in ebeln
and werks in werks.
select single maktx into ITAB-maktx
from makt
where matnr = ITAB-matnr.
select LIFNR name1 adrnr telf1 telfx into (itab-lifnr,itab-name1,itab-adrnr,itab-telf1,ITAB-telfx)
from lfa1
where lifnr in lifnr.
SELECT SINGLE EINDT INTO ITAB-EINDT
FROM EKET
WHERE EBELN in EBELN.
concatenate itab-ebeln itab-ebelp into ITAB-TDNAME.
append ITAB.
clear : ITAB.
*
endselect.
endselect.
endselect.
loop at itab .
clear tline. refresh tline.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
id = 'A01'
language = 'E'
name = ITAB-TDNAME
object = 'EKPO'
IMPORTING
HEADER = TESTFLD
tables
lines = 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 <> 0.
ENDIF.
IF sy-subrc <> 0.
flag = 1.
ELSEIF sy-subrc = 0.
flag = 0.
if not tline[] is initial.
LOOP AT tline into wa_tline .
TLINE1-tdline = wa_tline-TDLINE.
append tline1.
ENDLOOP.
ENDIF.
ENDIF.
ENDLOOP.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
FORM = 'ZL'
LANGUAGE = SY-LANGU.
LOOP AT ITAB.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'IT2'
WINDOW = 'MAIN'
.
IF sy-subrc <> 0.
ENDIF.
ENDLOOP.
CALL FUNCTION 'CLOSE_FORM' .
IF sy-subrc <> 0.
ENDIF.
if iam giving endloop at the end of my report i.e after 'CLOSE_FORM' my reprt is executing 3 times and giving my each text one by one.
thanks