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: 

text question

Former Member
0 Kudos

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

TITLEBAR = 'Save SOC '

  • DIAGNOSE_OBJECT = ' '

text_question = 'Sales Order Confirmation Will Be Archived in'

I have to use a message class in the text question, how is that possible?

1 ACCEPTED SOLUTION

former_member451655
Active Participant
0 Kudos

Hi

try like this ,

*---w_count - u r Massge Text

EX:

w_count = 'Wot Even the Msg ...!'.

*---Pop Up Message to Confirm -

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

text_question = w_count " Are you certain...?

IMPORTING

answer = w_answer

EXCEPTIONS

text_not_found = 1

OTHERS = 2.

IF sy-subrc <> 0. " Function call failed..

MESSAGE i001(zload) WITH text-006. " Func call failed contact IS

STOP.

ENDIF.

IF w_answer NE '1'.

STOP.

ENDIF.

15 REPLIES 15

Former Member
0 Kudos

Not possible directly in the Function call, but you can build the TEXT_Question just before calling the functiona module using a message class and number. you can use function module MESSAGE_PREPARE to build a message and pass that to TEXT_QUESTION in the call

0 Kudos

text_question = perform message

form message.

CALL FUNCTION 'MESSAGE_PREPARE'

EXPORTING

msg_id = 002

msg_no = 002.

endform.

if i remove the quote in th test_question, it displays an error,

if i put the quote it displays as is, it seems not to call the function.

is this syntax correct?

0 Kudos

You need to call Message_Prepapre first to build the message, then call popup fm.check below


data : v_mess(255)
data : v_mess(255), v_ans.

CALL FUNCTION 'MESSAGE_PREPARE'
  EXPORTING
    MSG_ID                       = '00'
    MSG_NO                       = '002'
 IMPORTING
   MSG_TEXT                     = v_mess
.

CALL FUNCTION 'POPUP_TO_CONFIRM'
  EXPORTING
*   TITLEBAR                    = ' '
*   DIAGNOSE_OBJECT             = ' '
    TEXT_QUESTION               = v_mess

 IMPORTING
   ANSWER                      = v_ans

          .

0 Kudos

REPORT zisd_archivesoc_npsg MESSAGE-ID z10493498.

CALL FUNCTION 'MESSAGE_PREPARE'

EXPORTING

MSG_ID = 00

MSG_NO = 002

IMPORTING

MSG_TEXT = v_mess

.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

text_question = v_mess

It doesn't display anything.

v_mess(225), what is 255 for? when i enclosed id and no with quote

the program treat it as text element.

0 Kudos

code works for me. you need to put msg_id and msg_no within single quotes unless you are passign a variable there.

255 is just the length, you can put that as type string if you want


REPORT  YTEST1.

data : v_mess type string, v_ans.

CALL FUNCTION 'MESSAGE_PREPARE'
  EXPORTING
    MSG_ID                       = '00'
    MSG_NO                       = '002'
 IMPORTING
   MSG_TEXT                     = v_mess
.

CALL FUNCTION 'POPUP_TO_CONFIRM'
  EXPORTING
*   TITLEBAR                    = ' '
*   DIAGNOSE_OBJECT             = ' '
    TEXT_QUESTION               = v_mess.

former_member451655
Active Participant
0 Kudos

Hi

try like this ,

*---w_count - u r Massge Text

EX:

w_count = 'Wot Even the Msg ...!'.

*---Pop Up Message to Confirm -

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

text_question = w_count " Are you certain...?

IMPORTING

answer = w_answer

EXCEPTIONS

text_not_found = 1

OTHERS = 2.

IF sy-subrc <> 0. " Function call failed..

MESSAGE i001(zload) WITH text-006. " Func call failed contact IS

STOP.

ENDIF.

IF w_answer NE '1'.

STOP.

ENDIF.

0 Kudos

I created a message class Z10493498.

002: Are you certain?

I have to use it instead of text element.

CALL FUNCTION 'MESSAGE_PREPARE'

EXPORTING

MSG_ID = 00

MSG_NO = 002

IMPORTING

MSG_TEXT = v_mess.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

titlebar = 'Save SOC '

  • DIAGNOSE_OBJECT = ' '

text_question = v_mess

I tried this code but the pop up shows no text, why is that?

0 Kudos

use your own message class and message # in the code


REPORT  YTEST1.

data : v_mess type string, v_ans.

CALL FUNCTION 'MESSAGE_PREPARE'
  EXPORTING
    MSG_ID                       = '00'   *<---------your message class*
    MSG_NO                       = '002'   *<-------your message number*
 IMPORTING
   MSG_TEXT                     = v_mess
.

CALL FUNCTION 'POPUP_TO_CONFIRM'
  EXPORTING
*   TITLEBAR                    = ' '
*   DIAGNOSE_OBJECT             = ' '
    TEXT_QUESTION               = v_mess.

0 Kudos

I still can't display the message.

0 Kudos

paste your code, are you getting any errors? do you have the same code as I put. which SAP version are you running

0 Kudos

do i still have to declare my message id in data declaration section,

because it treats my message class as global field?

0 Kudos

cant say unless i see your code,

0 Kudos

version 7.1

REPORT zisd_archivesoc_npsg MESSAGE-ID z10493498.

data : v_mess(225), v_ans.

  • call subroutine

AT USER-COMMAND.

CASE sy-ucomm.

WHEN 'SAVE'.

PERFORM save_file.

WHEN 'BACK' OR 'CANC' OR 'EXIT'.

SET SCREEN 0.

LEAVE SCREEN.

WHEN OTHERS.

ENDCASE.

CALL FUNCTION 'MESSAGE_PREPARE'

EXPORTING

MSG_ID = z10493498

MSG_NO = 002

IMPORTING

MSG_TEXT = v_mess

.

FORM save_file.

CONCATENATE c_fname p_saleno INTO c_path.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

titlebar = 'Save SOC '

  • DIAGNOSE_OBJECT = ' '

text_question = v_mess

text_button_1 = 'Ok'

  • ICON_BUTTON_1 = ' '

text_button_2 = 'Cancel'

  • ICON_BUTTON_2 = ' '

  • DEFAULT_BUTTON = '1'

display_cancel_button = ''

  • USERDEFINED_F1_HELP = ' '

  • START_COLUMN = 25

  • START_ROW = 6

  • POPUP_TYPE =

  • IV_QUICKINFO_BUTTON_1 = ' '

  • IV_QUICKINFO_BUTTON_2 = ' '

IMPORTING

answer = v_answer

  • TABLES

  • PARAMETER =

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.

ELSE.

IF v_answer = 1.

OPEN DATASET c_path FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

TRANSFER wa_header TO c_path.

LOOP AT it_item INTO wa_items.

TRANSFER wa_items TO c_path.

ENDLOOP.

TRANSFER wa_total TO c_path.

CLOSE DATASET c_path.

MESSAGE s003 WITH c_path.

ENDIF.

ENDIF.

ENDFORM.

0 Kudos

move your call to inside the form save_file, and use single quote for msg_id and msg_no

FORM save_file.

CALL FUNCTION 'MESSAGE_PREPARE'

EXPORTING

MSG_ID = 'Z10493498'

MSG_NO = '002'

IMPORTING

MSG_TEXT = v_mess

.

0 Kudos

Yes!

Its done thank you very much, for the help.

Thanks a lot.