‎2006 Nov 14 5:27 AM
i want to read header text from sales order.if thr r more than one lines then i want to read only one line.
if user enters spaces in first lines then i want to read only first line
how can i do it.
thanks
nilesh
‎2006 Nov 14 5:33 AM
Hi,
Use the function module read_text to get the text.
And loop at the output table parameter you have passed and read only the first line. for the next loop break the statement.
Loop at itab.
if sy-tabix = 2.
exit.
endif.
write:/ ......
endloop.
regards,
Ram
pls reward points if helpful..
‎2006 Nov 14 5:33 AM
the FM READ_TEXT will return the text in the table of the fm
table : LINES
now read table LINES index <b>1</b>.
this will return the first line of the header text.
Regards
- Gopi
‎2006 Nov 14 5:35 AM
Use Function READ_TEXT.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
id =
language =
name =
object =
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
tables
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.
Here table parameter is of type TLINE.
So after execution of this function just read first line of TLINE.
Hope this will solve your purpose.
‎2006 Nov 14 5:51 AM
Hi,
Use the READ_TEXT function module with following parameters,
language = sy-langu
name = 'VBBK'
lines = tlines.
the table tlines willl contain all the lines. then u can delete those lines which u dont want....
‎2006 Nov 14 6:34 AM
Hope this will help you..
data: begin of tlinetab occurs 10.
include structure tline.
data: end of tlinetab.
**Sales order...
thead-tdobject = 'VBBK'.
thead-tdspras = sy-langu.
thead-tdlinesize = '072'.
thead-tdname = Sales order number
select single * from stxh where tdobject = thead-tdobject
and tdname = thead-tdname
and tdid = thead-tdid
and tdspras = thead-tdspras.
if sy-subrc = 0.
call function 'READ_TEXT'
exporting
client = sy-mandt
id = thead-tdid
language = thead-tdspras
name = thead-tdname
object = thead-tdobject
ARCHIVE_HANDLE = 0
importing
header = thead
tables
lines = tlinetab
exceptions
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
others = 8.
Message was edited by:
Atul Dhariwal
‎2006 Nov 14 6:38 AM
hi,
if the field length in the data dictioray is unlimited .
1.you need to create text object and link this object
with key fields of the table and reading this text and storing this text you need to use SAVE_TEXT and READ_TEXT fm's.
chk the sample code below.
1.create a text object using SE75 transaction .
2.Use FM : SAVE_TEXT to save this data with text object id.(data will be stored into STXH table).
3.Use READ_TEXT to retrive data.
sample code :
DATA: ws_thead LIKE thead,
i_tline LIKE TABLE OF tline WITH HEADER LINE.
data : x_matnr like mara-matnr.
c_mara(4) type c value 'MARA',
c_zid(4) type c value 'Z001'.
MOVE : x_matnr TO ws_thead-tdname, <-moving MATNR to store data
c_mara TO ws_thead-tdobject,
sy-langu TO ws_thead-tdspras,
c_zid TO ws_thead-tdid.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
client = sy-mandt
header = ws_thead
savemode_direct = 'X'
TABLES
lines = i_tline
EXCEPTIONS
id = 1
language = 2
name = 3
object = 4
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
DATA: lws_id LIKE thead-tdid,
lws_name LIKE thead-tdname,
lws_object LIKE thead-tdobject.
lws_id = c_zid.
lws_name = x_matnr. <- reading data using key field(MATNR)
lws_object = c_mara.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = lws_id
language = sy-langu
name = lws_name
object = lws_object
TABLES
lines = li_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.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.Regards
anver
<b><i>
pls mark all hlpful answers</i></b>