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

make pop up appear

Former Member
0 Likes
852

hi everybody

I have 2 parameters on a screen, p_file which selects the path and is assigned the path and the other (p_file2), takes the path in p_file and adds something to it.

If the user changes p_file2 manually, a popup appears to confirm the change.

The problem is Im able to retrieve the path in p_file, but cant make the popup appearing.

My code is below

PLz help

SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE TEXT-001.

PARAMETERS: p_file TYPE STRING.

PARAMETERS : p_file2 TYPE STRING.

PARAMETERS: p_test AS CHECKBOX.

SELECTION-SCREEN END OF BLOCK 1.

AT SELECTION-SCREEN on VALUE-REQUEST FOR p_file.

CALL METHOD cl_gui_frontend_services=>file_open_dialog

CHANGING

file_table = lt_filetab

rc = v_rc

EXCEPTIONS

file_open_dialog_failed = 1

cntl_error = 2

error_no_gui = 3

not_supported_by_gui = 4

OTHERS = 5.

READ TABLE lt_filetab INTO ls_filetab INDEX 1.

IF sy-subrc = 0.

p_file = ls_filetab-filename.

ENDIF.

SPLIT p_file AT '.' INTO l_text l_text2 l_text3.

CONCATENATE l_text '.' ' ' INTO l_text1.

CONCATENATE '.' l_text3 INTO l_text4.

CONCATENATE l_text1 l_text2 '_be' l_text4 INTO l_newfile.

TRANSLATE l_newfile TO UPPER CASE.

MOVE l_newfile TO p_file2.

AT SELECTION-SCREEN ON p_file2.

IF p_file2 NE l_newfile.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

  • TITLEBAR = ' '

  • DIAGNOSE_OBJECT = ' '

TEXT_QUESTION = 'Do u want to overwrite the file'

TEXT_BUTTON_1 = 'Yes'

TEXT_BUTTON_2 = 'No'

DISPLAY_CANCEL_BUTTON = 'X'

IMPORTING

ANSWER = l_answer

EXCEPTIONS

TEXT_NOT_FOUND = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

.

IF l_answer = '2'.

p_file2 = l_newfile.

ENDIF.

ENDIF.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
819
AT SELECTION-SCREEN ON p_file2.
"Change is here . add the additonal logic here..
IF p_file2 NE l_newfile.

additional logic.

move 'P_FILE2' to lt_dynpfields-fieldname.
  append lt_dynpfields.
  move 'P_FILE' to lt_dynpfields-fieldname.
  append lt_dynpfields.

  call function 'DYNP_VALUES_READ'
    exporting
      dyname               = sy-repid
      dynumb               = sy-dynnr
    tables
      dynpfields           = lt_dynpfields
    exceptions
      invalid_abapworkarea = 1
      invalid_dynprofield  = 2
      invalid_dynproname   = 3
      invalid_dynpronummer = 4
      invalid_request      = 5
      no_fielddescription  = 6
      invalid_parameter    = 7
      undefind_error       = 8
      double_conversion    = 9
      stepl_not_found      = 10.
  loop at lt_dynpfields.
    case lt_dynpfields-fieldname.

      when 'P_FILE'.
        p_file = lt_dynpfields-fieldvalue.
      when 'P_FILE2'.
        p_file2 = lt_dynpfields-fieldvalue.
      endcase.
  endloop.

add the correct declaration and place this logic before if condition and see.

AT SELECTION-SCREEN ON p_file2.
"Change is here . add the additonal logic here..
IF p_file2 NE l_newfile.

additional logic.

move 'P_FILE2' to lt_dynpfields-fieldname.
  append lt_dynpfields.
  move 'P_FILE' to lt_dynpfields-fieldname.
  append lt_dynpfields.

  call function 'DYNP_VALUES_READ'
    exporting
      dyname               = sy-repid
      dynumb               = sy-dynnr
    tables
      dynpfields           = lt_dynpfields
    exceptions
      invalid_abapworkarea = 1
      invalid_dynprofield  = 2
      invalid_dynproname   = 3
      invalid_dynpronummer = 4
      invalid_request      = 5
      no_fielddescription  = 6
      invalid_parameter    = 7
      undefind_error       = 8
      double_conversion    = 9
      stepl_not_found      = 10.
  loop at lt_dynpfields.
    case lt_dynpfields-fieldname.

      when 'P_FILE'.
        p_file = lt_dynpfields-fieldvalue.
      when 'P_FILE2'.
        p_file2 = lt_dynpfields-fieldvalue.
      endcase.
  endloop.

add the correct declaration and place this logic before if condition and see.

5 REPLIES 5
Read only

Former Member
0 Likes
819

Store the old value of p_file2 in the global variable and then compare the varibale with p_file2 if both are different then use the function module POPUP_TO_CONFIRM

Read only

Former Member
0 Likes
819

hi,

modify this code

if notIF p_file2 NE l_newfile.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

TITLEBAR = ' '

DIAGNOSE_OBJECT = ' '

TEXT_QUESTION = 'Do u want to overwrite the file'

TEXT_BUTTON_1 = 'Yes'

TEXT_BUTTON_2 = 'No'

DISPLAY_CANCEL_BUTTON = 'X'

IMPORTING

ANSWER = l_answer

EXCEPTIONS

TEXT_NOT_FOUND = 1

OTHERS = 2

.

IF SY-SUBRC 0.

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

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

ENDIF.

.

Read only

0 Likes
819

Hi Shailaja, wat u meant by notIF?the program doesnt get compiled

if notIF p_file2 NE l_newfile.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

TITLEBAR = ' '

DIAGNOSE_OBJECT = ' '

TEXT_QUESTION = 'Do u want to overwrite the file'

TEXT_BUTTON_1 = 'Yes'

TEXT_BUTTON_2 = 'No'

DISPLAY_CANCEL_BUTTON = 'X'

IMPORTING

ANSWER = l_answer

EXCEPTIONS

TEXT_NOT_FOUND = 1

OTHERS = 2

In my program, when I am assigning the value to p_file2,

the value doesnt appear on the screen and it

it loses that value when doing

AT SELECTION-SCREEN ON p_file2.

in debug mode, i can see the value of p_file2 but it doesnt appear on screen and it gets lost when doing AT SELECTION-SCREEN ON p_file2.

Read only

Former Member
0 Likes
820
AT SELECTION-SCREEN ON p_file2.
"Change is here . add the additonal logic here..
IF p_file2 NE l_newfile.

additional logic.

move 'P_FILE2' to lt_dynpfields-fieldname.
  append lt_dynpfields.
  move 'P_FILE' to lt_dynpfields-fieldname.
  append lt_dynpfields.

  call function 'DYNP_VALUES_READ'
    exporting
      dyname               = sy-repid
      dynumb               = sy-dynnr
    tables
      dynpfields           = lt_dynpfields
    exceptions
      invalid_abapworkarea = 1
      invalid_dynprofield  = 2
      invalid_dynproname   = 3
      invalid_dynpronummer = 4
      invalid_request      = 5
      no_fielddescription  = 6
      invalid_parameter    = 7
      undefind_error       = 8
      double_conversion    = 9
      stepl_not_found      = 10.
  loop at lt_dynpfields.
    case lt_dynpfields-fieldname.

      when 'P_FILE'.
        p_file = lt_dynpfields-fieldvalue.
      when 'P_FILE2'.
        p_file2 = lt_dynpfields-fieldvalue.
      endcase.
  endloop.

add the correct declaration and place this logic before if condition and see.

Read only

Former Member
0 Likes
819

> AT SELECTION-SCREEN ON p_file2.

>

> IF p_file2 NE l_newfile.

> CALL FUNCTION 'POPUP_TO_CONFIRM'

> EXPORTING

> * TITLEBAR = ' '

> * DIAGNOSE_OBJECT = ' '

> TEXT_QUESTION = 'Do u want to overwrite the file'

> TEXT_BUTTON_1 = 'Yes'

> TEXT_BUTTON_2 = 'No'

> DISPLAY_CANCEL_BUTTON = 'X'

> IMPORTING

> ANSWER = l_answer

> EXCEPTIONS

> TEXT_NOT_FOUND = 1

> OTHERS = 2

> .

> IF SY-SUBRC <> 0.

> * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

> * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

> ENDIF.

> .

>

> IF l_answer = '2'.

> p_file2 = l_newfile.

> ENDIF.

> ENDIF.

Hi anjali,

the problem is with the If condition....

Change the if condition as;

IF p_file2 EQ l_newfile.

This will solve your problem...

Regards

Karthik D