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

Problem in where condition - with range table ?

Former Member
0 Likes
458

I am writing this code in BADI....

I have problem with the bold part of coding below

( SELECT uzawe

UP TO 1 rows

FROM lfb1

INTO wa_uzawe

WHERE lifnr = i_rbkpv-lifnr " bseg-lifnr

AND bukrs IN r_bktxt.

ENDSELECT. )

Could you please correct why below <b>bukrs IN r_bktxt</b> has problem ?

DATA : wa_zcharval1 TYPE zkap-zcharval1,

r_bktxt TYPE RANGE OF lfb1-bukrs,

wa_bktxt LIKE LINE OF r_bktxt.

wa_bktxt-sign = 'I'.

wa_bktxt-option = 'BT'.

SELECT zcharval1 INTO wa_zcharval1

FROM zkap

WHERE zcharfld1 = 'U319'

AND zcharfld2 = 'ACTIVE_BUKRS'

AND znumfld1 = '0'

AND zseqno = '0'.

wa_bktxt-low = wa_zcharval1.

APPEND wa_bktxt TO r_bktxt.

CLEAR : wa_bktxt .

ENDSELECT.

IF r_bktxt[] IS NOT INITIAL.

<b> SELECT uzawe

UP TO 1 rows

FROM lfb1

INTO wa_uzawe

WHERE lifnr = i_rbkpv-lifnr " bseg-lifnr

AND <i>bukrs IN r_bktxt</i>.

ENDSELECT. </b>

ENDIF.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
434

If you are not providing the HIGH side of the range, you must use the EQ as your option.


wa_bktxt-sign = 'I'.
wa_bktxt-option = 'EQ'.        "<-   RIGHT HERE
 SELECT zcharval1 INTO wa_zcharval1
FROM zkap
WHERE zcharfld1 = 'U319'
AND zcharfld2 = 'ACTIVE_BUKRS'
AND znumfld1 = '0'
AND zseqno = '0'.

wa_bktxt-low = wa_zcharval1.
APPEND wa_bktxt TO r_bktxt.
CLEAR : wa_bktxt .
ENDSELECT.

Regards,

RIch Heilman

4 REPLIES 4
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
435

If you are not providing the HIGH side of the range, you must use the EQ as your option.


wa_bktxt-sign = 'I'.
wa_bktxt-option = 'EQ'.        "<-   RIGHT HERE
 SELECT zcharval1 INTO wa_zcharval1
FROM zkap
WHERE zcharfld1 = 'U319'
AND zcharfld2 = 'ACTIVE_BUKRS'
AND znumfld1 = '0'
AND zseqno = '0'.

wa_bktxt-low = wa_zcharval1.
APPEND wa_bktxt TO r_bktxt.
CLEAR : wa_bktxt .
ENDSELECT.

Regards,

RIch Heilman

Read only

Former Member
0 Likes
434

Hi,

Please try this.

...

wa_bktxt-sign = 'I'.

wa_bktxt-option = 'EQ'.

...

Why don't you use ranges for r_bktxt?

ranges: r_bktxt for lfb1-bukrs.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
434

Hi Sam,

Reason1. The type of the range r_bktxt and BUKRS may be different. Can you show how have you declared r_bktxt?

Reason2) The number of entries in the ranges table whould not be more than 1000.

You should use for all entries instead of ranges if that is the case.

Regards,

Ravi

Read only

Former Member
0 Likes
434

HI Sam,

do this way ..


 wa_bktxt LIKE LINE OF r_bktxt.
wa_bktxt-sign = 'I'.
wa_bktxt-option = 'EQ'.

Regards,

Santosh