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: 

automatic logon with userid and password

Former Member
0 Kudos
728

Hello,

We have a requirement to logon to another instance of SAP with a different user id. We have a transaction where we select from a list of user id (different profiles). Once we hit save, we would like to have a session to open up with the userid selected as the user for that session. Is there a function module that we can call to logon with a provided userid and password and get to the main SAP menu?

Regards,

Anna-Liza

3 REPLIES 3

Former Member
0 Kudos
101

Anna-Liza,

Before proceeding with your req, I would like to ask if this organization is a US-cased company governed by Sarbanes-Oxley 404?

If so, you should notify your company's internal audit team about this req... they will need to review it before it can be implemented.

0 Kudos
101

Hello John,

Yes the audit team is aware of this. There are logs that are being tracked when the id is requested and certain restriction are in place. However, the only thing is to reduce the steps in having the user manually log on with the selected userid.

Regards,

Anna-Liza

0 Kudos
101

Anna-Liza,

I can not find nor am I aware of any "auto-logon" FM/BAPIs for interactive users. SAP appears to be protecting the system by not providing this functionality.

I can suggest that you add code like this to get the users to the traditional SAP Logon screen.

When the user presses save (as you described above), add this code:

CALL FUNCTION 'WS_EXECUTE'

EXPORTING

  • DOCUMENT = ' '

  • CD = ' '

COMMANDLINE = 'peanut 00'

  • INFORM = ' '

PROGRAM = 'sapgui.exe'

  • EXCEPTIONS

  • FRONTEND_ERROR = 1

  • NO_BATCH = 2

  • PROG_NOT_FOUND = 3

  • ILLEGAL_OPTION = 4

  • GUI_REFUSE_EXECUTE = 5

  • OTHERS = 6

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

In the COMMAND_LINE parameter, replace with your system's hostname and system number. You can find these from your SAP Logon Pad by selecting DETAILS. This will provide the hostname and sys number. Replace in the code above and run.

Let me know how it goes.