2010 Apr 28 12:02 PM
Hi guys !! is it possible to join SAP tables dynamically.
I explain : a user chose some tables FOR EXAMPLE EKKO EKPO EKET.
Then some FIELDS from those tables.
And here comes my question how can i join tables dynamically then show contents.
Regards.
Mehdi.
Hi guys !! is it possible to join SAP tables dynamically.
I explain : a user chose some tables FOR EXAMPLE EKKO EKPO EKET.
Then some FIELDS from those tables.
And here comes my question how can i join tables dynamically then show contents.
Regards.
Mehdi.
2010 Apr 28 12:16 PM
why not just let them use SQVI - Quickviewer. If they don't know how to find the tables you could
create info sets for them.
Regards
Roy
2010 Apr 28 12:18 PM
maybe you can dinamically generate the select as a text ant then use this text generating and runing a temporary subroutine you can se how here ( http://help.sap.com/saphelp_nw04/helpdata/en/9f/db999535c111d1829f0000e829fbfe/content.htm )
I think you must generate all the subroutine as a code before this but it will work fine if you use the correct parameters.
2010 Apr 28 12:40 PM
to explain more i'm working on an SAP EXTRACTOR and this is the scenario :
the user X chose TABLES and Tables FIELDS.
but i dont know how to join those TABLES to get DATA.
2010 Apr 28 1:52 PM
1. Get all the fields of the tables using FM DDIF_FIELDINFO_GET.
2. There must be some relation beetween the tables. According to that create a dynamic internal table using the common key fields only and all non key fields.
3. Create a list of fields to be used in the select query with all non key fields and common key fields. Create join condition string and WHERE conditions string using concatenate statement.
4. Create a generic select querie as decribed
SELECT ([FIELD LIST])
INTO TABLE [dynamic internal table]
FROM ([JOIN CONDITION])
WHERE (CONDITIONS).
I think, it will work......But needs some time for analysis.......
2010 Apr 28 1:57 PM
Hi,
it is possible using a generated subroutine pool. I used this technic to implement a document search. Here are some relevant lines ...
append 'select distinct ts~tsnummer into table pt_tsnum' to lt_top.
append ' from /rand/ts_erfasst as ts' to lt_top.
append ' where ts~tsnummer in <tsnum>' to lt_mid.
append ' and ts~gescannt in <scadt>' to lt_mid.
append ' and ts~pernr in <pernr>' to lt_mid.
append ' and ts~tsweek >= l_week' to lt_mid.
l_hex = i_flag.
if l_hex o l_hx2.
append ' inner join PA0002 as pa on ts~pernr = pa~pernr' to lt_top.
append ' and pa~endda = ''99991231''' to lt_top.
append ' and pa~nachn in <nachn>' to lt_mid.
append ' and pa~vorna in <vorna>' to lt_mid.
endif.
[...]
GENERATE SUBROUTINE POOL lt_top name m_prog MESSAGE l_top.Regards
Nick
2010 Apr 29 3:23 PM
Still have no solution to my problem :s
I just linked 2 tables dynamically Header Tables & Item Tables should lik an other Table
For example :
Header table (EKKO) Item table (EKPO) and an other Table (X) that contain a discription of a field in the item Table
Like MAKT .....
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |