‎2008 Aug 26 11:53 AM
Hi Guyz,
at the moment text for material has been pickedup from mara-maktx and its only priting 40 characters(in sapscript) .. now to make it more meaningful i wanted to make it 80 characters to print on the list ..guessing i have to use function module 'Read_text' ..but ive got no idea how to use it...plz advise..
thanks
‎2008 Aug 26 11:55 AM
I think this function module has probably been mentioned a couple of times before.
YOU MAY WANT TO CLICK THE SEARCH BUTTON FIRST.
‎2008 Aug 26 11:56 AM
hi ,
*--Call to the Function Module For geting the longtext of sales text
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = '0001'
language = 'E'
name = v_name
object = 'MVKE'
TABLES
lines = i_line
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.
READ TABLE i_line INDEX 1.
MOVE : wa_readtext-matnr TO wa_longtext-matnr,
i_line-tdline TO wa_longtext-tdline.
APPEND wa_longtext TO i_longtext.
CLEAR wa_longtext.
ENDIF.
ENDIF.
ENDLOOP.
This fm Is used to fetch the long text. For this u have to pass the name , object and id.For the above function module . Iam fetching the long text maintain in the sales in the material master
‎2008 Aug 26 12:02 PM
Hi There,
Thanks for ur reply...iz ID always 0001 , wot will be value of v_name..
‎2008 Aug 26 12:04 PM
If you double click on the text area and then choose go to header from the menu on top you will get text id and other details.
‎2008 Aug 26 12:05 PM
you have to go to mm03 and check the ID there. and coming to the V_name , it is the material
‎2008 Aug 26 11:57 AM
‎2008 Aug 26 11:57 AM
Hi,
Check this sample code
REPORT z_test1.
TABLES:
thead.
PARAMETERS:
p_vbeln TYPE vbak-vbeln.
PARAMETERS:
p_textid TYPE thead-tdid.
DATA:
BEGIN OF t_thead OCCURS 0.
INCLUDE STRUCTURE thead.
DATA:
END OF t_thead.
DATA:
w_line TYPE i,
w_idx TYPE i,
w_flag TYPE i.
DATA:
BEGIN OF t_tline OCCURS 0.
INCLUDE STRUCTURE tline.
DATA:
END OF t_tline.
DATA:
w_test TYPE thead-tdname,
w_temp TYPE string VALUE 'FIRST ASSIGNMENT'.
START-OF-SELECTION.
w_test = p_vbeln.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = p_textid
language = sy-langu
name = w_test
object = 'VBBK'
TABLES
lines = t_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.
t_tline-tdline = w_temp.
APPEND t_tline.
ENDIF.
END-OF-SELECTION.
LOOP AT t_tline.
IF t_tline-tdline = w_temp.
w_flag = 1.
ENDIF.
ENDLOOP.
IF w_flag NE 1.
t_tline-tdline = w_temp.
APPEND t_tline.
ENDIF.
REFRESH t_thead.
t_thead-tdobject = 'VBBK'.
t_thead-tdname = w_test.
t_thead-tdid = p_textid.
t_thead-tdspras = sy-langu.
APPEND t_thead.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
client = sy-mandt
header = t_thead
savemode_direct = 'X'
TABLES
lines = t_tline
EXCEPTIONS
id = 1
language = 2
name = 3
object = 4.
IF sy-subrc NE 0.
WRITE: / 'ERROR'.
ELSE.
COMMIT WORK.
WRITE: / 'TEXT SAVED'.
ENDIF.
LOOP AT t_tline.
WRITE: / t_tline-tdline.
ENDLOOP.
Regards
Abhijeet
‎2008 Aug 26 11:58 AM
Go to the transaction from where you want to read the text from. Display the text and via the menu you can find the data you need to retrieve the text via FM READ_TEXT.
‎2008 Aug 26 11:59 AM
Hi....
Check this sample code.....
After completion of call transaction syntax or BAPI run....
lt_tline-tdformat = ''.
lt_tline-tdline = long_text. <----variable with long text
append lt_tline.
clear lt_tline.
ls_thead-tdobject = <give object name here>.
ls_thead-tdid = <give input>.
ls_thead-tdspras = sy-langu.
ls_thead-tdname = <generated number or something>.
perform read_txt changing ls_thead lt_tline[].
if sy-subrc <> 0.
perform save_txt using ls_thead lt_tline[].
endif.
endform. " save_lng_text
*&---------------------------------------------------------------------*
*& Form read_txt
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->THEAD text
* -->TLINE text
*----------------------------------------------------------------------*
form read_txt changing thead type thead
tline type standard table.
call function 'READ_TEXT'
exporting
client = sy-mandt
id = thead-tdid
language = thead-tdspras
name = thead-tdname
object = thead-tdobject
importing
header = thead
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.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " read_text
*&---------------------------------------------------------------------*
*& Form save_text
*&---------------------------------------------------------------------*
form save_txt using thead type thead
tline type standard table.
call function 'SAVE_TEXT'
exporting
* CLIENT = SY-MANDT
header = thead
savemode_direct = 'X'
tables
lines = 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.
else.
commit work.
endif.
endform. " save_textThanks,
Naveen.i
‎2008 Aug 26 12:00 PM
ähm well, the dataelement of mara-maktx is of type character with length 40.
Thats why it´s called material short text.
you can/should not change its size.
now i expect you want to use the material maindata text.
therefor the usage is:
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'GRUN'
language = sy-langu
name = lv_matnr "the materialnumber of the material whichs maindatatext
"you want to read.
object = 'MATERIAL'
TABLES
lines = gt_tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
‎2008 Aug 26 12:01 PM
use READ_TEXT Function Module
Here is the Example for fetching the Material Text.
DATA:v_matexn TYPE thead-tdname,
v_str TYPE i,
v_count TYPE i,
V_SPACE TYPE STRING.
IF v_mat CA sy-abcde.
v_str = STRLEN( v_mat ).
v_count = 18 - v_str.
CONCATENATE wa_vbrk-vkorg wa_vbrk-vtweg INTO V_SPACE.
SHIFT V_SPACE RIGHT BY V_COUNT PLACES.
CONCATENATE V_MAT V_SPACE INTO V_MATEXN.
ELSE.
CONCATENATE v_mat wa_vbrk-vkorg wa_vbrk-vtweg INTO v_matexn.
ENDIF.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = '0001'
language = 'E'
name = v_matexn
object = 'MVKE'
TABLES
lines = i_mat_txt
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.
loop through i_mat_txt and print tdline.
‎2008 Aug 26 12:25 PM
hi ...
iam in mm03 and i cant see any ids there...wot id mean?
and secondly where abouts iis text area?
plz advise..
‎2008 Aug 26 12:40 PM
Text Name 000000000000000637 (18 chars material)
Language EN or sy-langu
Text ID GRUN "Basic data text
Text Object MATERIAL "Material texts
"There are TextIDs : BEST , GRUN, or IVER
Plant level
Textname (18 chars material) + PLANT
Language EN or sy-langu
Text ID LTXT
Text Object MDTXT
Sales Text
Textname (18 chars material) + SalesOrg+Dist.Chanel
Language EN or sy-langu
Text ID 0001
Text Object MVKE