Application Development 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: 

DBSQL_SQL_INTERNAL_DB_ERROR SQL code: 2

quyen_tran
Explorer
0 Kudos
1,933

Hi experts,

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

12 REPLIES 12

xiaosanyu
Participant
0 Kudos
1,607

Hi, quyen.tran

Can you paste the code?

0 Kudos
1,607
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

.

0 Kudos
1,607

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

0 Kudos
1,607

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

matt
Active Contributor
0 Kudos
1,607

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

0 Kudos
1,607

and how did your Basis team fix it.?

matt
Active Contributor
0 Kudos
1,607

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.

turkaj
Active Participant
0 Kudos
1,607

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

0 Kudos
1,607

Hi Turkaj,

Thanks for your answer.

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

matt
Active Contributor
1,607

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

Sandra_Rossi
Active Contributor
0 Kudos
1,607

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

Sandra_Rossi
Active Contributor
0 Kudos
1,607

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.