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

Former Member
0 Likes
805

SELECT SINGLE * FROM ADRC

  • INTO ws_adrc

WHERE

  • client = sy-mandt AND

ADDRNUMBER = ws_adrnr

AND date_from = lv_data

AND nation = ' ' .

client , addrnumber, date_from and nation are the primary keys . what is the problem in Above select stmt?

Sy-subrc is always 4 ( do not understand).

But there is an entry in table adrc fot the supplied values of select single.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
767

Hai Sam Kumar

Check the following Code

SELECT SINGLE * FROM ADRC

INTO ws_adrc

WHERE ADDRNUMBER = '0000022003' and

date_from = '00010101' and

nation = space.

if sy-subrc = 0.

exit.

endif.

no need to give the condition as client = sy-mandt

Regards

Sreeni

Message was edited by: Sreenivasulu Ponnadi

6 REPLIES 6
Read only

Former Member
0 Likes
767

How is WS_ADRNR defined? Does it have leading zeroes?

NATION probably has a space, not a null field.

Try

AND NATION = SPACE.

Read only

Former Member
0 Likes
767

Hi sam,

*INTO ws_adrc

uncomment this!

regards,

keerthi.

Read only

0 Likes
767

Need to see the values of ws_adrnr

and lv_data. If they are not formatting correctly then you will not get a hit. For example does the value for ws_adrnr have leading zeros?

Regards,

Rich Heilman

Read only

Former Member
0 Likes
768

Hai Sam Kumar

Check the following Code

SELECT SINGLE * FROM ADRC

INTO ws_adrc

WHERE ADDRNUMBER = '0000022003' and

date_from = '00010101' and

nation = space.

if sy-subrc = 0.

exit.

endif.

no need to give the condition as client = sy-mandt

Regards

Sreeni

Message was edited by: Sreenivasulu Ponnadi

Read only

0 Likes
767

Also... the DATE_FROM line should probably be

DATE_FROM <= LV_DATA

or

DATE_FROM <= SY-DATUM AND

DATE_TO >= SY-DATUM

Read only

0 Likes
767

yes the problem should be of leading Zeros. as there is a conversion routine for the Domain. You could also use the Fm: CONVERSION_EXIT_ALPHA_RANGE_I, to convert it in the proper format.