Skip to Content
-4

AMDP database extract returning dubious records.

Jul 15, 2017 at 07:27 AM

124

avatar image

I have a select query for all entries. I am moving this to AMDP and doing an inner join of VBRP table with the internal table moved. The extract is not the records expected.

Does the AMDP call up a different schema? How do we set default schema when calling AMDP? I am also passing client number. How do we know which schema should the AMDP go to?

10 |10000 characters needed characters left characters exceeded

Your question is incomplete (in fact it's 2 questions). Do you want us to have a look at your rewritten query (so please provide those queries before and after the rewrite), or only to answer the question about which schema is used for AMDP (then why don't you simply read the internet answers for "amdp schema")?

0

Dear Sandra

Here's the source code.

Select matnr zzpernr ps_psp_pnr vbeln zzpspri zzproj FROM vbrp

INTO table it_vbrp for all entries in it_temp where vbeln = it_temp-refbln and matnr = it_temp-matnr

If you know how this query be transformed to AMDP then please tell.

0

And what is your AMDP ?

And what are the results ? Why do you think they are dubious ?

1

I really admire your patience ;-)

0

For all entries return 2050 records, AMDP query below gets me 717 records.

Select <vp.fields>

From vbrp as vp inner join :intrnal_table as CP on vp.<fields> = cp.<fields>;

Question again to you is if you know the query kindly share it. As this extracted result is not per extraction from the ABAP for all entries.

0

First, you should give all information about your issue. This forum is not here for writing solutions. It's for answering "why" and "how". I think you've got all the answers from Horst.

2
Further commenting has been locked.
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Horst Keller
Jul 15, 2017 at 10:31 AM
2

"Does the AMDP call up a different schema?"

No.

"How do we set default schema when calling AMDP?"

You can't. AMDP only uses the standard connection or a service connection to the ABAP schema.

"How do we know which schema should the AMDP go to?"

By reading the documentation.

This completely answers your three questions.

If you don't receive the expected results you simply have an error in the implementation that you must correct. First you have to understand the semantics of your FOR ALL ENTRIES then you have to transfer that to SQLScript. Did you bother about DISTINCT?

Show 9 Share
10 |10000 characters needed characters left characters exceeded

Hi keller

The below AMDP query is bonkers. Where exactly does distinct needs to add up?

Select <vp.fields>

From vbrp as vp inner join :intrnal_table as CP on vp.<fields> = cp.<fields>;

0

The ABAP documentation explains all for DISTINCT (and also SQL documentation).

1

Sandra, it's still an open question. ABAP HANA documentation is not specific to the select query, which is why I asked whether anything more needs to get added to the AMDP query. Yes I did delete adjacent duplicates before reaching out to AMDP inner join.

Select <vp.fields>

From vbrp as vp inner join :intrnal_table as CP on vp.<fields> = cp.<fields>;

Please let others post when you don't intend to find out the solution.

0
I admit I know nothing about AMDP, but sometimes people who don't know can help because of "around" knowledge. For instance, the following can obviously help:

https://help.sap.com/http.svc/rc/abapdocu_750_index_htm/7.50/en-US/abenmesh_amdp_abexa.htm says:

products = select * from snwd_pd as product 
where client = :clnt and node_key in (
select DISTINCT product_guid from :items );

is equivalent to:

SELECT * 
FROM snwd_pd
FOR ALL ENTRIES IN @items
WHERE node_key = @items-product_guid
INTO TABLE @products.
1

Suppose you have two and more conditions to compare, the example AMDP query won't work as this will not compare the two fields record wise. And will return records not expected.

Regards

Diganto

0

In SQL, when there are several fields to join, one cannot use IN, instead may either use the CONCAT function or the EXISTS condition. I prefer EXISTS as it "always" existed in Open SQL, but then DISTINCT is implicit so I think it doesn't need to be used (ask experts if there's a performance difference with/without).

So, if I use the example above and add the invented ANYFIELD field, I guess you could use:

products = select * from snwd_pd as product
where client = :clnt and EXISTS ( select * from :items where product_guid.guid = product.node_key and product_guid.anyfield = product.anyfield );

which would be equivalent to :

SELECT * 
  FROM snwd_pd 
  FOR ALL ENTRIES IN @items
  WHERE node_key = @items-product_guid 
    AND anyfield = @items-anyfield
  INTO TABLE @products.
1
Addendum: I realize that the 2 full codes from the ABAP documentation are globally equivalent, but this excerpt is not equivalent. In fact, the DISTINCT used here is from a performance perspective, but what you were looking for is a DISTINCT placed in the first SELECT (in your case: Select DISTINCT <vp.fields>)
1

I was not aware that Sandra was stopping anyone else from posting?

From the little information you have provided, I cannot tell that your queries are equivalent. So I would not expect the same results.

2

While u had read the posts you had known that I am looking for an AMDP query that works as For All Entries in ABAP. The difference between standard SAP examples and this is I have 2 and more fields to compare fields with VBRP table and doing a distinct will not yeild record specific extract( but will pull out N*M records for a single unique record) . The alternative which was thought out was to use "Inner join" which is not yeilding the extract it yeilds with "for all entries".

The final conclusion went with the schema usage to which Mr. Keller says is well integrated. Hence the confusion

Diganto

0