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

ALV issue

Hi friends

i am using two Reuse AlV grid dispaly function mobules to diplay BAPI sucees output messages and error output messages.

if there is both error and sucess messages for input recods then i want to display sucess messages first if i press back (F3) the i should get error oputput mesg next.

now my probelm is i am able to dipaly sucees msessages, but not able to display error messages, if i press back or F3 its going to selection screen instead to display error messages.

i have written code in subroutines as follows

if it_final_succ is not initial.

perform alv_success_diplay.

endif.

f it_final_error is not initial.

perform alv_error_diplay.

endif.

please help

Thanks

Ramesh

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Mar 29, 2008 at 06:41 AM

    IF it_final_succ IS NOT INITIAL.

    PERFORM alv_success_display.

    CASE sy-ucomm.

    WHEN 'BACK'.

    IF it_final_error IS NOT INITIAL.

    PERFORM alv_error_display.

    LEAVE TO SCREEN 0.

    ELSE.

    LEAVE TO SCREEN 0.

    ENDIF.

    ENDCASE.

    IF it_final_error IS NOT INITIAL.

    PERFORM alv_error_diplay.

    ENDIF.

    Thanks,

    siddu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 29, 2008 at 10:14 AM

    Hi Ramesh,

    That may not be possible .But u have one option to display Success messages output and after another output for Error messages. these two outputs are possible on single output screen. That we call it as Blocked ALV.

    Its like normal ALV but we 3 function modules to do that.

    Have a look this sample program and execute it . then u can come to know. that is solution for ur requirement.

    REPORT  zvenkat_head1.
    
    DATA: BEGIN OF i_mard OCCURS 0,
            werks TYPE mard-werks,
            lgort TYPE mard-lgort,
            matnr TYPE mard-matnr,
            insme TYPE mard-insme,
            einme TYPE mard-einme,
            speme TYPE mard-speme,
          END OF i_mard.
    
    DATA: BEGIN OF i_makt OCCURS 0,
            matnr TYPE makt-matnr,
            maktx TYPE makt-maktx,
            maktg TYPE makt-maktg,
          END OF i_makt.
    
    *&---------------------------------------------------------------------*
    *&      ALV Variables
    *&---------------------------------------------------------------------*
    TYPE-POOLS :slis.
    
    DATA :i_field   TYPE slis_t_fieldcat_alv,
          w_field   LIKE LINE OF i_field,
          w_layout  TYPE slis_layout_alv,
          i_events  TYPE slis_t_event,
          w_events  LIKE LINE OF i_events.
    
    DATA :i_field1   TYPE slis_t_fieldcat_alv,
          w_field1   LIKE LINE OF i_field1,
          w_layout1  TYPE slis_layout_alv,
          i_events1  TYPE slis_t_event,
          w_events1  LIKE LINE OF i_events1.
    
    *&---------------------------------------------------------------------*
    *&      START-OF-SELECTION
    *&---------------------------------------------------------------------*
    START-OF-SELECTION.
    
      PERFORM get_data_from_database .
    
    *&---------------------------------------------------------------------*
    *&      END-OF-SELECTION
    *&---------------------------------------------------------------------*
    END-OF-SELECTION.
    
      PERFORM build_fieldcatalog.
      PERFORM build_events.
      PERFORM display_data.
    *&---------------------------------------------------------------------*
    *&      Form  build_fieldcatalog
    *&---------------------------------------------------------------------*
    FORM build_fieldcatalog .
      CLEAR :
        w_field,
       i_field[].
      CLEAR :
        w_field1,
       i_field1[].
    
    *----------------Fieldcatalog 1
      w_field-fieldname = 'WERKS' .
      w_field-tabname = 'I_MARD'.
      w_field-seltext_m = 'Plant'.
      APPEND w_field TO i_field.
      CLEAR w_field.
    
      w_field-fieldname = 'LGORT' .
      w_field-tabname = 'I_MARD'.
      w_field-seltext_m = 'S.Location'.
      APPEND w_field TO i_field.
      CLEAR w_field.
    
      w_field-fieldname = 'MATNR'.
      w_field-tabname = 'I_MARD'.
      w_field-seltext_m = 'Mat No'.
      APPEND w_field TO i_field.
      CLEAR w_field.
    
      w_field-fieldname = 'INSME' .
      w_field-do_sum = 'X'.
      w_field-tabname = 'I_MARD'.
      w_field-seltext_m = 'quality Stock'.
      APPEND w_field TO i_field.
      CLEAR w_field.
    
      w_field-fieldname = 'EINME'.
      w_field-do_sum = 'X'.
      w_field-tabname = 'I_MARD'.
      w_field-seltext_m = 'Total Stock'.
      APPEND w_field TO i_field.
      CLEAR w_field.
    
      w_field-fieldname = 'SPEME'.
      w_field-do_sum = 'X'.
      w_field-tabname = 'I_MARD'.
      w_field-seltext_m = 'Blocked stock'.
      APPEND w_field TO i_field.
      CLEAR w_field.
    
    *----------------Fieldcatalog 2
    
      w_field1-fieldname = 'MATNR'.
      w_field1-tabname = 'I_MAKT'.
      w_field1-seltext_m = 'MATNR'.
      APPEND w_field1 TO i_field1.
      CLEAR w_field1.
    
    
      w_field1-fieldname = 'MAKTX'.
      w_field1-tabname = 'I_MAKT'.
      w_field1-seltext_m = 'MAKTX'.
      APPEND w_field1 TO i_field1.
      CLEAR w_field1.
    
      w_field1-fieldname = 'MAKTG'.
      w_field1-tabname = 'I_MAKT'.
      w_field1-seltext_m = 'MAKTG'.
      APPEND w_field1 TO i_field1.
      CLEAR w_field1.
    
    
    ENDFORM.                    " build_fieldcatalog
    *&---------------------------------------------------------------------*
    *&      Form  build_events
    *&---------------------------------------------------------------------*
    FORM build_events .
    
      CLEAR:
        w_events,
        i_events[],
        w_events1,
        i_events1[].
    
      w_events-name = 'TOP_OF_PAGE' .
      w_events-form = 'TOP_OF_PAGE' .
      APPEND w_events TO i_events.
      CLEAR w_events.
    
      w_events1-name = 'TOP_OF_PAGE' .
      w_events1-form = 'TOP_OF_PAGE' .
      APPEND w_events1 TO i_events1.
      CLEAR w_events1.
    
    
    ENDFORM.                    " build_events
    *&---------------------------------------------------------------------*
    *&      Form  display_data
    *&---------------------------------------------------------------------*
    FORM display_data .
      DATA :program LIKE sy-repid VALUE sy-repid.
    
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
        EXPORTING
          i_callback_program             = program
    *   I_CALLBACK_PF_STATUS_SET       = ' '
    *   I_CALLBACK_USER_COMMAND        = ' '
    *   IT_EXCLUDING                   =
                .
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout                        = w_layout
          it_fieldcat                      = i_field
          i_tabname                        = 'I_MARD'
          it_events                        = i_events
    *   IT_SORT                          =
    *   I_TEXT                           = ' '
        TABLES
          t_outtab                         = i_mard
    * EXCEPTIONS
    *   PROGRAM_ERROR                    = 1
    *   MAXIMUM_OF_APPENDS_REACHED       = 2
    *   OTHERS                           = 3
                .
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    
    
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout                        = w_layout
          it_fieldcat                      = i_field1
          i_tabname                        = 'I_MAKT'
          it_events                        = i_events1
    *   IT_SORT                          =
    *   I_TEXT                           = ' '
        TABLES
          t_outtab                         = i_makt
    * EXCEPTIONS
    *   PROGRAM_ERROR                    = 1
    *   MAXIMUM_OF_APPENDS_REACHED       = 2
    *   OTHERS                           = 3
                .
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    
    
    
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
    * EXPORTING
    *   I_INTERFACE_CHECK             = ' '
    *   IS_PRINT                      =
    *   I_SCREEN_START_COLUMN         = 0
    *   I_SCREEN_START_LINE           = 0
    *   I_SCREEN_END_COLUMN           = 0
    *   I_SCREEN_END_LINE             = 0
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER       =
    *   ES_EXIT_CAUSED_BY_USER        =
    * EXCEPTIONS
    *   PROGRAM_ERROR                 = 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.
    
    ENDFORM.                    " display_data
    
    *&---------------------------------------------------------------------*
    *&      Form  get_data_from_database
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    FORM get_data_from_database .
    
      SELECT werks lgort matnr insme einme speme
      FROM mard
      INTO CORRESPONDING FIELDS OF TABLE i_mard
      UP TO 20 ROWS
      WHERE werks = 'WF01'.
    
    
      SELECT  matnr
              maktx
              maktg
        FROM makt
        INTO TABLE i_makt
        UP TO 20 ROWS.
    
    ENDFORM.                    " get_data_from_database
    
    *&---------------------------------------------------------------------*
    *&      Form  top_of_page
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    FORM top_of_page.
    
      DATA: inc_colnum TYPE i.
      ULINE .
      inc_colnum = sy-linsz - 60.
      WRITE: / 'Report: ', sy-repid(18).
      WRITE AT 30(inc_colnum) sy-title CENTERED.
      inc_colnum = sy-linsz - 20.
      WRITE: AT inc_colnum 'Page: ', (11) sy-pagno RIGHT-JUSTIFIED.
      WRITE: / 'Client: ', sy-mandt.
      inc_colnum = sy-linsz - 20.
      WRITE: AT inc_colnum 'Date: ', sy-datum.
      WRITE: / 'User  : ', sy-uname.
      inc_colnum = sy-linsz - 60.
      WRITE AT 30(inc_colnum) 'Blocked ALV' CENTERED.
      inc_colnum = sy-linsz - 20.
      WRITE: AT inc_colnum 'Time: ', (10) sy-uzeit RIGHT-JUSTIFIED.
      ULINE .
    
    ENDFORM.                    "top_of_page

    Regards,

    Venkat.O

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 29, 2008 at 10:19 AM

    Hi Ramesh,

    Mu sugestion is just the error or sucess alv in a conatainer of the scree.

    If OOPs is difficult for you show it in a POPUP ALV.

    Use FM ->

    REUSE_ALV_POPUP_TO_SELECT

    Rgds

    Anversha

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 29, 2008 at 10:25 AM

    hi do like this it will work..use the table content but not the workarea in the check statement for this....

    if not it_final_succ[] is initial.

    perform alv_success_diplay.

    endif.

    if not it_final_error[] is initial.

    perform alv_error_diplay.

    endif.

    regards,

    venkat

    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.