‎2009 Oct 12 10:00 AM
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.
‎2009 Oct 12 10:21 AM
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.
‎2009 Oct 12 10:02 AM
‎2009 Oct 12 10:15 AM
Hi Venky,
You should indicate us the text of the error that you obtain...
Thanks!
Samuel
‎2009 Oct 12 10:21 AM
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.
‎2009 Oct 12 11:16 AM
> 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.
‎2009 Oct 12 11:49 AM