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

POPUP Window

Former Member
0 Likes
1,363

How can I display a popup window that will contain a two field, for username and password.

I need to create a function that will call for this popup window to validate the entries from the database.

7 REPLIES 7
Read only

Former Member
0 Likes
969

Adrian,

You need to do some dialog programming here.

Create a screen with two fields on the screen and have the attributes set for the second field as password so that characters don't show up.

You can do all this as a part of the function group so that the entire thing can be encapsulated in a function module. Then you can call the function wherever you want.

Were you looking for some other details?

<i><b>As a example you can take a look at functions POPUP_TO_GET_ONE_VALUE, POPUP_TO_GET_VALUE of the function group SPO3.</b></i>

Regards,

Ravi

Note : Please mark all the helpful answers

Message was edited by: Ravikumar Allampallam

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
969

This would work, but I can't see to get the pasword field to hide the data entered.



report zrich_0001 .

data: ivals type table of sval with header line.

data: bname type usr02-bname,
      bcode(8) type c.

start-of-selection.


  ivals-tabname = 'USR02'.
  ivals-fieldname = 'BNAME'.
  append ivals.

  ivals-tabname = 'TCPFS5'.
  ivals-fieldname = 'PW'.
  append ivals.

  call function 'POPUP_GET_VALUES'
    exporting
*   NO_VALUE_CHECK        = ' '
      popup_title           = 'Enter User Name & Password'
*   START_COLUMN          = '5'
*   START_ROW             = '5'
* IMPORTING
*   RETURNCODE            =
    tables
      fields                = ivals
   exceptions
     error_in_fields       = 1
     others                = 2
            .

  read table ivals with key fieldname = 'BNAME'.
  if sy-subrc  = 0.
    bname = ivals-value.
  endif.

  read table ivals with key fieldname = 'PW'.
  if sy-subrc  = 0.
    bcode = ivals-value.
  endif.


  write:/ bname, bcode.

Regards,

Rich Heilman

Read only

0 Likes
969

This is what I wanted Rich, but how can I possibly mask the password with asterisk?

Read only

0 Likes
969

I don't think you have a choice other than developing something like this on your own and take care of masking the password yourself, using the screen attributes of the field.

Regards,

Ravi

Note : Please mark all the helpful answers

Read only

Former Member
0 Likes
969

Hi Adrian,

Check this code.

It masks the password field as required by you.



REPORT  zzarun_pass.

DATA : passwd  TYPE string,
       encoded TYPE string,
       decoded TYPE string.

SELECTION-SCREEN BEGIN OF SCREEN 2000 AS WINDOW TITLE upass.
PARAMETERS : p_unam(20) TYPE c,
             p_pass(20) TYPE c  LOWER CASE .
SELECTION-SCREEN END OF SCREEN 2000.

initialization .
upass = 'Enter User Name and Password'.

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.
    IF screen-name = 'P_PASS'.
      screen-invisible = '1'.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.


START-OF-SELECTION.

  CALL SELECTION-SCREEN 2000 STARTING AT 20 5.

  passwd = p_pass.
  CONDENSE passwd.

  CALL METHOD cl_http_utility=>if_http_utility~encode_base64
    EXPORTING
      unencoded = passwd
    RECEIVING
      encoded   = encoded.

  CALL METHOD cl_http_utility=>if_http_utility~decode_base64
    EXPORTING
      encoded = encoded
    RECEIVING
      decoded = decoded.


  WRITE : / 'User Name          :' , p_unam,
          / 'Password Entered   :' , p_pass,
          / 'Encrypted Password :' , encoded,
          / 'Decrypted Password :' , decoded.

Regards,

AS.

Read only

Former Member
0 Likes
969

Hi Andrian,

If you dont want <b>'Check input'</b> and <b>'Save as variant'</b> buttons in the Pop Up Window. Then use this code.


REPORT  zzarun_pass.

DATA : passwd  TYPE string,
       encoded TYPE string,
       decoded TYPE string.
<b>DATA : itab TYPE TABLE OF sy-ucomm.</b>



SELECTION-SCREEN BEGIN OF SCREEN 2000 AS WINDOW TITLE upass.
PARAMETERS : p_unam(20) TYPE c,
             p_pass(20) TYPE c  LOWER CASE .
SELECTION-SCREEN END OF SCREEN 2000.

initialization .
upass = 'Enter User Name and Password'.

AT SELECTION-SCREEN OUTPUT.

<b>*To remove the 'Check input' and 'Save as variant' buttons.
 
APPEND 'NONE' TO itab.
APPEND 'SPOS' TO ITAB.

CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
EXPORTING
p_status = sy-pfkey
TABLES
p_exclude = itab.</b>

  LOOP AT SCREEN.
    IF screen-name = 'P_PASS'.
      screen-invisible = '1'.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.


START-OF-SELECTION.

    CALL SELECTION-SCREEN 2000 STARTING AT 20 5.

*Only if user presses execute button

 <b> IF sy-subrc EQ 0.</b>
  
    passwd = p_pass.
    CONDENSE passwd.

    CALL METHOD cl_http_utility=>if_http_utility~encode_base64
      EXPORTING
        unencoded = passwd
      RECEIVING
        encoded   = encoded.

    CALL METHOD cl_http_utility=>if_http_utility~decode_base64
      EXPORTING
        encoded = encoded
      RECEIVING
        decoded = decoded.


    WRITE : / 'User Name          :' , p_unam,
            / 'Password Entered   :' , p_pass,
            / 'Encrypted Password :' , encoded,
            / 'Decrypted Password :' , decoded.

  ELSE.

<b>*If cancelled</b>

    LEAVE PROGRAM.

  ENDIF.

Regards,

AS.

Message was edited by: Arun Sambargi

Read only

Former Member
0 Likes
969

For masking input in screen fields, I came across this in the help.sap.com documentation. Modifying the attributes of a screen field in the screen table has the following effects:

Case1

Active=1, Input=1, Output=1, Invisible=1

Screen field is displayed, even if Invisible is set

statically, except when Output only is set

statically.

Field contents are not displayed.

Ready for input, even if Input is not set statically.

User input is masked by asterisks (*).

Case2

Active=1, Input=1, Output=0, Invisible=1

Screen field is displayed, even if Invisible is set

statically, except when Output only is set

statically.

Output is masked by asterisks (*).

Ready for input, even if Input is not set statically.

User input is masked by asterisks (*).

Tim