2009 Oct 08 5:47 PM
Hi guys,
My problem is that SAP create different tables in DEV, QAS and PRD. My program runs well in DEV, but when i transported it to QAS,it gave a dump, error the table is not found. Correct, that's why SAP created the table in QAS with another name... why¿? no idea.
I was thinking to do sth like this.
case sy-mandt.
when '0100'.
select single target1 into wa1-fipex
from FMFMOADCC1000034 " table used in DEV
where sour1_from = wa1-hkont and sour1_to = wa1-hkont.
when '0200'.
select single target1 into wa1-fipex
from FMFMOATCC2000012 " table used in QAS
where sour1_from = wa1-hkont and sour1_to = wa1-hkont.
endcase.
but it doesnt work, because the table of QAS doesnt exit in DEV. , but how can i do it??
Can i create a dynamic select? or any ideas, how to solve that problem???
Thanks
2009 Oct 08 7:16 PM
Hello,
I dont know why you are doing this but a simple hack will solve your woes
DATA: DYNTAB TYPE TABNAME.
case sy-mandt.
when '0100'.
dyntab = 'FMFMOADCC1000034'.
when '0200'.
dyntab = 'FMFMOATCC2000012'.
endcase.
select single target1 into wa1-fipex
from (dyntab) " table used in QAS
where sour1_from = wa1-hkont and sour1_to = wa1-hkont.I think this should suffice ...
BR,
Suhas
2009 Oct 08 5:58 PM
Hi,
Whats the issue you are facing with the code you have used? since you are selecting based on the sy-mandt it will pick the appropriate select statement.
Vikranth
2009 Oct 08 6:04 PM
Hi,
nop, because in DEV, SAP gave me an error, the table FMFMOATCC2000012 doesnt exit. It is correct, in mandt 100, that table doesnt exit, but in 200 exits. and opposite.
?¿?¿ Any idea.
2009 Oct 08 6:23 PM
You have to call the function module ABADR_DRULE_TABLENAMES_GET and get the tablename and change your select statement to be a dynamic table select.
2009 Oct 08 6:24 PM
Ok but if the client number of DEV is 0100, the control wont even go to the select of 0200 i,e the table FMFMOATCC2000012 . Then how are you getting this error?
2009 Oct 08 6:27 PM
yes, it is correct.
Try to make a select using a table that it doesnt exit in SAP, it gives u an error
TABLE NAME is not defined in the ABAP Dictionary as a table, projection view, or database view.
So it is not possible to use it.
Thanks
2009 Oct 08 6:36 PM
Yes i understood now. I thought you were getting a dump. but the select wont even pass the syntax check.
2009 Oct 08 6:52 PM
One more option could be as follows,
the table DD02T stores all the table names. You could make a select on this table and frame your actual select query dynamically
data: w_tabname type dd02t-tabname.
select single tabname
from dd02t
into w_tabname
where tabname = 'FMFMOADCC1000034' OR
tabname = 'FMFMOATCC2000012 '.
if sy-subrc = 0.
select single target1
into wa1-fipex
from ( w_tabname )
where sour1_from = wa1-hkont and
sour1_to = wa1-hkont.
endif.
Vikranth
2009 Oct 08 6:00 PM
2009 Oct 08 6:02 PM
SAP created those tables in FMDERIVER
SAP gives different names in different systems. Crazy..
2009 Oct 08 7:16 PM
Hello,
I dont know why you are doing this but a simple hack will solve your woes
DATA: DYNTAB TYPE TABNAME.
case sy-mandt.
when '0100'.
dyntab = 'FMFMOADCC1000034'.
when '0200'.
dyntab = 'FMFMOATCC2000012'.
endcase.
select single target1 into wa1-fipex
from (dyntab) " table used in QAS
where sour1_from = wa1-hkont and sour1_to = wa1-hkont.I think this should suffice ...
BR,
Suhas
2009 Oct 08 7:27 PM
Thanks.
That was the answer that i was looking for.
Regards to all.
2009 Oct 08 7:39 PM
[Note 1231815|https://websmp206.sap-ag.de/~form/handler?_APP=01100107900000000342&_EVENT=REDIR&_NNUM=1231815&_NLANG=E] gives the proper solution.
Rob