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

SHORT DUMP IN SELECT STATEMENT

Former Member
0 Likes
1,557

Hi Guys!

I´m making a badi in BW, but i have a problem with a select statement that gets me a dump, can you help me to fix it.? the code is:

TYPES: BEGIN OF tp_mat_sales,

salesorg TYPE /bi0/pmat_sales-salesorg,

distr_chan TYPE /bi0/pmat_sales-distr_chan,

mat_sales TYPE /bi0/pmat_sales-mat_sales,

fcushpdt TYPE /bi0/pmat_sales-/bic/fcushpdt,

commmgmt TYPE /bi0/pmat_sales-/bic/commmgmt,

END OF tp_mat_sales.

DATA: t_mat_sales TYPE HASHED TABLE OF tp_mat_sales WITH UNIQUE KEY mat_sales salesorg distr_chan,

i_mat_sales TYPE tp_mat_sales.

SELECT salesorg distr_chan mat_sales /bic/commmgmt

INTO TABLE t_mat_sales

FROM /bi0/pmat_sales

FOR ALL ENTRIES IN t_data_in

WHERE mat_sales = t_data_in-mat_sales

AND salesorg = t_data_in-salesorg

AND distr_chan = t_data_in-distr_chan

AND objvers = 'A'.

Regards!!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,359

Try:

INTO CORRESPONDING FIELDS OF TABLE t_mat_sales

Rob

9 REPLIES 9
Read only

Former Member
0 Likes
1,359

What's the message of the Dump???

I don't see any problem in the code...

Greetings,

Blag.

Read only

Former Member
0 Likes
1,359

Hi!, the dump says:

Runtime Errors DBIF_RSQL_INVALID_RSQL

Exceptn CX_SY_OPEN_SQL_DB

ShrtText

Error in RSQL module of database interface.

What happened?

Error in ABAP application program.

The current ABAP program "ZCL_IM_AMGENMATS==============CP" had to be

terminated because one of the

statements could not be executed.

This is probably due to an error in the ABAP program.

Following a SELECT statement, the data read could not be placed in AN

the output area.

A conversion may have been intended that is not supported by the

system, or the output area may be too small.

Error analysis

An exception occurred. This exception is dealt with in more detail below

. The exception, which is assigned to the class 'CX_SY_OPEN_SQL_DB', was

neither

caught nor passed along using a RAISING clause, in the procedure

"IF_EX_OPENHUB_TRANSFORM~TRANSFORM" "(METHOD)"

.

Since the caller of the procedure could not have expected this exception

to occur, the running program was terminated.

The reason for the exception is:

The data read during a SELECT access could not be inserted into the

target field.

Either conversion is not supported for the target field's type or the

target field is too short to accept the value or the data are not in a

form that the target field can accept

Read only

0 Likes
1,359

Check these two things:

1) Double check if the field types specified for internal table are identical to the data elements in the database table you are selecting from.

2) Make sure that the SELECT statement is really returning unique values. Since you have defined the internal table as hash table with unique key, that could be causing the problem.

Read only

0 Likes
1,359

I think the itab definition should have LIKE instead of TYPE.


TYPES: BEGIN OF tp_mat_sales,
  salesorg like /bi0/pmat_sales-salesorg,
  distr_chan like /bi0/pmat_sales-distr_chan,
  mat_sales like /bi0/pmat_sales-mat_sales,
  fcushpdt like /bi0/pmat_sales-/bic/fcushpdt,
  commmgmt like /bi0/pmat_sales-/bic/commmgmt,
END OF tp_mat_sales.

Read only

0 Likes
1,359

Alexander is (partially) right. You have 5 fields in ITAB declaration, but only selecting 4 fields in SQL thereby sending the wrong data into wrong field.

Read only

0 Likes
1,359

...and that's why you use INTO CORRESPONDING...

You don't have to worry (as much) when the fields being selected change.

Rob

Read only

Former Member
0 Likes
1,360

Try:

INTO CORRESPONDING FIELDS OF TABLE t_mat_sales

Rob

Read only

0 Likes
1,359

Pls avoid the statement INTO CORRESPONDING becasue te performance reason. Check the selection feild, the field /bic/commmgmt is missing in decalration.

Read only

0 Likes
1,359

There is a performance hit when using INTO CORRESPONDING FIELDS OF TABLE..., but it's small. See

[ Performance - what will kill you and what will leave you with only a flesh wound|/people/rob.burbank/blog/2006/11/16/performance--what-will-kill-you-and-what-will-leave-you-with-only-a-flesh-wound]

Rob