Application Development and Automation 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: 
Read only

how to add basic data text into material master?

Former Member
0 Likes
2,728

Hi anybody,

I want update only basic data text into material master. how to update basic data text ?

is it any bapi or functional module is there in abap?

anybody please tell me.

tks

s.muthu

5 REPLIES 5
Read only

Former Member
0 Likes
1,382

Hi Subramaniyan,

You can make use of BAPI_MATERIAL_EDIT Function module.

Best regards,

raam

Read only

Former Member
0 Likes
1,382

It seems that BAPI_MATERIAL_EDIT only calls the edit screen but not automated updating data according to the importing or table parameters? It seems not working.

I think BDC is better.

Read only

Former Member
0 Likes
1,382

see the fm create_text.

Read only

Former Member
0 Likes
1,382

Hi Subramanyan,

Check this function module:

CREATE_TEXT

Check out this sample program:

REPORT ZMM_INSERT_LONGTEXT.*Internal table to hold long text...

DATA:

BEGIN OF T_UPLOAD OCCURS 0,

MATNR LIKE MARA-MATNR, " Material number

ID(2) TYPE C, " Identification

LTEXT LIKE TLINE-TDLINE, " Long text

END OF T_UPLOAD,*Internal table to hold long text....

T_LINE LIKE TLINE OCCURS 0 WITH HEADER LINE.DATA:

W_GRUN LIKE THEAD-TDID , " To hold id

W_OBJECT LIKE THEAD-TDOBJECT VALUE 'MATERIAL',

" To hold object id

LV_VALUE(70). " Value to hold material number

START-OF-SELECTION.* This perform is used to upload the file

PERFORM UPLOAD_FILE.* This perform is used to place the text in MM02 transaction

PERFORM PLACE_LONGTEXT.

&----


*& Form create_text

&----


  • This routine used to create text in MM02 transaction

----


  • Passed the parameter w_grun to P_C_GRUN

  • and lv_value to P_LV_VALUE

----


FORM CREATE_TEXT USING P_C_GRUN

P_LV_VALUE. DATA:

L_ID LIKE THEAD-TDID,

L_NAME(70). MOVE : P_C_GRUN TO L_ID,

P_LV_VALUE TO L_NAME. CALL FUNCTION 'CREATE_TEXT'

EXPORTING

FID = L_ID

FLANGUAGE = SY-LANGU

FNAME = L_NAME

FOBJECT = W_OBJECT

  • SAVE_DIRECT = 'X'

  • FFORMAT = '*'

TABLES

FLINES = T_LINE

EXCEPTIONS

NO_INIT = 1

NO_SAVE = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

CLEAR LV_VALUE.

ELSE.

DELETE T_LINE INDEX 1.

ENDIF.ENDFORM. " create_text&----


*& Form upload_file

&----


  • This routine is used to upload file

----


  • No interface parameters are passed

----


FORM UPLOAD_FILE . CALL FUNCTION 'UPLOAD'

EXPORTING

  • CODEPAGE = ' '

  • FILENAME = ' '

FILETYPE = 'DAT'

  • ITEM = ' '

  • FILEMASK_MASK = ' '

  • FILEMASK_TEXT = ' '

  • FILETYPE_NO_CHANGE = ' '

  • FILEMASK_ALL = ' '

  • FILETYPE_NO_SHOW = ' '

  • LINE_EXIT = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • SILENT = 'S'

  • IMPORTING

  • FILESIZE =

  • CANCEL =

  • ACT_FILENAME =

  • ACT_FILETYPE =

TABLES

DATA_TAB = T_UPLOAD

EXCEPTIONS

CONVERSION_ERROR = 1

INVALID_TABLE_WIDTH = 2

INVALID_TYPE = 3

NO_BATCH = 4

UNKNOWN_ERROR = 5

GUI_REFUSE_FILETRANSFER = 6

OTHERS = 7

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF. SORT T_UPLOAD BY MATNR ID.

ENDFORM. " upload_file

&----


*& Form place_longtext

&----


  • This routine places the text in MM02 transaction

----


  • No interface parameters are passed

----


FORM PLACE_LONGTEXT . LOOP AT T_UPLOAD. T_LINE-TDFORMAT = 'ST'.

T_LINE-TDLINE = T_UPLOAD-LTEXT.

APPEND T_LINE. IF T_UPLOAD-ID EQ 'BT'.

MOVE T_UPLOAD-MATNR TO LV_VALUE.

MOVE 'GRUN' TO W_GRUN. "Test ID for Basic data text

PERFORM CREATE_TEXT USING W_GRUN LV_VALUE.

ENDIF. IF T_UPLOAD-ID EQ 'IT'.

CLEAR W_GRUN.

MOVE T_UPLOAD-MATNR TO LV_VALUE.

MOVE 'PRUE' TO W_GRUN. "Test ID for Inspection text

PERFORM CREATE_TEXT USING W_GRUN LV_VALUE.

ENDIF. IF T_UPLOAD-ID EQ 'IC'.

CLEAR W_GRUN.

MOVE : T_UPLOAD-MATNR TO LV_VALUE,

'IVER' TO W_GRUN.

"Test ID for Internal comment

PERFORM CREATE_TEXT USING W_GRUN LV_VALUE.

ENDIF.

ENDLOOP.ENDFORM. " place_longtext

Hope this helps you.

Regards,

Chandra Sekhar

Read only

rajesh_akarte2
Active Participant
0 Likes
1,382

Hi,

You can use CREATE_TEXT function module to fulfill your requirement.

and pass the value for TDID, TDNAME(Material Name) and TDOBJECT. and ur text in TDLINE.

for more information u can go through following link.

http://abaplovers.blogspot.com/2008/02/function-modules-create-text-and-read.html

Regards,

Rajesh Akarte