cancel
Showing results for 
Search instead for 
Did you mean: 

generate query at a time & connect two database ?

former_member637595
Participant
0 Kudos

Hi

Could u help me? it is necessary that

I have two database ( RSHPL,RSPL) and both data base have same table name and same fieldname (Table Name :-OITM, Fieldname :ONHAND ,pk- ITEMcode,)

At first I tell u what I want?

I want to generate query at a time & connect two database and same table name(OITM) to select the TOTAL VALUE of this field(ONHAND) and pk-key is Itemcode.

Is it Possible? If Possible plz write this query and send me.

Accepted Solutions (1)

Accepted Solutions (1)

Nussi
Active Contributor
0 Kudos

here is the solution - copy it in your query analyzer and replace the database name

select x.itemcode, sum(x.onhand) from

(select itemcode, sum(onhand) as 'onhand' from [databasename1].dbo.oitm group by itemcode

union all

select itemcode, sum(onhand) as 'onhand' from [databasename2].dbo.oitm group by itemcode) as x

group by itemcode

please reward points - it cost me 5 minutes of my live

former_member637595
Participant
0 Kudos

The problem is solved.

Thank you very much David

Nussi
Active Contributor
0 Kudos

@gangotri

it would be really nice when you award points

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

I don't think its possible to write a query from within SAP that allows you to get data from another SAP database.

I have used SQL Reporting Services to report on data from multiple databases, and this works very well for many of my clients. It depends on what you want to do with the data, do you need to display it on the screen in SAP and it to a field or will a report suffice?

Regards,

Adrian

Former Member
0 Kudos

Hi,

I also want to ask u smethng related to query,i hve created 1 UDF at row level of outgoing payment now my problem is i want to do FMS i.e formatted search at row level suah that Customer/vendor reference no. should get displayed........

i know its already there but what the problem is in layout PLD i am unable to pick up that value...what i must do in such case.let me know its actualy an urgent requirment..........so let me know asap.

mona