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

Select code -Runtime erro

Former Member
0 Likes
654

Dear all,

I have return the Code like this.

REPORT zdon3.

TABLES :VBAK.

SELECT-OPTIONS S_VBELN FOR VBAK-VBELN.

DATA: BEGIN OF wa_vbakvbap,

vbeln TYPE vbak-vbeln,

kunnr TYPE vbak-kunnr,

matnr TYPE vbap-matnr,

werks TYPE vbap-werks,

netwr TYPE vbak-netwr,

END OF wa_vbakvbap.

DATA: it_vbakvbap LIKE TABLE OF wa_vbakvbap WITH HEADER LINE.

SELECT hvbeln hkunnr h~netwr

imatnr iwerks

INTO TABLE it_vbakvbap FROM vbak AS h

INNER JOIN vbap AS i ON hvbeln = ivbeln

WHERE H~VBELN IN S_VBELN.

LOOP AT it_vbakvbap.

WRITE:/ it_vbakvbap-vbeln,it_vbakvbap-kunnr,

it_vbakvbap-matnr,it_vbakvbap-werks.

ENDLOOP.

*i didnt get any error and its activated fine.When iam trying to Excute this it is going in Run-time error.

What could be the Mistake.

Thanks in Advance

Regards

raj.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
624

Hi,

Change this



SELECT h~vbeln h~kunnr i~matnr  i~werks h~netwr 
 INTO TABLE it_vbakvbap FROM vbak AS h
INNER JOIN vbap AS i ON h~vbeln = i~vbeln
WHERE H~VBELN IN S_VBELN.
 "The order in which you have written the fields in the select query should correspond to the order in internal table

Or you can use


INTO CORRESPONDING FIELDS OF TABLE clause.

But this is pretty performance intensive.

5 REPLIES 5
Read only

Former Member
0 Likes
624

1

Read only

Former Member
0 Likes
624

Hi Venky,

You should indicate us the text of the error that you obtain...

Thanks!

Samuel

Read only

Former Member
0 Likes
625

Hi,

Change this



SELECT h~vbeln h~kunnr i~matnr  i~werks h~netwr 
 INTO TABLE it_vbakvbap FROM vbak AS h
INNER JOIN vbap AS i ON h~vbeln = i~vbeln
WHERE H~VBELN IN S_VBELN.
 "The order in which you have written the fields in the select query should correspond to the order in internal table

Or you can use


INTO CORRESPONDING FIELDS OF TABLE clause.

But this is pretty performance intensive.

Read only

Former Member
0 Likes
624

> But this is pretty performance intensive.

Often repeated, but still wrong!

Here is is not necessary.

> IN S_VBELN.

what do you select ??????? Without this information your question is incomplete and useless.

Read only

0 Likes
624

thanks a lo Nitwick

Regards

raj.