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 upto

Former Member
0 Likes
505

Hi,

I want to select one row in table vbfa depending on invoice number.

Since invoice number is one of the primary fields, query will return multiple rows.

Now i want to select any one row and depending on another key fields value I want to write logic.

Eg.

Select * from vbfa into ws_vbeln where vbeln = ws_vbeln upto 1 rows.

If vbfa-vbtrp_n = 'A' .......

Is this okay.

4 REPLIES 4
Read only

Former Member
0 Likes
485

hi,

if you are using primary key, you can as well use select single... instead of select-upto 1 rows.

regards,

madhumitha

Read only

Former Member
0 Likes
485

Select * from vbfa into table itab where vbeln = ws_vbeln .

loop at itab.

If itab-vbtrp_n = 'A'.

it_finla-vbtrp_n = itab-vbtrp_n.

elseif itab-vbtrp_n = 'B'.

it_finla-vbtrp_n = itab-vbtrp_n.

elseif itab-vbtrp_n = 'C'.

it_finla-vbtrp_n = itab-vbtrp_n.

endif.

endloop .

regards,

venkat

Read only

Former Member
0 Likes
485

Hi,

Select * from vbfa into ws_vbeln where vbeln = ws_vbeln upto 1 rows.

If vbfa-vbtrp_n = 'A' .......

Will work alternatively

Select single * from vbfa into ws_vbeln where vbeln = ws_vbeln .

Will work

try doing.

Reward points

Read only

Former Member
0 Likes
485

Hi,

You can write in this way

*Select * from vbfa into ws_vbeln*

upto 1 rows

where vbeln = fs_vbeln

and vbfa-vbtrp_n = 'A' .......

endselect.

Else

*Select Single * from vbfa into ws_vbeln*

where vbeln = fs_vbeln

and vbfa-vbtrp_n = 'A' .......

In both the case you will get one record only.

Reward some points.

Bye,

Anomitro