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

How to Populate Internal table data to Table Control in a Report Program

Dear All,

How to Populate Internal table data to Table Control in a Report Program? It is a pure report program with out any Module pool coding involved, which is just used to display data. Till now it is being displayed in a report. Now the user wants the data to be displayed in a table control. Could someone tell me how to go about with this.

Thanks in Advance,

Joseph Reddy

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 21, 2005 at 02:23 PM

    Hi Joseph,

    Try creating a custom screen, and calling it in your report using the statement CALL SCREEN <xxxx>.

    Sudha

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 21, 2005 at 02:25 PM

    In your report call a screen like call screen 100.

    Go to that screen.

    create table control.

    do the requires loop at itab etc at PBO and PBI of that screen.

    tat's it.

    Regards

    Asit

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 21, 2005 at 02:26 PM

    Hi Joseph,

    Can you be a bit more clear on what exactly you mean by Table control?

    If you are talking about a Grid sort of display, with options to edit the report, then we can use REUSE_ALV_GRID_DISPLAY function module, by passing the internal table to be displayed.

    Thanks,

    Ravi

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 21, 2005 at 02:28 PM

    If you want to use a table control, you will need to create a screen.

    In your report....

    
    start-of-selection.
    
    perform get_data.  " Get all your data here
    call screen 100. " Now present to the user.
    
    
    

    Double click on the "100" in your call screen statement. This will forward navigate you to the screen. If you have not created it yet, it will ask you if you want to create it, say yes. Go into screen painter or layout of the screen. Use the table control wizard to help you along the process. It will write the code for you. Since it is an output only table control, it will be really easy with not a lot of code.

    A better way to present the data to the user would be to give it in a ALV grid. If you want to go that way, it is a lot easier. Here is a sample of the ALV function module. You don't even have to create a screen.

    
    report zrich_0004
           no standard page heading.
    
    type-pools slis.
    
    data: fieldcat type slis_t_fieldcat_alv.
    
    data: begin of imara occurs 0,
          matnr type mara-matnr,
          maktx type makt-maktx,
          end of imara.
    
    * Selection Screen
    selection-screen begin of block b1 with frame title text-001 .
    select-options: s_matnr for imara-matnr .
    selection-screen end of block b1.
    
    start-of-selection.
    
      perform get_data.
      perform write_report.
    
    
    ************************************************************************
    *  Get_Data
    ************************************************************************
    form get_data.
    
      select  mara~matnr makt~maktx
                into corresponding fields of table imara
                  from mara
                   inner join makt
                     on mara~matnr = makt~matnr
                        where mara~matnr in s_matnr
                          and makt~spras = sy-langu.
    
    endform.
    
    ************************************************************************
    *  WRITE_REPORT
    ************************************************************************
    form write_report.
    
      perform build_field_catalog.
    
    * CALL ABAP LIST VIEWER (ALV)
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                it_fieldcat = fieldcat
           tables
                t_outtab    = imara.
    
    endform.
    
    ************************************************************************
    * BUILD_FIELD_CATALOG
    ************************************************************************
    form build_field_catalog.
    
      data: fc_tmp type slis_t_fieldcat_alv with header line.
      clear: fieldcat. refresh: fieldcat.
    
      clear: fc_tmp.
      fc_tmp-reptext_ddic    = 'Material Number'.
      fc_tmp-fieldname  = 'MATNR'.
      fc_tmp-tabname   = 'IMARA'.
      fc_tmp-outputlen  = '18'.
      fc_tmp-col_pos    = 2.
      append fc_tmp to fieldcat.
    
    
      clear: fc_tmp.
      fc_tmp-reptext_ddic    = 'Material'.
      fc_tmp-fieldname  = 'MAKTX'.
      fc_tmp-tabname   = 'IMARA'.
      fc_tmp-outputlen  = '40'.
      fc_tmp-col_pos    = 3.
      append fc_tmp to fieldcat.
    
    endform.
    
    

    Regards,

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.