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

Problem with creating material using BAPI_MATERIAL_SAVEDATA.

Former Member
0 Likes
1,716

Dear All,

I am trying to create material using BAPI BAPI_MATERIAL_SAVEDATA for MM41 i,e material master. I have to give lots of fields from excel file. The problem is I am unable to get the date fields necessary for my material to create. Like in my excel I have fields like MVKE-LSTFL MVKE-LDVFL and so on. Here LDVFL is a date field. I am not getting this field anywhere in this BAPI. Please tell me what to do. Should I use another BAPI and what is that ?

Thanks in advance.

Best regards,

Rosaline.

11 REPLIES 11
Read only

Former Member
0 Likes
1,512

Hi

If the field is not managed by standard structure, you can try to manage it by EXTENSIONIN

Max

Read only

0 Likes
1,512

Thanks Max for your reply. Do you mean extension by appending those fields to BAPI structure ?

With regards,

Rosaline.

Read only

0 Likes
1,512

Hi

yes

This parameter EXTENSIONIN and EXTENSIONINX are based on structure BAPIPAREX, in the first field BAPIPAREX-STRUCTURE you need to indicate the table you need to update, so:

BAPIPAREX-STRUCTURE = 'BAPI_TE_MVKE'.

now BAPI_TE_MVKE is another sturcture, and you can enhance it in order to add new fields (standard and custom), so you need to move it to other field of BAPIPAREX.

This is a sample:

TABLES: BAPI_TE_MVKE, BAPI_TE_MVKEX.

TABLES: BAPIPAREX.

MVKE-LDVFL

BAPI_TE_MVKE-SALES_ORG = ......

BAPI_TE_MVKE-DISTR_CHAN = .......

BAPI_TE_MVKE-<new field> = ..... (in your case BAPI_TE_MVKE-LDVFL = ......)

BAPI_TE_MVKE-<new_field> = ...... (in your case BAPI_TE_MVKE-LSTFL = ......)

BAPI_TE_MVKEX-SALES_ORG = ......

BAPI_TE_MVKEX-DISTR_CHAN = .......

BAPI_TE_MVKEX-<new field> = 'X'. (in your case BAPI_TE_MVKEX-LDVFL = ......)

BAPI_TE_MVKEX-<new_field> = 'X'. (in your case BAPI_TE_MVKE-LSTFL = ......)

EXTENSIONIN--STRUCTURE = 'BAPI_TE_MVKE'.

EXTENSIONIN+30 = BAPI_TE_MVKE.

APPEND EXTENSIONIN.

CLEAR BAPIPAREX.

BAPIPAREX--STRUCTURE = 'BAPI_TE_MVKE'.

BAPIPAREX+30 = BAPI_TE_MVKE.

APPEND BAPIPAREX TO EXTENSIONIN.

BAPIPAREX--STRUCTURE = 'BAPI_TE_MVKEX'.

BAPIPAREX+30 = BAPI_TE_MVKEX.

APPEND BAPIPAREX TO EXTENSIONINX.

Max

Read only

0 Likes
1,512

Thanks Max for your help. I am trying to use this idea.

With regards,

Rosaline.

Read only

JL23
Active Contributor
0 Likes
1,512

maybe you should use BAPI_RETAILMATERIAL_CREATE

Read only

asik_shameem
Active Contributor
0 Likes
1,512

Why don't you use BAPI_MATERIAL_MAINTAINDATA_RT ?

Read only

0 Likes
1,512

Hi Asik,

Thanks for your reply. I tried to use this function. Here i got all my necessary fields. But still I am getting message type E after processing data from excel. Portion of code is given below. Plz help.


LOOP AT t_article.
 BAPIE1MATHEAD-MATERIAL = T_ARTICLE-MATNR.
 BAPIE1MATHEAD-MATL_TYPE = T_ARTICLE-MTART.
 BAPIE1MATHEAD-MATL_GROUP = T_ARTICLE-MATKL.
 BAPIE1MATHEAD-MATL_CAT   = T_ARTICLE-ATTYP.
 BAPIE1MATHEAD-REF_MATL  = T_ARTICLE-RMATN.

 IT_CLIENTDATA-TRANS_GRP = T_ARTICLE-TRAGR.
 IT_CLIENTDATA-DIVISION = T_ARTICLE-SPART.
 IT_CLIENTDATAX-TRANS_GRP = 'X'.
 IT_CLIENTDATAX-DIVISION = 'X'.

 IT_ADDCLIENTDATA-LOADINGGRP = T_ARTICLE-WLADG.
 IT_ADDCLIENTDATA-LI_PROC_ST = T_ARTICLE-LSTFL.
 IT_ADDCLIENTDATA-LI_PROC_DC = T_ARTICLE-LSTVZ.
 IT_ADDCLIENTDATA-VAL_CLASS  = T_ARTICLE-WBKLA.
 IT_ADDCLIENTDATAX-LOADINGGRP = 'X'.
 IT_ADDCLIENTDATAX-LI_PROC_ST = 'X'.
 IT_ADDCLIENTDATAX-LI_PROC_DC = 'X'.
 IT_ADDCLIENTDATAX-VAL_CLASS  = 'X'.

 IT_MATDESC-MATL_DESC = T_ARTICLE-MAKTX.
 IT_MATDESC-LANGU = 'EN'.

 IT_PLANTDATA-MRP_CTRLER = T_ARTICLE-DISPO1.
 IT_PLANTDATA-MRP_CTRLER = T_ARTICLE-DISPO2.
 IT_PLANTDATA-PLND_DELRY = T_ARTICLE-PLIFZ1.
 IT_PLANTDATA-PLND_DELRY = T_ARTICLE-PLIFZ2.
 IT_PLANTDATA-REORDER_PT = T_ARTICLE-MINBE.
 IT_PLANTDATA-MRP_CTRLER = 'X'.
 IT_PLANTDATA-PLND_DELRY = 'X'.
 IT_PLANTDATA-REORDER_PT = 'X'.

 IT_SALESDATA-SALES_ORG = T_ARTICLE-VKORG.
 IT_SALESDATA-DISTR_CHAN = T_ARTICLE-VTWEG.
 IT_SALESDATAX-SALES_ORG = 'X'.
 IT_SALESDATAX-DISTR_CHAN = 'X'.

 APPEND : IT_CLIENTDATA, IT_CLIENTDATAX, IT_ADDCLIENTDATA, IT_ADDCLIENTDATAX,
          IT_MATDESC, IT_PLANTDATA, IT_PLANTDATAX, IT_SALESDATA, IT_SALESDATAX.

ENDLOOP.
CALL FUNCTION 'BAPI_MATERIAL_MAINTAINDATA_RT'
  EXPORTING
    HEADDATA                   = BAPIE1MATHEAD
 IMPORTING
   RETURN                     = IT_RETURN
 TABLES
   CLIENTDATA                 = IT_CLIENTDATA
   CLIENTDATAX                = IT_CLIENTDATAX
*   CLIENTEXT                  =
*   CLIENTEXTX                 =
   ADDNLCLIENTDATA            = IT_ADDCLIENTDATA
   ADDNLCLIENTDATAX           = IT_ADDCLIENTDATAX
   MATERIALDESCRIPTION        = IT_MATDESC
   PLANTDATA                  = IT_PLANTDATA
   PLANTDATAX                 = IT_PLANTDATAX
   SALESDATA                  = IT_SALESDATA
   SALESDATAX                 = IT_SALESDATAX.

With regards,

Rosaline.

Edited by: Rosaline. on Dec 5, 2011 11:37 AM

Read only

0 Likes
1,512

What error message are you getting?

By the way, refer the FM documentation in SE37. It gives you the best explanation that how to fill the data in each structure and table.

Read only

0 Likes
1,512

Hi,

The error msg I am getting is -

Return Type: E
Messages for article : log number 0000000000013519

.

From log tcode SLG1 I have found the error is -

No entry in key field MATNR of header segment

I have read the documentation but not getting new idea yet.

With regards,

Rosaline.

Edited by: Rosaline. on Dec 7, 2011 8:46 AM

Read only

0 Likes
1,512

Hi ,

Need to pass info abt the Material views...

BASIC_VIEW = 'X'. =>Basic views 1/2

LIST_VIEW

SALES_VIEW

LOGDC_VIEW

LOGST_VIEW

POS_VIEW

regards

Prabhu

Read only

0 Likes
1,512

Thanks Prabhu. But the problem exists the same. I have given BASIC VIEW, LIST VIEW and so on. Can it be an excel file problem ? I guess the values I am passing to BAPI is not correct. Any idea ?

With regards,

Rosaline.