Interactive in ALV

Hi,
Can u  guide me how to do Interactive reports in ALV with a sample Program code plz.
Regards.
CDREDDY.

hi,
check this sample code.you will be well versed with all the events of a interactive alv report.mark points if useful.
*& Report  ZALV4_INTERACTIVE                                           *
*&  interactive alvs                                                                   *
REPORT  ZALV4_INTERACTIVE NO STANDARD PAGE HEADING
                          MESSAGE-ID ZMSG
                          LINE-COUNT 37(3)
                          LINE-SIZE 134.
TYPE-POOLS : SLIS.
TABLES         DECLARATION        ********************
TABLES : VBRK,              " BILLING MASTERS TABLE
         VBRP.              " BILLING ITEM TABLE
TYPES     DECLARATION             ********************
TYPES : BEGIN OF TY_VBRK,       " types for billing masters table
         VBELN TYPE VBRK-VBELN, " billing document
         WAERK TYPE VBRK-WAERK, " document currency
         VKORG TYPE VBRK-VKORG, " sales organization
         FKDAT TYPE VBRK-FKDAT, " billing date
         BUKRS TYPE VBRK-BUKRS, " company code
         BUTXT TYPE T001-BUTXT, " company name
         NETWR TYPE VBRK-NETWR, " net currency value
         LINE_COLOR(4) TYPE C,
         END OF TY_VBRK.
TYPES : BEGIN OF TY_VBRP,      " types for billing document item data
         POSNR TYPE VBRP-POSNR, " billing item
         FKIMG TYPE VBRP-FKIMG, " actual invoiced quantitty
         VRKME TYPE VBRP-VRKME, " sales unit
         NETWR TYPE VBRP-NETWR, " net currency value
         MATNR TYPE VBRP-MATNR, " material number
         ARKTX TYPE VBRP-ARKTX, " short text for sales order item
        END OF TY_VBRP.
FIELD     CATALOG                 ********************
DATA : WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
       WA_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV.
LAYOUT    DECLARATION             ********************
DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV,
       WA_LAYOUT1 TYPE SLIS_LAYOUT_ALV.
EVENTS  DECLARATION               ********************
DATA : TY_EVENTS TYPE SLIS_ALV_EVENT,
       IT_EVENTS TYPE SLIS_T_EVENT.
PF           STATUS               ********************
DATA : PF_STATUS TYPE SLIS_FORMNAME VALUE 'SET_PF_STATUS'.
USER       COMMAND                ********************
DATA : USER_COMMAND TYPE SLIS_FORMNAME VALUE 'SET_USER_COMMAND',
       R_UCOMM LIKE SY-UCOMM.
INTERNAL       TABLES             ********************
DATA : IT_VBRK TYPE TABLE OF TY_VBRK, "internal table for billing master
       IT_VBRP TYPE TABLE OF TY_VBRP, "internal table for billing item
*internal table for field catalog
       IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
       IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV.
WORK         AREA                 ********************
DATA : WA_VBRK LIKE LINE OF IT_VBRK, "work area for billing master
       WA_VBRP LIKE LINE OF IT_VBRP. "work area for billing item
VARIABLE  DECLARATION             ********************
DATA : V_DATE TYPE SY-DATUM, " variable to store date values
       V_VBELN TYPE VBRK-VBELN, " variable for billing document
       V_FKDAT TYPE VBRK-FKDAT, " variable for billing date
       V_FLAG(1). " variable for flag
SELECTION         SCREEN          ********************
SELECT-OPTIONS : S_VBELN FOR VBRK-VBELN , " Billing document
                 S_FKDAT FOR VBRK-FKDAT,   " Billing date
                 S_MATNR FOR VBRP-MATNR.   " Material number
PARAMETERS : R1 RADIOBUTTON GROUP G1, "whole item details
             R2 RADIOBUTTON GROUP G1. "selected item details
           INITIALIZATION         ********************
INITIALIZATION.
  V_FLAG = 'X'.
  V_DATE = SY-DATUM - 20.
  S_FKDAT-SIGN = 'I'.
  S_FKDAT-OPTION = 'EQ'.
  S_FKDAT-LOW = V_DATE.
  S_FKDAT-HIGH = SY-DATUM.
  APPEND S_FKDAT.
  SELECTION SCREEN VALIDATION     ********************
AT SELECTION-SCREEN.
  PERFORM CONVERSION. " performs data conversion for input
  PERFORM VBELN_VALIDATE. " validating the billing document
  PERFORM FKDAT_VALIDATE. " validating the billing date
  START OF SELECTION              ********************
START-OF-SELECTION.
  SET TITLEBAR  'AAAA'.
  PERFORM VBRK_POPULATE. " populating the billing master detais
  PERFORM FIELDCATALOG.  " designing the field catalog
  PERFORM EVENTS.        " performing the events for top of page
  PERFORM DISP_BASICLIST." displaying the basic list
*&      Form  VBELN_VALIDATE
      text validating the billing document
-->  p1        text
<--  p2        text
FORM VBELN_VALIDATE .
  IF S_VBELN IS INITIAL.
   MESSAGE E000 WITH 'Make entries in all required fields'.
  ELSE.
    SELECT SINGLE VBELN
           FROM VBRK
           INTO V_VBELN
           WHERE VBELN IN S_VBELN.
    IF SY-SUBRC <> 0.
      MESSAGE I000 WITH 'BILLING DOCUMENT DOESNT EXIST'.
    ENDIF.
  ENDIF.
ENDFORM.                    " VBELN_VALIDATE
*&      Form  FKDAT_VALIDATE
      text validating the billing date
-->  p1        text
<--  p2        text
FORM FKDAT_VALIDATE .
  SELECT SINGLE FKDAT
         FROM VBRK
         INTO V_FKDAT
         WHERE FKDAT IN S_FKDAT.
  IF SY-SUBRC <> 0.
    MESSAGE I000 WITH 'BILLING DATE DOESNT EXIST'.
  ENDIF.
ENDFORM.                    " FKDAT_VALIDATE
*&      Form  VBRK_POPULATE
      text populating the billing master details
-->  p1        text
<--  p2        text
FORM VBRK_POPULATE .
  DATA : LD_COLOR(1) TYPE C.
  LD_COLOR = 5.
  SELECT VBRK~VBELN
         VBRK~WAERK
         VBRK~VKORG
         VBRK~FKDAT
         VBRK~BUKRS
         VBRK~NETWR
         T001~BUTXT
  FROM VBRK INNER JOIN T001
  ON VBRKBUKRS = T001BUKRS
  INTO CORRESPONDING FIELDS OF TABLE IT_VBRK
   WHERE VBRK~VBELN IN S_VBELN AND
         VBRK~FKDAT IN S_FKDAT.
  LOOP AT IT_VBRK INTO WA_VBRK.
    LD_COLOR = LD_COLOR + 1.
    IF LD_COLOR = 8.
      LD_COLOR = 1.
    ENDIF.
    CONCATENATE 'C' LD_COLOR '10' INTO WA_VBRK-LINE_COLOR.
    MODIFY IT_VBRK FROM WA_VBRK.
  ENDLOOP.
ENDFORM.                    " VBRK_POPULATE
*&      Form  CONVERSION
      text data conversion to take leading zeroes into account
-->  p1        text
<--  p2        text
FORM CONVERSION .
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      INPUT  = S_VBELN
    IMPORTING
      OUTPUT = S_VBELN.
ENDFORM.                    " CONVERSION
*&      Form  DISP_BASICLIST
      text displaying the basic list
-->  p1        text
<--  p2        text
FORM DISP_BASICLIST .
  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
   EXPORTING
  I_INTERFACE_CHECK              = ' '
  I_BYPASSING_BUFFER             =
  I_BUFFER_ACTIVE                = ' '
    I_CALLBACK_PROGRAM             = SY-REPID
    I_CALLBACK_PF_STATUS_SET       = PF_STATUS
    I_CALLBACK_USER_COMMAND        = USER_COMMAND
  I_STRUCTURE_NAME               =
    IS_LAYOUT                      = WA_LAYOUT
    IT_FIELDCAT                    = IT_FIELDCAT
  IT_EXCLUDING                   =
  IT_SPECIAL_GROUPS              =
  IT_SORT                        =
  IT_FILTER                      =
  IS_SEL_HIDE                    =
  I_DEFAULT                      = 'X'
    I_SAVE                         = 'X'
  IS_VARIANT                     =
    IT_EVENTS                      = IT_EVENTS
  IT_EVENT_EXIT                  =
  IS_PRINT                       =
  IS_REPREP_ID                   =
  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         =
    TABLES
      T_OUTTAB                       = IT_VBRK
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.                    " DISP_BASICLIST
*&      Form  FIELDCATALOG
      text designing the field catalog
-->  p1        text
<--  p2        text
FORM FIELDCATALOG .
  WA_FIELDCAT-TABNAME = 'IT_VBRK'.
  WA_FIELDCAT-FIELDNAME = 'VBELN'.
  WA_FIELDCAT-SELTEXT_L = 'BILLING DOCUMENT'.
  WA_FIELDCAT-COL_POS = 1.
WA_FIELDCAT-EMPHASIZE = 'C610'.
  WA_FIELDCAT-KEY = 'X'.
  WA_FIELDCAT-OUTPUTLEN = 20.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-TABNAME = 'IT_VBRK'.
  WA_FIELDCAT-FIELDNAME = 'WAERK'.
  WA_FIELDCAT-SELTEXT_L = 'DOCUMENT CURRENCY'.
  WA_FIELDCAT-COL_POS = 2.
  WA_FIELDCAT-OUTPUTLEN = 20.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-TABNAME = 'IT_VBRK'.
  WA_FIELDCAT-FIELDNAME = 'VKORG'.
  WA_FIELDCAT-SELTEXT_L = 'SALES ORGANIZATION'.
  WA_FIELDCAT-EMPHASIZE = 'C610'.
  WA_FIELDCAT-COL_POS = 3.
  WA_FIELDCAT-OUTPUTLEN = 20.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-TABNAME = 'IT_VBRK'.
  WA_FIELDCAT-FIELDNAME = 'FKDAT'.
  WA_FIELDCAT-SELTEXT_L = 'BILLING DATE'.
  WA_FIELDCAT-COL_POS = 4.
  WA_FIELDCAT-OUTPUTLEN = 20.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-TABNAME = 'IT_VBRK'.
  WA_FIELDCAT-FIELDNAME = 'BUKRS'.
  WA_FIELDCAT-SELTEXT_L = 'COMPANY CODE'.
  WA_FIELDCAT-COL_POS = 5.
  WA_FIELDCAT-OUTPUTLEN = 20.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-TABNAME = 'IT_VBRK'.
  WA_FIELDCAT-FIELDNAME = 'BUTXT'.
  WA_FIELDCAT-SELTEXT_L = 'COMPANY NAME'.
  WA_FIELDCAT-COL_POS = 6.
  WA_FIELDCAT-OUTPUTLEN = 25.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-TABNAME = 'IT_VBRK'.
  WA_FIELDCAT-FIELDNAME = 'NETWR'.
  WA_FIELDCAT-SELTEXT_L = 'NET CURRENCY VALUE'.
  WA_FIELDCAT-COL_POS = 7.
  WA_FIELDCAT-OUTPUTLEN = 20.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_LAYOUT-ZEBRA = 'X'.
  WA_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
ENDFORM.                    " FIELDCATALOG
*&      Form SET_PF_STATUS
      text set the pf status
FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.
  SET PF-STATUS 'Z50658_PFSTATUS' EXCLUDING EXTAB.
ENDFORM.                                          "SET_PF_STATUS
*&      Form  SET_USER_COMMAND
      text set the user command
FORM SET_USER_COMMAND USING R_UCOMM
                            RS_SELFIELD TYPE SLIS_SELFIELD.
  CASE R_UCOMM.
    WHEN 'CLICK'.
      IF R1 = 'X'.
        IF NOT IT_VBRK IS INITIAL.
          SELECT POSNR
                 FKIMG
                 VRKME
                 NETWR
                 MATNR
                 ARKTX
          FROM VBRP
          INTO CORRESPONDING FIELDS OF TABLE IT_VBRP
          FOR ALL ENTRIES IN IT_VBRK
          WHERE VBELN = IT_VBRK-VBELN.
          IF SY-SUBRC <> 0.
            MESSAGE I000 WITH ' NO BILLING DETAILS FOUND'.
          ELSE.
            IF V_FLAG = 'X'.
              PERFORM DET_FIELDCATALOG.
              V_FLAG = ''.
            ENDIF.
            PERFORM DET_LISTDISPLAY.
          ENDIF.
        ENDIF.
      ENDIF.
      IF R2 = 'X'.
        READ TABLE IT_VBRK INTO WA_VBRK INDEX RS_SELFIELD-TABINDEX.
        IF SY-SUBRC = 0.
          SELECT SINGLE POSNR
                        FKIMG
                        VRKME
                        NETWR
                        MATNR
                        ARKTX
          FROM VBRP
          INTO CORRESPONDING FIELDS OF WA_VBRP
          WHERE VBELN = WA_VBRK-VBELN.
        ENDIF.
        APPEND WA_VBRP TO IT_VBRP.
      ENDIF.
      IF V_FLAG = 'X'.
        PERFORM DET_FIELDCATALOG. "designing the field catalog for items
        V_FLAG = ''.
      ENDIF.
      PERFORM DET_LISTDISPLAY. "displaying the secondary list
    WHEN 'BACK'.
      LEAVE TO SCREEN 0.
    WHEN 'UP'.
      LEAVE TO SCREEN 0.
    WHEN 'CANCEL'.
      CALL TRANSACTION 'SE38'.
  ENDCASE.
ENDFORM.                                          "SET_USER_COMMAND
*&      Form  DET_FIELDCATALOG
      text designing the field catalog for item details
-->  p1        text
<--  p2        text
FORM DET_FIELDCATALOG .
  WA_FIELDCAT1-TABNAME = 'IT_VBRP'.
  WA_FIELDCAT1-FIELDNAME = 'POSNR'.
  WA_FIELDCAT1-SELTEXT_L = 'BILLING ITEM'.
  WA_FIELDCAT1-COL_POS = 1.
  WA_FIELDCAT1-OUTPUTLEN = 20.
  APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
  CLEAR WA_FIELDCAT1.
  WA_FIELDCAT1-TABNAME = 'IT_VBRP'.
  WA_FIELDCAT1-FIELDNAME = 'FKIMG'.
  WA_FIELDCAT1-SELTEXT_L = 'INVOICE QUANTITY'.
  WA_FIELDCAT1-COL_POS = 2.
  WA_FIELDCAT1-OUTPUTLEN = 20.
  APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
  CLEAR WA_FIELDCAT1.
  WA_FIELDCAT1-TABNAME = 'IT_VBRP'.
  WA_FIELDCAT1-FIELDNAME = 'VRKME'.
  WA_FIELDCAT1-SELTEXT_L = 'SALES UNIT'.
  WA_FIELDCAT1-COL_POS = 3.
  WA_FIELDCAT1-OUTPUTLEN = 20.
  APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
  CLEAR WA_FIELDCAT1.
  WA_FIELDCAT1-TABNAME = 'IT_VBRP'.
  WA_FIELDCAT1-FIELDNAME = 'NETWR'.
  WA_FIELDCAT1-SELTEXT_L = 'NET CURRENCY VALUE'.
  WA_FIELDCAT1-COL_POS = 4.
  WA_FIELDCAT1-OUTPUTLEN = 20.
  APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
  CLEAR WA_FIELDCAT1.
  WA_FIELDCAT1-TABNAME = 'IT_VBRP'.
  WA_FIELDCAT1-FIELDNAME = 'MATNR'.
  WA_FIELDCAT1-SELTEXT_L = 'MATERIAL NUMBER'.
  WA_FIELDCAT1-COL_POS = 5.
  WA_FIELDCAT1-OUTPUTLEN = 20.
  APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
  CLEAR WA_FIELDCAT1.
  WA_FIELDCAT1-TABNAME = 'IT_VBRP'.
  WA_FIELDCAT1-FIELDNAME = 'ARKTX'.
  WA_FIELDCAT1-SELTEXT_L = 'SALES ORDER ITEM'.
  WA_FIELDCAT1-COL_POS = 6.
  WA_FIELDCAT1-OUTPUTLEN = 20.
  APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
  CLEAR WA_FIELDCAT1.
  WA_LAYOUT1-ZEBRA = 'X'.
ENDFORM.                    " DET_FIELDCATALOG
*&      Form  DET_LISTDISPLAY
      text displaying the secondary list
-->  p1        text
<--  p2        text
FORM DET_LISTDISPLAY .
  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
   EXPORTING
  I_INTERFACE_CHECK              = ' '
  I_BYPASSING_BUFFER             =
  I_BUFFER_ACTIVE                = ' '
   I_CALLBACK_PROGRAM             = SY-REPID
  I_CALLBACK_PF_STATUS_SET       = ' '
  I_CALLBACK_USER_COMMAND        = ' '
  I_STRUCTURE_NAME               =
     IS_LAYOUT                      = WA_LAYOUT1
     IT_FIELDCAT                    = IT_FIELDCAT1
  IT_EXCLUDING                   =
  IT_SPECIAL_GROUPS              =
  IT_SORT                        =
  IT_FILTER                      =
  IS_SEL_HIDE                    =
  I_DEFAULT                      = 'X'
  I_SAVE                         = ' '
  IS_VARIANT                     =
   IT_EVENTS                      = IT_EVENTS
  IT_EVENT_EXIT                  =
  IS_PRINT                       =
  IS_REPREP_ID                   =
  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         =
    TABLES
      T_OUTTAB                       = IT_VBRP
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.
  CLEAR IT_VBRP[].
ENDFORM.                    " DET_LISTDISPLAY
*&      Form  EVENTS
      text
-->  p1        text
<--  p2        text
FORM EVENTS .
  CLEAR TY_EVENTS.
  TY_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
  TY_EVENTS-FORM = 'TOP_OF_PAGE'.
  APPEND TY_EVENTS TO IT_EVENTS.
ENDFORM.                    " EVENTS
*&      Form  TOP_OF_PAGE
      text
FORM TOP_OF_PAGE.
  SKIP.
  ULINE.
  WRITE :/2 ' DATE :', SY-DATUM,
          45 'INTELLIGROUP ASIA PVT LTD',
          110 'TIME :', SY-UZEIT.
  WRITE : /3 'USER :', SY-UNAME,
           45 'TITLE :', SY-TITLE,
           110 'PAGE :', SY-PAGNO.
  ULINE.
  SKIP.
ENDFORM.                    "TOP_OF_PAGE
regards,
Deepthi Reddy

Similar Messages

  • Number of Classical , Interactive and ALV reports in Project.

    Hi,
    I am new to ABAP.
    Can anybody please  tell me how many Classical , Interactive and ALV reports will be there in a approximate one year span of project ? and how many input parameters ( Select-options) will be there in a report. if you send the some sample input parameters in a report how it looks in real time will help  me to practice and for the interviews.
    Thanks,
    Maanasa..

    Maanasa,
    Welcome to SDN
    It entirely depends upon the project, on  your team and on the specs of the requirement....
    From interview point of view no body is going to ask u such questions, becz there is no specific answer for such question.
    ~~Guduri

  • How to make an interactive block ALV

    Hi,
       I am new to the field of ABAP and have recently started working on ALV's. My problem is that i do not know how to make an interactive block ALV. I have implemented this functionality with the simple ALV but I am not getting the same for block ALV. Anyone who has worked on the same or has any idea please help me.
    Regards.
    Alok Bhardwaj

    Hi jester526,
    You'll need Acrobat to create links in a PDF file. Please see https://acrobatusers.com/tutorials/creating-and-editing-links for instructions.
    Best,
    Sara

  • Please tell me the way to the run the interactive OO alv in the background.

    please tell me the way to the run the interactive OO alv in the background. is there any thing to do with SAP GUI.

    hi there...
    regarding your query, i tried to do this but ended in a short dump. You can check the folowing link which i checked once i got this error.
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    i think this will be of some help to you.
    Do reward if helpful or get back if need further assistance/

  • Please tell me the way to the run the interactive OO alv in the backgrou

    please tell me the way to the run the interactive OO alv in the background.

    hi there...
    regarding your query, i tried to do this but ended in a short dump. You can check the folowing link which i checked once i got this error.
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    i think this will be of some help to you.
    Do reward if helpful or get back if need further assistance/

  • Interactive versus ALV reports....

    Hi,
    I just wanted to clear my doubt.
    What is the difference between interactive and ALV reports ?

    In ABAP, there are a total of 4 types of reports. They are:
    Classical
    Interactive
    Logical Database
    ABAP query
    Classical Reports
    Classical reports are normal reports. These reports are not having any sub reports.IT IS HAVING ONLY ONE SCREEN/LIST FOR OUTPUT. Events In Classical Reports. INTIALIZATION:This event triggers before selection sreen display. AT-SELECTION-SCREEN:This event triggers after proccesing user input still selection screen is in active mode. START OF SELECTIONS:starrt of selection screen triggers after proceesing selection screen. TOP-OF-PAGE:It provides header for abap reports. END-OF-PAGE:It provides footer for page. AT PF:For predefined function kes AT USER COMMAND:For user defined function keys.
    Interactive Reports
    Interactive reports are very accurate reports. These reports contain more than 20 sub reports.
    Logical Database Reports
    Logical database is another tool for ABAP reports. Using LDB we can provide extra features for ABAP reports.(Give Example Also ok understand)
    ABAP Query Reports
    ABAP query is another tool for ABAP. It provides efficency for ABAP reports. These reports are very accurate. For example, ALV and HR ABAP reports. ALV stands for ABAP List Viewer.
    ABAP Report Types
    ABAP report types are those ones available in some report's attributes screen, i.e. :
    Executable program
    Function group (containing function modules)
    Include
    Interface pool
    Class pool
    Module pool
    Subroutine pool
    Also ALV means ABAP List Viewer. Most convenient way to use it is through reuse library (cf. transaction se83) available from release 4.6 of SAP R/3.
    ALV is available in two modes: list and grid. List mode is good old list processing with standard functionnalities, and grid mode is using a new OCX object displaying grids
    Thanks,

  • Interactive to alv

    Hi friends doing a interactive report with hide statement .when doublec click
    on it alv report is to be displalyed .
    i had from and to in my selection crietria ..user can input groups
    suppose A1,TO A3.
    BUT WHEN I DOUBLE CLICK ON A1 I WILL GET A1 DETAILS IN LAV OUTPUT..AND WHEN I PRESS
    BACK AND SCROLL AND DOUBLE CLICK ON A2 GROUP THEN TOO I GET A1 DETAILS SIMILARLY FOR
    A3 ALSO .
    I AM USING CALL SCREEN IN  MY ITAB IAM GETTING THE CORRECT DATA BUT THE TABLE DISPLAYS THE
    PREVIOUS VALUE
    HERE IS MY CODE PLEASE CORRECT ME WHERE IAM WRONG ..
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'ALV'.
      SET TITLEBAR '001'.
    clear g_custom_container.
    refresh g_custom_container.
      IF g_custom_container IS INITIAL.
        CREATE OBJECT g_custom_container
               EXPORTING container_name = g_container.
        CREATE OBJECT grid1
               EXPORTING i_parent = g_custom_container.
        CALL METHOD grid1->set_table_for_first_display
          EXPORTING
            is_layout       = gs_layout
          CHANGING
            it_outtab       = i_output[]     "i_best_10%_detail[]
            it_fieldcatalog = gt_fieldcatalog
            it_sort         = gt_sort.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE user_command_0100 INPUT.
      CALL METHOD cl_gui_cfw=>dispatch.
    CALL METHOD g_editable_alv->refresh_table_display
            exporting
       is_layout = gs_fcatlayo
       changing
        it_outtab = gt_fieldcat[]
        it_fieldcatalog = gt_fcatfcat[].
    clear i_output.
    free: i_output[].
    *refresh i_output.
      CASE sy-ucomm.
        WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    FORM fieldcatalog_init USING lt_fieldcatalog TYPE lvc_t_fcat
                           value(field_name) value(field_type) value(field_text) value(field_key)
                           value(field_len).
      DATA: ls_fieldcatalog TYPE lvc_s_fcat.
      CLEAR ls_fieldcatalog.
           ls_fieldcatalog-tabname = table_name.
      ls_fieldcatalog-fieldname = field_name.
      ls_fieldcatalog-datatype  = field_type.
      ls_fieldcatalog-reptext   = field_text.
      ls_fieldcatalog-coltext  =  field_text.
      ls_fieldcatalog-seltext  =  field_text.
      ls_fieldcatalog-tooltip  =  field_text.
      ls_fieldcatalog-key       = field_key.
      ls_fieldcatalog-intlen    = field_len.
      ls_fieldcatalog-dd_outlen = field_len.
      IF ls_fieldcatalog-fieldname = 'NOBESTBATCH'.
        ls_fieldcatalog-emphasize = 'C411'.
      ENDIF.
      IF ls_fieldcatalog-fieldname = 'NOBATCH'.
        ls_fieldcatalog-emphasize = 'C411'.
      ENDIF.
      APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ENDFORM.                    "fieldcatalog_init
    regards
    answers will be rewarded points

    Hi
    You need to <b>refresh the ALV display</b>, as you are populating the output table again.
    Why is that code commented?
    Regards
    Raj

  • Interactive List : ALV + Normal List

    Hi,
    Please help me on this.
    I haveto write an interactive report where the first screen would be an ALV list, on clicking the line item I need to display the detailed report in normal list. Also, the data displayed in the normal list is almost same as that displayed on ALV.I have created both types of output but dont know how to link them as interactive. any suggestions or help?

    hi,
    this is an ALV interactive report .in this you can find logic for interactive report.make use of it.
    instead of alv make use of normal report for secondary list.
    REPORT  ZSR_ALV_INTERACTIVE.
    TABLES : LFA1,EKKO,EKPO.
    SELECT-OPTIONS : VENDOR FOR LFA1-LIFNR.
    DATA : BEGIN OF ITAB OCCURS 0,
           LIFNR LIKE LFA1-LIFNR,
           NAME1 LIKE LFA1-NAME1,
           END OF ITAB.
    DATA : BEGIN OF JTAB OCCURS 0,
           EBELN LIKE EKKO-EBELN,
           AEDAT LIKE EKKO-AEDAT,
           END OF JTAB.
    DATA : BEGIN OF KTAB OCCURS 0,
           EBELP LIKE EKPO-EBELP,
           MATNR LIKE EKPO-MATNR,
           END OF KTAB.
    TYPE-POOLS : SLIS.
    DATA : REPID LIKE SY-REPID.
    DATA :LFA1_B TYPE SLIS_T_FIELDCAT_ALV,
          LFA1_W TYPE SLIS_FIELDCAT_ALV,
          EKKO_B TYPE SLIS_T_FIELDCAT_ALV,
          EKKO_W TYPE SLIS_FIELDCAT_ALV,
          EKPO_B TYPE SLIS_T_FIELDCAT_ALV,
          EKPO_W TYPE SLIS_FIELDCAT_ALV,
          EVENTS_B TYPE SLIS_T_EVENT,
          EVENTS_W TYPE SLIS_ALV_EVENT.
    PERFORM GET_VAL.
    REPID = SY-REPID.
    SELECT LIFNR NAME1 FROM LFA1 INTO TABLE ITAB WHERE LIFNR IN VENDOR.
    *perform val USING USER_COMMAND sel.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
      EXPORTING
        I_CALLBACK_PROGRAM = REPID
        IT_FIELDCAT        = LFA1_B
        IT_EVENTS          = EVENTS_B
      TABLES
        T_OUTTAB           = ITAB.
    *&      Form  GET_VAL
          text  this is to put column headings
    FORM GET_VAL.
      LFA1_W-FIELDNAME = 'LIFNR'.
      LFA1_W-REF_TABNAME = 'LFA1'.
      LFA1_W-REF_FIELDNAME = 'LIFNR'.
      APPEND LFA1_W TO LFA1_B.
      LFA1_W-FIELDNAME = 'NAME1'.
      LFA1_W-REF_TABNAME = 'LFA1'.
      LFA1_W-REF_FIELDNAME = 'NAME1'.
      APPEND LFA1_W TO LFA1_B.
      EKKO_W-FIELDNAME = 'EBELN'.
      EKKO_W-REF_TABNAME = 'EKKO'.
      EKKO_W-REF_FIELDNAME = 'EBELN'.
      APPEND EKKO_W TO EKKO_B.
      EKKO_W-FIELDNAME = 'AEDAT'.
      EKKO_W-REF_TABNAME = 'EKKO'.
      EKKO_W-REF_FIELDNAME = 'AEDAT'.
      APPEND EKKO_W TO EKKO_B.
      EKPO_W-FIELDNAME = 'EBELP'.
      EKPO_W-REF_TABNAME = 'EKPO'.
      EKPO_W-REF_FIELDNAME = 'EBELP'.
      APPEND EKPO_W TO EKPO_B.
      EKPO_W-FIELDNAME = 'MATNR'.
      EKPO_W-REF_TABNAME = 'EKPO'.
      EKPO_W-REF_FIELDNAME = 'MATNR'.
      APPEND EKPO_W TO EKPO_B.
      EVENTS_W-NAME = 'USER_COMMAND'.
      EVENTS_W-FORM = 'VAL'.
      APPEND EVENTS_W TO EVENTS_B.
    ENDFORM.                    "GET_VAL
    *&      Form  VAL
          text
         -->USER_COMMANtext
         -->SEL        text     for retrieving data
    FORM VAL USING USER_COMMAND LIKE SY-UCOMM SEL TYPE SLIS_SELFIELD.
      DATA : VEN(10) TYPE N,
             PO(10) TYPE N.
      DATA : MAT(10) TYPE C.
      IF SEL-FIELDNAME = 'LIFNR'.
        VEN = SEL-VALUE.
        SELECT EBELN AEDAT FROM EKKO INTO TABLE JTAB WHERE LIFNR = VEN.
       CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM             = REPID
         I_STRUCTURE_NAME               = EKKO_B
          IT_FIELDCAT                    = EKKO_B
          IT_EVENTS                      = EVENTS_B
         TABLES
           T_OUTTAB                       = JTAB.
      ENDIF.
      IF SEL-FIELDNAME = 'EBELN'.
        PO = SEL-VALUE.
        SELECT EBELP MATNR FROM EKPO INTO TABLE KTAB WHERE EBELN = PO.
        CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
          EXPORTING
            I_TITLE            = 'ITEM DETAILS'
            I_TABNAME          = 'EKPO'
            IT_FIELDCAT        = EKPO_B
            I_CALLBACK_PROGRAM = REPID
          IMPORTING
            ES_SELFIELD        = SEL
          TABLES
            T_OUTTAB           = KTAB.
      ENDIF.
    logic to select a record
      IF SEL-FIELDNAME = 'MATNR'.
        MAT = SEL-VALUE.
        SET PARAMETER ID 'MAT' FIELD MAT.
        CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
      ENDIF.
    ENDFORM.                    "VAL

  • Interacting with ALV output on Webdynpro

    Hi expert,
    I am displaying the output in ALV fromat using Webdynpro application.
    When I click on a column, i want to perform some functionality.
    How this can be achived?
    Do we need to display that Column as a Button? Then, how to trigger that action from that column?
    Thanks,
    Sreenivas

    Sreenivas,
    Please post it in webdynpro for abap forum.
    To give you hint you need to make the column as link to action and set an event handler onclick for the alv or you can search in webdynpro for abap forum
    Thanks
    Bala Duvvuri

  • Please tell me the procedure to the run the interactive alv in the backgrou

    please tell me the procedure to the run  the interactive OO alv in the background?
    Edited by: ramyav on Apr 4, 2008 3:56 PM

    Hi,
    If u want to run the interactive ALV in background how do u trigger At line-selection event?

  • How a interactive report will work as same as ALV report

    I have one assignment.I need to convert an interactive report to ALV report.How can I done this issue.

    HI
    Refer these links...
    double click on alv report 1
    http://sapprograms.blogspot.com/2008/04/double-click-on-alv-report-1.html
    Alv interactive report  
    Alv interactive report
    Edited by: avinash kodarapu on Dec 1, 2008 5:08 PM

  • OOPS Interactive ALV

    Hi Experts,
    Can any one provide me an Example program for interactive oops alv for displaying to according the Deliveryno i want to display the Salesorder details using likp,lips,kna1,vbap.When i am executing the report according to the delivery no i am displaying the sales order details in interactive oops alv but when i am clicking the other deliveryno it showing the previous interactive details only it is not refreshing.Can any one help me for this solution.
    <Downgraded the urgrency>
    Edited by: Suhas Saha on Sep 11, 2011 6:46 PM

    Hi Venkat,
    Do you need a report like when click on delivery no you need to get the sales order details with respective to the so.
    [Interactive Alv|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907?quicklink=index&overridelayout=true]
    Regards,
    Madhu.

  • About double click event in ALV report

    Hi all,
    I want to program a double-click event in ALV reprot.
    I am not suppose to use module pool approach for the same.
    If a user double clicks on the any of the row of ALV report, the transaction should get called.
    Again, I am using function 'REUSE_ALV_GRID_DISPLAY' for displaying ALV.
    Can you please help me to solve this?
    Thanks,
    -Siddhi

    Hi Sidhi,
    You can do it easily by using Reuse_ALV_GRID_DISPALY.
    The User Command subroutine which you pass to this function module in that you can check which field is selected and what is the value of that and also you can get the table index.
    I am giving you a code example where interactivity of ALV report is done .
    *& Report  ZRAIL_LOT_REPORT
    REPORT  zrail_lot_report.
    TABLES :qals,aufk.
    TYPE-POOLS:slis.
    TYPES:BEGIN OF x_lot,
          sel(1)   TYPE c,                    "SELECTION
          prueflos TYPE qals-prueflos,        "INSPECTION LOT NUMBER
          werk     TYPE qals-werk,            "PLANT
          losmenge TYPE qals-losmenge,        "LOT QUANTITY
          mengeneinh TYPE qals-mengeneinh,   "BASE UNIT OF MEASURE FOR THE INSPECTION LOT QUANTITY
          matnr   TYPE  qals-matnr,          " MATERIAL NO. ATTACHED TO ORDER
          zzequnr  TYPE qals-zzequnr,         "EQUIPMENT NO.
          zzassembly TYPE qals-zzassembly,    "ASSEMBLY
          herkunft  TYPE qals-herkunft,       "INSPECTION LOT ORIGIN
          aufnr     TYPE qals-aufnr,          "ORDER NO.
          sttxt     TYPE qals_d02-sttxt,      "LOT STATUS
          objnr     TYPE qals-objnr,          "OBJECT NUMBER
          enstehdat TYPE qals-enstehdat,      "lot creation date
          pruefer   TYPE qamr-pruefer,        "Name of the Inspector
          END OF x_lot.
    TYPES:BEGIN OF x_ordmat,
          aufnr TYPE aufk-aufnr,             "Order No.
          equnr TYPE afih-equnr,             "Equipment No. attached to Order
          zmatnr TYPE aufk-zmatnr,           "Material No. attached to Order
          bautl  TYPE afih-bautl,            "Assembly attached to Order
          END OF x_ordmat.
    TYPES:BEGIN OF x_status,
          objnr TYPE jest-objnr,
          stat  TYPE jest-stat,
          txt04 TYPE tj02t-txt04,
          END OF x_status.
    DATA:it_qals TYPE STANDARD TABLE OF x_lot,
         wa_qals TYPE x_lot.
    DATA:it_ordmat TYPE TABLE OF x_ordmat,
         wa_ordmat TYPE x_ordmat.
    DATA:it_status TYPE STANDARD TABLE OF x_status,
         wa_status TYPE x_status.
    DATA:mytabix TYPE sy-tabix.
    DATA: wa_layout   TYPE slis_layout_alv,
          wa_fieldcat TYPE slis_fieldcat_alv,
          it_fieldcat TYPE TABLE OF slis_fieldcat_alv,
          it_fcat TYPE TABLE OF slis_fieldcat_alv.
    DATA:mytabix1 TYPE sy-tabix.
    SELECTION-SCREEN BEGIN OF BLOCK  b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_werks FOR qals-werk,
                    s_zmatnr FOR aufk-zmatnr,
                    s_assbly FOR qals-zzassembly,
                    s_equnr FOR qals-zzequnr,
                    s_lotor FOR qals-herkunft,
                    s_lotdat FOR qals-enstehdat.
    SELECTION-SCREEN END OF BLOCK b1.
    INITIALIZATION.
      s_lotdat-low = sy-datum - 7.
      s_lotdat-high = sy-datum.
      APPEND s_lotdat.
    START-OF-SELECTION.
      PERFORM get_data_qals.
      PERFORM build_fieldcat.
      PERFORM display_data.
      EXIT.
    END-OF-SELECTION.
    *&      Form  get_data_qals
          text
    -->  p1        text
    <--  p2        text
    FORM get_data_qals .
      IF it_qals[] IS INITIAL.
        SELECT a~prueflos
               a~werk
               a~losmenge
               a~mengeneinh
               a~zzequnr
               a~zzassembly
               a~herkunft
               a~aufnr
               a~objnr
               a~matnr
               a~enstehdat
               b~pruefer
               FROM qals AS a INNER JOIN qamr AS b
               ON aprueflos = bprueflos
               INTO CORRESPONDING FIELDS OF TABLE it_qals
               WHERE werk IN s_werks
               AND   zzassembly IN s_assbly
               AND   zzequnr    IN s_equnr
               AND   herkunft   IN s_lotor
               AND   enstehdat  IN s_lotdat.
      ENDIF.
      IF it_ordmat[] IS INITIAL.
        SELECT a~aufnr
               a~zmatnr
               b~bautl
               b~equnr
               FROM aufk AS a INNER JOIN afih AS b
               ON aaufnr = baufnr
               INTO CORRESPONDING FIELDS OF TABLE it_ordmat FOR ALL ENTRIES IN it_qals
               WHERE a~aufnr = it_qals-aufnr
                AND zmatnr IN s_zmatnr.
      ENDIF.
      IF it_status[] IS INITIAL.
        SELECT a~objnr
               a~stat
               b~txt04
               FROM  tj02t AS b
               INNER JOIN jest AS a ON bistat = astat
               INTO CORRESPONDING FIELDS OF TABLE it_status FOR ALL ENTRIES IN it_qals
               WHERE a~objnr = it_qals-objnr
               AND   b~spras = sy-langu
               AND   a~inact = space.
      ENDIF.
      LOOP AT it_qals INTO wa_qals.
        mytabix = sy-tabix.
        READ TABLE it_ordmat INTO wa_ordmat WITH KEY aufnr = wa_qals-aufnr.
        IF sy-subrc = 0.
          IF wa_qals-herkunft = '14'.
            wa_qals-matnr = wa_ordmat-zmatnr.
            wa_qals-zzequnr =  wa_ordmat-equnr.
            wa_qals-zzassembly = wa_ordmat-bautl.
            MODIFY it_qals FROM wa_qals INDEX  mytabix TRANSPORTING matnr zzassembly zzequnr.
          ENDIF.
        ENDIF.
        LOOP AT it_status INTO wa_status WHERE objnr = wa_qals-objnr.
          CONCATENATE wa_qals-sttxt wa_status-txt04 INTO wa_qals-sttxt SEPARATED BY space.
          CLEAR :wa_status.
        ENDLOOP.
        MODIFY it_qals FROM wa_qals INDEX  mytabix TRANSPORTING sttxt.
        CLEAR :wa_qals,wa_ordmat,mytabix.
      ENDLOOP.
      IF s_zmatnr[] IS NOT INITIAL.
        DELETE it_qals WHERE matnr IS INITIAL.
      ENDIF.
    ENDFORM.                    " get_data_qals
    *&      Form  build_fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM build_fieldcat .
      wa_layout-zebra = 'X'.
      wa_layout-colwidth_optimize = 'X'.
      wa_layout-box_fieldname = 'SEL'.
      wa_layout-box_tabname = 'IT_QALS'.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
        I_PROGRAM_NAME               =
          i_internal_tabname           = 'IT_QALS'
          i_structure_name             = 'QALS_D02'
        I_CLIENT_NEVER_DISPLAY       = 'X'
        I_INCLNAME                   =
        I_BYPASSING_BUFFER           =
        I_BUFFER_ACTIVE              =
        CHANGING
          ct_fieldcat                  = it_fieldcat
      IF sy-subrc = 0.
        LOOP AT  it_fieldcat INTO wa_fieldcat.
          CASE  wa_fieldcat-fieldname .
            WHEN  'PRUEFLOS'.
              wa_fieldcat-col_pos = 1.
              wa_fieldcat-hotspot = 'X'.
              APPEND wa_fieldcat TO it_fcat.
            WHEN   'WERK'.
              wa_fieldcat-col_pos = 3.
              APPEND wa_fieldcat TO it_fcat.
            WHEN  'LOSMENGE'.
              wa_fieldcat-col_pos = 4.
              wa_fieldcat-no_out = ''.
              APPEND wa_fieldcat TO it_fcat.
            WHEN  'MENGENEINH'.
              wa_fieldcat-col_pos = 5.
              wa_fieldcat-no_out = ''.
              APPEND wa_fieldcat TO it_fcat.
            WHEN 'ZZEQUNR'.
              wa_fieldcat-col_pos = 6.
              wa_fieldcat-no_out = ''.
              wa_fieldcat-hotspot = 'X'.
              APPEND wa_fieldcat TO it_fcat.
            WHEN  'ZZASSEMBLY'.
              wa_fieldcat-col_pos = 7.
              wa_fieldcat-no_out = ''.
              wa_fieldcat-hotspot = 'X'.
              APPEND wa_fieldcat TO it_fcat.
            WHEN  'HERKUNFT'.
              wa_fieldcat-col_pos = 8.
              APPEND wa_fieldcat TO it_fcat.
            WHEN  'AUFNR'.
              wa_fieldcat-col_pos = 9.
              wa_fieldcat-hotspot = 'X'.
              APPEND wa_fieldcat TO it_fcat.
            WHEN  'ENSTEHDAT'."enstehdat
              wa_fieldcat-col_pos = 10.
              APPEND wa_fieldcat TO it_fcat.
            WHEN  'STTXT'.
              wa_fieldcat-col_pos = 12.
              wa_fieldcat-hotspot = 'X'.
              APPEND wa_fieldcat TO it_fcat.
            WHEN OTHERS.
          ENDCASE.
          CLEAR wa_fieldcat.
        ENDLOOP.
        wa_fieldcat-fieldname = 'MATNR'.
        wa_fieldcat-tabname  =  'IT_QALS'.
        wa_fieldcat-col_pos = 2.
        wa_fieldcat-ref_tabname = 'AUFK'.
        wa_fieldcat-hotspot = 'X'.
        wa_fieldcat-seltext_l = 'Material No.'.
        APPEND wa_fieldcat TO it_fcat.
        wa_fieldcat-fieldname = 'PRUEFER'.
        wa_fieldcat-tabname  =  'IT_QALS'.
        wa_fieldcat-col_pos = 11.
        wa_fieldcat-ref_tabname = 'QAMR'.
        wa_fieldcat-seltext_l = 'Name of the Inspector'.
        APPEND wa_fieldcat TO it_fcat.
      ENDIF.
    ENDFORM.                    " build_fieldcat
    *&      Form  display_data
          text
    -->  p1        text
    <--  p2        text
    FORM display_data .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
       i_callback_program                = 'ZRAIL_LOT_REPORT'
      I_CALLBACK_PF_STATUS_SET          = ' '
         i_callback_user_command           = 'USER_COMMAND'
         is_layout                         = wa_layout
          it_fieldcat                       = it_fcat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
        TABLES
          t_outtab                          = it_qals
    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  USER_COMMAND
          text
         -->R_UCOMM      text
         -->RS_SELFIELD  text
    FORM user_command USING r_ucomm TYPE sy-ucomm  rs_selfield TYPE slis_selfield.
      CASE rs_selfield-fieldname  .
        WHEN 'PRUEFLOS'.
          SET PARAMETER ID 'QLS' FIELD rs_selfield-value.
          CALL TRANSACTION 'QA03' AND SKIP FIRST SCREEN.
        WHEN 'ZZEQUNR'.
          SET PARAMETER ID 'EQN' FIELD  rs_selfield-value.
          CALL TRANSACTION 'IE03' AND SKIP FIRST SCREEN.
        WHEN 'ZMATNR'.
          SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
          CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
        WHEN 'ZZASSEMBLY'.
          SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
          CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
        WHEN 'AUFNR'.
          SET PARAMETER ID 'ANR' FIELD rs_selfield-value.
          CALL TRANSACTION 'IW33' AND SKIP FIRST SCREEN.
        WHEN 'STTXT'.
          MOVE rs_selfield-tabindex TO mytabix1.
          PERFORM show_status.
      ENDCASE.
    ENDFORM.                    "USER_COMMAND
    *&      Form  show_status
          text
    -->  p1        text
    <--  p2        text
    FORM show_status .
      DATA:it_systat TYPE TABLE OF bapi2045ss,
           wa_sysstat TYPE bapi2045ss,
           it_bapi2045us TYPE TABLE OF bapi2045us.
      DATA:it_fsys TYPE TABLE OF slis_fieldcat_alv.
      DATA:insplot TYPE bapi2045d_il0-insplot.
      DATA:language TYPE bapi2045la.
      CLEAR wa_qals.
      READ TABLE it_qals INTO wa_qals INDEX mytabix1.
      insplot = wa_qals-prueflos.
      language-langu = sy-langu.
      CALL FUNCTION 'BAPI_INSPLOT_GETSTATUS'
        EXPORTING
          number        = insplot
          language      = language
        TABLES
          system_status = it_systat
          user_status   = it_bapi2045us.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name     = 'ZRAIL_LOT_REPORT'
          i_internal_tabname = 'IT_SYSTAT'
          i_structure_name   = 'BAPI2045SS'
        CHANGING
          ct_fieldcat        = it_fsys.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = 'ZRAIL_LOT_REPORT'
          it_fieldcat        = it_fsys
        TABLES
          t_outtab           = it_systat.
    ENDFORM.                    " show_status
    IIn the subrouitne the User command the Parameter rs_selfield will give you the selected or clicked field and its value its record no .
    I hope this will help you.

  • How can I select 2 options in Interactive reports

    Hi Friends
    I have a doubt about Interactive reports/ ALV interactive reports. Is there any option to select multiple selections in interactive reports. If I am displaying in a screen CustNo, Name, Country.
    I want to see order details of that customer in another screen using AT Line-Selection. Can I select multiple customer nos at a time and also can I see those order details whom I selected over in first list.
    Please send me reply ASAP if there is any option with suitable example.
    Thanks
    Praveen.

    Check out this sample.  It uses two ALV grids.  On the first one you can do multiple selection, hit the continue buttons and it will throw another ALV with those material/plant records.  Implement the following program.  Create screen 100 and 200.  One each screen create a custom container called ALV_CONTAINER(screen 100) and ALV_CONTAINER2(screen 200).  Create the gui status for both.  Don't forget to create a "CONTINUE" button on the gui-status 100.
    report zrich_0006.
    tables: mara.
    type-pools: slis, icon.
    * Internal Tables
    data: begin of ialv occurs 0,
          matnr type mara-matnr,
          maktx type makt-maktx,
          end of ialv .
    data: begin of ialv2 occurs 0,
          matnr type mara-matnr,
          werks type marc-werks,
          end of ialv2.
    * Miscellanous Variables
    data: index_rows type lvc_t_row,
          index like line of index_rows.
    data: alv_container type ref to cl_gui_custom_container,
          alv_container2 type ref to cl_gui_custom_container,
          alv_grid type ref to cl_gui_alv_grid,
          alv_grid2 type ref to cl_gui_alv_grid,
          row_table type lvc_t_row with header line,
          ok_code like sy-ucomm,
          layout  type lvc_s_layo,
          fieldcat type lvc_t_fcat,
          fieldcat2 type lvc_t_fcat.
    select-options: s_matnr for mara-matnr.
    start-of-selection.
      select mara~matnr makt~maktx
                 into corresponding fields of table ialv
                     from mara
                          inner join makt
                             on mara~matnr = makt~matnr
                                    where mara~matnr in s_matnr
                                      and makt~spras = sy-langu.
      sort ialv ascending by matnr.
      call screen 100.
    *      Module  status_0100  OUTPUT
    module status_0100 output.
      set pf-status '0100'.
      set titlebar '0100'.
      data: lt_exclude type ui_functions.
    * Create Controls
      create object alv_container
             exporting container_name = 'ALV_CONTAINER'.
      create object alv_grid
             exporting  i_parent =  alv_container.
    *  Populate Field Catalog
      perform get_fieldcatalog.
    * Optionally restrict generic functions to 'change only'.
    * (The user shall not be able to add new lines).
      perform exclude_tb_functions changing lt_exclude.
    * Set selection mode to "D"  --  Multiple Lines
      layout-sel_mode = 'D'.
      call method alv_grid->set_table_for_first_display
          exporting
               is_layout              = layout
               it_toolbar_excluding   = lt_exclude
               i_structure_name       = 'IALV'
          changing
               it_outtab       = ialv[]
               it_fieldcatalog = fieldcat[].
    endmodule.
    *      Module  USER_COMMAND_0100  INPUT
    module user_command_0100 input.
      case sy-ucomm.
        when 'BACK' or 'CANC'.
          perform free_containers.
          if sy-subrc = 0.
            set screen 0.
            leave screen.
          else.
            leave program.
          endif.
        when 'EXIT'.
          perform free_containers.
          leave program.
        when 'CONTINUE'.
    * Retrieve selected rows from ALV grid
      clear index_rows.  refresh index_rows.
      call method alv_grid->get_selected_rows
               importing
                     et_index_rows = index_rows.
    * Do something with those selected rows here
          loop at index_rows into index.
            read table ialv index index-index.
            if sy-subrc = 0.
              select * appending corresponding fields of table ialv2
                           from marc
                               where matnr = ialv-matnr.
            endif.
          endloop.
          perform free_containers.
          leave to screen 200.
      endcase.
    endmodule.
    *      Form  FREE_CONTAINERS
    form free_containers.
      if not alv_container is initial.
        call method alv_container->free.
        clear: alv_container.
        free : alv_container.
      endif.
      if not alv_container2 is initial.
        call method alv_container2->free.
        clear: alv_container2.
        free : alv_container2.
      endif.
    endform.
    *      Form  Get_Fieldcatalog - Set Up Columns/Headers
    form get_fieldcatalog.
      data: ls_fcat type lvc_s_fcat.
      data: columnno(3) type n value '0'.
      refresh: fieldcat.
      clear: ls_fcat.
      ls_fcat-reptext    = 'Material Number'.
      ls_fcat-coltext    = 'Material Number'.
      ls_fcat-fieldname  = 'MATNR'.
      ls_fcat-ref_table  = 'IALV'.
      ls_fcat-outputlen  = '18'.
      ls_fcat-col_pos    = 1.
      append ls_fcat to fieldcat.
      clear: ls_fcat.
      ls_fcat-reptext    = 'Material Description'.
      ls_fcat-coltext    = 'Material Description'.
      ls_fcat-fieldname  = 'MATKX'.
      ls_fcat-ref_table  = 'IALV'.
      ls_fcat-outputlen  = '40'.
      ls_fcat-col_pos    = 2.
      append ls_fcat to fieldcat.
    endform.
    *      Form  Get_Fieldcatalog2 - Set Up Columns/Headers
    form get_fieldcatalog2.
      data: ls_fcat type lvc_s_fcat.
      data: columnno(3) type n value '0'.
      refresh: fieldcat2.
      clear: ls_fcat.
      ls_fcat-reptext    = 'Material Number'.
      ls_fcat-coltext    = 'Material Number'.
      ls_fcat-fieldname  = 'MATNR'.
      ls_fcat-ref_table  = 'IALV2'.
      ls_fcat-outputlen  = '18'.
      ls_fcat-col_pos    = 1.
      append ls_fcat to fieldcat2.
      clear: ls_fcat.
      ls_fcat-reptext    = 'Plant'.
      ls_fcat-coltext    = 'Plant'.
      ls_fcat-fieldname  = 'WERKS'.
      ls_fcat-ref_table  = 'IALV2'.
      ls_fcat-outputlen  = '4'.
      ls_fcat-col_pos    = 2.
      append ls_fcat to fieldcat2.
    endform.
    *      Form  EXCLUDE_TB_FUNCTIONS
    form exclude_tb_functions changing pt_exclude type ui_functions.
    * Only allow to change data not to create new entries (exclude
    * generic functions).
      data ls_exclude type ui_func.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
      append ls_exclude to pt_exclude.
    endform.
    *      Module  status_0200  OUTPUT
    module status_0200 output.
      set pf-status '0200'.
      set titlebar '0200'.
    * Create Controls
      create object alv_container2
             exporting container_name = 'ALV_CONTAINER2'.
      create object alv_grid2
             exporting  i_parent =  alv_container2.
    *  Populate Field Catalog
      perform get_fieldcatalog2.
      call method alv_grid2->set_table_for_first_display
          changing
               it_outtab       = ialv2[]
               it_fieldcatalog = fieldcat2[].
    endmodule.
    *      Module  USER_COMMAND_0200  INPUT
    module user_command_0200 input.
      case sy-ucomm.
        when 'BACK' or 'CANC'.
          perform free_containers.
          if sy-subrc = 0.
            set screen 0.
            leave screen.
          else.
            leave program.
          endif.
        when 'EXIT'.
          perform free_containers.
          leave program.
      endcase.
    endmodule.
    Regards,
    Rich Heilman

  • ALV Edit Field...

    Hi all,
    I have this problem...
    I'd built a interactive OO ALV where users can edit the line items.
    However, there is this field, EMAIL, during edit, users won't be able add in text to it...
    I have make the EMAIL long enough, as long as 225 characters...
    but strange once you update it... and go in to edit it again... it won't let me put in text more... it will only let you type as far as previous data...
    Why can't i enter data until 225 chars max for that particular field EMAIL in my OO ALV...
    p/s : I have put my FIELDCAT-OUTPUTLEN = '225' ... still i couldn't add more text to that field EMAIL...
    Please let me know if there have been previous solution given in SCN...
    Thanks,
    William Wilstroth
    Edited by: william wilstroth on Sep 8, 2008 6:53 PM

    Hi William,
    goto saptechinal website there in tutorial you will find multilple sample programs over there
    Regards,
    Chinna

Maybe you are looking for

  • How do you change a php file to pdf

    how do you change a php doct. to a pdf

  • OBIEE - Use CURRENT_DATE in where condition

    Hello All, I want to use CURRENT_DATE in one column named "Incident Date/System"."Submit Date(GMT)". I just want to extract CURRENT_DATE(06-02-2013) data. I want to use that field like "Incident Date/System"."Submit Date(GMT)" = CURRENT_DATE. But i a

  • How to catch a SOAP fault

    Hi All, I have a ISU to web service, PROXY to SOAP sync interface. I am getting following as response. How can I get this into Fault message mapping? I have followed these blogs: Fault Message Types - A Demo (Part 1) Handling Web Service SOAP Fault R

  • No playlist too small for "this playlist will not fit on one audio CD"

    What on earth is goin' on w/ iTunes ?! ( In my case it's 7.6.2 (9) ) After having a 91.MB playlist receive the "*The songs in this playlist will not fit on one audio CD"* for a 700 MB audio-CD burn, I searched around here and found this thread . . .

  • Payment advice creating residual items within customer tolerance

    There are residual items posting on customer accounts when the document number field is populated in the payment advice.  When the field is left blank, the item posts to the proper expense account for small balance.