‎2011 Feb 21 2:45 PM
Hi Experts,
Can anyone tell me if BAPI handles the validations defined for standard transactions ? I have a standard transaction KB15N. Validation defined for a field works fine when run thorugh the transaction. But if same data is updated using BAPI , validations are not getting called and wrong data is updated in the system.
Could you please confirm if BAPI handles validations ? If yes, how to take care of it ?
Best Regards,
V joshi
‎2011 Feb 21 2:56 PM
In general, BAPI's should call the same validations like the standard transactions, e.g. BAPI_ACC_DOCUMENT_POST runs through the same validations like posting via FB01.
BAPI's are designed to be called from outside the SAP system as well, so it would be pretty bad if such a loophole would exist.
Check your prerequisites of the validation, maybe you check for a transaction code which is different if called from the BAPI.
Also try tracing the execution of that BAPI (SE30 or better SAT, if available) and see which routines are being called.
Thomas
‎2011 Feb 21 2:56 PM
In general, BAPI's should call the same validations like the standard transactions, e.g. BAPI_ACC_DOCUMENT_POST runs through the same validations like posting via FB01.
BAPI's are designed to be called from outside the SAP system as well, so it would be pretty bad if such a loophole would exist.
Check your prerequisites of the validation, maybe you check for a transaction code which is different if called from the BAPI.
Also try tracing the execution of that BAPI (SE30 or better SAT, if available) and see which routines are being called.
Thomas
‎2011 Feb 21 3:04 PM
Hi Thomas,
Thanks for your quick reply.
I have following condition in the prerequsite of validation
Prerequsite : Transaction code = 'KB15N'
check : Sr cost element > '90000000' AND Sr cost element < '9ZZZZZZZ'
I am using BAPI 'BAPI_ACC_MANUAL_ALLOC_POST' for posting.
Do i need to modify the pre-requisite condition ? Kindly guide.
Regards,
V Joshi
‎2011 Feb 21 3:11 PM
You have to find out the correct prerequisites yourself. Obviously SY-TCODE is not KB15N when called via BAPI.
Assuming it works the same as the FI validations: activate the expert trace inside the validation maintenance (must be in display mode), then processing will stop right there and you can find out the current values of the SY-fields (and other field values passed to the validation) in your debugger window.
Thomas
‎2011 Feb 21 2:56 PM
Hi,
Validations of fields depends upon user.
BAPI's will validate some of the fields. For example, if the type of the field is 'date' and you are sending a string, it 'll throw a error message and if the plant or some master data didnt present in the system, it throws the error message.
But in the case of fields which uses conversion exits, you 've to handle those in the report itself.
If this doesnt meet your requirement , provide more information about what BAPI are you using and data passed.
‎2011 Feb 22 5:18 AM
Hi ,
As our Thomas told it will validate same like how it is done in GUI.
Regards,
Madhu.
Edited by: madhurao123 on Feb 22, 2011 6:19 AM