ABAP popup window

作者:郑德鼎 约 3 分钟阅读 更新日期:2024-02-22 2 年前更新 标签:ABAP, 开发

ABAP PopUp: Types and Samples codes

July 16, 2015  John

ABAP PopUps are rich enough to do different functions.

In this articles, I will try to details the most used Abap Popup window kind with sample SAP ABAP code of course to help you implement it quickly.

Table of Contents

Differents ABAP Popups

Abap Popup to Confirm

This is a an Abap Popup yes no. The return of the PopUp function will be

‘ ‘ for No and J for Yes.

This PopUp can also used as Abap Popup to Confirm Value.

OR

Others PopUps functions can be used for Abap Popup to display text

POPUP_TO_DECIDE_WITH_MESSAGE

POPUP_TO_DECIDE

Learn SAP ABAP: SAP ABAP Programming Language For Beginners

Abap Popup with input field Or Value

Abap Popup to inform

Display text/message in PopUp with the function POPUP_TO_INFORM.

Abap Popup with table display

Display a table in PopUp.

POPUP_WITH_TABLE_DISPLAY

In order to display BAPIRET2 table messages when checking or saving a transaction, I recommend using this C14Z_MESSAGES_SHOW_AS_POPUP

Display SLG1 log Like PopUp in ABAP

To Display a SLG1 log in a Popup in ABAP used the standard function OXT_MESSAGE_TO_POPUP

When digging into OXT_MESSAGE_TO_POPUP, the core is based on the other more commun function BAL_DSP_LOG_DISPLAY used in displaying log.

The input for OXT_MESSAGE_TO_POPUP is a table typed BAPIRETTAB.

Display popup screen within ABAP Web dynpro

Check this post about PoPUp in WebDynPro ABAP

ABAP PopUps Programs Sample

Check these standard ABAP Programs to find more about PopUp in SAP. These sample programs focus how to display to Log ( SLG1 ).

SBAL_DEMO_04_POPUP

SBAL_DEMO_04_POPUP_S

SAP develops a cool option for both these programs to display Tables in PopUp in Grid Mode

Actually, the standard use the display profile parameter while calling BAL_DSP_LOG_DISPLAY.

1

2

3

4

5

6

7

8

9

11 | DATA:lv_answer.

CALL FUNCTION 'POPUP_CONTINUE_YES_NO'

EXPORTING

textline1 = 'Are you sure to leave program ?'

titel     = 'POPUP_CONTINUE_YES_NO'

IMPORTING

answer    = lv_answer. IF lv_answer = 'J'.

LEAVE PROGRAM.

ENDIF.

1

2

3

4

5

6

7

8

9

11 | DATA: lv_answer.

CALL FUNCTION 'POPUP_TO_CONFIRM_DATA_LOSS'

EXPORTING

defaultoption = 'J'

titel         = 'Exit Program'

IMPORTING

answer        = lv_answer. IF lv_answer = 'J'.

LEAVE PROGRAM.

ENDIF..

1

2

3

4

5

6

7 | CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

titel = 'Information'

txt1  = 'Information line 1'

txt2  = 'Information line 2'

txt3  = 'Information line 3'

txt4  = 'Information line 4'.

1

2

3

4

5

6

7

8

9

15 | " lt_tab type of any

CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'

EXPORTING

endpos_col         = 80

endpos_row         = 25

startpos_col       = 1

startpos_row       = 1

titletext          = 'PopUp Title for Display Table'

*   IMPORTING

*     CHOISE             =

TABLES

valuetab           = lt_tab

EXCEPTIONS

break_off          = 1

OTHERS             = 2

1

2

3

4

5

6

7

8

9

42 | " Types for messages: PopUp Table

TYPES: BEGIN OF esp1_message_wa_type,

msgid  LIKE sy-msgid,

msgty  LIKE sy-msgty,

msgno  LIKE sy-msgno,

msgv1  LIKE sy-msgv1,

msgv2  LIKE sy-msgv2,

msgv3  LIKE sy-msgv3,

msgv4  LIKE sy-msgv4,

lineno LIKE mesg-zeile,

END OF esp1_message_wa_type.
DATA: lt_message_popup TYPE TABLE OF esp1_message_wa_type. DATA: lt_bapiret_tab   TYPE TABLE OF bapiret2. " BAPIRETTAB

FIELD-SYMBOLS:  like LINE OF lt_bapiret_tab.

FIELD-SYMBOLS:  like LINE OF lt_message_popup.

" Fill lt_bapiret_tab with Transaction return

" Prepare Table for PopUP

LOOP AT lt_bapiret_tab ASSIGNING

WHERE type is NOT INITIAL. " avoid dumb for none relevant message

APPEND INITIAL LINE TO lt_message_popup ASSIGNING .

-msgty = -type .

-msgid = -id .

-msgno = -number .

-msgv1 = -message_v1 .

-msgv2 = -message_v2 .

-msgv3 = -message_v3 .

-msgv4 = -message_v4 .

-lineno = sy-tabix.

ENDLOOP.

" Call the PopUp Table

IF NOT lt_message_popup[] IS INITIAL. CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'

TABLES

i_message_tab = lt_message_popup[]. ENDIF.
1 | " use grid for display if wanted ls_display_profile-use_grid = p_grid. " 'X' or ' '
郑德鼎

关于作者:郑德鼎

企业信息化与 SAP 技术顾问,长期专注 SAP ABAP、FI/CO、MM、SD 等模块的技术分享与实战经验总结。查看更多介绍

来源说明:本文内容由「ABAP popup window.docx」整理生成,仅用于内部技术分享与学习交流。