on 03-29-2009 7:13 AM
Hello everyone,
I have to print Plant address in smartform for my Invoice Document.
Plant will be taken from the sales order number.
I don't know much about the function module 'Read_Text'.
pls. explain about it. and how is it used for extracting the Plant's address.
Thanks
Regards
Tanu
Hi,
What i understood from ur query is enduser is maintaining plant address in header text of invoice.
If that is the case then only u need to use FM 'Read_text'.
First go to VF02/03 -> give invoice no.-> enter.
inside invoice -> goto -> header-> header text.
u will see all texts maintained at header level for that invoice.
If plant address is there then only you need to use read_text FM.
Steps for that -
goto 'STXH' table.-> display contents
give input in selection screen - > tdobject - 'VBBK' (for invoice header)
tdname - invoice no.
execute.
You will see no.of records for header text maintained for that invoice.
now pick up 'tdid' from that. (4 digit no.)
now goto se37 -> FM 'Read_Text' -> execute.
give input parameters -> client - > your client.
tdid -> id got from STXH table
language -> 'EN' or if any other then that one.
name - > invoice no.
object -> 'VBBK'.
after executing FM u will get entry in table 'LInes'.
double click on that and u will see actual text which was maintained in invoice header.
Ok now to display this text in smartform there are two ways-
1. just call FM 'Read_text' -> enter parameters as above and take output in one int table which is same
as table 'Lines'.
loop at int table -> field is tdline.
i.e. under one text element in smartform -
loop at int_tab.
write int_tab-tdline.
endloop.
But this is some what confusing so u can use following way -
2. in smartform create one text element .- > at top left there is one drop down -> select 'Include Text'.
Just pass parameters as above in that window.
dont forget to check the box -> 'No error if text does not exist'.
The text maintained under that id will come automatically in ur smartform.
Now if Plant address is not maintained in header text then just do this -
get plant no. from invoice, (VBRP - Werks)
get address no for that plant from T001W-adrnr.
get detailed address from ADRC table -> input this address no.
print it in smartform.
I think this will help to solve ur problem.
regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
refer this code.
pass ur plant intotvko and u will get adrnr.
pass this into adrc and get address.
SELECT adrnr from tvko into addrnum1
where vkorg = wa_vbak-vkorg.
ENDSELECT.
IF SY-SUBRC EQ 0.
SELECT * FROM ADRC INTO TABLE IT_ADRC1
WHERE ADDRNUMBER = ADDRNUM1.
READ TABLE IT_ADRC1 INTO WA_ADRC1 INDEX 1.
ABOUT READ_TEXT.
refer this and just pass ur entries.
if u dont know aboutentries then describe in detail which text u want to read.
MOVE WA_LIKP-VBELN TO TEXT_NAME1.
MOVE 'Z004' TO TEXT_ID1.
MOVE 'VBBK' TO TEXT_OBJECT1.
SELECT SINGLE TDOBJECT FROM STXH INTO TEXT_OBJECT1
WHERE TDOBJECT EQ TEXT_OBJECT1
AND TDID EQ TEXT_ID1
AND TDNAME EQ TEXT_NAME1.
if sy-subrc eq 0.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = TEXT_ID1
LANGUAGE = SY-LANGU
NAME = TEXT_NAME1
OBJECT = TEXT_OBJECT1
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
TABLES
LINES = itab_lt_tline1.
LOOP AT itab_lt_tline1 into wa_line1.
LR_NO = wa_line1-tdline(50).
ENDLOOP.
ENDIF.
no need to use read_text.
Edited by: MONIKA DHUMAL on Apr 3, 2009 10:40 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Read_text sample code :
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = zvid
language = 'R'
name = zvname
object = 'VBBK'
IMPORTING
header = thead
TABLES
lines = line
EXCEPTIONS
OTHERS = 8.
DATA: zvname LIKE thead-tdname.
DATA: zvid LIKE thead-tdid.
DATA : line LIKE tline OCCURS 0 WITH HEADER LINE
I think Id , name and Object are you can get from STXH table. Output will be in LINE.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Case 1. : Use read_text by providing the Plant address number as input to it. for that first get the Plant address number from T001w by providing Plant No as input to T001w using select query. The Output of Read_text will be storing in Tlines parameter. Then Place Tline-tdline in needed place to display the address.
Case 2 ; with out using read_text you can fetch it from ADRC Table by writing Select statements in order to provide Address number as input to ADRC. Place the ADRC Fields directly or concatenate the ADRC fields into one variable and place it in required position.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Get address number form T001w based on plant, then get address from ADRC based on this addrnumber.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.