2021 Jan 13 7:42 AM
I AM PASSING MATERIAL ,PLANT,BATCH TO BAPI_BATCH_CHANGE AND WANT TO CHNGE VFDAT AND HSDAT IN MCHA TABLE....BUT ITS NOT UPDATING IN MCHA TABLE
CAN ANY HELP ME ON THIS HOW TO UPDATE VFDAT AND HSDAT FIELDS IN MCHA TABLE BY BY PASSING MATERILA ,PLANT,BATCH,VFDAT,HSDAT FIELD TO SOME BAPI/FM?AS IT URGET
I have passed expiry date and prod date as 'X' under attributes parameter ,and also passed doclassify as 'X'.
and also used Bapi_transaction_commit in test sequnce in se37.
But still i cant see mcha table i not updated..
can anyone help me on this asap.
2021 Jan 13 7:43 AM
Welcome and Thank you for visiting SAP Community to get answers to your questions. Please add more details to your question, e.g. you can also add a screenshot. With that, you can reach a broader range of experts to get your question answered. I also recommend to do this tutorial https://developers.sap.com/tutorials/community-qa.html
The more details you provide, the more likely it is that members will be able to assist you. Furthermore, please avoid writing in capital letters as it could be understood as shouting to the community. Please edit your question and change the capital letters to smaller ones. Thank you.
Finally, if you're hoping to connect with readers, please consider adding a picture to your profile. Here's how you do it: https://www.youtube.com/watch?v=F5JdUbyjfMA&list=PLpQebylHrdh5s3gwy-h6RtymfDpoz3vDS. By personalizing your profile with a photo of you, you encourage readers to respond.
Regards, Svea
SAP Community Global Moderator
2021 Jan 13 8:27 AM
Hello 472472
You can use BAPI_BATCH_CHANGE function to update both VFDAT (Shelf Life Expiration or Best-Before Date) and HSDAT (Date of Manufacture).
Both dates are available in BATCHATTRIBUTES import parameter structure as EXPIRYDATE and PROD_DATE fields respectively. You also need to put X value into EXPIRYDATE and PROD_DATE fields of BATCHATTRIBUTESX import parameter structure to indicate that you want to change the respective fields.
Take your time to read the function documentation.
Best regards
Dominik Tylczynski
2021 Jan 13 1:34 PM
I have done this DOMINIK, i have also set doclassify = 'X' and also using bapi_transaction_commit but still vfdat(expiry dat) and proda_date not getting updated in MCHA table .
i am also used fm BAPI_BATCH_SAVE_REPLICA
BAPI_OBJCL_CHANGE.
BUT no use ,...
Sir could you pls help on this asap
Thanks,
Ramana
2021 Jan 13 1:43 PM
I have passed expiry date and prod date as 'X' under attributes parameter ,and also passed doclassify as 'X'.
and also used Bapi_transaction_commit in test sequnce in se37.
But still i cant see mcha table i not updated..
can anyone help me on this asap.
2021 Jan 14 10:01 AM
Hello 472472
I've tested the change of VFDAT and HSDAT with BAPI_BATCH_CHANGE function and it works.
You don't need to execute BAPI_TRANSACTION_COMMIT afterwards - see note 619913 - FAQ: Basic batch management functions, question 5:
Question:
What do I need to consider when maintaining batch data or using BAPIs for classification?
Answer:
You can use the BAPIs BAPI_BATCH_CREATE, BAPI_BATCH_CHANGE, and BAPI_BATCH_SAVE_REPLICA to maintain batch data.
These three BAPIs implicitly perform a separate COMMIT WORK.
If a COMMIT WORK AND WAIT is required, or if batch maintenance is to be included in a transaction, the implicit COMMIT performed by the BAPIs must be suppressed. This is done by calling the function module TRANSACTION_BEGIN before calling the individual BAPI. The calling program thus takes over the transaction control. This is ended by calling the function module TRANSACTION_END or BAPI_TRANSACTION_COMMIT.
Also depending on your batch level setting, you might have to specify plant next to material number and batch number - see the function documentation:
Batch Level
If the batch level (BatchControlFields) is on plant level, you must specify a plant in the Plant parameter.
You shouldn't try to change batch classification while changing VFDAT and/or HSDAT. These dates are part of a batch master data, not part of a batch classification.
Best regards
Dominik Tylczynski
2021 Jan 15 7:50 AM
bfb5e56e-6705-4837-b634-8b1cc8a23a3e.jpeg093eff07-4739-45e0-88d9-78acca68949e.jpegHi sir
See how I am testing...
There is no updation in mcha table..
and no error message displayed in se37
2021 Jan 15 10:06 AM
2021 Jan 15 2:50 PM
2021 Jan 14 2:23 PM
Did you get any Error, Warning or even Success message in RETURN parameter from the BAPI call?
2021 Jan 14 8:44 PM
No .. I didn’t get to any message...after exciting the bapi...
I can see result as 0.
I am trying this in sandbox system where only material,batch, and plant fields data is eixsts in mocha table...I am passing expiry and manufacturing dates and long three key fields plant,material and batch to bapi_batch_change... I cant fields updated in mcha
2021 Jan 15 11:43 AM
"I can see result as 0."
A BAPI won't usually set sy-subrc, you have to check the RETURN parameter. for TYPE = 'E' or 'A'
2021 Jan 15 3:01 PM
Hello Ramana venkata
Your batch level is 1 i.e. material level. Table MCHA is updated only if batch level is 0 i.e. plant level. Your changes are written to MCH1 table.
Best regards
Dominik Tylczynski
2021 Jan 15 4:02 PM
Yes Sir...its updating MCH1 table....
In this case, which BAPI/FM, can be used to update fields in mcha table ..Sir...
Many thanks Sir,
Ramana
2021 Jan 15 4:17 PM
Hello 472472
There are no separate functions to update MCH1 and MCHA tables. They are used by the system to store batch master data depending on the batch level setting. If the level is plan, MCHA is used; otherwise MCH1 is used. The system does that automatically behind the scenes.
Your batch level is 1 i.e. material level. Therefore MCH1 is updated. Instead of trying to update MCHA, just start using MCH1 in your other developments.
Best regards
Dominik Tylczynski
2021 Jan 18 6:13 AM
2021 Jan 18 7:31 AM