Skip to Content
0
Former Member
Feb 16, 2010 at 09:31 AM

Select Query problem

29 Views

Hi,

My Report is working fine but we want report on basis of sales office wise..means Branch employee can see only own data not of other branches.

My query is on VBRK and picking the Billing document from there. for Sales office wise data, we must goto VBRP table...

I query on VBRP and in selection screen put the Sales office input criteria.

But when i am inserting 1 billing document of AAA Sales office, but in sales office inserting BBB Sales office, then the output shows. It must not show because billing document is of AAA Sales office not BBB.

My Query is..

SELECT * FROM vbrk WHERE vbeln IN vbeln AND ( fkart = 'ZG1' OR fkart = 'ZG2' OR fkart = 'RE' OR fkart = 'ZWCN' OR fkart = 'G2' ) AND rfbsk EQ 'C'.

IF vbrk-fkart = 'ZG1'.

line10 = 'YOUR ACCOUNT WITH US HAS BEEN CREDITED WITH THE AMOUNT AS MENTIONED BELOW FOR PRICE DIFFERENCE AGAINST,'.

ELSEIF vbrk-fkart = 'ZG2'.

line10 = 'YOUR ACCOUNT WITH US HAS BEEN CREDITED WITH THE AMOUNT AS MENTIONED BELOW FOR INCENTIVE AGAINST,'.

ELSEIF vbrk-fkart = 'RE'.

line10 = 'YOUR ACCOUNT WITH US HAS BEEN CREDITED WITH THE AMOUNT AS MENTIONED BELOW CREDIT FOR RETURN AGAINST,'.

ELSEIF vbrk-fkart = 'ZWCN'.

line10 = 'YOUR ACCOUNT WITH US HAS BEEN CREDITED WITH THE AMOUNT AS MENTIONED BELOW FOR WARRENTY CREDIT NOTE AGAINST,'.

ELSEIF vbrk-fkart = 'G2'.

line10 = 'YOUR ACCOUNT WITH US HAS BEEN CREDITED WITH THE AMOUNT AS MENTIONED BELOW FOR CREDIT MEMO AGAINST,'.

ENDIF.

IF itab-vbeln = vbrp-vbeln.

SELECT SINGLE vkbur FROM vbrp INTO itab-vkbur WHERE vbeln = itab-vbeln AND vbeln IN vbeln AND vkbur IN vkbur.

ELSE.

ENDIF.

***********************

plz. help..