2010 Jan 05 4:37 AM
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
2010 Jan 06 4:13 AM
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
a®
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
a®
2010 Jan 06 2:46 AM
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
2010 Jan 06 3:03 AM
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?
2010 Jan 06 3:07 AM
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.
2010 Jan 06 3:55 AM
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??
2010 Jan 06 4:13 AM
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
a®
2010 Jan 06 6:56 AM
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
.
2010 Jan 06 4:24 AM
Hi;
Its a better way to create a z-table and store the data into it.
Regards
Shashi
2010 Jan 06 8:36 AM
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[]
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |