Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP CDS table with complex AMDP coding

former_member310653
Participant
0 Kudos

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,

1 ACCEPTED SOLUTION

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

Check the mapping tables.

13 REPLIES 13

iftah_peretz
Active Contributor
0 Kudos

Hey,

Can this help?

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/

0 Kudos

You know you gave the same link I gave?

I did not even know there was another reply. I see you beat me with 3 min posting your answer. 🙂

Well, then it must be a good link, right?

:). It is so good that even the writer of that linked blog answered the question.

iftah_peretz
Active Contributor
0 Kudos

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

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

The return value of a CDS table function implemented in AMDP has the

"type of a standard table is created with an empty table key named result with a structured row type....."

With other words, inside the procedure it has a tabular type that you can fill in the implementation. What exactly is your problem?

0 Kudos

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.

former_member310653
Participant
0 Kudos

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?

0 Kudos

What happens if you SELECT with Open SQL.

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

Check the mapping tables.

0 Kudos

hi horst keller,

I have seen many of ur blogs and I am following of it.Sir I have started using AMDP but only with select statements with joins.I wanted know what all functions does amdp support which are supported in ABAP.Please give me a reference regarding the same.

thanks

Regard's

uday

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

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.