Application Development and Automation 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: 
Read only

SM30 - Selection Screen

Former Member
0 Likes
742

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
Read only

Former Member
0 Likes
687

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
Read only

Former Member
0 Likes
688

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

Read only

Former Member
0 Likes
687

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.

Read only

Former Member
0 Likes
687

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.

Read only

Former Member
0 Likes
687

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