Skip to Content
author's profile photo Former Member
Former Member

Back , Cancel , exit in ALV with Objects

Hi

I have created a ALV with ABAP objects , the dialog screen doesnt have the back , exit and cancel buttons . How can I bring them .

Secondly , I have to send all the contents of the dialog screen to print , when the user clicks a "Print" button which I have placed on the screen. How can this be made possible.

Thank you

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Sep 07, 2007 at 01:46 PM

    Above the Call to ALV FM, add following:

    SET PF-STATUS 'ZSTAT'.

    double click on it & goto Menu bar

    In the ICONS of SAVE, CANCEL, BACK, type text SAVE CANCEL BACK respectively & activate

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 07, 2007 at 01:47 PM

    Hi,

    You have to create the GUI status to activate the back,exit buttons.

    In the ALV toolbar itself you have print option. If you select this all ALV data will be printed.No need to do additional coding for this.

    <b>Reward if helpful.</b>

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 07, 2007 at 01:55 PM

    Hi

    see this example

    in this by seaing this u can understand it

    tables: zemp_sujoy.

    data: g_container type ref to cl_gui_custom_container,

    g_grid type ref to cl_gui_alv_grid.

    data: t_emp_sujoy type table of zemp_sujoy,

    t_fieldcatalog type lvc_t_fcat,

    lwa_fieldcatalog type lvc_s_fcat.

    selection-screen begin of block a with frame title text-001.

    select-options: s_empno for zemp_sujoy-empno.

    selection-screen end of block a.

    IF g_grid IS INITIAL.

    PERFORM sub_container.

    *

    PERFORM sub_grid.

    *

    PERFORM sub_fieldcatalog.

    PERFORM create_alv.

    ELSE.

    CALL METHOD g_grid->refresh_table_display

    • EXPORTING

    • IS_STABLE =

    • I_SOFT_REFRESH =

    • EXCEPTIONS

    • FINISHED = 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.

    ENDIF.

    ENDMODULE. " create_alv_display OUTPUT

    &----


    *& Form sub_container

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM sub_container .

    CREATE OBJECT g_container

    EXPORTING

    • PARENT =

    container_name = 'G_CONTAINER'

    • STYLE =

    • LIFETIME = lifetime_default

    • REPID =

    • DYNNR =

    • NO_AUTODEF_PROGID_DYNNR =

    • EXCEPTIONS

    • CNTL_ERROR = 1

    • CNTL_SYSTEM_ERROR = 2

    • CREATE_ERROR = 3

    • LIFETIME_ERROR = 4

    • LIFETIME_DYNPRO_DYNPRO_LINK = 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.

    ENDFORM. " sub_container

    &----


    *& Form sub_grid

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM sub_grid .

    CREATE OBJECT g_grid

    EXPORTING

    • I_SHELLSTYLE = 0

    • I_LIFETIME =

    i_parent = g_container

    • I_APPL_EVENTS = space

    • I_PARENTDBG =

    • I_APPLOGPARENT =

    • I_GRAPHICSPARENT =

    • I_NAME =

    • I_FCAT_COMPLETE = SPACE

    • EXCEPTIONS

    • ERROR_CNTL_CREATE = 1

    • ERROR_CNTL_INIT = 2

    • ERROR_CNTL_LINK = 3

    • ERROR_DP_CREATE = 4

    • others = 5

    .

    IF sy-subrc <> 0.

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

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

    ENDIF.

    ENDFORM. " sub_grid

    &----


    *& Form create_alv

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM create_alv .

    CALL METHOD g_grid->set_table_for_first_display

    • EXPORTING

    • I_BUFFER_ACTIVE =

    • I_BYPASSING_BUFFER =

    • I_CONSISTENCY_CHECK =

    • I_STRUCTURE_NAME =

    • IS_VARIANT =

    • I_SAVE =

    • I_DEFAULT = 'X'

    • IS_LAYOUT =

    • IS_PRINT =

    • IT_SPECIAL_GROUPS =

    • IT_TOOLBAR_EXCLUDING =

    • IT_HYPERLINK =

    • IT_ALV_GRAPHICS =

    • IT_EXCEPT_QINFO =

    • IR_SALV_ADAPTER =

    CHANGING

    it_outtab = t_emp_sujoy

    it_fieldcatalog = t_fieldcatalog

    • IT_SORT =

    • IT_FILTER =

    • EXCEPTIONS

    • INVALID_PARAMETER_COMBINATION = 1

    • PROGRAM_ERROR = 2

    • TOO_MANY_LINES = 3

    • others = 4

    .

    IF sy-subrc <> 0.

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

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

    ENDIF.

    ENDFORM. " create_alv

    &----


    *& Form sub_fieldcatalog

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM sub_fieldcatalog .

    lwa_fieldcatalog-col_pos = 1.

    lwa_fieldcatalog-coltext = 'EMPNO'.

    lwa_fieldcatalog-fieldname = 'EMPNO'.

    lwa_fieldcatalog-ref_table = 'T_EMP_SUJOY'.

    *lwa_fieldcatalog-key = 'X'.

    APPEND lwa_fieldcatalog TO t_fieldcatalog.

    CLEAR lwa_fieldcatalog.

    lwa_fieldcatalog-col_pos = 1.

    lwa_fieldcatalog-coltext = 'FIRST_NAME'.

    lwa_fieldcatalog-fieldname = 'FIRST_NAME'.

    lwa_fieldcatalog-ref_table = 'T_EMP_SUJOY'.

    *lwa_fieldcatalog-key = 'X'.

    APPEND lwa_fieldcatalog TO t_fieldcatalog.

    ENDFORM. " sub_fieldcatalog

    &----


    *& Form sub_get_data

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form sub_get_data .

    SELECT * FROM zemp_sujoy

    INTO TABLE t_emp_sujoy

    where empno in s_empno.

    endform. " sub_get_data

    &----


    *& Module STATUS_9000 OUTPUT

    &----


    • text

    ----


    module STATUS_9000 output.

    SET PF-STATUS 'PF9000'.

    • SET TITLEBAR 'xxx'.

    endmodule. " STATUS_9000 OUTPUT

    &----


    *& Module exit INPUT

    &----


    • text

    ----


    module exit input.

    leave to screen 0.

    start-of-selection.

    perform sub_get_data.

    CALL SCREEN 9000.

    &----


    *& Include ZTEST_ALV1_OOP_F01

    &----


    &----


    *& Module create_alv_display OUTPUT

    &----


    • text

    ----


    MODULE create_alv_display OUTPUT.

    IF g_grid IS INITIAL.

    PERFORM sub_container.

    *

    PERFORM sub_grid.

    *

    PERFORM sub_fieldcatalog.

    PERFORM create_alv.

    ELSE.

    CALL METHOD g_grid->refresh_table_display

    • EXPORTING

    • IS_STABLE =

    • I_SOFT_REFRESH =

    • EXCEPTIONS

    • FINISHED = 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.

    ENDIF.

    ENDMODULE. " create_alv_display OUTPUT

    &----


    *& Form sub_container

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM sub_container .

    CREATE OBJECT g_container

    EXPORTING

    • PARENT =

    container_name = 'G_CONTAINER'

    • STYLE =

    • LIFETIME = lifetime_default

    • REPID =

    • DYNNR =

    • NO_AUTODEF_PROGID_DYNNR =

    • EXCEPTIONS

    • CNTL_ERROR = 1

    • CNTL_SYSTEM_ERROR = 2

    • CREATE_ERROR = 3

    • LIFETIME_ERROR = 4

    • LIFETIME_DYNPRO_DYNPRO_LINK = 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.

    ENDFORM. " sub_container

    &----


    *& Form sub_grid

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM sub_grid .

    CREATE OBJECT g_grid

    EXPORTING

    • I_SHELLSTYLE = 0

    • I_LIFETIME =

    i_parent = g_container

    • I_APPL_EVENTS = space

    • I_PARENTDBG =

    • I_APPLOGPARENT =

    • I_GRAPHICSPARENT =

    • I_NAME =

    • I_FCAT_COMPLETE = SPACE

    • EXCEPTIONS

    • ERROR_CNTL_CREATE = 1

    • ERROR_CNTL_INIT = 2

    • ERROR_CNTL_LINK = 3

    • ERROR_DP_CREATE = 4

    • others = 5

    .

    IF sy-subrc <> 0.

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

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

    ENDIF.

    ENDFORM. " sub_grid

    &----


    *& Form create_alv

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM create_alv .

    CALL METHOD g_grid->set_table_for_first_display

    • EXPORTING

    • I_BUFFER_ACTIVE =

    • I_BYPASSING_BUFFER =

    • I_CONSISTENCY_CHECK =

    • I_STRUCTURE_NAME =

    • IS_VARIANT =

    • I_SAVE =

    • I_DEFAULT = 'X'

    • IS_LAYOUT =

    • IS_PRINT =

    • IT_SPECIAL_GROUPS =

    • IT_TOOLBAR_EXCLUDING =

    • IT_HYPERLINK =

    • IT_ALV_GRAPHICS =

    • IT_EXCEPT_QINFO =

    • IR_SALV_ADAPTER =

    CHANGING

    it_outtab = t_emp_sujoy

    it_fieldcatalog = t_fieldcatalog

    • IT_SORT =

    • IT_FILTER =

    • EXCEPTIONS

    • INVALID_PARAMETER_COMBINATION = 1

    • PROGRAM_ERROR = 2

    • TOO_MANY_LINES = 3

    • others = 4

    .

    IF sy-subrc <> 0.

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

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

    ENDIF.

    ENDFORM. " create_alv

    &----


    *& Form sub_fieldcatalog

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM sub_fieldcatalog .

    lwa_fieldcatalog-col_pos = 1.

    lwa_fieldcatalog-coltext = 'EMPNO'.

    lwa_fieldcatalog-fieldname = 'EMPNO'.

    lwa_fieldcatalog-ref_table = 'T_EMP_SUJOY'.

    *lwa_fieldcatalog-key = 'X'.

    APPEND lwa_fieldcatalog TO t_fieldcatalog.

    CLEAR lwa_fieldcatalog.

    lwa_fieldcatalog-col_pos = 1.

    lwa_fieldcatalog-coltext = 'FIRST_NAME'.

    lwa_fieldcatalog-fieldname = 'FIRST_NAME'.

    lwa_fieldcatalog-ref_table = 'T_EMP_SUJOY'.

    *lwa_fieldcatalog-key = 'X'.

    APPEND lwa_fieldcatalog TO t_fieldcatalog.

    ENDFORM. " sub_fieldcatalog

    &----


    *& Form sub_get_data

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form sub_get_data .

    SELECT * FROM zemp_sujoy

    INTO TABLE t_emp_sujoy

    where empno in s_empno.

    endform. " sub_get_data

    &----


    *& Module STATUS_9000 OUTPUT

    &----


    • text

    ----


    module STATUS_9000 output.

    SET PF-STATUS 'PF9000'.

    • SET TITLEBAR 'xxx'.

    endmodule. " STATUS_9000 OUTPUT

    &----


    *& Module exit INPUT

    &----


    • text

    ----


    module exit input.

    leave to screen 0.

    endmodule. " exit INPUT

    reward if usefull

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.