How to add a checkbox to dynamic itab  so that i can select some records

How to add a checkbox to dynamic itab  so that i can select some records in the alv and can display them in another alv using a button
I have requirement where i have to display the dynamic itab records in an alv ....Some records from this alv output has to be selected through checkbox  provided in the first column .( I will get to know the structure of the itab only at runtime ,so iam using dynamic itab)

Hi,
   I tried and finally i got it , Just try for it.
type-pools : slis.
PARAMETERS : p_tab type dd02l-tabname.
data : ref_tabletype  type REF TO cl_abap_tabledescr,
       ref_rowtype TYPE REF TO cl_abap_structdescr.
field-symbols  : <lt_table>  type   standard TABLE ,
       <fwa> type any,
       <field> type abap_compdescr.
data : lt_fcat type lvc_t_fcat,
       ls_fcat type lvc_s_fcat,
       lt_fldcat type SLIS_T_FIELDCAT_ALV,
       ls_fldcat like line of lt_fldcat.
data : ref_data type REF TO data,
        ref_wa type ref to  data.
ref_rowtype ?= cl_abap_typedescr=>DESCRIBE_BY_name( p_name = p_tab ).
TRY.
CALL METHOD cl_abap_tabledescr=>create
  EXPORTING
    p_line_type  = ref_rowtype
  receiving
    p_result     = ref_tabletype.
CATCH cx_sy_table_creation .
write : / 'Object Not Found'.
ENDTRY.
*creating object.
create data ref_data type handle ref_tabletype.
create data ref_wa type handle ref_rowtype.
*value assignment.
ASSIGN ref_data->* to <lt_table>.
assign ref_wa->* to <fwa>.
loop at ref_rowtype->components ASSIGNING <field>.
  ls_fcat-fieldname = <field>-name.
  ls_fcat-ref_table = p_tab.
  append ls_fcat to lt_fcat.
if lt_fldcat[] is  INITIAL.
    ls_fldcat-fieldname = 'CHECKBOX'.
    ls_fldcat-checkbox = 'X'.
    ls_fldcat-edit = 'X'.
    ls_fldcat-seltext_m = 'Checkbox'.
    append ls_fldcat to lt_fldcat.
  endif.
  clear ls_fldcat.
  ls_fldcat-fieldname = <field>-name.
  ls_fldcat-ref_tabname = p_tab.
  append ls_fldcat to lt_fldcat.
endloop.
loop at lt_fldcat into ls_fldcat.
  if sy-tabix = 1.
    ls_fldcat-checkbox = 'X'.
    ls_fldcat-edit = 'X'.
modify lt_fldcat FROM ls_fldcat
    TRANSPORTING checkbox edit.
endif.
endloop.
CALL METHOD cl_alv_table_create=>create_dynamic_table
  EXPORTING
    it_fieldcatalog           = lt_fcat[]
  IMPORTING
    ep_table                  = ref_data.
assign ref_data->* to <lt_table>.
select * FROM (p_tab) into table <lt_table>.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
   IT_FIELDCAT                       = lt_fldcat[]
  TABLES
    t_outtab                          = <lt_table>.
Thanks & Regards,
Raghunadh .K

Similar Messages

  • How to add new field into dynamic internal table

    Hello Expert.
    how to add new field into dynamic internal table.
    PARAMETERS: P_TABLE(30).    "table name
    DATA: I_TAB TYPE REF TO DATA.
    FIELD-SYMBOLS: <TAB> TYPE standard TABLE.
    *Create dynamic FS
    create DATA I_TAB TYPE TABLE OF (p_table).
      ASSIGN I_TAB->* TO <TAB>.
    SELECT * FROM (p_table) INTO TABLE <TAB>.
       here i want to add one more field into <TAB> at LAST position and my 
       Field name  =  field_stype     and
       Field type    =  'LVC_T_STYL'
    could you please helpme out .

    Hi,
    Please find the code below.You can add the field acc to your requirement.
    Creating Dynamic internal table
    TYPE-POOLS: slis.
    FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE,  u201C Dynamic internal table name
                   <fs_dyntable>,                     u201C Field symbol to create work area
                   <fs_fldval> type any.              u201C Field symbol to assign values 
    PARAMETERS: p_cols(5) TYPE c.                     u201C Input number of columns
    DATA:   t_newtable TYPE REF TO data,
            t_newline  TYPE REF TO data,
            t_fldcat   TYPE slis_t_fldcat_alv,
            t_fldcat   TYPE lvc_t_fcat,
            wa_it_fldcat TYPE lvc_s_fcat,
            wa_colno(2) TYPE n,
            wa_flname(5) TYPE c. 
    Create fields .
      DO p_cols TIMES.
        CLEAR wa_it_fldcat.
        move sy-index to wa_colno.
        concatenate 'COL'
                    wa_colno
               into wa_flname.
        wa_it_fldcat-fieldname = wa_flname.
        wa_it_fldcat-datatype = 'CHAR'.
        wa_it_fldcat-intlen = 10.
        APPEND wa_it_fldcat TO t_fldcat.
      ENDDO. 
    Create dynamic internal table and assign to FS
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = t_fldcat
        IMPORTING
          ep_table        = t_newtable. 
      ASSIGN t_newtable->* TO <t_dyntable>. 
    Create dynamic work area and assign to FS
      CREATE DATA t_newline LIKE LINE OF <t_dyntable>.
      ASSIGN t_newline->* TO <fs_dyntable>.
    Populating Dynamic internal table 
      DATA: fieldname(20) TYPE c.
      DATA: fieldvalue(10) TYPE c.
      DATA: index(3) TYPE c. 
      DO p_cols TIMES. 
        index = sy-index.
        MOVE sy-index TO wa_colno.
        CONCATENATE 'COL'
                    wa_colno
               INTO wa_flname. 
    Set up fieldvalue
        CONCATENATE 'VALUE' index INTO
                    fieldvalue.
        CONDENSE    fieldvalue NO-GAPS. 
        ASSIGN COMPONENT  wa_flname
            OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
        <fs_fldval> =  fieldvalue. 
      ENDDO. 
    Append to the dynamic internal table
      APPEND <fs_dyntable> TO <t_dyntable>.
    Displaying dynamic internal table using Grid. 
    DATA: wa_cat LIKE LINE OF fs_fldcat. 
      DO p_cols TIMES.
        CLEAR wa_cat.
        MOVE sy-index TO wa_colno.
        CONCATENATE 'COL'
                    wa_colno
               INTO wa_flname. 
        wa_cat-fieldname = wa_flname.
        wa_cat-seltext_s = wa_flname.
        wa_cat-outputlen = '10'.
        APPEND wa_cat TO fs_fldcat.
      ENDDO. 
    Call ABAP List Viewer (ALV)
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          it_fieldcat = fs_fldcat
        TABLES
          t_outtab    = <t_dyntable>.

  • How do I add a email to my iMessage so that I can have two emails

    How do I add a email to my iMessage so that I can have two emails

    Settings>Messages>Send & Receive at>You can be reached by iMessages at>Add another email. Add the email address and wait for Apple to verify it. You will have to respond to their email which will be sent to the inbox of the email address that you are adding to messages.
    you can find more information here.
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l

  • An you tell me how to add an advanced action to the TEB so you can check for multiple lines of input

    an you tell me how to add an advanced action to the TEB so you can check for multiple lines of input? How do you add the advanced action?

    Can you elaborate your requirement?
    If you want to have a text wrapped around and enable a scroller for the same, you can achieve it by TEB properties and check the scroll bar option,
    Is this what you are looking to achieve?
    Thanks,
    Anjaneai

  • How to I update to a 7.0 so that I can add the iBook app to my ipad

    How do I update to a 7.0 so that I can add the iBook app to my iPad

    What generation iPad do you have?
    The First generation iPad cannot be updated past iOS 5.1.1
    However you should be able to get the last compatible version of the iBooks App by tapping on the install button.
    You might need to download first to a computer running itunes or a device that can take the newest version before you will get the option for the last compatible version.
    http://www.engadget.com/2013/09/17/apple-ios-last-compatible-version-app-iphone- ipod-ipad/
    http://appleinsider.com/articles/13/09/17/apples-ios-app-store-now-offers-last-c ompatible-versions-of-apps-for-older-devices

  • How do I get back my Tools menu so that I can add Joliprint or some other print utility?

    I would have never upgraded to FF 3.6 had I known what waited for me. However, I now have and need a print utility so that I can print in pdf website articles in which I am interested. How do I get back my bookmark toolbar so that I can add Joliprint to it?

    The Tools menu item is on the Menu bar. See this: <br />
    https://support.mozilla.com/en-US/kb/Menu+bar+is+missing

  • Library filters: can I add to the list of metadata fields that I can search by?

    Is it possible to add to the list of metadata fields that lightroom can search for images by?
    I know about the 'Any searchable ... ' but that does now allow me to search for specific conditions -
    I am using some of the IPTC fields as a way to classify images of mine for various purposes and would like to
    do something like search for images where the iptc source field has a certain value while the instructions
    fields has some other value. I do not think this is possible using the available tools.
    So, I'd like to be able to add these fields to the menu of possible fields in Smart collections
    of the library metadata filter.
    So, am I missing something obvious? Can this be done?
    Cheers,
    Bonny

    Hi Rob,
    Thanks for this plug in - it's really great.
    The fields I'm looking for are part of the IPTC fields, and since I'm entering them in LR, they're not part of the image,
    and I assume not something that exiftool can find in the image. So unfortunately I do not think I can use this plugin
    for the actual purpose I'm intending.
    I'll shed some light on what I'm doing and therefore what I'm looking for:
    I have a collection of images (of people) that I need to match names to.
    I use some IPTC fields (that are otherwise useless for me) to store this data.
    These fields are the "Job Identifier", "Instructions", "Creditline" and "Source" in the IPTC tagset.
    At  some point I then want to look for errors in the data entry, etc and so I need to search for various
    values of those fields for validation purposes mainly.
    I created a tagset using Jeffrey's plugin and it allows me to view and use only the info I'm after, but no searching.
    Your plugin provides more complete functionality (tagset creation as well as the searchability). The only question
    is how do I go about using your plugin to use the fields I'm using?
    Cheers,
    Bonny

  • Hellooo Frndz....:)  i have to use UISplitviewController.and I want to do add UISplitViewController To UINavigationController but problem is that i can't do this...:( :( :(  i use MGSplitViewController Bt I Dont know Perfectly Use Of MGSplitViewController

    Hellooo Frndz....:)
    i have to use UISplitviewController.and I want to do add UISplitViewController To UINavigationController but problem is that i can't do this...:(
    i use MGSplitViewController Bt I Dont know Perfectly Use Of MGSplitViewController...
    so pLz anyone can help me how to add UISpliViewController To UINavigationController ???
    ===> Thnxs...:)

    thanks..K  T
    you can give me any idea for how to Create My Own Interface for Add UISplitViewController to UINavigationController ...Becouse I was used MGSplitView Controller For Add SplitView to NavigationController
    bt i dnt Know how to use MGSplitViewController...when I Added MGSplitViewController To My Application The I can't Use property Of MGSplitViewController ...so,
    PLZ Help Me this is very Important For me...
    Thnks..:

  • I've downloaded the Creative Cloud, once completed the creative cloud window pos up with spinning whell in center then the entire window disapears. How do I get it to remain open so that I can download programs needed.

    I've downloaded the Creative Cloud, once completed the creative cloud window pos up with spinning whell in center then the entire window disapears. How do I get it to remain open so that I can download programs needed

    right click the executable > click 'run as administrator'.

  • I entered the incorrect password for my home wifi network and now I can't change it. How do I clear out the wrong password so that I can enter a correct one?

    I entered the incorrect password for my home wifi network, and now I can't change it. How do I clear out the wrong password so that I can enter a correct one?

    Settings > wi-fi  then tap on the little blue arrow next to the network you want to change. You have to tap on the blue arrow and not on the name.
    Now at the top tap on "forget this network".
    After that, the iPhone will think your home network is a new network and will ask you for the password to connect.

  • I purchased movies through Apple TV at home. I then signed in to my itunes account on my ipad and the movies show up but they are listed as only accessible via icloud. How do I download them to my ipad so that I can view them on an airplane?

    I purchased movies via Apple TV. I want to view them on my ipad. I signed in to itunes and see them on my ipad but they are only accessible via icloud. How do I download them to my ipad to view where there is no WiFi?

    Hi there apearsal,
    Welcome to Apple Support Communities.
    It sounds like you’ve purchased movies with your Apple TV and want to know how to download those movies to your iPad, so that you can watch them later without a Wi-Fi network connection. Take a look at this article, it’ll walk you through the process of downloading purchases:
    Download past purchases - Apple Support
    Ciao,
    -Jason

  • HT201269 My old windows computer crashed and I had to buy another one.  I rescued my itunes file off of the old one and installed it on the new desktop.  How do I get itunes to recognize it so that I can get all my old music (mostly burned CD's) to be rec

    My old windows computer crashed and I had to buy another one.  I rescued my itunes file off of the old one and installed it on the new desktop.  How do I get itunes to recognize it so that I can get all my old music (mostly burned CD's) to be recognized

    Syncing to a "New" Computer or replacing a "crashed" Hard Drive: Apple Support Communities

  • When I set up email for the first time, I had to enter a 4 digit pin. Since then, every time I switch my phone on, I have to enter this pin.   How do I remove or bypass the pin so that I can switch on the Iphone without having to first enter a pin?

    When I set up email for the first time, I had to enter a 4 digit pin. Since then, every time I switch my phone on, I have to enter this pin.   How do I remove or bypass the pin so that I can switch on the Iphone without having to first enter a pin?

    Go to Settings>General>Passcode Lock>tap Turn Passcode Lock Off, enter your "pin".
    Edit:  Are you saying you are getting a prompt for your email pin, or are you talking about the passcode lock that appears when you turn the phone on?

  • How do i save my document on pages so that i can open it on other computers

    How do I sav emy document on pages so that i can open it on other computers?

    Well, that was the short answer, then I rethought your question.
    Will the “other computers,” be Mac, or a mixture of Mac, Windows PC, and possibly Linux?
    What application on the other computers will be accessing the Pages content created on your MacBook Pro?
    Using the File export options I originally mentioned, you could save the files to iCloud. Then on the other computer, you use the web browser to sign into your iCloud account. When you click the iWork icon, the files that you saved from your MBP will be there. You can then right-click on the file you want and a download option exists.

  • How we can select two records in alv report

    how we can select two records in alv report

    Hello,
    You can use the method <b>get_selected_rows</b>.
         CALL METHOD gv_alv->get_selected_rows
            IMPORTING
          ET_INDEX_ROWS =
            et_row_no     = lt_selected_rows.
    READ TABLE lt_selected_rows INTO ls_selected_row INDEX 1 .
    The table <b>lt_selected_rows</b> will contain all the selected rows.
    Regards,
    Beejal
    **reward if this helps

Maybe you are looking for