Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Validate trips before creating

Former Member
0 Likes
869

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

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
0 Likes
808

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

5 REPLIES 5
Read only

naimesh_patel
Active Contributor
0 Likes
809

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

Read only

0 Likes
808

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

Read only

Former Member
0 Likes
808

Are you creating trips in R/3 or using ESS portal ?

Read only

0 Likes
808

Hi Mandar,

We are Creating trips in R/3.

Read only

0 Likes
808

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.