User Command in Dynamic ALV Display

Hi,
I have an requirement where i'm displaying Dynamic ALV grid by calling the method by passing the field Symbol in  it_outtab parameter:
CALL METHOD cl_gui_alv_grid->set_table_for_first_display
For this i'm creating a custom container in my screen container
CREATE OBJECT cl_gui_custom_container
        EXPORTING container_name = lv_container.
Now in the output every record is having a checkbox in the end.Now if the user check this checkbox n clicks on push button(added in Application toolbar) then this record should be kept and rest all the records should be deleted.
This can be done if an internal table is passed to the method as the field symbol doesnt hold any data after the output is displayed.
Is there any solution where this can be made possible.
Thanks in advance.
Sheetal

try this ..
before displaying ALV , store all the data in the fieldsymbol into another internal table
then display ALV with field symbol
after u click the pushbutton , get the seleted rows into another table using get_selected rows,
now again call CALL METHOD cl_gui_alv_grid->set_table_for_first_display
and give the new selected rows of internal table and refresh the grid

Similar Messages

  • Call user command / PAI from ALV

    Hello,
    Is there a possibility to call a user command from within an ALV method? I want the PAI module of the ALV's screen to run.
    best regards
    Roland

    Hi,
    Yes you can make an ALV interactive which will execute is PAI (USER COMMAND) when user performs any action.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program                = sy_repid       " report id
         i_callback_pf_status_set          = 'PF'           " for PF-STATUS
         i_callback_user_command           = 'COMMAND'      " for User-Command
         is_layout                         = wa_layout      " for layout
         it_fieldcat                       = it_field       " field catalog
       TABLES
         t_outtab                          = it_final      " internal table
       EXCEPTIONS
         program_error                     = 1
         OTHERS                            = 2.
    When you double-click on any cell of alv grid, use this code to fetch the data of the line that you currently clicked, its working:-
    When you double click on the ALV grid line, you will have sy-ucomm = '&IC1'.
    So when you define a i_callback_user_command for the FM reuse_alv_grid_display, and create it as:-
    FORM command USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
      DATA : ok_code TYPE sy-ucomm.
      ok_code = ucomm.
      CASE ok_code.
        WHEN '&IC1'. "for double click on alv grid line
          " your code
      ENDCASE.
    ENDFORM.
    As you have used selfield TYPE slis_selfield, the field selfield will hold all the values.
    To know on which row you have clicked and to retain that line, use code:-
    Suppose you are currently displaying data from internal table itab and corresponding to it you have work area wa.
    read table itab into wa index selfield-tabindex. "index value of line you clicked
    " now you have the contents of line that you double clicked currently
    Now to know the field name that you clicked, use:-
    selfield-fieldname " will fetch you the name of field that you clicked
    Now using the work-area and the name of field that you clicked, you can easily make out the details of the field i.e., field name and field value and you can code as per your requirement.
    Also you can refer this wiki by me on:-
    ALV Grid Display with checkbox to process selected records at runtime
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/alv%252bgrid%252bdisplay%252bwith%252bcheckbox%252bto%252bprocess%252bselected%252brecords%252bat%252bruntime
    To have checkbox with each record in alv and display on those records on next display which were selected by the user on initial grid.
    Hope this helps you.
    Regards,
    Tarun
    Edited by: Tarun Gambhir on Mar 6, 2009 2:48 PM

  • USER COMMAND FOR INTERACTIVE ALV REPORT

    Hi Frens
    I am making an interactive alv report showing a cost center hierarchy. I could scuccessfully capture the first click event in the user command using  '&IC1'. Now i want to capture the second click event for the third hierarchy.
    When i try to do that, the program flow keeps hitting the same user command time n again. I want to put in a different code for the different click events. What is the way to achieve this?
    I searched ....there is nothing like '&IC2'. It does not work.

    hi,
    You can try this for the first click
    READ TABLE IST_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'USER_COMMAND'.
        MODIFY IST_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME = WA_EVENT-NAME.
      ENDIF.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM       = G_REPID
          I_CALLBACK_PF_STATUS_SET = C_PF         "'SET_PF_STATUS'
          I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
          I_CALLBACK_TOP_OF_PAGE   = 'TOP_OF_PAGE'
          I_GRID_TITLE             = G_TITLE
          IS_LAYOUT                = IST_LAYOUT
          IT_FIELDCAT              = IST_FIELDCAT[]
          IT_SORT                  = IST_SORT
          I_SAVE                   = 'A'
          IT_EVENTS                = IST_EVENTS
          IS_PRINT                 = IST_PRNT
        IMPORTING
          E_EXIT_CAUSED_BY_CALLER  = G_EXIT
          ES_EXIT_CAUSED_BY_USER   = IST_EXIT
        TABLES
          T_OUTTAB                 = IST_FINAL "sodtl
        EXCEPTIONS
          PROGRAM_ERROR            = 1
          OTHERS                   = 2.
    FORM USER_COMMAND USING R_UCOMM TYPE SY-UCOMM
      RS_SELFIELD TYPE SLIS_SELFIELD.
    your code....
    ENDFORM.
    for second click
    READ TABLE IST_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND1'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'USER_COMMAND1'.
        MODIFY IST_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME = WA_EVENT-NAME.
      ENDIF.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM       = G_REPID
          I_CALLBACK_PF_STATUS_SET = C_PF "'SET_PF_STATUS'
          I_CALLBACK_USER_COMMAND  = 'USER_COMMAND1'
          I_CALLBACK_TOP_OF_PAGE   = 'TOP_OF_PAGE'
          I_GRID_TITLE             = G_TITLE
          IS_LAYOUT                = IST_LAYOUT
          IT_FIELDCAT              = IST_FIELDCAT[]
          I_SAVE                   = 'A'
        TABLES
          T_OUTTAB                 = IST_FINAL1.
    hope this solves.

  • Reg:user command in oops alv...

    hi all,
           i have creeated an alv report using container, and by calling the method set table for first display.the output is coming,wat i want is,
         i have  placed a hotspot on document number field,if users clicks it,it has to call fb03 transaction code and the corresponding document shoud open...
    i have did this type in ordinary alv report,but how to do this using oops concept,
    plz give me a solution along with coding ore sample
             thx in advance.....
    regards,
    balaji.s

    hi balaji for any thing in alv oops look at this,
    oops_beginers
    http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    ALV Gird Control (BC-SRV-ALE)
    SAP Container
    SAP Control Framework
    or Thread New To OOPs ABAP
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
    General Tutorial for OOPS
    check all the below links
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    Check this cool weblog:
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    these links
    http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
    For funtion module to class
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
    for classes
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
    for methods
    http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
    for inheritance
    http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
    for interfaces
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
    Check these links.
    http://www.henrikfrank.dk/abapuk.html
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
    Go through the below links,
    For Materials:
    1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
    2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    OO ABAP links:
    1) http://www.erpgenie.com/sap/abap/OO/index.htm
    2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    go through these links
    http://www.erpgenie.com/abap/index.htm
    http://sic.fh-lu.de/sic/bic.nsf/(vJobangebote)/EC8AD2AE0349CE92C12572200026FDB8/$File/Intern%20or%20Working%20Student%20as%20ABAB%20OO%20Developer.pdf?Open
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    ABAP_OBJECTS_ENJOY_0 Template for Solutions of ABAP Object Enjoy Course
    ABAP_OBJECTS_ENJOY_1 Model Solution 1: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_2 Model Solution 2: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_3 Model Solution 3: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_4 Model Solution 4: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_5 Model Solution 5: ABAP Objects Enjoy Course
    DEMO_ABAP_OBJECTS Complete Demonstration for ABAP Objects
    DEMO_ABAP_OBJECTS_CONTROLS GUI Controls on Screen
    DEMO_ABAP_OBJECTS_EVENTS Demonstration of Events in ABAP Objects
    DEMO_ABAP_OBJECTS_GENERAL ABAP Objects Demonstration
    DEMO_ABAP_OBJECTS_INTERFACES Demonstration of Interfaces in ABAP Objects
    DEMO_ABAP_OBJECTS_METHODS Demonstration of Methods in ABAP Objects
    DEMO_ABAP_OBJECTS_SPLIT_SCREEN Splitter Control on Screen
    check the below links lot of info and examples r there
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    Check this cool weblog:
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    these links
    http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
    For funtion module to class
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
    for classes
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
    for methods
    http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
    for inheritance
    http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
    for interfaces
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
    For Materials:
    1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
    2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    1) http://www.erpgenie.com/sap/abap/OO/index.htm
    2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    ALVOOPS
    http://www.abap4.it/download/ALV.pdf
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
    http://www.erpgenie.com/abap/controls/alvgrid.htm
    OOPS with ABAP
    https://www.sdn.sap.com/irj/sdn/wiki?path=/pages/viewpage.action&pageid=37566
    /people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap
    http://www.sapgenie.com/abap/OO/
    For understanding COntrol Frameworks in OO ABAP, check this.
    http://www.sapgenie.com/abap/controls/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com.
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    ALVOOPS
    http://www.erpgenie.com/abap/controls/alvgrid.htm
    OOPS with ABAP
    https://www.sdn.sap.com/irj/sdn/wiki?path=/pages/viewpage.action&pageid=37566
    /people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap
    http://www.sapgenie.com/abap/OO/
    For understanding COntrol Frameworks in OO ABAP, check this.
    http://www.sapgenie.com/abap/controls/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com.
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    Regarding  ALV Grid  Control using OOPs concepts
    Regarding  ALV Grid  Control using OOPs concepts
    OOPS – OO ABAP
    http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    DIRLL DOWN AND INTERACTIVE REPORT
    http://www.sap-img.com/abap/difference-between-drilldown-report-and-interactive-report.htm
    PAGE BREAK FOR ALV LIST
    check out this link
    http://www.abap4.it/download/ALV.pdf
    good book on ABAP objects(OOPS)
    http://www.esnips.com/doc/bc475662-82d6-4412-9083-28a7e7f1ce09/Abap-Objects---An-Introduction-To-Programming-Sap-Applications
    How to check Cluster Table Data
    https://forums.sdn.sap.com/click.jspa?searchID=5215473&messageID=3520315
    http://www.sap-img.com/abap/the-different-types-of-sap-tables.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/81/415d363640933fe10000009b38f839/frameset.htm
    Check this cool weblog:
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    these links
    http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
    For funtion module to class
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
    for classes
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
    for methods
    http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
    for inheritance
    http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
    for interfaces
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
    For Materials:
    1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
    2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    1) http://www.erpgenie.com/sap/abap/OO/index.htm
    2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    COLOURING Single Columan
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    Check this thread to get more idea about ALVs.
    Interactive ALV
    Check the following link for ALV Block List
    http://www.sap-basis-abap.com/abap/sample-program-on-block-lists.htm
    Check the following link for ALV Hierarchial
    http://www.sap-img.com/abap/how-to-use-alv-for-hierarchical-lists.htm
    regards,
    venkat.

  • Rows as columns and dynamic alv display

    Hi everyone,
    I need to build a intenal table dynamically as well as dispaly few rows as columns in alv output.
    I have seen posts where internal table has been created dynamicaaly as well seen the posts where rows of the table are displayed as columns but, can we achieve both the functionalities at same time.
    I have table as:
    SO     PO     Date    MAT    QTY  
    1        A       X    Y1      10 
                           K1      15
                           M2      11
    2       B       X1     Y2       5
                           M1      12
    3       C       1x     Z1      15
                           K1       6
                           L1      10
    Now the ouput has to be :
    SO     PO   Date     MAT-Y1    MAT-K1    MAT-Y2   MAT-L1     Mat-Z1    MAT-M1   MAT-M2
    1        A     X      10          15                                               11            
    2        B     X1                         5                             12                
    3        C     1X                  6                10          15                                       
    I will not be knowing the number of materials untill runtime(dynamic) and as well the rows has to be displayed as columns. Is it possible to do that.
    Regards
    Edited by: Madhu Posanipalli on Jun 6, 2011 4:51 PM

    Hi,
    Check below code. It will work definitly.
    *& Report  YTEST_PROG_RP
    REPORT  YTEST_PROG_RP.
    type-POOLs slis.
    TYPES: BEGIN OF ty_tab,
        so TYPE i,
        po TYPE c,
        date(2) TYPE c,
        mat(2) TYPE c,
        qty TYPE i,
    END OF ty_tab.
    DATA: itab TYPE STANDARD TABLE OF ty_tab INITIAL SIZE 0,
          jtab TYPE STANDARD TABLE OF ty_tab INITIAL SIZE 0,
          ktab TYPE STANDARD TABLE OF ty_tab INITIAL SIZE 0,
          wa_tab TYPE ty_tab, wa_j TYPE ty_tab, wa_k TYPE ty_tab.
    FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE,
                   <fs_dyntable>,
                   <fs_fldval> type any.
    *ALV data declarations
    data: fieldcatalog type LVC_T_FCAT, " with header line, "slis_t_fieldcat_alv with header line,
          fieldcatalog1 TYPE LVC_s_FCAT,
          fieldcatalog2 type  slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid,
          gt_events     type slis_t_event,
          gd_prntparams type slis_print_alv.
    DATA t_newtable TYPE REF TO data.
    DATA t_newline  TYPE REF TO data.
    DATA wa_flname TYPE string.
    *Start-of-selection.
    START-OF-SELECTION.
      perform data_retrieval.
      perform build_fieldcatalog.
      perform dynamic_table.
      perform build_layout.
      perform build_events.
      perform build_print_params.
      perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
      DATA: lv_field1 TYPE string, lv_cnt LIKE sy-tabix VALUE 3, itab_lines TYPE i.
      DATA: fieldname(20) TYPE c.
      DATA: fieldvalue(10) TYPE c.
      DATA: index(3) TYPE c.
      DATA: wa_cat LIKE LINE OF fieldcatalog2,
      wa_colno(2) TYPE n,
      wa_flname(5) TYPE c. .
      fieldcatalog1-fieldname   = 'SO'.
    fieldcatalog1-seltext   = 'SO'.
      fieldcatalog1-col_pos     = 1.
      fieldcatalog1-outputlen   = 2.
    fieldcatalog-emphasize   = 'X'.
    fieldcatalog-key         = 'X'.
    fieldcatalog-do_sum      = 'X'.
    fieldcatalog-no_zero     = 'X'.
      append fieldcatalog1 to fieldcatalog.
      clear  fieldcatalog1.
      fieldcatalog1-fieldname   = 'PO'.
    fieldcatalog1-seltext   = 'PO'.
      fieldcatalog1-col_pos     = 2.
      fieldcatalog1-outputlen   = 2.
      append fieldcatalog1 to fieldcatalog.
      clear  fieldcatalog1.
      fieldcatalog1-fieldname   = 'DATE'.
    fieldcatalog1-seltext   = 'Date'.
      fieldcatalog1-col_pos     = 3.
      fieldcatalog1-outputlen   = 2.
      append fieldcatalog1 to fieldcatalog.
      clear  fieldcatalog1.
      LOOP AT itab INTO wa_tab.
        lv_cnt = lv_cnt + 1.
        CONCATENATE 'MAT-' wa_tab-mat into lv_field1.
        TRANSLATE lv_field1 TO UPPER CASE.
        fieldcatalog1-fieldname   = lv_field1.
       fieldcatalog1-seltext   = lv_field1.
        fieldcatalog1-col_pos     = lv_cnt.
        fieldcatalog1-outputlen   = 6.
        append fieldcatalog1 to fieldcatalog.
        clear fieldcatalog1.
        CLEAR: lv_field1, wa_tab.
      ENDLOOP.
      CLEAR lv_cnt.
    Create dynamic internal table and assign to FS
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = fieldcatalog
        IMPORTING
          ep_table        = t_newtable.
      ASSIGN t_newtable->* TO <t_dyntable>.
      CREATE DATA t_newline LIKE LINE OF <t_dyntable>.
      ASSIGN t_newline->* TO <fs_dyntable>.
    DESCRIBE TABLE fieldcatalog LINES itab_lines.
      loop at fieldcatalog INTO fieldcatalog1.
        CLEAR wa_cat.
        wa_cat-fieldname = fieldcatalog1-fieldname.
        wa_cat-seltext_s = fieldcatalog1-fieldname.
        wa_cat-outputlen = fieldcatalog1-outputlen.
        APPEND wa_cat TO fieldcatalog2.
        CLEAR fieldcatalog1.
      ENDLOOP.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    form build_layout.
    gd_layout-no_input          = 'X'.
    gd_layout-colwidth_optimize = 'X'.
    gd_layout-totals_text       = 'Totals'(201).
    gd_layout-totals_only        = 'X'.
    gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
                                            "click(press f2)
    gd_layout-zebra             = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text       = 'helllllo'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
               i_callback_program      = gd_repid
               i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
               i_callback_user_command = 'USER_COMMAND'
               i_grid_title           = outtext
               is_layout               = gd_layout
                it_fieldcat             = fieldcatalog2[]
               it_special_groups       = gd_tabgroup
               it_events               = gt_events
               is_print                = gd_prntparams
               i_save                  = 'X'
               is_variant              = z_template
           tables
                t_outtab                = <t_dyntable>
           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_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
      DATA: lv_index LIKE sy-tabix.
      wa_tab-so = 1.
      wa_tab-po = 'A'.
      wa_tab-date = 'X'.
      wa_tab-mat = 'Y1'.
      wa_tab-qty = 10.
      append wa_tab to itab.
      clear wa_tab.
      wa_tab-mat = 'K1'.
      wa_tab-qty = 15.
      append wa_tab to itab.
      CLEAR wa_tab.
      wa_tab-mat = 'M2'.
      wa_tab-qty = 11.
      append wa_tab to itab.
      CLEAR wa_tab.
      wa_tab-so = 2.
      wa_tab-po = 'B'.
      wa_tab-date = 'X1'.
      wa_tab-mat = 'Y2'.
      wa_tab-qty = 5.
      append wa_tab to itab.
      CLEAR wa_tab.
      wa_tab-mat = 'M1'.
      wa_tab-qty = 12.
      append wa_tab to itab.
      CLEAR wa_tab.
      wa_tab-so = 3.
      wa_tab-po = 'C'.
      wa_tab-date = '1x1'.
      wa_tab-mat = 'Z1'.
      wa_tab-qty = 15.
      append wa_tab to itab.
      CLEAR wa_tab.
    wa_tab-mat = 'K1'.
    wa_tab-qty = 6.
    append wa_tab to itab.
    CLEAR wa_tab.
      wa_tab-mat = 'L1'.
      wa_tab-qty = 10.
      append wa_tab to itab.
      CLEAR wa_tab.
      LOOP AT itab INTO wa_tab.
        if wa_tab-so is NOT INITIAL AND wa_tab-po is NOT INITIAL AND wa_tab-date is NOT INITIAL.
          wa_j-so = wa_tab-so.
          wa_j-po = wa_tab-po.
          wa_j-date = wa_tab-date.
          lv_index = wa_tab-so.
        else.
          READ TABLE itab INTO wa_j WITH KEY so = lv_index.
        ENDIF.
        wa_j-mat = wa_tab-mat.
        wa_j-qty = wa_tab-qty.
        APPEND wa_j to jtab.
        CLEAR: wa_tab, wa_j.
      ENDLOOP.
    endform.                    " DATA_RETRIEVAL
    Form  TOP-OF-PAGE                                                 *
    ALV Report Header                                                 *
    Form top-of-page.
    **ALV Header declarations
    *data: t_header type slis_t_listheader,
         wa_header type slis_listheader,
         t_line like wa_header-info,
         ld_lines type i,
         ld_linesc(10) type c.
    Title
    wa_header-typ  = 'H'.
    wa_header-info = 'EKKO Table Report'.
    append wa_header to t_header.
    clear wa_header.
    Date
    wa_header-typ  = 'S'.
    wa_header-key = 'Date: '.
    CONCATENATE  sy-datum+6(2) '.'
                  sy-datum+4(2) '.'
                  sy-datum(4) INTO wa_header-info.   "todays date
    append wa_header to t_header.
    clear: wa_header.
    Total No. of Records Selected
    describe table it_ekko lines ld_lines.
    ld_linesc = ld_lines.
    concatenate 'Total No. of Records Selected: ' ld_linesc
                       into t_line separated by space.
    wa_header-typ  = 'A'.
    wa_header-info = t_line.
    append wa_header to t_header.
    clear: wa_header, t_line.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
          exporting
               it_list_commentary = t_header.
               i_logo             = 'Z_LOGO'.
    endform.                    "top-of-page
          FORM USER_COMMAND                                          *
          --> R_UCOMM                                                *
          --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    Check function code
    CASE r_ucomm.
       WHEN '&IC1'.
      Check field clicked on within ALVgrid report
       IF rs_selfield-fieldname = 'EBELN'.
        Read data table, using index of row user clicked on
         READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
        Set parameter ID for transaction screen field
         SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
        Sxecute transaction ME23N, and skip initial data entry screen
         CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
       ENDIF.
    ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  BUILD_EVENTS
          Build events table
    form build_events.
    data: ls_event type slis_alv_event.
    call function 'REUSE_ALV_EVENTS_GET'
          exporting
               i_list_type = 0
          importing
               et_events   = gt_events[].
    read table gt_events with key name =  slis_ev_end_of_page
                              into ls_event.
    if sy-subrc = 0.
       move 'END_OF_PAGE' to ls_event-form.
       append ls_event to gt_events.
    endif.
       read table gt_events with key name =  slis_ev_end_of_list
                              into ls_event.
    if sy-subrc = 0.
       move 'END_OF_LIST' to ls_event-form.
       append ls_event to gt_events.
    endif.
    endform.                    " BUILD_EVENTS
    *&      Form  BUILD_PRINT_PARAMS
          Setup print parameters
    form build_print_params.
    gd_prntparams-reserve_lines = '3'.   "Lines reserved for footer
    gd_prntparams-no_coverpage = 'X'.
    endform.                    " BUILD_PRINT_PARAMS
    *&      Form  END_OF_PAGE
    form END_OF_PAGE.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      write: sy-uline(50).
      skip.
      write:/40 'Page:', sy-pagno .
    endform.                    "END_OF_PAGE
    *&      Form  END_OF_LIST
    form END_OF_LIST.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      skip.
      write:/40 'Page:', sy-pagno .
    endform.                    "END_OF_LIST
    *&      Form  dynamic_table
          text
    -->  p1        text
    <--  p2        text
    FORM dynamic_table .
      DATA: lv_s1 TYPE string, lv_s2 TYPE string.
      DATA lv_mat TYPE string.
      DATA: fieldvalue(10) TYPE c.
      ktab[] = jtab[].
      delete ADJACENT DUPLICATES FROM ktab COMPARING so.
      loop at ktab INTO wa_tab.
    Field1
        wa_flname = 'SO'.
        fieldvalue = wa_tab-so.
        CONDENSE    fieldvalue NO-GAPS.
        ASSIGN COMPONENT  wa_flname
            OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
        <fs_fldval> =  fieldvalue.
        CLEAR fieldvalue.
    Field2
        wa_flname = 'PO'.
        fieldvalue = wa_tab-po.
        CONDENSE    fieldvalue NO-GAPS.
        ASSIGN COMPONENT  wa_flname
            OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
        <fs_fldval> =  fieldvalue.
        CLEAR fieldvalue.
    Field3
        wa_flname = 'DATE'.
        fieldvalue = wa_tab-date.
        CONDENSE    fieldvalue NO-GAPS.
        ASSIGN COMPONENT  wa_flname
            OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
        <fs_fldval> =  fieldvalue.
        CLEAR fieldvalue.
        loop at jtab INTO wa_j WHERE so = wa_tab-so.
          CONCATENATE 'MAT-' wa_j-mat INTO lv_mat.
          wa_flname = lv_mat.
          fieldvalue = wa_j-qty.
          CONDENSE    fieldvalue NO-GAPS.
          ASSIGN COMPONENT  wa_flname
              OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
          <fs_fldval> =  fieldvalue.
          CLEAR: wa_j, fieldvalue.
        ENDLOOP.
        APPEND <fs_dyntable> TO <t_dyntable>.
        CLEAR wa_tab.
        FREE <fs_dyntable>.
      ENDLOOP.
    ENDFORM.                    " dynamic_table
    Ram.

  • Dynamic ALV Display

    Hi all,
    I have a program where i need to display split screen ALV.
    One ALV table on the left and one the right.
    In the left ALV i display 10 table names..
    If i click on the table name then the table should be displayed in the right side ALV.
    This i can successfully do it  but if i click on the another table after displaying the one table the new table will not be displayed where as still the first displayed tabled is shown..
    Below is my coding please have a look and let me know the error..
    IF gr_custom_container_02 IS INITIAL.
        CREATE OBJECT gr_custom_container_02
              EXPORTING
                container_name = 'CUSTOM'.
        Split the Container---------------------------------------------------*
        CREATE OBJECT splitter
          EXPORTING
            parent    = gr_custom_container_02
            rows       = 1
            columns    = 2.
        CALL METHOD splitter->get_container
          EXPORTING
            row       = 1
            column    = 1
          RECEIVING
            container = container_1.
    create the ALV Table-------------------------------------------------*
        CREATE OBJECT gr_alv_grid_02
          EXPORTING
            i_parent = container_1.
      create Fieldcatalog--------------------------------------------------*
        PERFORM prepare_fieldcat_02 CHANGING g_t_fieldcat_02.
      To Customize the layout
        PERFORM prepare_layout_02 CHANGING g_s_layout_02.
      Show ALV-------------------------------------------------------------*
        CALL METHOD gr_alv_grid_02->set_table_for_first_display
          EXPORTING
            is_layout       = g_s_layout_02
          CHANGING
            it_fieldcatalog = g_t_fieldcat_02
            it_outtab       = g_t_queuename.
        SET HANDLER event_receiver->handle_hotspot_click FOR gr_alv_grid_02.
      ELSE.
    To refresh the table for displaying.
        CALL METHOD cl_gui_cfw=>flush.
        CALL METHOD gr_alv_grid_02->refresh_table_display
          EXCEPTIONS
            finished = 1
            OTHERS   = 2.
      ENDIF.
        CALL METHOD splitter->get_container
          EXPORTING
            row       = 1
            column    = 2
          RECEIVING
            container = container_2.
    create the ALV Table-------------------------------------------------*
        CREATE OBJECT gr_alv_grid_03
          EXPORTING
            i_parent = container_2.
      Show ALV-------------------------------------------------------------*
        CALL METHOD gr_alv_grid_03->set_table_for_first_display
          EXPORTING
          CHANGING
            it_fieldcatalog      = g_t_fieldcat_03
            it_outtab            = <select_queue_table>.

    Hi,
    You should develop an event handler method where you will catch the click on the left container. There you should evaluate the the data and you should free the ALV grid from the right container and then you should call the method set_table_for_first_display with the data that you want. At the end you should call the static method CL_GUI_CFW=>FLUSH to synchronize the ALV framework.
    With Regards
    George

  • User command is not getting triggered in interactive ALV with LIST display

    Hi experts,
    I have developed an interactive ALV report with LIST display. Here, the issue is, when i double click a record in the primary ALV list, the control must go to the USER COMMAND event which i have written in my report. But the user command event is not getting triggered at all when i double click any record.
    It gives the following information instead.
    "Choose a valid function".
    (My user command name and its respective form name are same.)
    Here is my code..
    START-OF-SELECTION.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program       = sy-repid
          i_structure_name         = p_table
          i_callback_user_command  = 'TST1'
          i_callback_pf_status_set = 'SET_PF_STATUS'
        TABLES
          t_outtab                 = <dyn_table>
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
      ENDIF.
    FORM tst1 USING r_ucomm LIKE sy-ucomm
                    rs_selfield TYPE slis_selfield.
    * Local data declaration
      DATA: li_tab TYPE REF TO data,
            l_line TYPE REF TO data.
    * Local field-symbols
      FIELD-SYMBOLS:<l_tab> TYPE table,
                    <l_wa>  TYPE ANY.
    * Create table
      CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
      ASSIGN li_tab->* TO <l_tab>.
    * Create workarea
      CREATE DATA l_line LIKE LINE OF <l_tab>.
      ASSIGN l_line->* TO <l_wa>.  CASE r_ucomm.
    *   When a record is selected
        WHEN '&IC1'.
    *     Read the selected record
          READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
          rs_selfield-tabindex.      IF sy-subrc = 0.
    *       Store the record in an internal table
            APPEND <dyn_wa> TO <l_tab>.
    *       Fetch the field catalog info
            CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
              EXPORTING
                i_program_name         = 'Z_DEMO_PDF_JG'
                i_structure_name       = p_table
              CHANGING
                ct_fieldcat            = i_fieldcat
              EXCEPTIONS
                inconsistent_interface = 1
                program_error          = 2
                OTHERS                 = 3.
    Please advice what is the msitake i have done here..

    Read the following code:
    pass the  i_callback_user_command = g_user_command to the ALV function module and write the FORM user_command USING ucomm    LIKE sy-ucomm
                            selfield TYPE slis_selfield.
    as shown below.
    thanx
    Data for ALV display
    DATA  : gt_fieldcat TYPE slis_t_fieldcat_alv,
            gt_events           TYPE slis_t_event,
            g_variant LIKE disvariant,
            g_user_command      TYPE slis_formname VALUE 'USER_COMMAND',
            g_status            TYPE slis_formname VALUE 'SET_PF_STATUS',
            gt_list_top_of_page TYPE slis_t_listheader,
            g_repid LIKE sy-repid,
            gf_pos TYPE i
    Data for ALV display
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
               EXPORTING
              i_callback_program      = g_repid
                 i_callback_program      = sy-repid
                 it_fieldcat             = gt_fieldcat[]
           it_events               = gt_events[]
              i_callback_user_command = g_user_command
                 i_save                  = 'A'
                 is_variant              = g_variant
               TABLES
                 t_outtab                = it_print.
    FORM user_command USING ucomm    LIKE sy-ucomm
                            selfield TYPE slis_selfield.
      CASE ucomm.
        WHEN '&IC1'.
          CASE selfield-sel_tab_field.
            WHEN '1-KUNNR'.
              READ TABLE it_print INTO wa_print INDEX selfield-tabindex.
              IF sy-subrc = 0.
                SET PARAMETER ID 'BPA' FIELD wa_print-kunnr.
                CALL TRANSACTION 'BP'.
              ENDIF.
            WHEN '1-MATNR'.
              READ TABLE it_print INTO wa_print INDEX selfield-tabindex.
              IF sy-subrc = 0.
                SET PARAMETER ID 'JP_ISS' FIELD wa_print-matnr.
                CALL TRANSACTION 'JP29' AND SKIP FIRST SCREEN..
               GET PARAMETER ID 'WRK' FIELD wa_zprint-werks.
               SET PARAMETER ID 'VKO' FIELD wa_zprint-vkorg.
               SET PARAMETER ID 'VTW' FIELD wa_zprint-vtweg.
               CALL TRANSACTION 'JP29' AND SKIP FIRST SCREEN.
              ENDIF.
    Endcase.
    Endform.

  • I have a problem with ALV Grid User Command?

    Hi Experts,
    I have a problem with ALV GRID User Command.
    I am calling TCODE IW33 (Order Display) from the ALV output at first time by selecting an order. But, User command is calling IW33 Initial screen with blank value of order. Even I checked in debugging the value what I selected is passing properly, but once that screen (IW33 Initial) displays, value doesn't appear. Then, Manually, I  created another session and gone to TCODE IW33 and displayed an order. After that I came out from that order. Then again run my ALV program and selected another order, now order is displaying, but not what I selected current order instead of displaying previous order what I just displayed manually. If I selected any other order, system will display the same order what I dislayed manually.
    Here is my code.
    FORM user_command_alv  USING u_ucomm TYPE sy-ucomm
                           us_self_field TYPE slis_selfield.
    CASE u_ucomm.
    WHEN '&IC1'.
    READ TABLE it_final INDEX us_self_field-tabindex INTO wa_final.
            WHEN 'ORDER'.
              IF NOT wa_final-order IS INITIAL.
                SET PARAMETER ID 'COK' FIELD wa_final-order.
                CALL TRANSACTION 'IW33' AND SKIP FIRST SCREEN.
              ENDIF.
    endform.
    PARAMETER ID 'COK'  also the standard one.
    Could you please help me out, Where I did wrong?
    If I select any order, that order only should display.
    Thanks in advance.
    Regards,
    Sarayu.
    Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 2:33 PM

    hi,
    Please check it once the Paramater ID is 'ANR' for IW33 order number.
    Hope this may help.
    Regards,
    Sravanthi

  • User command for checkbox in alv grid output

    Hi,
    Does anyone knows the user command for checkbox in alv grid display. My requirement is to have a column for checkbox in alv output. When the user checks the checkbox, a pop-up dialog box will appear. This dialog box was created in screen painter. I can't find the user command for this. Please help.
    Thanks in advance.

    Hi,
    there r two ways for creating checkbox col on the ALV grid.
    1.)  take an extra field in your internal table i.e 
    data:
       checkbox type c.
    loop at internal_table into wa.
    checkbox.
    endloop.
    or
    the fieldcatalog attribute
    2.) wa_fcat-checkbox = 'X'.
    append wa_fcat to t_fcat.
    clear wa_fcat.
    if itab-checkbox = 'X'.
    call screen <dialogbox screen number>.
    endif.
    regards
    ravi

  • At user command in alv's

    how to handle at user commads in alv's?

    Hi Praveen
    Interactive Reports
    As the name suggests, the user can Interact with the report. We can have a drill down into the report data. For example, Column one of the report displays the material numbers, and the user feels that he needs some more specific data about the vendor for that material, he can HIDE that data under those material numbers.
    And when the user clicks the material number, another report (actually sub report/secondary list) which displays the vendor details will be displayed.
    We can have a basic list (number starts from 0) and 20 secondary lists (1 to 21).
    Events associated with Interactive Reports are:
    AT LINE-SELECTION
    AT USER-COMMAND
    AT PF<key>
    TOP-OF-PAGE DURING LINE-SELECTION.
    HIDE statement holds the data to be displayed in the secondary list.
    sy-lisel : contains data of the selected line.
    sy-lsind : contains the level of report (from 0 to 21)
    <u><b>Interactive Report Events:</b></u>
    AT LINE-SELECTION : This Event triggers when we double click a line on the list, when the event is triggered a new sublist is going to be generated. Under this event what ever the statements that are been return will be displayed on newly generated sublist.
    AT PFn: For predefined function keys...
    <u><b>AT USER-COMMAND :</b></u> It provides user functions keys.
    TOP-OF-PAGE DURING LINE-SELECTION :top of page event for secondary list.
    <b>check this sample code</b>
    TYPE-POOLS: slis.                      " ALV Global Types
    DATA :
      gt_user LIKE uinfo OCCURS 0 WITH HEADER LINE. " User info in SM04
    START-OF-SELECTION.
      PERFORM f_read_data.
      PERFORM f_display_data.
    *       Form  F_LIRE_DATA
    FORM f_read_data.
      REFRESH gt_user.
    * Get User's info
      CALL FUNCTION 'THUSRINFO'
           TABLES
                usr_tabl = gt_user.
    * Wait in a task
      PERFORM f_call_rfc_wait.
    ENDFORM.                               " F_READ_DATA
    *      Form  F_DISPLAY_DATA
    FORM f_display_data.
      DEFINE m_sort.
        add 1 to ls_sort-spos.
        ls_sort-fieldname = &1.
        append ls_sort to lt_sort.
      END-OF-DEFINITION.
      DEFINE m_event_exit.
        clear ls_event_exit.
        ls_event_exit-ucomm = &1.
        ls_event_exit-after = 'X'.
        append ls_event_exit to lt_event_exit.
      END-OF-DEFINITION.
      DATA :
        ls_layout     TYPE slis_layout_alv,
        lt_sort       TYPE slis_t_sortinfo_alv,
        ls_sort       TYPE slis_sortinfo_alv,
        lt_event_exit TYPE slis_t_event_exit,
        ls_event_exit TYPE slis_event_exit.
    * Build Sort Table
      m_sort 'ZEIT'.
    * Build Event Exit Table
      m_event_exit '&NTE'.                 " Refresh
      ls_layout-zebra = 'X'.
      ls_layout-colwidth_optimize = 'X'.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                i_callback_program      = sy-cprog
                i_callback_user_command = 'USER_COMMAND'
                is_layout               = ls_layout
                i_structure_name        = 'UINFO'
                it_sort                 = lt_sort
                it_event_exit           = lt_event_exit
           TABLES
                t_outtab                = gt_user.
    ENDFORM.                               " F_DISPLAY_DATA
    *       FORM USER_COMMAND                                             *
    FORM user_command USING i_ucomm     TYPE syucomm
                            is_selfield TYPE slis_selfield.     "#EC CALLED
      CASE i_ucomm.
        WHEN '&NTE'.
          PERFORM f_read_data.
          is_selfield-refresh = 'X'.
          SET USER-COMMAND '&OPT'.         " Optimize columns width
      ENDCASE.
    ENDFORM.                               " USER_COMMAND
    *      Form  F_CALL_RFC_WAIT
    FORM f_call_rfc_wait.
      DATA lv_mssg(80).                                         "#EC NEEDED
    * Wait in a task
      CALL FUNCTION 'RFC_PING_AND_WAIT' STARTING NEW TASK '001'
        PERFORMING f_task_end ON END OF TASK
        EXPORTING
          seconds               = 5        " Refresh time
          busy_waiting          = space
        EXCEPTIONS
          RESOURCE_FAILURE      = 1
          communication_failure = 2  MESSAGE lv_mssg
          system_failure        = 3  MESSAGE lv_mssg
          OTHERS                = 4.
    ENDFORM.                               " F_CALL_RFC_WAIT
    *      Form  F_TASK_END
    FORM f_task_end USING u_taskname.
      DATA lv_mssg(80).                                         "#EC NEEDED
    * Receiving task results
      RECEIVE RESULTS FROM FUNCTION 'RFC_PING_AND_WAIT'
        EXCEPTIONS
          RESOURCE_FAILURE      = 1
          communication_failure = 2  MESSAGE lv_mssg
          system_failure        = 3  MESSAGE lv_mssg
          OTHERS                = 4.
      CHECK sy-subrc EQ 0.
      SET USER-COMMAND '&NTE'.             " Refresh
    ENDFORM.                               " F_TASK_END
    *************** END OF PROGRAM Z_ALV_AUTO_REFRESH *********************
    check this link too
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abap-AddUsercommandfunctionalitytoALVgridreport&
    Reward all helpfull answers
    Regards
    Pavan

  • User command in ALV grid

    Hi
    I am displaying the output of a report in the ALV grid.
    I have used REUSE_ALV_LIST_DISPLAY in my code as follows.
    FORM DISPLAY_ALV_LIST.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
      EXPORTING
      I_CALLBACK_PROGRAM = SYREPID
      IS_LAYOUT = FIELDLAYOUT
      I_CALLBACK_USER_COMMAND  = 'USER-COMMAND'
      IT_FIELDCAT = FIELDCATALOG[]
      I_SAVE = 'X'
      IT_EVENTS = EVENTSTAB[]
      TABLES
      T_OUTTAB = ITAB_1
      EXCEPTIONS
      PROGRAM_ERROR = 1
      OTHERS = 2.
    ENDFORM. " DISPLAY_ALV_LIST
    When I try to call a transaction at the user command with sy-ucomm = &IC1 sys gives a message 'Not valid'.
    FORM USER-COMMAND USING UCOMM LIKE SY-UCOMM
                           SELFIELD TYPE SLIS_SELFIELD.
      READ TABLE ITAB_1 INDEX SELFIELD-TABINDEX.
      CHECK SY-SUBRC = 0.
      CASE UCOMM.
        WHEN '&IC1'.
          CASE SELFIELD-SEL_TAB_FIELD.
            WHEN 'ITAB_1-VBELN'.
              SET PARAMETER ID 'VF' FIELD ITAB_1-VBELN.
              CALL TRANSACTION 'VF03' AND SKIP FIRST SCREEN.
            WHEN 'ITAB_1-MATNR'.
              SET PARAMETER ID 'MAT' FIELD ITAB_1-MATNR.
              CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
          ENDCASE.
      ENDCASE.
    ENDFORM.                    "USER_COMMAND
    Kindly let me know what am I missing in the above code. As this FORM USER-COMMAND is at all called during the user-command.
    Regds
    Priya

    the Code what u are given is WRONG , check this one.
    put like this , it will solve ur probs.
      check r_ucomm = '&IC1'.             "User Double Clicked on Some field
      check not rs_selfield-value is initial.
      case rs_selfield-fieldname.
        when 'AUFNR'.
          if rad4 ne 'X'.
            read table  itab_order index rs_selfield-tabindex.
          else.
            read table  itab_order2 index rs_selfield-tabindex.
            itab_order-aufnr = itab_order2-aufnr.
          endif.
          if sy-subrc eq 0.
            set parameter id 'ANR' field  itab_order-aufnr.
            set parameter id 'VGN' field '10'.
            call transaction 'CO14' and skip first screen.
          endif.                            " IF SY-SUBRC EQ 0
      endcase.
    Regards
    Prabhu
    Message was edited by: Prabhu Peram

  • ALV Grid Problem - User command Back Cancel Exit

    Hi Guys,
                 I was trying to use the ALV grid and my problem is, on the grid display, when i try to hit the back button or exit or cancel, then a blank screen appears and i need to hit either back or other buttons one more time to go back to the selection screen.
                 Is there any thing I am missing here? Please suggest me the solution.
    Thanks in advance,
    Srinivas.

    hi srinivas,
    we have 2 options in this case.
    1) i think ur using EVENTS_GET function module. If u use sometimes we are facing this kind of problem. i think accroding to my knowliege its bug in SAP....
    2) See in debug mode what is the user command for this back button everty time USERCOMMAND FOR BACK BUTTON not 'BACK' .If it ios correct plaese add the code for back button in user command event.
    if u dont want to face that problem remove that events_get fm and write the code manually. i am not sure abt ur code.
    i hope u got the point what i am saying.
    Thanks,
    Maheedhar

  • ALV detail user command?

    Hi,
    sorry, I'm notoriously curious:
    On ALV Grid & List display we use user commands (like double-click) to branch to whatever we like.
    But on the detail screen there is only Find and Enter.
    It would be nice to have the same functions on the detail screen.
    Usually we use the ALV functions, not the Objects.
    Any ideas?
    TIA,
    C.

    Get the OKcode for that detail and handle the sy-ucomm.
    and instead of Standard pop up, give ur own pop up
    and PF-status.
    use this FM to show the popup REUSE_ALV_POPUP_TO_SELECT.
    CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
      EXPORTING
       I_TITLE                       =
       I_SELECTION                   = 'X'
       I_ALLOW_NO_SELECTION          =
       I_ZEBRA                       = ' '
       I_SCREEN_START_COLUMN         = 0
       I_SCREEN_START_LINE           = 0
       I_SCREEN_END_COLUMN           = 0
       I_SCREEN_END_LINE             = 0
       I_CHECKBOX_FIELDNAME          =
       I_LINEMARK_FIELDNAME          =
       I_SCROLL_TO_SEL_LINE          = 'X'
        I_TABNAME                     =
       I_STRUCTURE_NAME              =
       IT_FIELDCAT                   =
       IT_EXCLUDING                  =
       I_CALLBACK_PROGRAM            =
       I_CALLBACK_USER_COMMAND       =
       IS_PRIVATE                    =
    IMPORTING
       ES_SELFIELD                   =
       E_EXIT                        =
      TABLES
        T_OUTTAB                      =
    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.
    what ever pf status you want keep them and excllude rest using it_excluding.
    this will solve ur problem

  • Problem with User Command in alv report

    Hi
    I have developed a ALV grid report with drill down capability to transaction code for user command. I am having a trouble with this.
    CASE ucomm.
        WHEN '&IC1'.
          CLEAR: wa_import.
          IF selfield-fieldname EQ 'ANLN1'.
            READ TABLE t_import INTO wa_import INDEX selfield-tabindex.
            SET PARAMETER ID 'BUK' FIELD wa_import-bukrs.
            SET PARAMETER ID 'ANl' FIELD wa_import-anln1.
            CALL TRANSACTION 'AW01N'.
          ENDIF.
    here my parameter ids are showing the values but when i call the transaction i am not getting the actual asset numbers.
    Can someone help me out this
    Thanks

    Hi,
    add the AND SKIP FIRST SCREEN...addition..
    CALL TRANSACTION 'AW01N' AND SKIP FIRST SCREEN.
    Thanks
    Naren

  • Problem in Data Display in Dynamic ALV Report

    Hi all,
    I am developing a Dynamic ALV report where I want display material batch (zjpack_base-charg) in column and Material (zjpack_base-matnr) & Qty (Zjpack_base-netwr) field row wise.My intention is to show report datewise for a material how many batch developed with there qty.I am sending you the code which i already wrote.Here column is developed batchwise but I am not able to show the qty against each batch.Please see my code and guide me how to display.
    REPORT  zdynamic_test                           .
    *REPORT  ztest_notepad.
    *& Declarations
    *Type-pools
    TYPE-POOLS: slis.
    *TABLES
    TABLES: zjpack_base.
    *Types
    TYPES:
          ty_fcat      TYPE lvc_s_fcat,
          ty_fcatalog  TYPE slis_fieldcat_alv.
    *Work areas
    DATA:
          wa_fcat      TYPE ty_fcat,
          wa_fcatalog  TYPE ty_fcatalog.
    *Internal tables
    DATA:
          it_fcat      TYPE STANDARD TABLE OF ty_fcat,
          it_fcatalog  TYPE STANDARD TABLE OF ty_fcatalog.
    *Type reference
    DATA:
          it_dyn_tab   TYPE REF TO data,
          wa_newline   TYPE REF TO data.
    *INTERNAL TABLE
    DATA: BEGIN OF it_itab OCCURS 0.
            INCLUDE STRUCTURE zjpack_base.
    DATA: END OF it_itab.
    *Filed symbols
    FIELD-SYMBOLS:
          <gt_table>   TYPE STANDARD TABLE,
          <fs_dyntable>,
          <fs_fldval>  TYPE ANY,
          <l_field>    TYPE ANY.
    *Variables
    DATA:
          l_fieldname  TYPE lvc_s_fcat-fieldname,
          l_tabname    TYPE lvc_s_fcat-tabname,
          l_fieldtext  TYPE lvc_s_fcat-seltext,
          l_index      TYPE char2.
    "Selection-screen
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-s11 .
    SELECT-OPTIONS:s_matnr FOR zjpack_base-matnr.
    SELECT-OPTIONS:s_charg FOR zjpack_base-charg.
    SELECT-OPTIONS:s_fdate FOR zjpack_base-fdate .
    SELECTION-SCREEN END OF BLOCK b1.
    PARAMETERS:
             p_colms   TYPE i.
    *& start-of-selection.
    START-OF-SELECTION.
      PERFORM select_data.
      PERFORM build_fieldcat.
      PERFORM create_dynamic_table.
    DO 20 TIMES.
       DO p_colms TIMES.
         l_index = sy-index.
         CONCATENATE 'FIELD' l_index INTO l_fieldname.
         ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
         <l_field> = sy-index.
       ENDDO.
       INSERT <fs_dyntable> INTO TABLE <gt_table>.
    ENDDO.
      LOOP AT it_itab.
        l_index = sy-tabix.
        CONCATENATE 'FIELD' l_index INTO l_fieldname.
        ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
        <l_field> = it_itab-matnr.
        INSERT <fs_dyntable> INTO TABLE <gt_table>.
      ENDLOOP.
      LOOP AT it_fcat INTO wa_fcat.
        PERFORM fieldcatalog1 USING: wa_fcat-fieldname
                                      wa_fcat-tabname
                                      wa_fcat-seltext.
      ENDLOOP.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program = 'ZTEST_NOTEPAD'
          it_fieldcat        = it_fcatalog
        TABLES
          t_outtab           = <gt_table>.
    *&      Form  BUILD_FIELDCAT
    FORM build_fieldcat .
    CLEAR: l_fieldname,
            l_tabname,
            l_fieldtext,
            l_index.
    DO  p_colms TIMES.
       CLEAR l_index.
       l_index = sy-index.
       CONCATENATE 'FIELD' l_index INTO l_fieldname.
       CONCATENATE 'Field' l_index INTO l_fieldtext.
       l_tabname = '<GT_TABLE>'.
       PERFORM fieldcatalog USING: l_fieldname
                                   l_tabname
                                   l_fieldtext.
    ENDDO.
    ENDFORM.                    " BUILD_FIELDCAT
    *&      Form  CREATE_DYNAMIC_TABLE
    FORM create_dynamic_table .
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = it_fcat
        IMPORTING
          ep_table        = it_dyn_tab.
      ASSIGN it_dyn_tab->* TO <gt_table>.
    Create dynamic work area and assign to FS
      CREATE DATA wa_newline LIKE LINE OF <gt_table>.
      ASSIGN wa_newline->* TO <fs_dyntable>.
    ENDFORM.                    " CREATE_DYNAMIC_TABLE
    *&      Form  FIELDCATALOG
    FORM fieldcatalog USING field table f_txt.
      wa_fcat-fieldname = field.
      wa_fcat-tabname   = table.
      wa_fcat-seltext = f_txt.
      APPEND wa_fcat TO it_fcat.
      CLEAR  wa_fcat.
    ENDFORM.                    " FIELDCATALOG
    *&      Form  FIELDCATALOG1
    FORM fieldcatalog1 USING field table f_txt.
      wa_fcatalog-fieldname = field.
      wa_fcatalog-tabname   = table.
      wa_fcatalog-seltext_m = f_txt.
      APPEND wa_fcatalog TO it_fcatalog.
      CLEAR  wa_fcatalog.
    ENDFORM.                    " FIELDCATALOG1
    *&      Form  SELECT_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM select_data .
    DATA: v_srlno TYPE i.
      SELECT matnr charg blqty
      INTO CORRESPONDING FIELDS OF it_itab
      FROM zjpack_base
      WHERE matnr IN s_matnr
      AND   charg IN s_charg
      AND   fdate IN s_fdate.
        COLLECT it_itab.
      ENDSELECT.
    v_srlno.
    LOOP AT it_itab.
       v_srlno = v_srlno + 1.
    ENDLOOP.
      CLEAR: l_fieldname,
              l_tabname,
              l_fieldtext,
              l_index.
    1st Field
    l_index = sy-tabix.
      CONCATENATE 'FIELD' '1' INTO l_fieldname.
      l_fieldtext = 'MATNR'.
      l_tabname = '<GT_TABLE>'.
      PERFORM fieldcatalog USING: l_fieldname
                                  l_tabname
                                  l_fieldtext.
    Other fields
      LOOP AT it_itab.
        CLEAR l_index.
        l_index = sy-tabix + 1.
        CONCATENATE 'FIELD' l_index INTO l_fieldname.
        CONCATENATE 'CHARG-' it_itab-charg INTO l_fieldtext.
        l_tabname = '<GT_TABLE>'.
        PERFORM fieldcatalog USING: l_fieldname
                                    l_tabname
                                    l_fieldtext.
      ENDLOOP.
    Please guide me how my problem will solve.
    Thanks & Regards
    Nirmal

    Hi all, I am developing a Dynamic ALV report where I want display material batch (zjpack_base-charg) in column and Material (zjpack_base-matnr) & Qty (Zjpack_base-netwr) field row wise.My intention is to show report datewise for a material how many batch developed with there qty.I am sending you the code which i already wrote.Here column is developed batchwise but I am not able to show the qty against each batch.Please see my code and guide me how to display.
    *& Report  ZDYNAMIC_TEST                                               *
    REPORT  zdynamic_test                           .
    *REPORT  ztest_notepad.
    *& Declarations
    *Type-pools
    TYPE-POOLS: slis.
    *TABLES
    TABLES: zjpack_base.
    *Types
    TYPES:
          ty_fcat      TYPE lvc_s_fcat,
          ty_fcatalog  TYPE slis_fieldcat_alv.
    *Work areas
    DATA:
          wa_fcat      TYPE ty_fcat,
          wa_fcatalog  TYPE ty_fcatalog.
    *Internal tables
    DATA:
          it_fcat      TYPE STANDARD TABLE OF ty_fcat,
          it_fcatalog  TYPE STANDARD TABLE OF ty_fcatalog.
    *Type reference
    DATA:
          it_dyn_tab   TYPE REF TO data,
          wa_newline   TYPE REF TO data.
    *INTERNAL TABLE
    DATA: BEGIN OF it_itab OCCURS 0.
            INCLUDE STRUCTURE zjpack_base.
    DATA: END OF it_itab.
    *Filed symbols
    FIELD-SYMBOLS:
          <gt_table>   TYPE STANDARD TABLE,
          <fs_dyntable>,
          <fs_fldval>  TYPE ANY,
          <l_field>    TYPE ANY.
    *Variables
    DATA:
          l_fieldname  TYPE lvc_s_fcat-fieldname,
          l_tabname    TYPE lvc_s_fcat-tabname,
          l_fieldtext  TYPE lvc_s_fcat-seltext,
          l_index      TYPE char2.
    "Selection-screen
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-s11 .
    SELECT-OPTIONS:s_matnr FOR zjpack_base-matnr.
    SELECT-OPTIONS:s_charg FOR zjpack_base-charg.
    SELECT-OPTIONS:s_fdate FOR zjpack_base-fdate .
    SELECTION-SCREEN END OF BLOCK b1.
    PARAMETERS:
             p_colms   TYPE i.
    *& start-of-selection.
    START-OF-SELECTION.
      PERFORM select_data.
      PERFORM build_fieldcat.
      PERFORM create_dynamic_table.
    *  DO 20 TIMES.
    *    DO p_colms TIMES.
    *      l_index = sy-index.
    *      CONCATENATE 'FIELD' l_index INTO l_fieldname.
    *      ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
    *      <l_field> = sy-index.
    *    ENDDO.
    *    INSERT <fs_dyntable> INTO TABLE <gt_table>.
    *  ENDDO.
      LOOP AT it_itab.
        l_index = sy-tabix.
        CONCATENATE 'FIELD' l_index INTO l_fieldname.
        ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
        <l_field> = it_itab-matnr.
        INSERT <fs_dyntable> INTO TABLE <gt_table>.
      ENDLOOP.
      LOOP AT it_fcat INTO wa_fcat.
        PERFORM fieldcatalog1 USING: wa_fcat-fieldname
                                      wa_fcat-tabname
                                      wa_fcat-seltext.
      ENDLOOP.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program = 'ZTEST_NOTEPAD'
          it_fieldcat        = it_fcatalog
        TABLES
          t_outtab           = <gt_table>.
    *&      Form  BUILD_FIELDCAT
    FORM build_fieldcat .
    *  CLEAR: l_fieldname,
    *         l_tabname,
    *         l_fieldtext,
    *         l_index.
    *  DO  p_colms TIMES.
    *    CLEAR l_index.
    *    l_index = sy-index.
    *    CONCATENATE 'FIELD' l_index INTO l_fieldname.
    *    CONCATENATE 'Field' l_index INTO l_fieldtext.
    *    l_tabname = '<GT_TABLE>'.
    *    PERFORM fieldcatalog USING: l_fieldname
    *                                l_tabname
    *                                l_fieldtext.
    *  ENDDO.
    ENDFORM.                    " BUILD_FIELDCAT
    *&      Form  CREATE_DYNAMIC_TABLE
    FORM create_dynamic_table .
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = it_fcat
        IMPORTING
          ep_table        = it_dyn_tab.
      ASSIGN it_dyn_tab->* TO <gt_table>.
    * Create dynamic work area and assign to FS
      CREATE DATA wa_newline LIKE LINE OF <gt_table>.
      ASSIGN wa_newline->* TO <fs_dyntable>.
    ENDFORM.                    " CREATE_DYNAMIC_TABLE
    *&      Form  FIELDCATALOG
    FORM fieldcatalog USING field table f_txt.
      wa_fcat-fieldname = field.
      wa_fcat-tabname   = table.
      wa_fcat-seltext = f_txt.
      APPEND wa_fcat TO it_fcat.
      CLEAR  wa_fcat.
    ENDFORM.                    " FIELDCATALOG
    *&      Form  FIELDCATALOG1
    FORM fieldcatalog1 USING field table f_txt.
      wa_fcatalog-fieldname = field.
      wa_fcatalog-tabname   = table.
      wa_fcatalog-seltext_m = f_txt.
      APPEND wa_fcatalog TO it_fcatalog.
      CLEAR  wa_fcatalog.
    ENDFORM.                    " FIELDCATALOG1
    *&      Form  SELECT_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM select_data .
    *  DATA: v_srlno TYPE i.
      SELECT matnr charg blqty
      INTO CORRESPONDING FIELDS OF it_itab
      FROM zjpack_base
      WHERE matnr IN s_matnr
      AND   charg IN s_charg
      AND   fdate IN s_fdate.
        COLLECT it_itab.
      ENDSELECT.
    *  v_srlno.
    *  LOOP AT it_itab.
    *    v_srlno = v_srlno + 1.
    *  ENDLOOP.
      CLEAR: l_fieldname,
              l_tabname,
              l_fieldtext,
              l_index.
    * 1st Field
    *  l_index = sy-tabix.
      CONCATENATE 'FIELD' '1' INTO l_fieldname.
      l_fieldtext = 'MATNR'.
      l_tabname = '<GT_TABLE>'.
      PERFORM fieldcatalog USING: l_fieldname
                                  l_tabname
                                  l_fieldtext.
    * Other fields
      LOOP AT it_itab.
        CLEAR l_index.
        l_index = sy-tabix + 1.
        CONCATENATE 'FIELD' l_index INTO l_fieldname.
        CONCATENATE 'CHARG-' it_itab-charg INTO l_fieldtext.
        l_tabname = '<GT_TABLE>'.
        PERFORM fieldcatalog USING: l_fieldname
                                    l_tabname
                                    l_fieldtext.
      ENDLOOP.
    ENDFORM.                    " SELECT_DATA

Maybe you are looking for

  • HP Officejet Pro 8500 has to be rebooted every time I print

    All of a sudden my Officejet Pro 8500, Windows 7, has stopped printing unless I power off and on.  Then it will print for a while.  If there is not constant printing and i try to print again later It says "Printing" but never prints.  I power off, th

  • Problem of accuracy when sync with mac OS

    When I sync my Curve 8520 with my mac, the time of a meting changes. If for example I write a meeting in my phone between 01:00 to 02:00, it will be marked on my computer between 02:00 to 03:00. Another problem: a meeting that will last one all day d

  • Can't delete a mailbox

    I have one user who tried copying over a bunch of mail folders from their old POP account in Apple Mail that were stored locally. The user copied a bunch of them that were successful, but there were some that used illegal characters such as apostroph

  • ODI HTML Mail error

    Hello All, I am unable to send a mail using ODI send Mail. As an alternative i downloaded the jython script "TRT_Send_Jython_HTML_Email.xml" from the oracle support. When i am trying to execute the above procedure i am getting the following error. or

  • I cannot install Presenter 10 because I get a message "A conflicting or prelease version ... exists on this computer"

    I previously had Presenter 8 installed, then upgraded to Presenter 9. I have uninstalled both. However, I get this message when I try to install Presenter 10: "A conflicting or prerelease version of Adobe Presenter 10 (64 bit) exists on this computer