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: 

Retrieve User login id into internal table and check with KANA1-KUNNR

Former Member
0 Kudos
383

Dear All,

I need to retrive login id field from an Logon input field, and I need to compare with Kna1-Kunnar whether it is External user or Internal User.

What is the logic for this, Is there any existing BAPI or FM..

Regards,

Maruti

1 ACCEPTED SOLUTION

rahul_kamble2
Participant
0 Kudos
129

Hi,

Structure field SYST-UNAME will contain the login id of the user at any point of time.

you can compare this field with USR21-BNAME

take the USR21-ADDRNUMBER

check this entry in KNA1-ADRNR..if record found then its External user else its Internal User.

Regards,

Rahul

4 REPLIES 4

Former Member
0 Kudos
129

Hi Maruti,

You can get the logon user name from sy-uname. And then can check in USR02 table whether its external or internal user.

Hope this information helps you.

0 Kudos
129

Thanks for ur inputs,,

But here i need to retrive user login id from NON-SAP field entry, which i should map to internal table(This i done).

Now i need to compare with internal table field value(cust id) with KNA1-KUNNR. and if it is matching itab with kna1-kunnr then it is external id if not that is internal id.

This is the concept...I need logic for this.

Regards,

Maruti

rahul_kamble2
Participant
0 Kudos
130

Hi,

Structure field SYST-UNAME will contain the login id of the user at any point of time.

you can compare this field with USR21-BNAME

take the USR21-ADDRNUMBER

check this entry in KNA1-ADRNR..if record found then its External user else its Internal User.

Regards,

Rahul

anub
Participant
0 Kudos
129

Hi,

I guess the internal table you are talking about is declared with the cust id as that of the kna1-kunnr form.

If that is the case you can try with the select query for kna1

I mean

data : (declare you internal table here 'itab')

data : wa_itab like itab.

loop at itab into wa_itab.

select single * from kna1

where kunnr = wa_itab-custid.

if sy-sybrc = 0.

(int customer)

else.

(ext customer)

endif.

endloop.

Try this.

Reward if useful.

Regards,

Anu.