Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

DBSQL_SQL_INTERNAL_DB_ERROR SQL code: 2

quyen_tran
Explorer
0 Likes
8,528

Hi experts,

Have you ever faced this issue? do you know what is this and how to fix it?

13 REPLIES 13
Read only

xiaosanyu
Participant
0 Likes
8,202

Hi, quyen.tran

Can you paste the code?
Read only

0 Likes
8,202
SELECT BKPF~BELNR,
BKPF~GJAHR,
BKPF~BUKRS,
BKPF~BLART,
BKPF~BUDAT,
BKPF~AWKEY,
BKPF~AWTYP,
BKPF~XBLNR,
ACDOCA~DOCLN,
ACDOCA~BUZEI,
ACDOCA~DRCRK,
ACDOCA~SGTXT,
ACDOCA~RHCUR,
ACDOCA~HSL,
ACDOCA~ZUONR,
ACDOCA~MSL,
ACDOCA~UMSKZ,
ACDOCA~REBZG,
ACDOCA~REBZJ,
BSEG~NETDT,
BSEG~AUGDT,
BSEG~HKONT,
BSEG~ZLSCH, "Payment method
BSEG~ZLSPR, "Pmnt block
BSEG~KUNNR,
VBPA~PARVW,
VBPA~KUNNR AS VBPA_KUNNR
FROM BKPF INNER JOIN ACDOCA ON ACDOCA~BELNR EQ BKPF~BELNR
AND ACDOCA~RBUKRS EQ BKPF~BUKRS
AND ACDOCA~RYEAR EQ BKPF~GJAHR
INNER JOIN BSEG ON ACDOCA~BELNR EQ BSEG~BELNR
AND ACDOCA~RBUKRS EQ BSEG~BUKRS
AND ACDOCA~GJAHR EQ BSEG~GJAHR
AND ACDOCA~BUZEI EQ BSEG~BUZEI
LEFT OUTER JOIN VBPA ON BKPF~AWKEY EQ VBPA~VBELN
INTO TABLE @DATA(LT_SS02_DATA)
WHERE BKPF~BUKRS IN @s_BUKRS
AND BKPF~BELNR IN @s_BELNR
AND BKPF~GJAHR IN @s_GJAHR
AND ACDOCA~RLDNR EQ '0L'
AND BSEG~KUNNR IN @s_KUNNR

.

Read only

0 Likes
8,198

There is no problem with SQL statements, you can also test them with fixed BLNER doc numbe

Read only

0 Likes
8,198

Thanks for your feedback.

This short-dump sometimes happens, not all the time, and when we rerun it is Ok. so I don't know why it happened

Read only

matt
Active Contributor
0 Likes
8,198

For these types of issues I go to my Basis team.

Read only

0 Likes
8,198

and how did your Basis team fix it.?

Read only

matt
Active Contributor
0 Likes
8,198

I don't know. It's their job, not mine as a developer.

The point is that this is most likely not a coding error, but an error with the database. Basis need to fix it.

Read only

turkaj
Active Participant
0 Likes
8,198

Hi quyen,

the problem is with the BSEG table. This table is a cluster table and cannot be used in a JOIN. Perhaps that is the problem.

A possible solution:
You can do it for the table BSEG with the command FOR ALL ENTRIES instead of JOINS.


For example:

DATA: lt_bseg TYPE TABLE OF bseg.

SELECT * FROM bseg
  INTO TABLE lt_bseg
  FOR ALL ENTRIES IN @lt_openitems
  WHERE belnr EQ @lt_openitems-doc_no
    AND gjahr EQ @lt_openitems-fisc_year
    AND bukrs EQ @lt_openitems-comp_code.

SELECT bkpf~bukrs,
  bkpf~belnr,
  ...
FROM bkpf INNER JOIN acdoca ON acdoca~belnr EQ bkpf~belnr
..
LEFT OUTER JOIN vbpa ON bkpf~awkey EQ vbpa~vbeln
INTO TABLE @DATA(lt_ss02_data)
FOR ALL ENTRIES IN @lt_bseg
WHERE bkpf~belnr EQ @lt_bseg-belnr
...

Regards
Jim

Read only

0 Likes
8,193

Hi Turkaj,

Thanks for your answer.

but in my system( S4Hana) BSEG is Transparent table.

Read only

matt
Active Contributor
8,193

Joining a cluster table gives you a syntax error, not a dump.

Read only

Sandra_Rossi
Active Contributor
0 Likes
8,193

Please post the code as text instead of image, so that one can easily answer by copying your code in order to complete it. Then, select your code and press the button [CODE], which makes the code appear colored/indented, it will be easier for people to look at it. Thank you!

Edit is possible via menu Actions > Edit.

Also, avoid posting just screenshots. For referencing your question:

SQL error 2: general error: key does not exist in the map

Read only

Sandra_Rossi
Active Contributor
0 Likes
8,193

If you want to be assisted, don't share only the first lines of the short dump, attach it in full.

You can also search the error message in the Web and in the SAP notes.

For any database error as in your case (not ABAP), you should indicate which database you are using.

Read only

Ermelinda
Newcomer
0 Likes
6,254

How did you solve the problem? thanks