‎2005 May 31 10:42 AM
hi,
When I'm using transaction MSC1 to create a batch i can see in table table MCH1 my material/batch created and the field CUOBJ_BM filled with value.
When using the bapi BAPI_BATCH_CREATE the field MCH1-CUOBJ_BM is empty. But the number exist in table INOB.
in the bapi i only pass Material, Batch and Expiration Date in parameter BATCHATTRIBUTE.
I just wondering why I don't get this number in MCH1 even after using BAPI_OBJCL_GET_KEY_OF_OBJECT.
thank you,
Joseph
‎2005 May 31 10:47 AM
Hello,
If I remember correctly, the BAPI_BATCH_CREATE simply creates all the necessary batch data. Classification must be done seperately using the corresponding classification BAPIs.
Transaction MSC1 probably classifies by default according to customizing. You have to do it "manually".
Hope this helps (please reward me if it does),
Joerg
‎2005 May 31 10:47 AM
Hello,
If I remember correctly, the BAPI_BATCH_CREATE simply creates all the necessary batch data. Classification must be done seperately using the corresponding classification BAPIs.
Transaction MSC1 probably classifies by default according to customizing. You have to do it "manually".
Hope this helps (please reward me if it does),
Joerg
‎2005 May 31 10:52 AM
Yes I was also thinking about this possibility.
But I'm asking a key for this material/batch with BAPI_OBJCL_GET_KEY_OF_OBJECT and specify the parameter CREATE_MISSING_KEY = 'X'.
I was thinking that maybe it will created in table MCH1 the object but no.
I'm still looking for a missing step....
thank you Joerg
‎2005 May 31 3:13 PM
Hello,
Unfortunately I have only used the classification BAPIs from an external program, so I don't have any ABAP coding for you - just a textual description. I still hope this will help you.
You probably really have to create the key using the FM BAPI_OBJCL_GET_KEY_OF_OBJECT with OBJECTTABLE = 'MCHA', CLASSTYPE = <your class type>, OBJECTNAME = '<MATNR><WERKS>', CREATEMISSINGKEY = 'X'. The resulting object key in CLOBJECTKEYOUT should then be updated into the MCH* tables automatically.
Hope this helps (please reward me if it does ,
Joerg
‎2005 Jun 01 8:01 AM
Hi joerg,
I already use this method but without success.
So i decide, and i know that is not a very good thing to do, to create the Batch with a batch input and then update the characteristics with bapi BAPI_OBJCL_CHANGE.
anyway thank Joerg for your help
Joseph
Message was edited by: joseph fryda
‎2005 Jun 01 8:14 AM
Hello,
Could you state again why the BAPI fails?
The order of steps necessary to create a batch and classify it are:
BAPI_BATCH_CREATE
BAPI_TRANSACTION_COMMIT
BAPI_OBJCL_GET_KEY_OF_OBJECT
BAPI_TRANSACTION_COMMIT
BAPI_OBJCL_CHANGE_KEY
BAPI_TRANSACTION_COMMIT
Again: Unfortunately I have only tried this from an external (VB-) program, so I don't have any ABAP coding. However, it worked for me. Maybe you should search OSS for relevant notes? Have you checked other "popular" error sources such as forgetting BAPI_TRANSACTION_COMMIT or omitting leading zeroes of MATNR etc.?
Regards, Joerg.
‎2005 Jun 01 8:19 AM
I make the same steps as you describe.
The bapi doesn't fails. The problem is why I don't see in field MCH1-CUOBJ_BM <b>an object number</b>. Why this field stay empty when you use bapi and when you use the online transaction or batch input this field contains a value?
Message was edited by: joseph fryda
‎2005 Jun 01 8:32 AM
Hello,
Is the field empty in MCHA as well?
Can you see the classification in the MSCxN transactions?
Regards, Joerg
‎2005 Jun 01 10:17 AM
Hi, Joseph!
For classified batch creation you can use VB_CREATE_BATCH:
CALL FUNCTION 'VB_CREATE_BATCH'
EXPORTING
ymcha = wa_mcha
new_lgort = lgort
kzcla = '1'
xkcfc = 'X'
IMPORTING
ymcha = wa_mcha
TABLES
char_of_batch = it_clbatch
EXCEPTIONS
<exception list>.
where you have to set for wa_mcha(for my working example):
wa_mcha-matnr
wa_mcha-werks
wa_mcha-bwtar
and all approporiate classification for it_clbatch:
it_clbatch-atnam
it_clbatch-atwtb
After succesful execution you can find batch number in wa_mcha-charg.
Regards,
Maxim.
‎2005 Jun 01 11:51 AM
Just for information I am created Batch for material <b>and not</b> Batch for material/werks, so table MCHA is useless for me (i don't think that i'm suppose to update it).
I will send a note to oss and keep you guys updated.
thanks
joseph
‎2009 Oct 08 12:51 PM
Hi Guys,
Does anyone knows a solution to this problem?
Thanks,
Abdullah
‎2016 Jun 22 6:43 PM
Hi all ,
Was facing the same issue and came across this post.
Only passing kzcla = '1' in FM 'VB_CREATE_BATCH' , will help in populating the field , MCH1-CUOBJ_BM.