09-09-2008 12:13 PM
Hi ,
I have a table with SM30.
and my Select query for SD report takes what are the user ID;s maintained in the Ztable.
But If the enduser is a Internal User and not maintained in the Ztable he should be able to see all the sales orders.
If the entered user is maintained in the table he should be able to see only the customers which are assigned to it.
if he tries to see the customer which is not asigned to him
it should throw a error message.
Please let me know what I should do.
My Select querry is
SELECT
kunnr
FROM zsd_c2c_auth
INTO CORRESPONDING FIELDS OF
TABLE gt_c2c_auth
WHERE kunnr IN s_kunnr
AND syuname = sy-uname.
Thanks,
Varun
09-09-2008 12:19 PM
If current user is end user,it will not return any records after your select query as this user is not maintained in Z table. In this case,write ur select query again without user condition. It will give you desired results.
SELECT
kunnr
FROM zsd_c2c_auth
INTO CORRESPONDING FIELDS OF
TABLE gt_c2c_auth
WHERE kunnr IN s_kunnr
AND syuname = sy-uname.
->> If current user is not maintained i.e. he is end user,display all records
if sy-subrc NE 0 OR gt_c2c_auth[] is initial.
SELECT
kunnr
FROM zsd_c2c_auth
INTO CORRESPONDING FIELDS OF
TABLE gt_c2c_auth
WHERE kunnr IN s_kunnr.
endif.
Regards,
Aparna Gaikwad
09-09-2008 12:19 PM
If current user is end user,it will not return any records after your select query as this user is not maintained in Z table. In this case,write ur select query again without user condition. It will give you desired results.
SELECT
kunnr
FROM zsd_c2c_auth
INTO CORRESPONDING FIELDS OF
TABLE gt_c2c_auth
WHERE kunnr IN s_kunnr
AND syuname = sy-uname.
->> If current user is not maintained i.e. he is end user,display all records
if sy-subrc NE 0 OR gt_c2c_auth[] is initial.
SELECT
kunnr
FROM zsd_c2c_auth
INTO CORRESPONDING FIELDS OF
TABLE gt_c2c_auth
WHERE kunnr IN s_kunnr.
endif.
Regards,
Aparna Gaikwad
09-09-2008 12:22 PM
SELECT
kunnr
FROM zsd_c2c_auth
INTO CORRESPONDING FIELDS OF
TABLE gt_c2c_auth
WHERE kunnr IN s_kunnr
AND syuname = sy-uname.
if sy-subrc <> 0.
SELECT
kunnr
FROM zsd_c2c_auth
INTO CORRESPONDING FIELDS OF
TABLE gt_c2c_auth
WHERE kunnr IN s_kunnr.
endif.
09-09-2008 12:44 PM
Actually its like
if the user is not maintained in the table he should be able to see all orders.Irrespective of Ztable.
If maintained he should see only specific orders that are against him.
09-09-2008 1:06 PM
Hi,
after your select query i.e.
SELECT
kunnr
FROM zsd_c2c_auth
INTO CORRESPONDING FIELDS OF
TABLE gt_c2c_auth
WHERE kunnr IN s_kunnr
AND syuname = sy-uname.
if sy-subrc = 0.
means some records are fetched i.e. that user is maintained in internal table.
then write the same query with the reqd condition i.e. criteria based on which you want to give access to end user.
if sy-subrc =! 0.
SELECT
kunnr
FROM zsd_c2c_auth
INTO CORRESPONDING FIELDS OF
TABLE gt_c2c_auth
WHERE kunnr IN s_kunnr.
hope it will work.
Thanks
Rajesh Kumar