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

Generic Table to a formal type - for master data user exit class

Former Member
0 Likes
492

Hello,

I am attempting to setup an ABAP OO framework for extending master data with the CMOD exit, EXIT_SAPLRSAP_002. My goal is to create generic base class, upcast to the actual extraction structure, apply the customizing data fields, and then return the full table to the exit. The problem is that I_T_DATA, the internal table for return values is untyped and therefore generic. I tried using a class parameter as “type ref to DATA”, but the upcast if failing is failing. Can any one suggest:

  • What parameter type should I use for the class method parameter?

  • How do you upcast to the formal extract structure type?

  • How do you assign the result back to the generic type?

Thanks very much for the help!

Hello,

I am attempting to setup an ABAP OO framework for extending master data with the CMOD exit, EXIT_SAPLRSAP_002. My goal is to create generic base class, upcast to the actual extraction structure, apply the customizing data fields, and then return the full table to the exit. The problem is that I_T_DATA, the internal table for return values is untyped and therefore generic. I tried using a class parameter as “type ref to DATA”, but the upcast if failing is failing. Can any one suggest:

  • What parameter type should I use for the class method parameter?

  • How do you upcast to the formal extract structure type?

  • How do you assign the result back to the generic type?

Thanks very much for the help!

1 REPLY 1
Read only

Former Member
0 Likes
442

I ended up figuring out the answer after a bit more work. In case it helps others, the keys points are:

  • I_T_DATA exposed in EXIT_SAPLRSAP_00x is a dynamic internal table

  • The reference to the table can be passed to a method parameter as a generic type, “TABLE”

  • Though, to store the value in the class as a formally typed value, such as required by an attribute, the type must be cast to the type, “DATA”.

For example:

Public section

Method CONSTRUCTUR

IMPORTS

PT_DATA TYPE TABLE.

  • Assign data pointer to attribute

GET REFERENCE OF PT_DATA INTO A_T_DATA.

Endmethod.

protected section.

data A_T_DATA type ref to DATA .

Hope that helps.