Skip to Content

Calling custom action in ODATA in SAP C4C

Hi Experts,

I have an requirement where I need to pass some data to the third party using ODATA. Please find detailed information below:

1. Third party will send me me some attributes like Postal Code, Skill.

2. I need to call an custom action of custom BO where I will use that sent data i.e. (Skill, Postal Code) to create a collection of Data using custom logic.

3. Finally need to send back that collection.

Best Regards,

Monik Sharma

Add comment
10|10000 characters needed characters exceeded

  • Hi Horst,

    Please find the details below:

    1. In Custom BO TechnicianHeaderData, I have stored all the information of the Technicians longwith their Skillset as well as their Service area postal codes.

    2. The requirement is that a third party system wants to check the availablity of the technicians, so they will make a call to the SAP C4C system with Skill, PostalCode and Date only.

    3. I have created a another BO TechnicianAvailbilityData and have created the ODATA service for the same. I have created an action SEARCH_TECHNICIAN_AVAILBILITY where I have written all the logic in the BO:

    Structure of this BO is:

    PostalCode =====> Need to send in request

    Skill Name =====> Need to send in response

    Availability From (date field) =====> Need to send in request

    Availbility To (date field) =====> Need to send in request

    Technician Name

    Avaibalility Time Slot 6-7

    ------

    ------

    Availbility Time Slot 21-22

    Avaibility Date

    As per the requirement, we need to send data back in the above structure after creating the data.

    Logic for creating the data in the action is:

    1. Reading request data like Posta Code, Skill, Date From and Date To.

    2. Use Skill and Postal Code to retreive the data from BO TechnicianHeaderData, we will have list of technicians working in that postal code and for that particular skill.

    3. We will use those technicians ID and Dates requested, we will query the activities and check if the technician is avaible or not. for those dates.

    4. So we have got the request for Dates: Avaibility From :23-04-2019 Avaibility To: 25-04-2019

    5. We will send three records in the response i.e. for 23-04-2019, 24-04-2019 and 25-04-2019.

    Best Regards,

    Monik Sharma

  • Hi Horst Schaude,

    Could you please look into the requirement and see if the same is possible :) .

    Best Regards,

    Monik

  • Hello Monik,

    Sorry for the delay, but the information service about updates to questions had some malfunction. :-(

    In principle it should be possible with some adjustment:

    1. In a ODATA service you can call a BO action via "Function Import".
    2. But this takes over only the ObjectID. Therefore you need to map your request (Postal Code, Skill, Date From and Date To) into the ObjectID
    3. The action (ABSL code) needs to separate this ID and perform its checks.
    4. On success it can return the InstanceData, else nothing.

    HTH,
    . Horst

  • Get RSS Feed

1 Answer

  • May 03 at 12:53 PM

    Copying the solution from Horst Schaude:

    Hello Monik,

    Sorry for the delay, but the information service about updates to questions had some malfunction. :-(

    In principle it should be possible with some adjustment:

    1. In a ODATA service you can call a BO action via "Function Import".
    2. But this takes over only the ObjectID. Therefore you need to map your request (Postal Code, Skill, Date From and Date To) into the ObjectID
    3. The action (ABSL code) needs to separate this ID and perform its checks.
    4. On success it can return the InstanceData, else nothing.

    HTH,
    . Horst

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Horst/Felini,

      So it means it would be possible to call an action of BO, that action will seprate the ID and will create Data by logic of the action in the custom BO and finally return all the data created in that custom BO. If this is possible, could you please brief the steps little more that how exactly I will acheive the same. What I have understood is that a GET call will be made from third party, it will first trigger an action of BO which will create data and than finally all the data will be returend automatically in the same call. Please correct me if my understanding is correct.

      Best Regards,

      Monik