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: 

Runtime error in SELECT statement?

Former Member
0 Kudos

Keep getting this error and cannot figure out how to fix it. any ideas?

Here is the code i have:

 

REPORT Z_SALESORDERMIKE.

TABLES: ZMIKESALEDORDER, VBAK.

DATA: w_VBELN like VBAK-VBELN, w_ERDAT like VBAK-ERDAT, w_ERNAM like VBAK-ERNAM.

DATA wa_ZMIKESALEDORDER type VBAK.

INSERT VBAK from wa_ZMIKESALEDORDER.

PARAMETERS: SALESDOC like w_VBELN,

DATECRTD like w_ERDAT,

CRTDBY like w_ERNAM.

top-of-page.

start-of-selection.

select VBELN ERDAT ERNAM from VBAK into ZMIKESALEDORDER.

endselect.

AT SELECTION-SCREEN ON SALESDOC.

IF SALESDOC = w_VBELN.

WRITE: w_VBELN, w_ERDAT, w_ERNAM.

ENDIF.

AT SELECTION-SCREEN ON DATECRTD.

IF DATECRTD = w_ERDAT.

WRITE: w_VBELN, w_ERDAT, w_ERNAM.

ENDIF.

AT SELECTION-SCREEN ON CRTDBY.

IF CRTDBY = w_ERNAM.

WRITE: w_VBELN, w_ERDAT, w_ERNAM.

ENDIF.

 

end-of-selection.

end-of-page.

4 REPLIES 4

Former Member
0 Kudos

Hi Mike,

Your Select query syntax need to be changed.

Type SELECT in the abap editor and select the Keyword and press F1 to get the syntax and useful information.

Check sap help documentation for more information.

Regards,

AyyamPerumal

0 Kudos

Ayyam,

Any idea what it needs to be changed to?

Thanks

0 Kudos

Hi Mike,


Can you please elaborate on what you are trying to bring out from this report?

Since you are trying to write a single line as no loop is used for the data, use SELECT SINGLE statement like

SELECT SINGLE VBELN ERDAT ERNAM from VBAK

     into (W_VBELN,W_ERDAT,W_ERNAM)

     WHERE VBELN = SALESDOC AND ERDAT = DATECRTD AND ERNAM = CRTDBY.


But still i am not sure what your requirement is.


Regards,

AyyamPerumal

Former Member
0 Kudos

Hi Mike,

You have used select end select.

select VBELN ERDAT ERNAM from VBAK into ZMIKESALEDORDER.

endselect.

and no where clause, I am not understanding your requirements, your query trying to fetch all records.

and what is the fields from this table ZESALEDORDER(may be diff structure from VBAK)

Please post your clear requirement.

Regards,

Vadamalai A.