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

error in BAPI_MATERIAL_SAVEDATA

anup_deshmukh4
Active Contributor
0 Likes
2,682

Hello experts

I am using BAPI_MATERIAL_GETINTNUMBER to generate the material number and then calling the

BAPI_MATERIAL_SAVEDATA Bapi for the creation but after the exectuion i am getting the return value as follows although i have given the newly generated matnr in the MATERIAL filed of HEADDATA passing structre of BAPI_MATERIAL_SAVEDATA

please suggest some solution...

TYPE E

ID MG

NUMBER 046

MESSAGE Field MATNR has been transferred inconsistently or is blank

LOG_NO

LOG_MSG_NO 000000

MESSAGE_V1 MATNR

MESSAGE_V2

MESSAGE_V3

MESSAGE_V4

PARAMETER

ROW 0

FIELD

SYSTEM TEST

___________________________________

7 REPLIES 7
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,343

Try clearing the header data.

Read the documentation and pass all the mandatory fields.

Read only

0 Likes
1,343

below is my code.....


CALL FUNCTION 'BAPI_MATERIAL_GETINTNUMBER'
  EXPORTING
    MATERIAL_TYPE          =  HEADDATA-MATL_TYPE
   INDUSTRY_SECTOR        = 'A'
   REQUIRED_NUMBERS       = '1'
 IMPORTING
   RETURN                 = RETURN_2
  TABLES
    MATERIAL_NUMBER        = GT_MATERIAL_NUMBER
          .
COMMIT WORK.
READ TABLE GT_MATERIAL_NUMBER INTO  WA_MATERIAL_NUMBER INDEX 1.
MOVE WA_MATERIAL_NUMBER-MATERIAL TO HEADDATA-MATERIAL.
move 'A' to HEADDATA-ind_sector.
move 'X' to HEADDATA-BASIC_VIEW.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
  EXPORTING
    HEADDATA                   =  HEADDATA
    CLIENTDATA                 =  CLIENTDATA
    CLIENTDATAX                =  CLIENTDATAX
    PLANTDATA                  =  PLANTDATA
    PLANTDATAX                 =  PLANTDATAX
*   FORECASTPARAMETERS         =
*   FORECASTPARAMETERSX        =
*   PLANNINGDATA               =
*   PLANNINGDATAX              =
*   STORAGELOCATIONDATA        =
*   STORAGELOCATIONDATAX       =
*   VALUATIONDATA              =
*   VALUATIONDATAX             =
*   WAREHOUSENUMBERDATA        =
*   WAREHOUSENUMBERDATAX       =
*   SALESDATA                  =
*   SALESDATAX                 =
*   STORAGETYPEDATA            =
*   STORAGETYPEDATAX           =
*   FLAG_ONLINE                = ' '
*   FLAG_CAD_CALL              = ' '
*   NO_DEQUEUE                 = ' '
*   NO_ROLLBACK_WORK           = ' '
 IMPORTING
    RETURN                     = RETURN
 TABLES
    MATERIALDESCRIPTION        = GT_MATERIALDESCRIPTION
*   UNITSOFMEASURE             =
*   UNITSOFMEASUREX            =
*   INTERNATIONALARTNOS        =
    MATERIALLONGTEXT           = GT_MATERIALLONGTEXT
*   TAXCLASSIFICATIONS         =
*   RETURNMESSAGES             =
*   PRTDATA                    =
*   PRTDATAX                   =
*   EXTENSIONIN                =
*   EXTENSIONINX               =
          .

Read only

Former Member
0 Likes
1,343

Hi,

In the table headdata, there is a flag for external number range.

Since you are using internal number range, please make sure that this flag is initiall.

Also, please dont use commit before creating the material. The commit statement clears all buffer tables.

Hope this helps,

Raj

Read only

Former Member
0 Likes
1,343

You can directly use BAPI_MATERIAL_SAVEDATA to create material...

From where your are getting the material number .....?

if you have material number in afile, take those it into internal table and pass that to the bapi BAPI_MATERIAL_SAVEDATA it wil create the material in your sap system.

Please let me know if you need further info..

Regards

Satish Boguda

Read only

former_member196299
Active Contributor
0 Likes
1,343

Hi ,

In BAPI_MATERIAL_SAVEDATA , the HEADDATA parameter should be filled with all the mandatory field values to create a material . For example , only passing the Mat. no would not do , along with that you need to pass the material type value , Industry sector and few more .

Please check the basic mandatory entries needed to create a material and pass the corresponding values to the BAPI .

The material creation should be done .

Regards,

Ranjita

Read only

anup_deshmukh4
Active Contributor
0 Likes
1,343

Self answered

Read only

0 Likes
1,343

Hi Anup,

I am also getting the same error. My material number is a external material number, I am passing that to HEADERDATA. Can you please let me know how to solve this issue?

Thank you in advance.

Regards,

Isuru