Search code examples
odatasapui5abapnetweaver

OData Function Import Exporting String


I created an OData Service in the transaction SEGW. Then i added an Function Import with 2 import parameters. Inside the function import there is generated an String including the 2 parameters. I set an external breakpoint to the function import and tested it with /IWFND/GW_CLIENT and it works correctly. But now i want to pass that generated String as an export parameter. So when i call the function import in SAP WEB IDE i want to pass the two parameters and get the generated string. My problem is i don't know how to implement an export parameter or how to pass that string.

Screenshot of the function import declaration


Solution

  • Define a Complex Type

    enter image description here

    and set this complex type as an export parameter in your function import definition.

    enter image description here

    In the redefined "execute_action" method copy your response structure to the export parameter

        copy_data_to_ref(
      EXPORTING
        is_data = ls_your_response_structure
      CHANGING
        cr_data = er_data ).