cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to parse an Employee Central ODATA into ABAP table

kmoore007
Active Contributor
0 Likes
1,171

I can retrieve a SuccessFactors Employee Central ODATA file, for example ODATA BenefitEnrollment, using an ABAP program.  But I'm unsure about how to parse the data into an internal table with the retrieved data columns and values.  Does someone have an example ABAP program on how to achieve this?

Thanks,

Kenneth

Accepted Solutions (0)

Answers (2)

Answers (2)

turkaj
Active Participant

Hi Kenneth,

that depends on the format in which you receive the data. If you receive it as a JSON file, then you can simply convert it into an ABAP structure using the following method.

 

DATA lv_odata_json TYPE string. "your ODATA-JSON-String
DATA lt_abap_data TYPE ref to data. "here you can create a corresponding ABAP structure/table and use it here

TRY.
    /ui2/cl_json=>deserialize(
                    EXPORTING
                      json             = lv_odata_json
                    CHANGING
                      data             = lt_abap_data ).
CATCH cx_sy_move_cast_error.
    "Error handling
ENDTRY.

 

It is also possible to create a dynamic structure, but it is better if you create a corresponding ABAP structure in ABAP and then transfer the string to your ABAP structure using the method mentioned above.

Regards
Jim

junwu
SAP Champion
SAP Champion

if the data is in xml format, you can use xslt

kmoore007
Active Contributor
0 Likes
I can retrieve the data in string or json format. I can convert from string to XML using a couple of functions.