Application Development 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: 

SM30 - Selection Screen

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

4 REPLIES 4

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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