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

Table attribute to a class

Former Member
0 Likes
1,596

Hi,

I am creating a custom global class using SE24. I have a constructor and method called SCC_DELETE. For this i need to pass MARA table in the attribute tab. I have doubt that can i choose LIKE typing in the attribute tab ?

If i choose how i can loop this table inside the method?

After the delete inside the method i need to send the data back ? for this can i do that?

Whether i have to use different table as CHANGING in the attribute tab?

Thanks

Sa_R

1 ACCEPTED SOLUTION
Read only

marcelo_ramos1
SAP Mentor
SAP Mentor
0 Likes
986

Hi,

To define your internal table in Atribute tab you must use a <b>Table Type</b> with Mara as row type.

<i>You can create Table Type on SE11.</i>

<i><b>In you atribute tab you can use as follow:</b></i>

 
t_mara TYPE <Your Table Type>. "Use TYPE for this

<b><i>If you're trying to define the table as method parameter you can try the same way used in atribute tab:</i></b>

<b><i>Inside the the method you can try this way:</i>

</b>


DATA: line_mara TYPE mara. "You can use this 


DATA: line_mara TYPE LINE OF <Your Table Type>. "Or this 


LOOP AT t_mara INTO line_mara.
"CHANGE line_mara.

MODIFY t_mara FROM line_mara INDEX <idx> "You can use this 
APPEND line_mara TO t_mara.   "Or this 

APPEND 
ENDLOOP.

Regards.

Marcelo Ramos

3 REPLIES 3
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
986

Hi,

You have to use CHANGING parameter for the method, if you want to change the data in the method and return the changed value.

Also if you want to send an internal table of type MARA then you might have to use a DDIC table type whose line type is MARA.

Also you cannot use LIKE, you can only use LIKE to refer to an already existing attribute. So you have to use TYPE and give the TABLE TYPE name to pass internal table.

Regards,

Sesh

Read only

marcelo_ramos1
SAP Mentor
SAP Mentor
0 Likes
987

Hi,

To define your internal table in Atribute tab you must use a <b>Table Type</b> with Mara as row type.

<i>You can create Table Type on SE11.</i>

<i><b>In you atribute tab you can use as follow:</b></i>

 
t_mara TYPE <Your Table Type>. "Use TYPE for this

<b><i>If you're trying to define the table as method parameter you can try the same way used in atribute tab:</i></b>

<b><i>Inside the the method you can try this way:</i>

</b>


DATA: line_mara TYPE mara. "You can use this 


DATA: line_mara TYPE LINE OF <Your Table Type>. "Or this 


LOOP AT t_mara INTO line_mara.
"CHANGE line_mara.

MODIFY t_mara FROM line_mara INDEX <idx> "You can use this 
APPEND line_mara TO t_mara.   "Or this 

APPEND 
ENDLOOP.

Regards.

Marcelo Ramos

Read only

Former Member
0 Likes
986

Marcelo Ramos,

You saved my day. Thanks

Points assigned

Sa_R