Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to Update the Basic Data text in Material Master.

Former Member
0 Kudos

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.

3 REPLIES 3

matt
Active Contributor

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

Subhankar
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

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