09-06-2008 6:36 AM
I am passing dynamic internal table to FM RFC enabled .. for that matter i am passing these values into String and then using this string in FM .. correct me if this is wrong way to do .
Following code is giving dump ...for Unicode conversion from <l_struct> to lt_string not possible. some special conversion needed.
data : lt_string TYPE sxms_str_t.
LOOP AT <lt_data> INTO <l_struct>.
APPEND <l_struct> TO lt_string.
ENDLOOP.
Pls suggets me if there is any other way to pass dynamic internal table to FM RFC enabled .
Thanks in advance .
09-06-2008 6:51 AM
you try this..
LOOP AT <lt_data> assigning <l_struct>.
APPEND <l_struct> TO lt_string.
ENDLOOP.
09-06-2008 6:51 AM
you try this..
LOOP AT <lt_data> assigning <l_struct>.
APPEND <l_struct> TO lt_string.
ENDLOOP.
09-06-2008 6:56 AM
no luck
problem is in APPEND <l_struct> TO lt_string. statement .
may be there is some type mismatch .. but tell is this is the right way to pass internal table toRFC FM ? or there is some other good method
09-06-2008 7:11 AM
what are you passing exactly in the dynamic internal table..?
Just give some more details on what you are doing..?
09-06-2008 7:26 AM
i am supposed to pass database table data from BW to table in R3
and user will enter BW table name at run time so i can not restrict the internal table structure .. for that matter i am creating dynamic internal table ..im using flollowing code
DATA : lt_data TYPE REF TO data,
l_struct TYPE REF TO data.
FIELD-SYMBOLS: <lt_data> TYPE STANDARD TABLE,
<l_struct> TYPE ANY.
*Initialize p_table variable with database table name .
PERFORM get_structure.
PERFORM GET_DATA.
Form get_strucutre .
CREATE DATA lt_data TYPE STANDARD TABLE OF (p_table). " this is your table
ASSIGN lt_data->* TO <lt_data>.
CREATE DATA l_struct TYPE (p_table). " this is your structure
ASSIGN l_struct->* TO <l_struct>.
Endform.
FORM get_data.
select * from (p_table) into table <lt_data>.
ENDFORM.
at this time i having data in internal table in BW .. now i will make a call to RFC FM and pass this internal table data .
now ques is how this can be done ? coz RFC FM supports parameter values to be passed as VALUE not reference ..
hope i am able to explain
09-06-2008 9:04 AM
>now ques is how this can be done ? coz RFC FM supports parameter values to be passed as VALUE not >reference
if your table data is small(512chars) then you can try this approach
just imitating the function RFC_READ_TABLE, here the data will be read to internal table of type TAB512.
you can also try the same way..
09-06-2008 10:34 AM
Vijay , it seems like this will solve my problem .. can u pls send across usage of this FM ..\
Thanks in advance
09-06-2008 10:54 AM
you can try out this approach...using RFC_READ_TABLE function
data: lt_options type table of rfc_db_opt,
lt_fields type table of rfc_db_fld,
lt_data type table of tab512,
l_offset type i,
l_len type i,
ls_flight type sflight.
field-symbols: <ls_fields> type rfc_db_fld,
<ls_data> type tab512,
<l_field> type any.
options-text = ' '. " Where condtions you can pass to the options parameter
append options to lt_options.
call function 'RFC_READ_TABLE'
destination bwsystem-rfcdest
exporting
query_table = 'SFLIGHT'
tables
options = lt_options
fields = lt_fields
data = lt_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
.
if sy-subrc <> 0.
* function not possible try RFC_FUNCTION_SEARCH
exit.
endif.
loop at lt_data assigning <ls_data>.
loop at lt_fields assigning <ls_fields>.
l_offset = <ls_fields>-offset.
l_len = <ls_fields>-length.
assign component <ls_fields>-fieldname of structure
ls_flight to <l_field>.
if sy-subrc eq 0.
<l_field> = <ls_data>+l_offset(l_len).
"Reading the columns one by one...here
endif.
endloop.
endloop.
09-06-2008 11:28 AM
thanks , in my case i have to trigger program from BW , read BW table data and send it to R3.
and user will enter BW table name at run time.
In BW i am maintaing customizing table where there exist BW table name , RFC destination name and TArget table name .
and i am maintaing target table striucture in R3 and this structure is as of BW table.
i am able to send the data from BW but i need a placeholder at receiver end R3 , it could be any table depending upon the user selection.
so this FM is not going to solve my purpose.
Pls help i am running out of ideas
09-08-2008 5:11 PM
09-06-2008 7:33 AM
09-06-2008 7:46 AM
it would work in case where the table strucutre is known ...whereas in my case its dynamic
at receiving server how would i know decide *like parameter name * in Function module RFC .
09-06-2008 8:22 PM
Hello Brijesh
If you problem is to move a structured record to an unstructured C-container (e.g. string) then you should use the static methods of CL_ABAP_CONTAINER_UTILITIES.
For more details please refer to:
Regards
Uwe