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

select stmt not picking values

Former Member
0 Likes
935

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
Read only

Former Member
0 Likes
895

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
Read only

Former Member
0 Likes
896

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

Read only

Former Member
0 Likes
895

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

Read only

Former Member
0 Likes
895

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

Read only

0 Likes
895

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

Rob

Read only

0 Likes
895

hey dude i don't get u ?

Read only

0 Likes
895

> This code of mice works fine for me..

Rob

Read only

Former Member
0 Likes
895

excellent rob, its working, thanks.

thanks for your time amandeep.

Read only

0 Likes
895

Glad to help.

Rob