Number of currently displayed rows in report with pagination?

Maybe I'm thinking to complicated, but ...
In my report I use the HTMLDB_ITEM.CHECKBOX function in order to display a checkbox for each row:
HTMLDB_ITEM.CHECKBOX(1,"ID",NULL,:P311_ASSIGNED,':') " "
Some of the checkboxes are selected depending on whether there is an entry for them in a database table.
As the report returns hundreds of rows, I use pagination (e.g. 15 rows per page).
After checking/unchecking the checkboxes and submitting the page by clicking the save button, I want to do the following: For each row CURRENTLY DISPLAYED on the screen (1) check, whether its checkbox is currently checked or not (2a) If it is checked and there is not yet an entry -> add row to the db table (2b) If it is unchecked and there is an entry in the db table -> remove row from db table.
How can I, on the server side, find out which rows (row ids) are currently displayed (using pagination), so that I check each of the currently displayed row ids for their existence in the database table? Is there any item stored on the server side, which tells me the row number of the first row currently displayed? Is there an item I can refer to, which tells me the amount of rows, which are displayed on one page?
Your help would be very much appreciated!
Konrad

Hi Konrad,
I will jump in. :-) Just have a few minutes before a meeting.
I think you don't have to make it that complicated, where you have to know the current pagination.
1) Your HTMLDB_ITEM.CHECKBOX has to contain as checked value #ROWNUM# as the row selector would do it.
2) You have to create a hidden item where you store your customer id
3) create another hidden item where you store if the customer has already the assignment
4) In your process you are now able to loop through your arrays.
DECLARE
    vRowNumber BINARY_INTEGER;
    vFound BOOLEAN;
BEGIN
    -- insert new event assignments
    FOR ii IN 1 .. WWV_Flow.g_f01.COUNT -- your checkbox
    LOOP
        vRowNumber := WWV_Flow.g_f01(ii);
        -- no assignment yet?
        IF WWV_Flow.g_f03(vRowNumber) IS NULL -- your hidden field where you store if you have an assmnt
        THEN
            INSERT INTO xxx VALUES (WWV_Flow.g_f02(vRowNumber)); -- your customer id
        END IF;
    END LOOP;
    -- delete old event assignments
    FOR ii IN 1 .. WWV_Flow.g_f03.COUNT -- your hidden field where you store if you have an assmnt
    LOOP
        -- only if the event was already assigned
        IF WWV_Flow.g_f03(ii) IS NOT NULL
        THEN
            vFound := FALSE;
            FOR jj IN 1 .. WWV_Flow.g_f01.COUNT -- your checkbox
            LOOP
                -- is the event still checked?
                IF WWV_Flow.g_f01(jj) = ii
                THEN
                    vFound := TRUE;
                    EXIT;
                END IF;
            END LOOP;
            IF NOT vFound
            THEN
                DELETE xxx WHERE CUSTOMER_ID = WWV_Flow.g_f02(ii);
            END IF;
        END IF;
    END LOOP;
END LOOP;Haven't tested the code, but I think it should show the idea.
Hope that helps
Patrick
Check out my APEX-blog: http://inside-apex.blogspot.com

Similar Messages

  • Empty report with pagination,  rows not displayed

    Dear HTML DB Team,
    We have in our reports the next error: An empty report with pagination appears , no rows not displayed
    The test case to reproduce the error:
    1. Create "SQL report" with next report attributes in "Layout and Pagination"
         a. Row ranges 1-15 16-30 in select list (with pagination)
    b. Number of Rows : 15
    c. Number of Rows (Item): empty
    d. Max Row Count: empty
    2. Fill the table on which the report is based with 17 rows
    3. Go to the 2nd page of the report , pagination rows 16-17 of 17
    4. Remove 2 rows from the table, refresh report
    5, The pagination shows now 1 - 15 of 15 rows
    - no rows displayed
    - no "previous button" ( only )
    - no way to get the rows displayed, except logging out and in again
    Any suggestions?
    Erik

    Hello,
    i encountered the same problem while developing in HTMLDB.
    In application builder, i select application Application 106, then click on items, then click next ( the application has 22 global items). Now i want to take a look at the global items in application 105 (there are only 5). In the menu i click Builder - Application 106, select application 105 from Available Applications, click Go and Items. It shows no rows, but says that is displaying rows 1-5, and offers a Next button. No way to see/modify the items unless make a new session or go back to Application 106, Click Previous to see the first page of global items and then again switch to Appication 105 or click to the next button and then manually set pg_min_row=1 in URL.
    One more question - is this forum the right place to report bug suspicions, or is there some other special place for that?
    Best regards,
    Andres

  • Problem of POP LOV  in a  SQL Report  with pagination

    I am using a pop up lov (along with some other fields), HTMLDB_ITEM.POPUP_FROM_LOV(5, null, 'EMPLOYEE_LIST', '20', '50')), in a sql report. This is a report with pagination. Whenever I select any value from pop up lov on first page of the report it gets populated properly in the corresponding text field. But from second page onwards it doesn’t populate any value.
    For example, my report fetches a total of 50 rows, of which I am displaying 15 at a time. The popup lov comes with a text field for each row. Whenever I do select from popup lov for 1-15 rows which come on page 1, the values come up in the text field properly, but for rows 16-30 on second page, 31-45 on third 46-50 on fourth the values do not get populated. When I changed the pagination settings to display 40 rows..the values were still coming properly on page 1(1-40 rows) and not on the next page. Any clues… how to resolve this problem?

    good find. this is a bug that has already been identified and will be corrected in the upcoming patch release for htmldb. a good work-around for now is to use the equivalent declarative options in the tool. so rather than coding your query like...
    select ename , HTMLDB_ITEM.POPUP_FROM_LOV(2, null, 'DEPARTMENT', '20', '50') as "department" from emp
    ...just code it like this...
    select ename , null as "department" from emp
    ...and then use the column attributes screen for your "department" column to indicate that you'd like that col to be rendered as a "Popup LOV (named LOV)" using your DEPARTMENT list of values.
    hope this helps,
    raj

  • Interactive report with pagination

    Hi,
    i have create an interactive report with pagination .i have follow instraction form
    [http://dbswh.webhop.net/apex/f?p=BLOG:READCAT:0::::CATEGORY:10800346812869]
    i have put JQuary in Page HTML HEADER .
    Now it show me that code in header in my page .No value in my pagination select list.
    How can i solve this problem.
    Thanks

    Hi friends,
    i have sort out that problem,
    i have jus put JQuary code in JavaScript Section.
    Thanks

  • Sql Query(Updateable Report) with pagination

    Hi,
    We're on APEX 3.2 I have a question on Sql Query(Updateable Report) and pagination. I have an updateable report which we have set to show 20 rows. When the userwhi has more than 20 rows enters the data and clicks next the data disappears. I have been reviewing other posts, but haven't come to a clear conclusion on how to prevent this from happening. I have been trying to use javascript to show a save popup when clicking 'Next' Any help is appreciated.
    Thanks,
    Joe

    any ideas?

  • Updateable Report with pagination(APEX 3.2)

    Hi,
    I am working on APEX 3.2 and I have a question on Sql Query(Updateable Report) and pagination. I have an updateable report which we have set to show 100 rows. When the user has more than 100 rows enters the data and clicks next the data disappears. How can i save first 100 records once i click next ?. Any suggestions will be appreciated.
    Thanks,
    Greenhorn

    Here is what I did to get it to work.
    1. Copy xmlparserv2.jar from my ORACLE_HOME/oc4j/lib directory to my glassfish domains/domain1/applications/fop/WEB-INF/lib directory.
    2. Added the following two lines to the glassfish domains/domain1/fop/apex_fop.jsp before the driver.run() line
    out.clear();
    out = pageContext.pushBody();The second part of solution I found on another forum page.

  • Number stored as text (in jsp report with excel output)

    Hi
    I created a jsp report for excel output. I see that the numbers are left aligned with a green traingle on the top of each cell. Was just wondering how can I resolve this and have my numbers displayed as numbers - right aligned and with no green triangle. Is there some setting I have to make explicitly so that numbers appear as numbers in excel output?
    Thx!

    Hi Sasidar,
    In Excel right click the column select format cells and then select  the format as text which is general by default.
    Regards,
    Anil.

  • How to display the alv report blocks wise with out using the blocked alv

    Hi
    How to display the alv report with out using the blocked alv function module.
    Thanks
    Chinnu

    see this Standard Program
    RPR_ABAP_SOURCE_SCAN

  • Udf Data is not being displayed in the report

    Hi all,
    i have designed one report in which i am displaying some udf fields along with other system fields.
    i have not used any selection criteria.
    when i run report it doesn't display udf data of some random rows in the report even if data is peresent in that udf field.
    If i open sales order and press 'Shift-F2'  and update the document and now if i run report then i get that udf value in the report.
    why this happening. data is there in the udf field only its not displayed in the report with out updating the that udf.
    pls suggest some solution.
    regsrds,
    Chetan.

    Hi Ashish,
    I ran the "ZPS/!ZPS" in RSRT where ZPS is the infoset name. In Dev, it displayed the values. In QA, it displayed the below messages:
    ECharacteristic 0TCAKYFNM does not exist. Check authorizations
    WThere are calculated elements. These results are bracketed [  ]
    and below that, it displayed the values for Number of records. But, it has not displayed the values for the other figures.
    Does this has any impact in QA.
    Thanks & Regards,
    AVN Rao.

  • ALV Reporting with drill down capabillities

    I'm creating a abap custom report using the ALV.  I want to drill down to CJ03 which is projects.  I know how to do it in regular custom reporting, but I don't seem to be able to get it to work using the ALV.  Can anyone help?
    Thanks.
    Linda

    Hi Linda,
    Take a look at this sample program. The logic to handle any interaction with the user is in my "PORCESS_USER_COMMANDS" routine.
    This is defined in the "I_CALLBACK_USER_COMMAND" parameter in the ALV FM.
    Hope this helps.
    Cheers,
    Pat.
    [code]
    Modification History
    Date      | Author    | Chg Req #     | Description
    15.08.2001| Pat Yee   | $TMP          | Program Creation
    This program is an example of how the ALV Display works.
    It will display Customer Data.
    This report will also show how to display an ALV report with different
    colored lines and icons
    REPORT zpat.
    Include Programs
    INCLUDE <icon>.
    Database Tables
    TABLES: kna1.                  "Customer Master
    Types
    TYPE-POOLS: kkblo.
    Structures
    Structure to hold the Color Information
    DATA: BEGIN OF st_color,
            color(3) TYPE c,
          END OF st_color.
    Structure to hold the Icon Information
    DATA: BEGIN OF st_icon,
            icon(4) TYPE c,
          END OF st_icon.
    ALV Field Catalog Structure
    DATA: st_fieldcat   TYPE slis_fieldcat_alv.
    ALV Layout Structure
    DATA: st_layout     TYPE slis_layout_alv.
    Internal Tables
    Output Table
    DATA: BEGIN OF tbl_kna1 OCCURS 0.
            INCLUDE STRUCTURE st_icon.   "Icon Structure
            INCLUDE STRUCTURE kna1.      "Customer Master Structure
            INCLUDE STRUCTURE st_color.  "Color Structure
    DATA: END OF tbl_kna1.
    ALV Field Catalog Table
    DATA: tbl_fieldcat  TYPE slis_t_fieldcat_alv.
    Variables
    DATA: fieldname(30) TYPE c,
          g_repid       LIKE sy-repid.
    Start of Selection
    START-OF-SELECTION.
      g_repid = sy-repid.
      PERFORM get_data.
    End of Selection
    END-OF-SELECTION.
      PERFORM do_fancy_stuff.
      PERFORM get_layout.
      PERFORM get_fieldcat.
      PERFORM create_report.
    *&      Form  CREATE_REPORT
          Learn to read the subroutine name!
    FORM create_report.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                i_interface_check       = ' '
                i_callback_program      = g_repid
                i_callback_user_command = 'PROCESS_USER_COMMANDS'
                it_fieldcat             = tbl_fieldcat
                i_default               = 'X'
                i_save                  = ' '
                is_layout               = st_layout
           TABLES
                t_outtab                = tbl_kna1
           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.                               " CREATE_REPORT
    *&      Form  GET_FIELDCAT
          Build the Field Catalog
    FORM get_fieldcat.
    Here the field catalog is created. To display more fields simply
    'uncomment' the additional lines and add the field name. Also note
    that the field catalog is much more powerful than this. You can
    intensify fields, change the colour, assign reference fields, etc.
    Look at type slis_fieldcat_alv for more options.
      PERFORM write_fieldcat USING 'ICON'  'TBL_KNA1' '    ' 'X' 1 '2' 'X'
      PERFORM write_fieldcat USING 'KUNNR' 'TBL_KNA1' 'KNA1' 'X' 2 ' ' ' '
      PERFORM write_fieldcat USING 'NAME1' 'TBL_KNA1' 'KNA1' ' ' 3 '10' ' '
                                   'X'.
      PERFORM write_fieldcat USING 'STRAS' 'TBL_KNA1' 'KNA1' ' ' 4 ' ' ' '
      PERFORM write_fieldcat USING 'TELF1' 'TBL_KNA1' 'KNA1' ' ' 5 ' ' ' '
      PERFORM write_fieldcat USING 'ORT01' 'TBL_KNA1' 'KNA1' ' ' 6 ' ' ' '
      PERFORM write_fieldcat USING 'PSTLZ' 'TBL_KNA1' 'KNA1' ' ' 7 ' ' ' '
      PERFORM write_fieldcat USING 'SORTL' 'TBL_KNA1' 'KNA1' ' ' 8 ' ' ' '
      PERFORM write_fieldcat USING 'ERNAM' 'TBL_KNA1' 'KNA1' ' ' 9 ' ' ' '
      PERFORM write_fieldcat USING 'SPRAS' 'TBL_KNA1' 'KNA1' ' ' 10 ' ' ' '
    perform write_fieldcat using '     ' 'TBL_KNA1' 'KNA1' ' ' 10 ' '.
    perform write_fieldcat using '     ' 'TBL_KNA1' 'KNA1' ' ' 11 ' '.
    perform write_fieldcat using '     ' 'TBL_KNA1' 'KNA1' ' ' 12 ' '.
    ENDFORM.                               " GET_FIELDCAT
    *&      Form  WRITE_FIELDCAT
          Write the Field Catalog data to the Field Catalog Table
         -->name   Field name
         -->tab    Table name
         -->st     Structure Name
         -->key    Is this field a Key?
         -->pos    Position Number
         -->length Field Length
         -->icon   Display as Icon
         -->hot    Hotspot
    FORM write_fieldcat USING name tab st key pos length icon hot.
      st_fieldcat-fieldname   = name.
      st_fieldcat-tabname     = tab.
      st_fieldcat-ref_tabname = st.
      st_fieldcat-key         = key.
      st_fieldcat-col_pos     = pos.
      st_fieldcat-outputlen   = length.
      st_fieldcat-icon        = icon.
      st_fieldcat-hotspot     = hot.
      APPEND st_fieldcat TO tbl_fieldcat.
      CLEAR st_fieldcat.
    ENDFORM.                               " WRITE_FIELDCAT
    *&      Form  PROCESS_USER_COMMANDS
          Interactive Reporting Commands
    FORM process_user_commands USING syst-ucomm LIKE syst-ucomm
                                     selfield TYPE slis_selfield.
    This subroutine is called when there is user interaction in the output
    In this case if the user double clicks the Customer Number then the
    program will call transaction XD03 and display the Customer Master
    Data
      CASE syst-ucomm.
        WHEN '&IC1'.
    get cursor field fieldname.
          READ TABLE tbl_kna1 INDEX selfield-tabindex.
          SET PARAMETER ID 'KUN' FIELD tbl_kna1-kunnr.
          CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
      ENDCASE.
    ENDFORM.                               " PROCESS_USER_COMMANDS
    *&      Form  GET_LAYOUT
      set the layout of the ALV.
      add color to the row?
    FORM get_layout.
      st_layout-info_fieldname    = 'COLOR'.
      st_layout-colwidth_optimize = 'X'.
      st_layout-get_selinfos      = 'X'.
    ENDFORM.                    " GET_LAYOUT
    *&      Form  get_data
          Get some data to play with
    FORM get_data.
      SELECT * FROM kna1 INTO CORRESPONDING FIELDS OF TABLE tbl_kna1
             UP TO 30 ROWS.
    ENDFORM.                    " get_data
    *&      Form  do_fancy_stuff
          Do some fancy pants stuff for example changing the color of
          lines and adding icons
    FORM do_fancy_stuff.
    Here we will demonstrate changing the color of ALV Record lines as
    well as displaying Icons
      LOOP AT tbl_kna1.
    All records where NAME1 begins with 'M', will be displayed in Bluish
    Green
        IF tbl_kna1-name1(1) EQ 'M'.
          tbl_kna1-color = 'C41'.  "Bluish Green
          MODIFY tbl_kna1 TRANSPORTING color.
        ENDIF.
    All records with no TELF1 will be displayed in White and have a
    Warning Icon
        IF tbl_kna1-telf1 IS INITIAL.
          tbl_kna1-color = 'C00'.  "White
          tbl_kna1-icon  = '@AH@'. "Warning Icon
          MODIFY tbl_kna1 TRANSPORTING icon color.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " do_fancy_stuff[/code]

  • GL Account Report with Customer Analysis

    Hi..
    Is there a straight forward way of producing a list by GL Account, which provides the Customer No posted to in the same Document?
    For example
    Doc No 1234567890
    01 Customer 999 £500
    50 GL 12345
    Executing a search on GL 12345 would therefore output with Customer analysis and the Customer 999 will be inlcluded.
    Thanks......

    Hi,
    Go to Customer line item display fbl5n and execute the report
    once executed select change lay out from that select G.L account. it will display
    If it is not sufficient
    same report take document no
    Fb03 enter document number it will display dr and cr with posting keys
    If it is usefull please assign points
    Thanks
      Shiva

  • Displaying a report with 250 000 rows in BI Publisher 11.1.1.6 == very slow

    Hi,
    I try to display a report with 250 000 rows in bi publisher 11.1.1.6.
    Running the SQL Request in TOAD take 20s.
    From bi publisher 11.1.1.6 this operation take more than 2 hour without result.
    The temp file show an xml file which increase (53 M to 70M to 100 M)
    I configure jvm (1.6_029) with the following parameters : Xms512m - Xmx2048 -XX:MaxPermSize=3072m
    My configuration is the following :
    REHL5 64bits
    8G RAM
    100G file system and 50 GB tmp file for bi publisher
    4 CPU
    Jdk Parameters:
    Xms512m -Xmx2048m -XX:MaxPermSize=3072m -XX:UseParallelGC.
    Total CPU usage : 25%
    Live Threads : 85 threads
    Used : 665 Mb
    Commited : 908 Mb
    GC time :
    8.047 s on PS MarkSweep (3 collections)
    8.625 s on PS Scavenge (242 collections)
    Any idea to increase performance or other will be appreciate.
    Thank you
    Mams

    If you are generating a PDF output, select "PDF Compression" option in the properties. Ensure you reduce all the log levels to "Low". Ensure there are no (or minimal) calculations/formulas in the report template.

  • Current Header Rows Not Appearing on FBL1N - A/P Detailed Line Item Report

    Our A/P staff somehow turned off the header rows at the top of the FBL1N report.    The rows contain the various variables related to the report such as vendor name, vendor address, city, state etc.
    Does anyone know how I can change the report so that these variables once again appear on the report?
    Thanks,

    Michael,
    Do you mean that you can not access via the following link?
    http://service.sap.com/notes
    Well, if this is your case, I will copy note 181592  here since there is only text information and not code correction. I am sorry but the format is not good, but I think this note will help you to insert header again.
    If this note does not help you, let me know and I will check the other notes that I have provided.
    Please kindly check the note text below:
    Best Regards,
    Vanessa Barth.
    ==============================================================
    SAP Note No. 181592                          20.01.2009           Page 1
    Number              181592
    Version             6 from 03.03.2000
    Status              Released for Customer
    Set on              02.03.2000
    Language            EN
    Master language     DE
    Short text          Line item: Setting-up the headers
    Responsible         Christian Auth
    Component           FI-GL-GL-D
                         Reporting/Analysis/Display
    Long text
    Symptom
    You want to display information in the headers or change information
    preset in the headers for the following: line item display for vendors,
    G/L accounts customers or customer information on an account.
    Additional key words
    Program RFITEMAP, RFITEMGL, RFITEMAR, Transactions FBL1N, FBL3N, FBL5N,
    layout variants, layout headers
    Cause and prerequisites
    You are not familiar with the option of individually setting header
    information or how to use maintenance transactions.
    Solution
    1.  Overview
         In the line item report you can display information in the header of
         the list (given that this information is equal for all items
         displayed).
         For example, a customer accounts clerk wants to display the
         following data in the header: account number and name of the
         customer, name and telephone number of the responsible accounting
         clerk for the customer, current date.
         You can use information taken from the account master data. General
         variables like the time and date are also available.
         The following describes how you can set up the layout of header
         information yourself. A header layout is always assigned to the
         particular display variant of the list which you set on the bottom
         of the selection screen or which you can choose using CTRL+F9 on the
         display ('Choose' button). You can therefore personalize the header
         layout as well as the remaining display layout.
         The header layout is output if the account number group is changed,
         if the list has been sorted according to the 'Account' field, and if
         a page break has been set for this field. You can maintain these
                                                                       Page 2
            settings under the menu option Edit -> Subtotal (Ctrl+F1).
         2.  Setting up the headers
             Choose from the menu
             Settings -> Display Variant -> Current header rows
             You now see rows in which you can arrange variables. Using the
             pushbuttons in the function bar, you can create or delete rows.
             When you position the cursor at the start position and choose
             function "Gen. variables" (Shift+F5) or "Characteristics..."
             (Shift+F8) a new variable is positioned in the header area. From the
             following dialog box, you can choose the variable (also called
             characteristic) from an inventory.
             Under "Text type", you determine whether the label for the variable
             (for example, the label 'Customer') or if the value itself should be
             used (that is, the appropriate customer number for the items
             displayed in each case). You can display pairs as follows:
             <Label>: <Value>
             for example,
             Customer: 47110815
             If the value is a key for a short or long text (either a name or a
             description), you can also select this under "Text type".
             After selecting and positioning the characteristics, save and return
             to the list. The headers are displayed immediately with correct
             values so that you can check your results right away.
         3.  Save the list variant
             Choose "Save" (Ctrl+F12) in the list. In the following dialog box,
             you can enter a name and a label for the list variant that will be
             stored together with your header layout.
             Note that general variants visible to every user have a name
                                                                           Page 3
           starting with the character '/'. User-specific variants on the other
           hand must begin with a letter and are only visible to you.
           Standard variants delivered by SAP in general start with a number
           and have preconfigured headers. You cannot change the SAP variants,
           but you can use them as template for your own enhancements, which
           you can store under another variant name.
       Valid releases
       Software Component                        Release
                                                 from            to
       SAP_APPL
            SAP Application
                                                 46C          - 46C
                                                 46A          - 46B          X
       Further components
       FI-AP-AP-D
        Reporting/Analysis/Display
       FI-AR-AR-D
        Reporting/Display/Credit Management
       Reference to related Notes
       Number    Short text
       306225    Line item: page break when printing lists
       213144    Line item: Header information disappears
       181697    Line item: Header information is missing

  • ALV report with dynamic columns, and repeated structure rows

    Hey Guys,
    I've done some ALV programming, but most of the reports were straight forward. This one is a little interesting. So here go the questions...
    Q1: Regarding Columns:
    What is the best way to code a report with columns being dynamic. This is one of the parameters the user is going to enter in his input.
    Q2: Regarding Rows:
    I want to repeat a structure(say it contains f1, f2, f3) multiple time in rows. What is the best way to do it? The labels for these fields have to appear in the first column.
    Below is the visual representation of the questions.
    Jan 06  , Feb 06, Mar 06....(dynamic)
       material 1
    Current Stock
    current required
    $Value of stock
       material 2
    Current Stock
    current required
    $Value of stock
       material 3
    Current Stock
    current required
    $Value of stock
    Thanks for your help.
    Sumit.

    Hi Sumit,
    Just check this sample from one of the SAP site
    ABAP Code Sample for Dynamic Table for ALV with Cell Coloring
    Applies To:
    ABAP / ALV Grid
    Article Summary
    ABAP Code Sample that uses dynamic programming techniques to build a dynamic internal table for display in an ALV Grid with Cell Coloring.
    Code Sample
    REPORT zcdf_dynamic_table.
    * Dynamic ALV Grid with Cell Coloring.
    * Build a field catalog dynamically and provide the ability to color
    * the cells.
    * To test, copy this code to any program name and create screen 100
    * as described in the comments. After the screen is displayed, hit
    * enter to exit the screen.
    * Tested in 4.6C and 6.20
    * Charles Folwell - [email protected] - Feb 2, 2005
    DATA:
    r_dyn_table TYPE REF TO data,
    r_wa_dyn_table TYPE REF TO data,
    r_dock_ctnr TYPE REF TO cl_gui_docking_container,
    r_alv_grid TYPE REF TO cl_gui_alv_grid,
    t_fieldcat1 TYPE lvc_t_fcat, "with cell color
    t_fieldcat2 TYPE lvc_t_fcat, "without cell color
    wa_fieldcat LIKE LINE OF t_fieldcat1,
    wa_cellcolors TYPE LINE OF lvc_t_scol,
    wa_is_layout TYPE lvc_s_layo.
    FIELD-SYMBOLS:
    <t_dyn_table> TYPE STANDARD TABLE,
    <wa_dyn_table> TYPE ANY,
    <t_cellcolors> TYPE lvc_t_scol,
    <w_field> TYPE ANY.
    START-OF-SELECTION.
    * Build field catalog based on your criteria.
    wa_fieldcat-fieldname = 'FIELD1'.
    wa_fieldcat-inttype = 'C'.
    wa_fieldcat-outputlen = '10'.
    wa_fieldcat-coltext = 'My Field 1'.
    wa_fieldcat-seltext = wa_fieldcat-coltext.
    APPEND wa_fieldcat TO t_fieldcat1.
    wa_fieldcat-fieldname = 'FIELD2'.
    wa_fieldcat-inttype = 'C'.
    wa_fieldcat-outputlen = '10'.
    wa_fieldcat-coltext = 'My Field 2'.
    wa_fieldcat-seltext = wa_fieldcat-coltext.
    APPEND wa_fieldcat TO t_fieldcat1.
    * Before adding cell color table, save fieldcatalog to pass
    * to ALV call. The ALV call needs a fieldcatalog without
    * the internal table for cell coloring.
    t_fieldcat2[] = t_fieldcat1[].
    * Add cell color table.
    * CALENDAR_TYPE is a structure in the dictionary with a
    * field called COLTAB of type LVC_T_SCOL. You can use
    * any structure and field that has the type LVC_T_SCOL.
    wa_fieldcat-fieldname = 'T_CELLCOLORS'.
    wa_fieldcat-ref_field = 'COLTAB'.
    wa_fieldcat-ref_table = 'CALENDAR_TYPE'.
    APPEND wa_fieldcat TO t_fieldcat1.
    * Create dynamic table including the internal table
    * for cell coloring.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = t_fieldcat1
    IMPORTING
    ep_table = r_dyn_table
    EXCEPTIONS
    generate_subpool_dir_full = 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.
    * Get access to new table using field symbol.
    ASSIGN r_dyn_table->* TO <t_dyn_table>.
    * Create work area for new table.
    CREATE DATA r_wa_dyn_table LIKE LINE OF <t_dyn_table>.
    * Get access to new work area using field symbol.
    ASSIGN r_wa_dyn_table->* TO <wa_dyn_table>.
    * Get data into table from somewhere. Field names are
    * known at this point because field catalog is already
    * built. Read field names from the field catalog or use
    * COMPONENT <number> in a DO loop to access the fields. A
    * simpler hard coded approach is used here.
    ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'ABC'.
    ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'XYZ'.
    APPEND <wa_dyn_table> TO <t_dyn_table>.
    ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'TUV'.
    ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'DEF'.
    APPEND <wa_dyn_table> TO <t_dyn_table>.
    * Color cells based on your criteria. In this example, a test on
    * FIELD2 is used to decide on color.
    LOOP AT <t_dyn_table> INTO <wa_dyn_table>.
    ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    * Get access to internal table used to color cells.
    ASSIGN COMPONENT 'T_CELLCOLORS'
    OF STRUCTURE <wa_dyn_table> TO <t_cellcolors>.
    CLEAR wa_cellcolors.
    wa_cellcolors-fname = 'FIELD2'.
    IF <w_field> = 'DEF'.
    wa_cellcolors-color-col = '7'.
    ELSE.
    wa_cellcolors-color-col = '5'.
    ENDIF.
    APPEND wa_cellcolors TO <t_cellcolors>.
    MODIFY <t_dyn_table> FROM <wa_dyn_table>.
    ENDLOOP.
    * Display screen. Define screen 100 as empty, with next screen
    * set to 0 and flow logic of:
    * PROCESS BEFORE OUTPUT.
    * MODULE initialization.
    * PROCESS AFTER INPUT.
    CALL SCREEN 100.
    * MODULE initialization OUTPUT
    MODULE initialization OUTPUT.
    * Set up for ALV display.
    IF r_dock_ctnr IS INITIAL.
    CREATE OBJECT r_dock_ctnr
    EXPORTING
    side = cl_gui_docking_container=>dock_at_left
    ratio = '90'.
    CREATE OBJECT r_alv_grid
    EXPORTING i_parent = r_dock_ctnr.
    * Set ALV controls for cell coloring table.
    wa_is_layout-ctab_fname = 'T_CELLCOLORS'.
    * Display.
    CALL METHOD r_alv_grid->set_table_for_first_display
    EXPORTING
    is_layout = wa_is_layout
    CHANGING
    it_outtab = <t_dyn_table>
    it_fieldcatalog = t_fieldcat2.
    ELSE. "grid already prepared
    * Refresh display.
    CALL METHOD r_alv_grid->refresh_table_display
    EXPORTING
    i_soft_refresh = ' '
    EXCEPTIONS
    finished = 1
    OTHERS = 2.
    ENDIF.
    ENDMODULE. " initialization OUTPUT
    Regards
    vijay

  • Creating TREE REPORT with CHECKBOX against each row

    Hi Friends,
    I need to create a <b>TREE REPORT with  CHECK BOX</b> against each row. when the user selects a row and clicks on a custom button then those should get populated into an internal table. <b>This is HIGH priority</b> one and I have tried my best but couldnt find any solution. Please advise me some sol.
    thanks in advance for your valuable time and help.
    Regards
    srithan
    Message edited by me for easyness
            Reddy

    Hi
    Following code is to add checkboxes in ALV tree:
    FORM add_root_request USING pls_data_ TYPE csg_gs_outtab_p_key__l_is_sub_node_ TYPE c
    CHANGING pl_carrid_key._node = nodes->add_node( related_node = p_key
    relationship = cl_gui_column_tree=>relat_last_child ).
    ... §0.2 if information should be displayed at
    the hierarchy column set the carrid as text for this node
    text = p_ls_data-object.
    node->set_text( text ).
    ... §0.3 set the data for the nes node
    node->set_data_row( p_ls_data ).
    item = node->get_hierarchy_item( ).
    item = node->get_item( 'FCHECKBOX' ). "FCHECKBOX is my radio button field in internal table which I am using to populate the ALV
    item->set_type( if_salv_c_item_type=>checkbox ).
    pl_carrid_key = node->get_key( )._
    CATCH cx_salv_msg.
    ENDFORM_._Following code is for handling checbox_change event
    PERFORM application_action_events.
    FORM application_action_events .
    data: lr_events type ref to cl_salv_events_tree.
    *data gr_events type ref to lcl_handle_events.
    lr_events = gr_tree->get_event( ).
    create object gr_events.
    set handler gr_events->check for lr_events.
    set handler gr_events->on_link_click for lr_events.
    set handler gr_events->on_before_user_command for lr_events.
    set handler gr_events->on_after_user_command for lr_events.
    set handler gr_events->on_keypress for lr_events.
    endform. " application_action_events----
    CLASS lcl_handle_events DEFINITION.
    PUBLIC SECTION.
    METHODS:
    check FOR EVENT checkbox_change OF cl_salv_events_tree IMPORTING node_key columnname checked. "Here node_key is the row number
    ENDCLASS. "lcl_handle_events DEFINITION
    CLASS lcl_handle_events IMPLEMENTATION
    §4.2 implement the events for handling the events of cl_salv_table
    CLASS lcl_handle_events IMPLEMENTATION_._
    METHOD check_._
    WRITE 'hello'_._
    DATA lwa_modify_check_ TYPE REF TO csg_gs_outtab.
    node_key = node_key - 1_._
    READ TABLE csg_gt_list INDEX node_key REFERENCE INTO lwa_modify_check._
    if columnname = 'FCHECKBOX'_._
    IF checked = 'X'_._
    If the value in internal table is set to X, then it is deselct
    lwa_modify_check->fcheckbox =_ ' '_._
    ELSE_._
    lwa_modify_check->fcheckbox =_ 'X'_._
    ENDIF_._
    ENDIF_._
    if columnname = 'CHECKBOX_READ'_._
    IF checked = 'X'_._
    If the value in internal table is set to X, then it is deselct
    lwa_modify_check->checkbox_read =_ ' '_._
    ELSE_._
    lwa_modify_check->checkbox_read =_ 'X'_._
    ENDIF_._
    ENDIF_._
    *MODIFY TABLE csg_gt_list from l_wa_modify_check.
    flag_test = flag_test + 1_._
    ENDMETHOD_._ "check
    ENDCLASS_._ "lcl_handle_events IMPLEMENTATION
    Please give me reward points

Maybe you are looking for

  • Foreign key fields not getting populated in datacontrol palette for EJB app

    Hi, I am quite new to ADF and EJB.I developed a jdeveloper application with JSF and EJB tiers.(I am using jdeveloper 10.1.3.5) For database the default HR database is used.I created the entities for the EMPLOYEES and DEPARTMENTS table. I also created

  • IPod 5G to iPod Touch

    I had a couple of questions regarding upgrading/switching rather from a iPod 5th Gen (30Gb) to the iPod Touch 32Gb. 1) Is there a way to clone my current 30Gb iPod 5G that i could copy the playlists; songs; videos; etc over to the classic? The 5G is

  • IPhone Calendar sync broken

    Since a few weeks I only see one iCloud calendar on my iPhone. I checked: all my devices use the same [email protected] address, and in iCloud.com I can see all my calendars. However on my iPhone 4 running iOS 7.1 I only see one calendar from iCloud. I tri

  • Text in FSV by using alternative COA

    I have created a FSV with alternative account nos. If i run F.01 by giving company code, FSV and by selecting alternative account no., only i am able to get the alternative gl account no. in item text coloumn, i am not getting the text alongwith no.

  • IPad mini touchscreen not as responsive...

    Hi, I have purchased my iPad mini last Friday and been using it since. I noticed when I am watching video and trying to adjust the volume on the screen, it's not as responsive as I experienced on my iphone. I have to try so many times for sensing my