‎2008 May 13 10:31 AM
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.
‎2008 May 13 10:35 AM
hi,
if you are using primary key, you can as well use select single... instead of select-upto 1 rows.
regards,
madhumitha
‎2008 May 13 10:37 AM
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
‎2008 May 13 10:37 AM
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
‎2008 May 13 10:41 AM
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