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 Query problem

Former Member
0 Likes
1,086

Hi,

I am using,

SELECT SINGLE * FROM ska1 WHERE

ktopl = 'TIPF'

AND saknr = gs_line_item-newko.

IF sy-subrc = 0.

...

endif.

here sy subrc always gives 4. But when i check from databse....the particular entry is present.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,053

Hi Anurodh,

It can't happen.

There must be some wrong in the data you provided.

Just hard code the value of SAKNR also and try.

Regards,

Atish

9 REPLIES 9
Read only

Former Member
0 Likes
1,054

Hi Anurodh,

It can't happen.

There must be some wrong in the data you provided.

Just hard code the value of SAKNR also and try.

Regards,

Atish

Read only

0 Likes
1,053

i have done that also...but no change....still sy-subrc = 0.

my saknr is 30010.

Read only

0 Likes
1,053

have u done the READ or FOR ALL ENTRIES?

Read only

0 Likes
1,053

Hi,

Use SAKNR as '0000030010'.

Regards,

Atish

Read only

0 Likes
1,053

thanks atish...its done.

Read only

0 Likes
1,053

Hi,

You need to use FM 'CONVERSION_EXIT_ALPHA_INPUT'.

Pass the SAKNR as importing as well as exporting parameter to this FM.

Then use that in your select query.

Regards,

Atish

Read only

Former Member
0 Likes
1,053

<b>if not gs_line_item is initial.</b>

SELECT SINGLE * FROM ska1

<b>for all entries in gs_line_item</b>

WHERE

ktopl = 'TIPF'

AND saknr = gs_line_item-newko.

endif.

Read only

former_member189629
Active Contributor
0 Likes
1,053

Anu,

Try this...

<b>READ TABLE gs_line_item."</b> WITH KEY newko = specify key if needed

if sy-subrc = 0.

SELECT SINGLE * FROM ska1 WHERE

ktopl = 'TIPF'

AND saknr = gs_line_item-newko.

IF sy-subrc = 0.

...

endif.

endif.

reward if helpful,

Karthik

Read only

Former Member
0 Likes
1,053

Hi,

Just UNPACK the value of saknr before select,

i.e. UNPACK gs_line_item-newko INTO gs_line_item-newko.

Since saknr is of length 10, your value of saknr should be of length 10 during selection.

UNPACK would fill leading spaces with zero.

Regards,

Raghavendra