2006 Jun 20 6:38 PM
Hi everyone,
please take a look at this code
data delvryacct like thead occurs 2 with header line.
data line like tline occurs 2 with header line.
data: txtid like rstxt-tdid,
lang like rstxt-tdspras,
txtname like rstxt-tdname,
txtobj like rstxt-tdobject.
txtid = ekpo-werks. (passing default during run time as 340b)
lang = 'E'.
txtname = ekko-lifnr. (passing during run time or debug mode 112456)
txtobj = 'LFA1'.
call function 'READ_TEXT'
exporting
id = txtid
language = lang
name = txtname
object = txtobj
importing
header = delvryacct
tables
lines = line
exceptions not_found = 1 others = 2.
case sy-subrc.
when 0.
read table line index 1.------- line is empty sy-subrc = 0
move line-tdline to e1edka1-ablad.
endcase.
Please let me know if iam missing anything
2006 Jun 20 6:41 PM
Swathi,
What is the issue you are facing here?
If you are not sure of the parameter values, just go the transaction where you can fill this text online and double click on the editor so that it opens in the full screen mode. Now, in the menu Go To-->Header, you can find the parameter values for TDOBJECT and TDID. TDNAME might be the vendor id like you are passing here.
Regards,
Ravi
Note : Please mark the helpful answers
2006 Jun 20 6:44 PM
2006 Jun 20 6:44 PM
HI,
look at the below code...
REPORT ZTEXT .
TABLES: PBIM.
* stxh, stxl, stxb - trans tables for text
* ttxit - text on text-ids
* ttxot - Short texts on text objects
* Transaction MD63
SELECT-OPTIONS: S_MATNR FOR PBIM-MATNR,
S_WERKS FOR PBIM-WERKS.
DATA: BEGIN OF HTEXT.
INCLUDE STRUCTURE THEAD.
DATA: END OF HTEXT.
DATA: BEGIN OF LTEXT OCCURS 50.
INCLUDE STRUCTURE TLINE.
DATA: END OF LTEXT.
DATA: BEGIN OF DTEXT OCCURS 50.
DATA: MATNR LIKE PBIM-MATNR.
INCLUDE STRUCTURE TLINE.
DATA: END OF DTEXT.
DATA: TNAME LIKE THEAD-TDNAME.
SELECT * FROM PBIM WHERE WERKS IN S_WERKS.
MOVE PBIM-BDZEI TO TNAME.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
ID = 'PB'
LANGUAGE = 'E'
NAME = TNAME
OBJECT = 'PBPT'
* ARCHIVE_HANDLE = 0
IMPORTING
HEADER = HTEXT
TABLES
LINES = LTEXT
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
LOOP AT LTEXT.
IF LTEXT-TDLINE NE ''.
MOVE LTEXT-TDLINE TO DTEXT-TDLINE.
MOVE PBIM-MATNR TO DTEXT-MATNR.
APPEND DTEXT.
ENDIF.
ENDLOOP.
ENDSELECT.
LOOP AT DTEXT.
WRITE:/ DTEXT-MATNR, DTEXT-TDLINE.
ENDLOOP.
Thanks
Sudheer
2006 Jun 20 6:46 PM
hi swathi,
try
case sy-subrc.
when 0.
loop at line.
read table line index 1.
endloop.
hope this helps,
priya.
2006 Jun 20 6:52 PM
Are you sure your TDID is plant id? I haven't seen such configuration anywhere. Also, for text name, enter LIFNR in internal format '0000112456' instead of '112456'. Can you check in any standard transaction for this text? If so, go to the long text view of this text and in the menu, 'Go to-->Header' should tell you how the text name should be, what the text id is and what the text object is.
2006 Jun 20 6:52 PM
2006 Jun 20 7:04 PM
hI gUYS WHEN I CHANGED THE
txtid = ekpo-werks. TO TXTID = '340'.
txtname = ekko-lifnr to txtname = '0000112456'.
I got the internal table populated . i want to know what if i want to use another vendor number .
so i can give only hard core values or is there any way i declared in the first method
txtid = ekpo-werks.
txtname = ekko-lifnr
so that it would cover all vendors.
Thanks in advance.
2006 Jun 20 7:15 PM
2006 Jun 20 7:19 PM
As I said, you have to find that out from the transaction where you enter this text.
TEXT ID, TEXT OBJECT will not change. You will only change the LIFNR which will be your TEXT NAME and I don't know why you want to use WERKS.
What texts are these, vendor, material master, PO header, PO item which one?
2006 Jun 20 7:20 PM
Nope Rich,
I just took 1 value from lfa1 table.
Rich can you tell me how to pass all the possiblities i.e for different vendors rather than a single vendor
Thanks
2006 Jun 20 7:21 PM
You can only read the text for one vendor at a time, so you must do this in a loop. Here is a sample program illitrating this.
report zrich_0001.
data: ilfa1 type table of lfa1 with header line.
data: lines type table of tline with header line.
data: objkey like thead-tdname.
select-options: s_lifnr for ilfa1-lifnr.
start-of-selection.
select * into table ilfa1 from lfa1
where lifnr in s_lifnr.
loop at ilfa1.
objkey = ilfa1-lifnr.
clear lines. refresh lines.
perform read_text tables lines
using '0001' " Or '0002'
'LFA1'
objkey.
if not lines[] is initial.
write:/ 'This is text for vendor', ilfa1-lifnr.
loop at lines.
write:/ lines-tdline.
endloop.
endif.
endloop.
*---------------------------------------------------------------------*
* FORM read_text *
*---------------------------------------------------------------------*
form read_text tables lines
using id
object
name.
* Read SAPscript Text
call function 'READ_TEXT'
exporting
client = sy-mandt
id = id
language = sy-langu
name = name
object = object
tables
lines = lines
exceptions
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
others = 8.
endform.Regards,
Rich Heilman
2006 Jun 20 7:29 PM
Thanks Rich,
I have one more Rich,
Iam creating a requistion using bapi_requistion_create and then creating po using ME59 . Iam not mentioning vendor number at anywhere in my program.but when i check that purchasing order i see a vendor no and for that vendor i need text. can you please let me know how to proceed about this.
MY question
1)how the vendor number is getting
2)how to retrieve text for that vendor
Thannks
2006 Jun 20 7:59 PM
2006 Jun 20 8:56 PM
Hi Rich,
I don't see any vendor assigned in EORD TABLE FOR WHICH IAM TRYING TO CREATE PO.bUT WHEN I CREATE A PURCHASE ORDER FOR THIS PARTICULAR MATERIAL ITS DISPLAYS A VENDOR WHICH I CHECKED IN EORD TABLE IS ASSIGNED TO ANOTHER MATERIAL.
pLEASE LET ME KNOW