Skip to Content
Technical Articles

Missed or stuck with openSAP week 4 ? Generate your RAP object

For whom did I wrote this class?

If you have not been able to attend week 4 of the openSAP course and you do not have to time to type all the code yourself.

Another target group might be those participants whose RAP business object in week 4 does not work as expected.

What do you have to do?

  1. Create two new packages
    • ZRAP_#### within ZLOCAL
    • ZRAP_TRAVEL_U_#### as a sub package of ZRAP_#### 
  2. Create a class zcl_generate_week4_#### within the package ZRAP_TRAVEL_####

     

  3. Replace the source code of the template with the source code that you can find on our github repository
  4. Replace all occurrences of #### with an own unique number or unique combination of numbers and characters (for example 5678)
    (You will find #### in line 1, 13, 14 and 45)

  5. Run the class as a console application using F9

 

Result

The class does the following:

  1. It creates all objects that have been created in week 4 beside the behavior implementation classes.

What is left to do

  1. Open the behavior definition and click on the names of the behavior implementation classes and use the quick fix to generate both classes as described in step 4 and step 6 of my script:Create behavior implementation class for travel

    Create behavior implementation class for booking

  2. Change the code in the behavior implementation class for Travel zbp_i_rap_travel_u_#### and Booking zbp_i_rap_booking_u_####.This is necessary since in the script I named the control structures zsrap_travel_x_#### and zbp_i_rap_booking_#### whereas the generator also adds a ‘_u’  into the name of the control structures.

    So the two lines of code that have to be changed should now read as follows in zbp_i_rap_booking_u_####

    legacy_entity_x-_intx      = CORRESPONDING zsrap_booking_x_u_####( <entity> MAPPING FROM ENTITY ).​

    and in zbp_i_rap_travel_u_####

      legacy_entity_x-_intx = CORRESPONDING zsrap_travel_x_u_####( <entity> MAPPING FROM ENTITY ).​
  3. Add the following statement to your service definition
    expose /DMO/I_Airport as Airport;​
  4. Activate the service binding
2 Comments
You must be Logged on to comment or reply to a post.
  • Hi André

    Thanks for all the work you’ve done.

    It shall ne provided by the standard !!!

    However I could not directly work with your work, I had to réinject the code and recopy the handler.

     

    I had an autorisation error, I have checked tour https service and it contained an autorisation object. Without it on my package everything works like a charm, combined with the uploader this  are great tools.

    Thanks again

  • Hi Andre

    Completing week 4, I noticed my app wasn’t working as expected, so I used the RAP generator and it works brilliantly well!

    Now I can see where I went wrong in my own code so it helps to deepen my understanding of the objects and SAP RAP architecture.

    So, many thanks!

    Cheers

    Ged

    P.S. SAP RAP sounds good together