Application Development and Automation 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: 
Read only

ABAP CDS table with complex AMDP coding

Former Member
0 Likes
9,041

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
Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
7,104

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

Check the mapping tables.

13 REPLIES 13
Read only

iftah_peretz
Active Contributor
0 Likes
7,104

Hey,

Can this help?

Read only

Former Member
7,104

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/

Read only

0 Likes
7,104

You know you gave the same link I gave?

Read only

7,104

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?

Read only

7,104

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

Read only

iftah_peretz
Active Contributor
0 Likes
7,104

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

Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
7,104

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?

Read only

0 Likes
7,104

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.

Read only

Former Member
0 Likes
7,102

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?

Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
7,102

What happens if you SELECT with Open SQL.

Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
7,105

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

Check the mapping tables.

Read only

0 Likes
7,102

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

Read only

0 Likes
7,102

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.