‎2012 Oct 08 2:50 PM
Hi all,
I'm trying to build a generic routine to import the content of cluster tables like STXL, I have tried the statement IMPORT FROM DATABASE with variables for table name and area but ABAP does not seems to be supporting the use of variables for this statement.
Does anybody have an idea on how to achieve this?
Thanks.
‎2012 Oct 22 12:04 AM
‎2012 Oct 22 1:43 AM
Hi,
Correct me if I'm wrong, are you trying to store/retrieve your data by using SAP memory with IMPORT/EXPORT statement? Or you simply just want to retrieve the data from database table and store into your internal table?
Regards,
Xavier
‎2012 Oct 22 5:07 AM
As the IMPORT FROM DATABASE medium part doesn't seem to allow a dynamic syntax, you may have to generate a subroutine and then perform the generated subroutine. Or you could select the data from the INDX type file to an internal table and use an IMPORT FROM INTERNAL TABLE
Regards,
Raymond
‎2012 Oct 23 12:52 AM
Hi guys,
Thank you for your replies, I'm trying to do an import from database not from memory, I'm trying to read tables like STXL in a generic way.
Thanks
‎2012 Oct 23 2:05 AM
‎2012 Oct 23 3:10 AM
Hi,
I mean having statements like these:
IMPORT object to tmp_var from database dbtable(ar) id st_key.
where dbtable is a variable and ar is a variable too, this way we can use the same statement for tables like stxl and mdtc.
Thanks.
‎2012 Oct 23 5:32 AM
Hi,
Try this for dynamic import. It works fine for me in case of VARID table
lwa_dyn_tab-clustername = <fwa_selctab>-name. " name of cluster field in cluster table
lwa_dyn_tab-programname = '<F_FIELD5>'. "field symbol of type any
APPEND lwa_dyn_tab TO gt_dyn_tab.
IMPORT (gt_dyn_tab)
FROM DATABASE vari(va) CLIENT g_mandt ID t_key. " Import dynamic.imported value will "come in <f_filed_5>
IF <f_field5> IS ASSIGNED.
wa_excl_data-field5 = <f_field5>.
ENDIF.
Hope this helps
Rgds,
Sandeep katoch
‎2012 Oct 23 8:29 PM
Hi,
Thank you Sandeep for your input but I would like to use the same statement for other tables than VARID.
Regards
‎2012 Oct 24 8:55 AM
HI,
You can do it in similar way.
As far as I know STXL table stores the text lines from SAP Script.
So you need only to build the dynamic internal table linked to field symbol with the text ID and text name and other possible keys.
Approach will be similar.
I will check If I can write some code for STXL table also.
Rgds,
Sandeep Katoch