Skip to Content
0
Former Member
Aug 03, 2006 at 04:17 PM

SELECT Statement question

40 Views

Hi ABAP Gurus,

I have the following code.

DATA: BEGIN OF i_p0000 OCCURS 0,

pernr LIKE pa0000-pernr,

begda LIKE pa0000-begda,

endda LIKE pa0000-endda.

DATA: END OF i_p0000.

DATA: v_date_from TYPE d,

v_date_to TYPE d.

DATA: BEGIN OF PERNRZ_TAB occurs 0,

PERNR(8) TYPE N,

END OF PERNRZ_TAB.

RANGES: l_r_pernr FOR pa0000-pernr, "personnel number

.

.

SELECT PERNRZ1 FROM ZTESTHR1 INTO table PERNRZ_TAB

WHERE BEGDAZ1

BETWEEN v_date_from AND v_date_to.

OPEN CURSOR WITH HOLD s_cursor FOR

SELECT pernr

begda

endda

FROM pa0000

WHERE pernr IN l_r_pernr.

  • Fetch records into interface table.

FETCH NEXT CURSOR s_cursor

APPENDING CORRESPONDING FIELDS

OF TABLE i_p0000

PACKAGE SIZE s_s_if-maxsize.

IF sy-subrc <> 0.

CLOSE CURSOR s_cursor.

RAISE no_more_data.

ELSE.

SORT i_p0000 BY pernr.

I would like to retrieve records based on the values in PERNRZ_TAB. When I make the following change I am getting an error.

SELECT pernr

begda

endda

FROM pa0000

WHERE pernr IN PERNRZ_TAB.

Thanks in advance.

Regards,

bw_newbie