Inhaltsverzeichnis
- 1 This is an old version of this page. To the new page please click here
- 2 Das ist eine alte Version dieser Seite. Zur neuen Seite klicken sie hier
- 3 Default mapping
- 4 Mappingtable /EPO1/FIELD_MAP
- 5 Inbound services - customizing EPO operation
- 6 Outbound service call - using the class /EPO1/CL_TOOLS
This is an old version of this page. To the new page please click here
Das ist eine alte Version dieser Seite. Zur neuen Seite klicken sie hier
The table /EPO1/FIELD_MAP can be used to control the mapping of fieldnames between ABAP and external data (JSON).
When consuming a webservice (outbound connection), this table can be helpful when using the class transformation /EPO1/EXC_JSON_FIELD_MAPPING with the static methods /EPO1/CL_TOOLS=>ABAP_TO_JSON and /EPO1/CL_TOOLS=>JSON_TO_ABAP.
When exposing a webservice (inbound connection), this table can be used by the EPO connector (depending to the configuration).
Default mapping
Without further settings, ABAP fieldnames are mapped to uppercase JSON fieldnames, but a JSON request (incoming data) could also use lowercase fieldnames.
If this mapping is not sufficient, an other mapping cound be adjusted following the next steps.
Mappingtable /EPO1/FIELD_MAP
Using transaktion SM30 to adjust the mapping (using the EPO service id as key).
Field | Description |
---|---|
Service | EPO service for incoming services (=provided webservices), EPO service ID for outgoing services (=consumed webservices) |
Message direction | Direction of a message; 'I' = inbound (request for an incoming call or response of an outgoing call) 'O' = outbound (response from an incoming call or request of an outgoing call) |
ABAP fieldname | Name of an ABAP structure field |
Ext. fieldname | Name of an external JSON field |
It is possible to specify a default mapping method, using an empty ABAP fieldname - write one of these keywords into the external fieldname
- [lowercase] - convert ABAP fieldnames to lowercase external fieldnames
- (e.g. 'USER_NAME' <=> 'user_name')
- [UPPERCASE] - convert ABAP fieldnames to uppercase external fieldnames (this is the default behaviour)
- (e.g. 'USER_NAME' <=> 'USER_NAME')
- [camelCase] - convert ABAP fieldnames to camelcase external fieldnames (lowercase, a combination of '_'and a letter will be mapped to the uppercase letter)
- (e.g. 'USER_NAME' <=> 'userName')
- [CamelCase] - convert ABAP fieldnames to camelcase external fieldnames, but the first character also converted to uppercase
- (e.g. 'USER_NAME' <=> 'UserName')
This default mapping works in both directions and is applied to all fields, where no explicit mapping is defined.
Inbound services - customizing EPO operation
Transaction /EPO1/EXC, open the menu items
- EPO Connection Area Menu
- EPO Connector Configuration
- Inbound Service Configuration
- EPO Runtime
- In: Maintain EPO Runtime service configuration
- open the service/operation
- Processing FM
- /EPO1/GFMC_JSON_PROCESSINGFM
- this function module will read the settings regarding the field mapping; other function modules might not be able to use and interpret these information
- Field Mapping
- check this checkbox to enable the field mapping; the service name of the operation is the first key field in the table /EPO1/FIELD_MAP
During the data processing (both directions: request and response), the mapping is done with the method /EPO1/CL_FIELD_NAME_MAPPING=>MAP, which reads the table /EPO1/FIELD_MAP.
Outbound service call - using the class /EPO1/CL_TOOLS
For outbound calls, the programmer is responsible to create a valid JSON request and to interpret the response JSON.
To make this task easier, use the methods /EPO1/CL_TOOLS=>ABAP_TO_JSON and /EPO1/CL_TOOLS=>JSON_TO_ABAP.
Both methods can be called, passing the EPO service ID to I_SERVICE_ID and the transformation /EPO1/EXC_JSON_FIELD_MAPPING to I_TRANSFORMATION. This transformation uses the static method /EPO1/CL_FIELD_NAME_MAPPING=>MAP for the mapping, which reads the table /EPO1/FIELD_MAP.
Request - /EPO1/CL_TOOLS=>ABAP_TO_JSON
Convert an ABAP structure to JSON, using the direction 'O' (outbound):
Parameter | Description |
---|---|
I_ANY | ABAP structure |
I_LINE_BREAK | 'X' in order to add line breaks |
I_INTENT | 'X' in order to add intents (additional to the line break) |
I_STRIP_INITIAL | Remove empty elements/structures/tables |
I_TRANSFORMATION | Convert the JSON-XML, using this transformation (use /EPO1/EXC_JSON_FIELD_MAPPING) |
I_SERVICE_ID | The service ID is passed to the transformation (in order to select the mapping information) |
ES_CALLSTATUS | Error messages |
E_JSON | JSON as string |
E_JSON_X | JSON as xstring |
Response - /EPO1/CL_TOOLS=>JSON_TO_ABAP
Convert a JSON response (string or xstring) into an ABAP structure, using the direction 'I' (inbound):
Parameter | Description |
---|---|
I_JSON | JSON as string |
I_JSON_X | JSON as xstring |
I_TRANSFORMATION | Convert the JSON-XML, using this transformation (use /EPO1/EXC_JSON_FIELD_MAPPING) |
I_SERVICE_ID | The service ID is passed to the transformation (in order to select the mapping information) |
E_ANY | ABAP structure |
ES_CALLSTATUS | Error messages |