2015 Jul 01 1:55 PM
Hi,
We have a requirement to validate Trips before creating and return the error messages using an RFC. We are using the FM ' HRTRV_IF_MODIFY_TRIP' and returns the RETURN parameter of this FM. Here trip is getting created. I have tried ROLLBACK after creating the trip. But no luck.
We also tried to delete the trip using 'BAPI_TRIP_DELETE' after creating trip. Trip is getting deleted and we are able to get the error messages. But the issue in this case is that the trip number is increasing unnecessarily.
Any other solution is there to validate the trips and get the error messages ?
Any help is appreciated.
Regards,
Veena
2015 Jul 01 4:01 PM
If you pass the FCODE = 'CHCK', it will do the checks but not post the trip.
CALL FUNCTION 'HRTRV_IF_MODIFY_TRIP'
EXPORTING
employeenumber = employee
tripno = get_tripno
framedata = framedata
TABLES
return = return
CHANGING
fcode = 'CHCK'.
The FM HRTRV_IF_MODIFY_TRIP has a BDC on PR01. So, if there is some error while processing the trip in BDC, that will not be captured when you pass CHCK as FCODE.
Regards,
Naimesh Patel
2015 Jul 01 4:01 PM
If you pass the FCODE = 'CHCK', it will do the checks but not post the trip.
CALL FUNCTION 'HRTRV_IF_MODIFY_TRIP'
EXPORTING
employeenumber = employee
tripno = get_tripno
framedata = framedata
TABLES
return = return
CHANGING
fcode = 'CHCK'.
The FM HRTRV_IF_MODIFY_TRIP has a BDC on PR01. So, if there is some error while processing the trip in BDC, that will not be captured when you pass CHCK as FCODE.
Regards,
Naimesh Patel
2015 Jul 03 6:27 AM
Thank you Naimesh.
After passing fcode = 'CHCK', we are getting errors in RETURN table. But if I pass fcode = 'INS', trips are getting created for the same data. If errors are there, why trips are getting created ? Could you please help me on this.
Regards,
Veena
2015 Jul 03 6:50 AM
2015 Jul 03 7:15 AM
2015 Jul 03 7:50 AM
You have put enhancement in following:
Program : SAPMFITP
Include : SAVE_REQUEST
Form : SAVE_REQUEST
This sub routine has many TABLES and USING parameters which contains data required to save the trip. You can check data stored in those tables according to your validations.
If your validations are violated then you can jump the process followed by standard program to save the trip.