09-18-2012 12:38 PM
Hi all,
i used bapi_material_savedata and bapi_objcl_create to create material and assign classes to it. i completed it successfully, no issues here.
recently we assigned number range for the material types, and i customized the bapi so that it could accept the materials to create if they satisfy the number range, and if they already exist then, no need to satisfy the number range. Now, if im giving a material within the number range for classification the bapi bapi_objcl_create returning the message 'Object 3000000001 does not exist' if i give the material which already exists then the bapi bapi_objcl_create successfully assigns the classification. im not getting it.
could anyone give suggestions on this.
thanks & regards
chinta
09-19-2012 2:12 PM
Hi Satish,
I hope you are sending the input to BAPI_OBJCL_CHAGE with leading zeroes.( Up to 18 Characters ). Please check.
Regards,
R
09-18-2012 1:45 PM
Hi
I suppose you call the BAPI for classification after calling the BAPI for material, so have you placed a COMMIT between the 2 BAPIs?
Max
09-18-2012 3:40 PM
Thanks for the reply brother.
its not the commit issue... i would say material gets created with bapi_material_savedata. as i said earlier i have problem only when number range is assigned to the material type.
09-18-2012 4:00 PM
we assign number ranges to have the number created by itself / automatic, whats the point in passing the number?
line 125 in BAPI_OBJCL_CREATE
*....Check existence of allocation......................................
call function 'BAPI_OBJCL_EXISTENCECHECK'
EXPORTING
classnum = classnumnew
classtype = classtypenew
objectkey = objectkeynew
objecttable = objecttablenew
keydate = keydate
TABLES
return = return.
09-18-2012 4:20 PM
hi, bapi cannot create internally, hence we use a standard bapi which would give a material number based on the material type which we pass to bapi_material_savedata hence we create a material.
guys i dont have problem while creating a material but while assigning a classification to it. when evere material number from the number range passes to bapi_objcl_create bapi returns no object exist. but if send already existing material but not from number range successfully done. clearly the issue is at bapi objcl create.
thanks
09-19-2012 11:11 AM
Hi
After calling bapi_material_savedata, if you don't call a COMMIT, the material is not stored in DB, so the next BAPI couldn't find the object.
Max
09-18-2012 4:56 PM
Did you check after 1st bapi if material is available on MARA table? Maybe it's only a matter of delay in DB update.
09-19-2012 2:02 PM
Insert a COMMIT WORK AND WAIT or call BAPI_TRANSACTION_COMMIT with WAIT parameter 'X', between the two call of BAPI.
...
CALL FUNCTION 'BAPI_STDMATERIAL_GETINTNUMBER'
...
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
...
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = return.
...
CALL FUNCTION 'BAPI_OBJCL_CREATE'
...
Regards,
Raymond
09-19-2012 2:12 PM
Hi Satish,
I hope you are sending the input to BAPI_OBJCL_CHAGE with leading zeroes.( Up to 18 Characters ). Please check.
Regards,
R
09-19-2012 7:14 PM
+1 to Rudra's comment. If a material number is all numeric it will contain leading zeros. You should call the fm CONVERSION_EXIT_ALPHA_INPUT with the material number prior to moving it to the object key field of BAPI_OBJCL_CREATE. I would call this FM prior to moving to object key regardless of how the material number was generated. It will only add the leading zeros if needed.
09-20-2012 5:15 AM
HI All,
Today's weather is very nice here in hyderabad... Larry what you said was correct. the material number is all numeric and i have add zeros to it. i checked it by adding zeros so it worked... now i have look for a functon module which checks wheather a given input conatins only numerics or not. to pass the input to the function module conversion_exit_alpha_input.
thanks Larry,
thanks all.
chinta
09-20-2012 9:13 AM
Hi Satish,
I am happy to know the problem is solved. However for material you should use CONVERSION_EXIT_MATN1_INPUT(Based on the domain Conversion routine of MATNR) instead of CONVERSION_EXIT_ALPHA_INPUT then you do not need to check if the material is numeric or not.
Regards,
R
09-20-2012 11:13 AM
09-20-2012 2:47 PM
Actually the ALPHA FM would probably work ok as well. It does the numeric check and determines if it needs to add leading zeros or not. However, I do agree with Rudra that the MATN1 FM is better because it is the one tied to the domain MATNR and will do any other special conversion needed for material numbers.
09-21-2012 5:35 AM
Larry, what you said is correct, ALPHA FM works ok, because need the material number of length 18 and, ALPHA FM gives me more than that and i have to do other operation to take what i need where as, MATN1 FM gives me exactly what i need... i believe it is much better than OK.. I suggest to use MATN1 FM for materials.
its good to share the knowledge and experience here...
Thank you.
09-21-2012 4:12 PM
Satish,
FYI,
ALPHA will also return just 18 if you send it a matnr based variable from your program. The input and out parameters are un-typed and will automatically adapt to what it is sent. When you run it via SE37 as a test, it returns MANY leading zeros because of the input parameter sent from se37 is very long.
Also,in our system we have material number configured to NOT pad leading zeros to an all numeric material number, so the MATN1 FM does not pad the leading zeros in our system, while ALPHA does.