02-16-2010 9:31 AM
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..
02-16-2010 9:39 AM
add condition for VBRK where sales office (VKBUR) as per selection screen
02-16-2010 9:51 AM
02-16-2010 9:54 AM
as VBRK is header you have to add there.. and while selecting data from VBAP which is item details then match VBRK fields including sales office in where condition...
02-16-2010 10:18 AM
02-16-2010 11:02 AM
You can join tables VBRK and VBRP on the basis ob vbeln and give the sales office in where condition alsong with other required values.
Exapmle
select VBRK vbeln vbrkfkart
VBRP~posnr
into table itab
from VBRK inner join VBRP
on VBRKvbeln = VBRPvbeln
where
VBRK~vbeln in s_vbelb (select options for vbeln) and
VBRP~VKBUR in s_vkbur (select options for sales office).
Now can can loop itab and do further processing
loop at itab.
if itab-fkart = 'RE'.
............
elseif.
..................
endloop.