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: 

select stmt not picking values

Former Member
0 Kudos

hi friends,

the below stmt is not picking any values,

here itab has both columns hkont and bukrs,

SELECT saknr bukrs

INTO TABLE I_SKB1

FROM SKB1

FOR ALL ENTRIES IN ITAB

WHERE saknr = ITAB-hkont and bukrs = itab-bukrs.

wheni remove the condition saknr = itab-hkont, ie. only with bukrs, it is working perfectly fine,

where as if i remove bukrs = itab-bukrs and run with condition of saknr = itab-hkont it is not working.

for testing purpose, i had picked up the value 165000 form skb1 and put as

saknr = 165000, then also its not picking up any value,

did any one face this problem before.

thank you.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

You have to pad with leading zeroes. You can use CONVERSION_EXIT_ALPHA_INPUT to do this.

Like this:

LOOP AT itab.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = itab-hkont
    IMPORTING
      output = itab-hkont.
  MODIFY itab.
ENDLOOP.

SELECT saknr bukrs
INTO TABLE i_skb1
FROM skb1
FOR ALL ENTRIES IN itab
WHERE saknr = itab-hkont AND bukrs = itab-bukrs.

Rob

Message was edited by:

Rob Burbank

8 REPLIES 8

Former Member
0 Kudos

You have to pad with leading zeroes. You can use CONVERSION_EXIT_ALPHA_INPUT to do this.

Like this:

LOOP AT itab.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = itab-hkont
    IMPORTING
      output = itab-hkont.
  MODIFY itab.
ENDLOOP.

SELECT saknr bukrs
INTO TABLE i_skb1
FROM skb1
FOR ALL ENTRIES IN itab
WHERE saknr = itab-hkont AND bukrs = itab-bukrs.

Rob

Message was edited by:

Rob Burbank

Former Member
0 Kudos

Sanjana,

Please make sure you are using AND condition, so it could be possible that combination values doesn't exist as per you itab.

Check that

-Pavan

Former Member
0 Kudos

This code of mine works fine for me..

PROGRAM ztest.

DATA: lt_skb1 TYPE TABLE OF skb1.

SELECT * UP TO 10 ROWS FROM skb1 INTO TABLE lt_skb1 WHERE bukrs EQ '0001' AND saknr EQ '0000001000'.
BREAK-POINT.

u have to put leading ZEROS.

use CONVERSION_EXIT_ALPHA_OUTPUT

A

Message was edited by:

Amandeep Bal

0 Kudos

Andeep - I find mice code not that reliable. They don't test very well:-)

Rob

0 Kudos

hey dude i don't get u ?

0 Kudos

> This code of mice works fine for me..

Rob

Former Member
0 Kudos

excellent rob, its working, thanks.

thanks for your time amandeep.

0 Kudos

Glad to help.

Rob