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

How to pass an internal table inside a call function??

siongchao_ng
Contributor
0 Likes
1,228

Hi all,

I need to copy out the contents of an internal table inside a call function. How am I supposed to do that? To be specific, I need to copy out the contents of gt_pernr_msg[] inside the hrdme99_log_store_msg call funtion. Thanks in advance.

Edited by: Siong Chao on Jan 6, 2010 3:25 AM

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
1,188

You can use


 ITAB     STRUCTURE       TAB512

Please check function module RFC_RED_TABLE

The refresh issue for that you need to store the internal table content in table or store it in any file in the app server

Hi all,

I need to copy out the contents of an internal table inside a call function. How am I supposed to do that? To be specific, I need to copy out the contents of gt_pernr_msg[] inside the hrdme99_log_store_msg call funtion. Thanks in advance.

Edited by: Siong Chao on Jan 6, 2010 3:25 AM

8 REPLIES 8
Read only

Former Member
0 Likes
1,188

Hi ,

Please check the parameters of the FM. If the same is avaliable as parameter in table tab.Then you can pass directly to the FM, else

Try EXPORT and IMPORT options.

Press F1 on EXPORT and IMPORT.

Edited by: Harsh Bhalla on Jan 6, 2010 8:21 AM

Read only

0 Likes
1,188

Hi,

The FM only have import parameters. The siuation remains is that I try to use the export to memory id right after the call function to collect the data that is appended in internal table gt_pernr_msg. However this FM is called many times and the message I can export out is the most recent message that is appended inside the internal table. I need to get all the messages instead. Any idea?

Read only

0 Likes
1,188

Hi ,

Asper my understanding , you have to collect the messages from the FM into your program.

If you know the exact places where this FM is called then you can import the table in your program and append the messages into an temporary internal table.

Keep appending all messages in this.

Hope this resolves your issue.

Read only

0 Likes
1,188

Hi Harsh,

I know where the Fm is called. So I try to append the messages into my temporary internal tabe. Trouble is, this FM will be called several times and the messages in my temporary internal table seems to get refreshed each time the FM is called. So at the end of the day, I only managed to get the most recent message. Any idea or syntax to copy out the entire contents of the internal table inside the FM??

Read only

former_member194669
Active Contributor
0 Likes
1,189

You can use


 ITAB     STRUCTURE       TAB512

Please check function module RFC_RED_TABLE

The refresh issue for that you need to store the internal table content in table or store it in any file in the app server

Read only

0 Likes
1,188

Hi,

In this FM, can the query table refer to the internal table inside an FM?? Note, l the example of this RFC_READ_TABLE refers to SAP tables in data dictionary. So can gt_pernr_msg used in this case??

CALL FUNCTION 'RFC_READ_TABLE'

EXPORTING

query_table = 'gt_pernr_msg'

  • DELIMITER = ' '

  • NO_DATA = ' '

  • ROWSKIPS = 0

  • ROWCOUNT = 0

tables

OPTIONS =

fields =

data =

  • EXCEPTIONS

  • TABLE_NOT_AVAILABLE = 1

  • TABLE_WITHOUT_DATA = 2

  • OPTION_NOT_VALID = 3

  • FIELD_NOT_VALID = 4

  • NOT_AUTHORIZED = 5

  • DATA_BUFFER_EXCEEDED = 6

  • OTHERS = 7

.

Read only

Former Member
0 Likes
1,188

Hi;

Its a better way to create a z-table and store the data into it.

Regards

Shashi

Read only

siongchao_ng
Contributor
0 Likes
1,188

Found the syntax finally.

First, have to declare the field types similar t the internal table inside the call function namely, gt_pernr_msg

data: begin of t_error occurs 0,

msgty like sy-msgty,

msgid like sy-msgid,

msgno like sy-msgno,

msgv1 like sy-msgv1,

msgv2 like sy-msgv2,

msgv3 like sy-msgv3,

msgv4 like sy-msgv4,

end of t_error.

field-symbols: <t_error> like t_error[].

assign ('(SAPLHRDME99_LOG)GT_PERNR_MSG[]') to <t_error>.

t_error[] = <t_error>[].

*Use assign syntax to copy the entire contents of the gt_pernr_msg[] to field symbol <t_error> which in turn is copied to my own internal table t_error[]