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

Error in Select statement

Former Member
0 Likes
2,991

Hi:

My selection-screen fields are:

date range, work order type range ( auart) , functional location range ( tplnr) and abc indicator( abckz).

I need to retrieve AUART , ARBEI, ISMNW from AUFK, AFRU, AFVV .

I tried in the following way:

SELECT aauart barbei c~ismnw INTO TABLE IT_TAB

FROM AUFK AS a

INNER JOIN PLPO as b ON awerks = bwerks

INNER JOIN AFRU as c ON awerks = cwerks

WHERE a~auart IN S_AUART.

its goin to short dump.

I would appreciate if anyone can correct me on this.

Thanks.

Raghu.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,284

Waht was the cause of the dump?

Rob

21 REPLIES 21
Read only

Former Member
0 Likes
2,285

Waht was the cause of the dump?

Rob

Read only

0 Likes
2,284

I guess it's timing out because neither the WHERE nor the JOIN conditions use any index.

Rob

Read only

0 Likes
2,284

Hi Rob,

can u give a sample code for using the index in my scenario.

thx

RAGHU

Read only

Former Member
0 Likes
2,284

hi Raghu,

There is no key field in the where condition of the select statement. Due to large amount of data, if you don't provide key field in the select statement program will give dump.

Regards,

Venkata Narayana

Read only

Former Member
0 Likes
2,284

try this

SELECT aauart barbei c~ismnw INTO <b>CORRESPONDING FIELDS OF</b> TABLE IT_TAB

FROM AUFK AS a

INNER JOIN PLPO as b ON awerks = bwerks

INNER JOIN AFRU as c ON awerks = cwerks

WHERE a~auart IN S_AUART.

I think in your internal table the fields sequence are not same as select query.

regards

shiba dutta

Read only

former_member186741
Active Contributor
0 Likes
2,284

If you cannot streamline your select and really do have to retrieve a lot of data you can make the following change to force it to operate in bite sized chunks.

SELECT aauart barbei c~ismnw INTO TABLE <b>IT_TAB2</b>

<b>PACKAGE SIZE 1000</b>

FROM AUFK AS a

INNER JOIN PLPO as b ON awerks = bwerks

INNER JOIN AFRU as c ON awerks = cwerks

WHERE a~auart IN S_AUART.

<b>

IF sy-subrc EQ 0.

append lines of IT_TAB2 TO IT_TAB.

ENDIF.

ENDSELECT.</b>

Read only

Former Member
0 Likes
2,284

Hi,

Instead of giving or comparing the fields awerks = cwerks compare bwerks = cwerks.And give a key field so tht it wont end up in short dump.

regards,

madhuri.

Read only

former_member196280
Active Contributor
0 Likes
2,284

The main cause for short dump is you did not use any key fields and it is getting time out.

In this case I recommend nested-loops. It may work effectively than joins....

Reward points if useful.

Regards,

SaiRam

Read only

0 Likes
2,284

Hi :

I modified my select statement as

SELECT aauart bismnw INTO TABLE IT_TAB

FROM AUFK AS a

INNER JOIN AFRU as b ON awerks = bwerks

WHERE a~auart IN S_AUART

AND A~WERKS = '1000'.

its giving run time errors " either conversion is not supported for the target field's type or target field is too short to accept the value".

I am trying to convert ISMNW field to char type, since its type is QUAN.

Thanks.

Raghu

Read only

0 Likes
2,284

Hi Raghu ,

How have you defined the internal table IT_TAB.

Regards

Arun

Read only

0 Likes
2,284

Your definition of the ismnw field in IT_TAB must be too small. Either make it bigger or change it to match the database definition and do the conversion later on outside the sql.

Read only

0 Likes
2,284

Internal table is declared.

convert ismnw field to char type from quan, it that u mean.

Read only

0 Likes
2,284

show us exactly how you have defined the table. Show us the abap code.

Read only

0 Likes
2,284

In general, how can we select ISMNW , ARBEI fields.we can find these fields in afru, afvv and plpo tables.

Read only

0 Likes
2,284

Hi Raghu ,

What i ment was could you please paste the code where you declare your internal table , what i understand is that the error occurs because the length of each row of the internal table is not sufficient to store the data you are retreiving.

Pasting your decleration here will help us to understand the root casue in a better way.

Regards

Arun

Read only

0 Likes
2,284

in your internal table declare the ISMNW field as

ismnw type afru-ismnw,

Read only

0 Likes
2,284

here is the code:

REPORT z_ska_scr NO STANDARD PAGE HEADING " LINE-SIZE 132.

MESSAGE-ID z_ka.

*-Tables----


TABLES: aufk, iloa,hivg,tpmus,afru,plpo.

*-Selection screen----


SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.

SELECT-OPTIONS:

s_auart FOR aufk-auart, "Work Order type

s_tplnr FOR iloa-tplnr, "Functional Location

s_abckz FOR iloa-abckz, "ABC Indicator

s_date FOR sy-datum. "Date Range

SELECTION-SCREEN END OF BLOCK blk1.

*-Global ypes----


DATA :BEGIN OF it_tab OCCURS 0,

auart TYPE auart,

ismnw type afru-ismnw,

arbei TYPE plpo-arbei,

tplnr TYPE tplnr,

abckz TYPE abckz,

werks(10) TYPE c VALUE '1000',

END OF it_tab.

*INITIALIZATION.

*

*

*-Main Program ogic----


START-OF-SELECTION.

SELECT aauart bismnw INTO TABLE it_tab

FROM aufk AS a

INNER JOIN afru AS b ON awerks = bwerks

WHERE a~auart IN s_auart

AND a~werks = '1000'.

IF sy-subrc <> 0.

MESSAGE i000.

RETURN.

ENDIF.

LOOP AT it_tab.

WRITE 😕 it_tab-auart, it_tab-ismnw.

ENDLOOP.

thanks.

Raghu

Read only

0 Likes
2,284

I believe you have to redesign you select statement. The join is too simple....only joining ON awerks = bwerks.....this will link every aufk's at the site 1000 to every afru at site 1000 regardless of if they are on the same order. I think this will cause a time-out as too many matches will happen.

Read only

0 Likes
2,284

thats only because of select statement or do i need to convert ISMNW , ARBEI fields into char type from quan type

Read only

0 Likes
2,284

I think the format of the fields is your smallest problem. I don't think the select itself makes sense. It joins EVERY AUFK to EVERY AFRU just on plant. That means if you have 500 afru's and 500 aufk's for site 1000 you will get 500 * 500 rows reurned: 250,000..... In my test system one site has 1220 rows in AFRU and 3000 rows in AUFk.........your sql would return 1220 * 3000 = 3,660,000 rows. Speak to someone at your site about what you are trying to do.

Read only

Nawanandana
Active Contributor
0 Likes
2,284

hai ragu

SELECT aauart barbei c~ismnw into corresponding fields of table IT_TAB

FROM AUFK AS a

INNER JOIN PLPO as b ON bwerks = awerks

INNER JOIN AFRU as c ON cwerks = awerks

WHERE a~auart IN S_AUART.

i think u can do it now

regard

nawa