Skip to Content

ABAP CDS table with complex AMDP coding

Hi Expert,

I am trying to create an ABAP CDS table, but I need to do some row-level processing in AMDP implementation, but I don't know how to return the result table variable in this AMDP implementation. the AMDP code as below:

as above, the final result table variable is VAR_OUT, I want to return this table variable, is it possible? how to code this return statement in AMDP procedure?

Many Thanks,

p1.png (33.1 kB)
p2.png (43.2 kB)
p3.png (52.7 kB)
p4.png (22.8 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    Dec 06, 2017 at 06:43 AM

    "still have the issue, which some data type inconsistent between table definition and AMDP code."

    Check the mapping tables.

    Add comment
    10|10000 characters needed characters exceeded

    • AMDP isn't implemented in ABAP but in Hana's SQLScript.

      ABAP just manages the procedures, creation, lifetime etc.

      You must read the SQLScript reference.

      For simple queries you don't need AMDP at all.

  • Dec 05, 2017 at 06:15 AM
    -1

    Hi!

    It need to be specified in the AMDP method definition. This can be implicitly for instance from your CDS table function or explicitly in the method definition in the AMDP class. Then use the RETURN statement in the AMDP or popupate the defined export parameter.

    Check this out: https://blogs.sap.com/2015/10/21/abap-news-for-release-750-cds-table-functions-implemented-by-amdp/

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 05, 2017 at 06:12 AM

    Hey,

    Can this help?

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 05, 2017 at 07:45 AM

    Also, refer to this (pages 7-9 of the PDF).

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 05, 2017 at 05:59 PM

    Thanks all for quick respond.

    after adjusting the code, finally I put return statement into the code below:

    and there is no error for the AMDP procedure any more:

    but when I try to preview the data for the ABAP CDS table, I get following error:

    can you pleas help how to fix the issue?

    I try to debug the code, but I can't put break-point into the code with following error:

    am I wrong with some concepts or operations?

    finally after run OPEN sql for this ABAP CDS table, I get following error message:

    but compare the data type for the fields of the ABAP CDS table with array types below in the code, I don't find any different, is the error message pointing to other meaning?

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 05, 2017 at 07:46 AM
    Add comment
    10|10000 characters needed characters exceeded

    • Thanks Horst, if I understand correctly, I fill the data into corresponding field in AMDP procedure, but still have the issue, which some data type inconsistent between table definition and AMDP code.