07-17-2008 12:33 PM
Hi Abapers,
I have more than 5000 materials for update basic Data text inside Material Master.
how to update basic data text using abap programe? is there any bapi or normal program?.
anybody give me sample of this.
Thanks
S.Muthu.
IT Dept.
07-17-2008 12:53 PM
Look at program RMDATIND, (well documented), or use LSMW. Oh, and there's a function module "MAINTAIN_MATERIAL_DARK", IIRC.
And yes, there are BAPIs. Did you look in transaction BAPI?
matt
07-17-2008 1:07 PM
Hi
You can do by using the FM SAVE_TEXT.
Just populate text into table i_tline.
Local data declaration
DATA: l_wa_thead TYPE thead, " Header
l_wa_tline TYPE tline. " Work area for tline
Populate header
l_wa_thead-tdobject = c_obj_material.
l_wa_thead-tdname = wa_data-matnr.
l_wa_thead-tdid = c_id_best.
l_wa_thead-tdspras = sy-langu.
l_wa_thead-tdluser = sy-uname.
l_wa_thead-tdfdate = sy-datum.
l_wa_thead-tdtxtlines = '1'.
IF i_tline[] IS NOT INITIAL.
l_wa_tline-tdformat = c_slash.
APPEND l_wa_tline TO i_tline.
ENDIF.
Text shd start from next line
l_wa_tline-tdformat = c_slash.
CONCATENATE c_text wa_data-text
INTO l_wa_tline-tdline SEPARATED BY space.
Append the new text to the int table
APPEND l_wa_tline TO i_tline and l_wa_thead
C* Local data declaration
DATA: l_wa_thead TYPE thead, " Header
l_wa_tline TYPE tline. " Work area for tline
Populate header
l_wa_thead-tdobject = c_obj_material.
l_wa_thead-tdname = wa_data-matnr.
l_wa_thead-tdid = c_id_best.
l_wa_thead-tdspras = sy-langu.
l_wa_thead-tdluser = sy-uname.
l_wa_thead-tdfdate = sy-datum.
l_wa_thead-tdtxtlines = '1'.
IF i_tline[] IS NOT INITIAL.
l_wa_tline-tdformat = c_slash.
APPEND l_wa_tline TO i_tline.
ENDIF.
Text shd start from next line
l_wa_tline-tdformat = c_slash.
CONCATENATE c_text wa_data-text
INTO l_wa_tline-tdline SEPARATED BY space.
Append the new text to the int table
APPEND l_wa_tline TO i_tline.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
client = sy-mandt
header = l_wa_thead
savemode_direct = c_check
TABLES
lines = i_tline
EXCEPTIONS
id = 1
language = 2
name = 3
object = 4
OTHERS = 5.
IF sy-subrc = 0.
COMMIT WORK.
endif.
07-17-2008 1:38 PM
Hi,
Plz look at the code below:
TYPES: BEGIN OF d_material,
material TYPE mara-matnr,
basic_text TYPE tline-tdline,
END OF d_material.
DATA: i_line LIKE TABLE OF tline WITH HEADER LINE,
head LIKE thead,
t_material TYPE STANDARD TABLE OF d_material,
wa_material TYPE d_material.
This internal table T_MATERIAL shud contain your 5000 material nos.
along with the BASIC TEXT that u want to insert.
LOOP AT t_material INTO wa_material.
To insert leading zeroes
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_material
IMPORTING
output = wa_material.
head-tdobject = 'MATERIAL'.
head-tdname = wa_material-material. "shud be with leading zeroes
head-tdid = 'GRUN'.
head-tdspras = 'EN'.
i_line-tdline = wa_material-basic_text.
APPEND i_line.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
header = head
savemode_direct = 'X'
TABLES
lines = i_line
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.
CLEAR wa_material.
ENDLOOP.
I hope it will solve your issue.
Regards,
Nadim