Problem Statement:
Recently I was working in a POC to integrate ODATA in AIF. We already have SAP blogs available on how to integrate ODATA in AIF. So I think there is no benefit in sharing the same again.
However during the implementation of the same, I have faced an issue and I couldn't find any available blog or SAP answer for that. The issue was ODATA payload was not displaying in the data content area in error handling TCode /AIF/ERR. Please see the screenshot below.
Solution:
Now let's discuss on the solution for the issue. After doing some debugging, I found one implementable BADI(later on I found same BADI also has been mentioned in one of the SAP note related to ODATA AIF integration) in which SAP has given us the option to prepare the payload structure.
The BADI name is "/AIF/ODATA_FILL_RAW_STRUC_BADI" and its a filter dependent BADI. The filter fields are Namespace, Interface Name and Interface Version.
We will have to create the BADI implementation with the respective AIF interface details.
Next we will have to write logic in the BADI implementation method "/AIF/IF_ODATA_FILL_RAW_STRUC~GET_PAY_LOAD_DATA" to prepare the payload structure from the requested ODATA payload. Please find below the sample code.
Please note, if the ODATA payload is in JSON format then you will have to write the logic accordingly to fill the AIF payload structure.
Testing:
Once the implementation is done, now check the payload for the same entry again. This time we can see the payload.
Conclusion:
I hope this blog will help if you want to see the ODATA payload in the data content area.