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

BAPIs not working

Former Member
0 Likes
2,685

Hi  Friends

Am  facing two issues with my program ,

1) Two  BAPIs as per suggestion by client only ,am using in program  first  BAPI is   (   BAPI_MATERIAL_SAVEDATA )  is uploading table  MARD  but for  the field   PSTAT ( Maintenance status ) Its uploading only one letter

example if value is  DE  then Bapi is uploading only 'D

2)  second BAPI for create BATCH  (  BAPI_BATCH_CREATE )  is  not uploading  data in table  MCHB  its  giving below error

   'No Batches are possible for material  XXXXXXX  in plant  XXXX '         am not sure if its data issue or  bapi is now working

If any one of you have any idea then please let me know

Thanks

Meeta

'

14 REPLIES 14
Read only

FredericGirod
Active Contributor
0 Likes
2,186

Hi,

1 -> for me this field indicates where you manage your material : MARA / MARC / MARD / MBEW ... maybe it removes your D because you didn't insert the values in the corresponding table

2 -> The batch flag is not set for your material / plant : MARC-XCHAR

regards

Fred

Read only

0 Likes
2,186

Hi  Fred  Thanks for your quick reply ,

1)  If you see the attached code am not inserting that value inside bapi only its behaving like this

     not sure why ?

2)  The batch flag is not set for your material / plant   ,  so what is the solution I should do for this

sorry am  technical consultant ...so can you guide me if its  data error  if yes then  how I can rectify it

Thanks

Meeta

Read only

0 Likes
2,186

Hi

Also I checked for  that test material  batch flag is set  it is  MACH-XCHAR = 'X'   in this table

regards

Meeta

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,186
  1. PSTAT is built from HEADDATA parameter flags
  2. As Frédéric already wrote, Flag is MARC-XCHAR, MACH is a data element and not a structure, how did you check ?

Regards,

Raymond

Read only

0 Likes
2,186

Hi Raymond   Thanks for your inputs

1)  I not find PSTAT  in HEADDATA  structure of bapi , can you please elaborate in detail how I can pass  this field data .

2) Sorry It was my typo mistake  I checked in  MARC-XCHAR  only the  flag is  X  it is set for that material .

Regards

Meeta

Read only

0 Likes
2,186
  1. PSTAT is calculated from subfields of HEADDATA, look at include L1001UEBF01 (form PSTAT_FUELLEN)
    • headdata-storage_view -> L
    • headdata-mrp_view -> D
  1. Did you forget PLANTX in BAPI_MARD?

Regards,

Raymond

Read only

JL23
Active Contributor
0 Likes
2,186

your attached code does not at all do any BAPI call, it is just a batch input for storage location data.

And it does not have the field PSTAT.

The indicator E stands for purchasing view.

It is not at all possible to have a purchasing view at storage location level, hence MARD-PSTAT can never have a DE, it could only be a DL , D for MRP data at storage location level and L to storage location data.

Read only

Former Member
0 Likes
2,186

Hi Jurgen   thanks for sharing your input here ,

Earlier BDCs were getting used  which got replaced with  BAPIs as per suggestion of client

you can see all BDC code commented and BAPIs code is there in change number 07

CH07

I saw when BDC was used to update these Tcodes then DL  was getting update but from Bapi  only

D is  getting updated  you can see  in below snap shot

Read only

JL23
Active Contributor
0 Likes
2,186

Sorry, seems I did something wrong with ctrl+F

But still your call is just this, which means only storage location data.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

    EXPORTING

      headdata             = bapimathead

      storagelocationdata  = bapi_mard

      storagelocationdatax = bapi_mardx

    IMPORTING

      return               = it_return

    TABLES

      materialdescription  = it_bapi.

and  bapimathead has nothing more than just 2 fields:

  bapimathead-material = w_matnr.

  bapimathead-mrp_view = c_yes.

What else than L in MARD_PSTAT can you expect from this code?

You have not a single field that corresponds to planning data at storage location level to get a D in PSTAT.

All BAPI_TRANSACTION_COMMIT statements are commented too.

Read only

Former Member
0 Likes
2,186

Hi Jurgen  , 

1) Actually all data uploading in MARD Table  from this BAPI  BAPI_MATERIAL_SAVEDATA'

  even  PSTAT field also updating ,

  only  issue is  from BDC its update as  DL  but  with BAPI  its updating only 'D'

eg :

in BDC code  PSTAT = DL

in BAPI code  PSTAT = D

what can we do for this at BAPI side ?

2 ) other issue is  second  bapi   BAPI_BATCH_CREATE   giving error ' 'No Batches are possible for material  XXXXXXX  in plant  XXXX '  .  and no data updating in table  MCHB .

Regards

Meeta

Read only

JL23
Active Contributor
0 Likes
2,186

The MRP4 screen of a material master is "multi-functional". you can access it by just having the plant number and you will see only the plant and client specific fields (from MARA and MARC table).

But if you add the storage location then you get as well the MRP4 screen specific fields at storage location level (from table MARD)

If you did not create this MRP view with storage location specific data, then you cannot have the D in the PSTAT field of table MARD.

Just try to go to MRP4 screen with MM03 and don't forget to enter the storage location, being in MRP 4 view  look at the status message.

If you had not maintained location specific data in MRP4 screen while creating the material, then you should see a message telling you that no data exist.

The main field needed would be MARD-DISKZ the SLoc MRP indicator

I haven't seen this your BAPI.

The error with the second BAPI is just what was already said, you can read it yourself in the long text of the message, just execute SE91 enter message class M3 and message number 201. click display and in the next screen select the message and click long text.

You try to create a batch for a material that is not batch managed.

just try to create a batch for this material using the online transaction MSC1N, you should get the same message.

Read only

Former Member
0 Likes
2,186

Hi  Jurgen   

Thanks for your inputs

c_yes = 'X' .

Actually  I added  some more parameters in  headdata of bapi

    bapimathead-basic_view = c_yes.
   bapimathead-sales_view = c_yes.
   bapimathead-purchase_view = c_yes.
   bapimathead-forecast_view  = c_yes.
   bapimathead-work_sched_view = c_yes.
   bapimathead-storage_view = c_yes.
   bapimathead-account_view = c_yes.
   bapimathead-mrp_view = c_yes.
   bapimathead-cost_view = c_yes.

and  now BAPI  updating 'DL'  properly  but I have a doubt that it will take more time for program am not sure at this time becz I am waiting for more test data which get created by functional guy ,becz one test data can be used only once .

reg second issue  as you suggested ," You try to create a batch for a material that is not batch managed. just try to create a batch for this material using the online transaction MSC1N, you should get the same message "     so its seems data issue and not bapi  issue  right ?  I have highlighted the same to functional consultant    mean time can you suggest if any steps I can take

I Tried giving  same material number , plant , batch in  MSC1N    to create but  I got message

material  XXXXXXX   is not handled in batches in plant XXXX

Regards

Meeta

Read only

JL23
Active Contributor
0 Likes
2,186

The BAPI will certainly need more time if you tell them to access each material master view.

Not sure if it is only a data issue, but for sure the batch management indicator is not active in the existing material master. You should probably react on this in your program and only execute the BAPI_BATCH_CREATE  if you found a batch management indicator

Read only

Former Member
0 Likes
2,186

Okey  then  how I can check that batch management indicator is active or not ?

else what I can write in code before calling  BAPI  BAPI_BATCH_CREATE