Skip to Content
-1
Former Member
Feb 24, 2014 at 12:06 PM

alternative for SELECT COUNT(*) FROM kna1 WHERE kunnr EQ <fs_kunnr>-low.

185 Views

hello friends,


what can be the alternative statement for the select statement used here BELOW mentioned in BOLD?


FIELD-SYMBOLS <fs_kunnr> LIKE s_kunnr.

SELECT kunnr FROM kna1

INTO TABLE gint_kna1

WHERE kunnr IN s_kunnr.

LOOP AT s_kunnr ASSIGNING <fs_kunnr>.

IF ( <fs_kunnr>-sign EQ gc_e OR <fs_kunnr>-option EQ gc_ne ).

SELECT COUNT(*) FROM kna1 WHERE kunnr EQ <fs_kunnr>-low.

MESSAGE e782(z0).

ENDIF.

ELSE.

IF NOT <fs_kunnr>-low IS INITIAL.

SORT gint_kna1 BY KUNNR ASCENDING.

READ TABLE gint_kna1 WITH KEY kunnr = <fs_kunnr>-low TRANSPORTING NO FIELDS BINARY SEARCH.

IF sy-subrc NE 0.

MESSAGE e782(z0).

ENDIF.

ENDIF.

IF NOT <fs_kunnr>-high IS INITIAL.

SORT gint_kna1 BY KUNNR ASCENDING.

READ TABLE gint_kna1 WITH KEY kunnr = <fs_kunnr>-high TRANSPORTING NO FIELDS BINARY SEARCH.

IF sy-subrc NE 0.

MESSAGE e782(z0).

ENDIF.

ENDIF.

ENDIF.

ENDLOOP.

IF <fs_kunnr> IS ASSIGNED.

MOVE <fs_kunnr> TO s_kunnr.

ENDIF.

ELSE.

MESSAGE e782(z0).

ENDIF.

thanks and regards,

vinod