cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass table name as a variable in AMDP procedure

0 Kudos

I am Passing the table name from ABAP report into variable and passing the same variable to AMDP method as a importing parameter. But when i am trying to use same import parameter in AMDP method implementation as dynamic table in select * query, it is giving error as 'Scalar Type not allowed".

class-METHODS get_details

IMPORTING

VALUE(iv_table) TYPE TABNAME

VALUE(it_settlement) TYPE tt_settl_tmp

EXPORTING

VALUE(et_accounts) TYPE tt_accounts.

ENDCLASS.

CLASS /dcfc/cl_coxx_settlr_amdp_clas IMPLEMENTATION.

METHOD get_details BY DATABASE PROCEDURE

FOR HDB

LANGUAGE

SQLSCRIPT

options READ-ONLY.

et_accounts = SELECT * from :iv_table AS a inner join :it_setttlement as b on a.paledger = b.ledger AND a.wwcom = b.wwcom AND a.bukrs = b.bukrs_pos;

iv_table is variable where table name in comming

Regards,

NM

Accepted Solutions (0)

Answers (3)

Answers (3)

haley_zhang
Explorer
0 Kudos

Hi Nitin,

I am facing the same issue currently. Did you finally figure out how to do that?

Thanks a lot.

Best regards,

Haley

Pavan_Golesar
Active Participant
0 Kudos

Also, make sure while passing to AMDP parameter you are using -- Table types with a structured row type .. Note Pass by value is the only way we can pass paratmer to AMDP method as the Pass by reference is not supported by ABAP Managed Database Procedures(AMDP) Methods.

Thanks 🙂

--Pavan Golesar

Pavan_Golesar
Active Participant
0 Kudos

Hi,

Scalar Type not allowed  ???

This is skeptic, can perform analysis of error during runtime in transaction ST22. and tell us what are the findings.

may be the issue is somewhere else. .. May be---

Hope you find the solution,

Pavan Golesar