XL Reporter: Date Range issues

I would like to setup a P&L to get the data from a date range.
At the "Advanced Report Buider", tab "Report Default", I entered the following code into "Complete Selection":
PER( Code >= @PeriodStart Or Code <= @PeriodEnd )
@PeriodStart: parameter point to "Code" of "Financial Period" table
@PeriodEnd: another parameter point to "Code" of "Financial Period" table
Everytime I run the report, it gave me the latest balance instead of the balance within the specified date range.
Please kindly advise.
Thanks in advance,
Vivian

Or is not correct.  It should be And.
Thanks,
Gordon

Similar Messages

  • ACI  - Date Range issue for Sales Details report

    I am working on ACI setup for one of my client. I set everything us as per documentation.
    This is regarding ‘Sales Details’ (Public Folders > ATG > Commerce > Sales > All Sales) report.
    Report is being generated if I select ‘Date Range’ under ‘Time Period’; but if I select ‘Predefined’ I get below errors:
    RQP-DEF-0177
    An error occurred while performing operation 'sqlPrepareWithOptions' status='-9'.
    UDA-SQL-0107 A general exception has occurred during the operation "prepare".ORA-32035: unreferenced query name defined in WITH clause RSV-SRV-0042 Trace back:RSReportService.cpp(758): QFException: CCL_CAUGHT: RSReportService::process()RSReportServiceMethod.cpp(239): QFException: CCL_RETHROW: RSReportServiceMethod::process(): promptPagingForward_RequestRSASyncExecutionThread.cpp(774): QFException: RSASyncExecutionThread::checkExceptionRSASyncExecutionThread.cpp(211): QFException: CCL_CAUGHT: RSASyncExecutionThread::run(): promptPagingForward_RequestRSASyncExecutionThread.cpp(824): QFException: CCL_RETHROW: RSASyncExecutionThread::processCommand(): promptPagingForward_RequestExecution/RSRenderExecution.cpp(593):
    Has anybody come across this issue?
    Any help in this regard will be highly appreciated.
    Thanks,
    Mukesh

    Contact Oracle support. I think we've seen this one before if using a particular version of Oracle(11.1?). There's a particular version of Oracle that doesn't support queries in a WITH clause that aren't referenced in the main query. Cognos seems to generate these types of queries not knowing that the version of Oracle doesn't support it. According or Support Article ID 1063400.1 you can patch this particular problem with Oracle or you can upgrade to Oracle 11.2. I also think that was a to get Cognos to generate an alternative query that doesn't use the WITH clause at all. Something about disabling the use of WITH in all queries by making a change to the report definition or alternatively a global change to the metadata model.
    Good luck...
    Andrew

  • Date Range Issue

    Hi Experts,
    I have created a linked server to connect to mysql DB . The query is executing fine currently filter is based on the on going month.
    The query actually fetches the records from 2 tables User and time sheet to find how many hours the users have  .
    Now we check the Hours for a period of 10th of the current month and 10th of the upcoming month .
    So for now date range will be  between 2014/10/05 and 2014/10/06.  This logic i have implemented in the query .
    Based on the query a report is generated which is sent out every Wednesday  .Now suppose its 5th of June 2014 . 
    The query will fail because the date range is derived based upon
    where cast(t.created_on as Date) > Concat(year(now()),"-",month(now()),"-","10")
     AND cast(t.created_on as Date) <=Concat(year(now()),"-",month(now())+1,"-","10")
    Please provide with a date filter like the report runs anytime the data is not affected. Like if the report is run in the
    first week of a new month  date range should be previous month Date 10 and current month  Date 10 and if the report is run after 10th of the current month then the date range should be between 10th of current month and 10 of upcoming month . Kindly
    help
    Select * From
    OPENQUERY
    (Mysql,
    'Select
     Sum(t.hours),
     Concat(u.firstname," ",
     u.lastname) as Name
     From mysql.time_entries t
     Inner Join
     users u
     on u.id = t.user_id    
     where cast(t.created_on as Date) >
     Concat(year(now()),"-",month(now()),"-","10")
     AND
     cast(t.created_on as Date) <=Concat(year(now()),"-",month(now())+1,"-","10")
     Group By u.firstname,u.lastname
     Union all
     Select Sum(0) as hours,
     Concat(firstname," ",
     lastname) as Name
     from users
     where id not in(
     Select
     t.user_id
     From mysql.time_entries t
     Inner Join
     users u
     on u.id = t.user_id    
     where cast(t.created_on as Date) >
     Concat(year(now()),"-",month(now()),"-","10")
     AND
     cast(t.created_on as Date) <=Concat(year(now()),"-",month(now())+1,"-","10"))
     And firstname not in( "xyz")
      GRoup by firstName,lastname'
      go

    I recommend use CLOSED-OPEN dates rather than OPEN-CLOSED dates...
    Hopefully this helps with your logic:
    DECLARE @ReportDate TABLE
    [ReportDate] DATE,
    [mDay] AS DAY([ReportDate]),
    [Beg] AS DATEADD(month, CASE WHEN DAY([ReportDate]) < 10 THEN -1 ELSE 0 END, [ReportDate]),
    [End] AS DATEADD(month, CASE WHEN DAY([ReportDate]) < 10 THEN 0 ELSE 1 END, [ReportDate]),
    [ReportBeg] AS DATEADD(month, CASE WHEN DAY([ReportDate]) < 10 THEN -1 ELSE 0 END, DATEADD(day, 10 - DAY([ReportDate]), [ReportDate])),
    [ReportEnd] AS DATEADD(month, CASE WHEN DAY([ReportDate]) < 10 THEN 0 ELSE 1 END, DATEADD(day, 10 - DAY([ReportDate]) + 1, [ReportDate]))
    INSERT INTO @ReportDate(ReportDate)
    VALUES
    ('7-May-2014'),
    ('10-May-2014'),
    ('15-May-2014');
    SELECT
    CASE WHEN SYSDATETIME() >= [ReportBeg] AND SYSDATETIME() < [ReportEnd] THEN 1 ELSE 0 END
    FROM @ReportDate;

  • Querying on date range issue?

    Hi,
    I'm looking for a solution for this issue,
    In the DB Table there is a column of type TIMESTAMP. so when i query for date range using BETWEEN keyword it returns data inserted on next day at 12.00.00 AM
    example :
    Table A
    ColumnA_
    data1
    data2
    data3
    ColumnTime_
    08/03/2010 11.55.00 AM
    08/04/2010 12.00.00 AM
    08/04/2010 12.00.01 AM
    here when I query using between (08/03/2010 and 08/04/2010) keyword on Column_Time then ,
    Ouput
    data1
    data2
    but I'm just looking for data1 in the output, any ideas?

    Between is inclusive of both boundaries:
    column between condition1 and condition2Translates into
    condition1 >= column
    and
    condition2 <= columnSo tell the code what you want ... in your case
    condition1 >= column
    and
    condition2 < columnI'm not sure if you expect the >= or not...adjust as needed.

  • Crystal report - Data display issue

    Hi all,
           I did a crystal report. the labels in the crystal report are
                    QTR1  QTR2  QTR3  QTR4
         If I select  the prompt value as QTR3, the values should display under QTR3, but data is displaying under QTR1
         If I select  the prompt value as QTR3 and QTR4, the values should display under QTR3 and QTR4 columns, but data is displaying under QTR1& QTR2.
    i.e., the data is displaying in an order starting from first column.
    Please let me know if I need to change any prompt settings to get the data in the order I needed.
    Thanks in Advance.
    Regards,
    Viswa

    there are 2 ways this can be done.
    do they only run one qtr at a time?
    you can create a group for each quarter
    create a parameter to pull by quarter.
    in the record selection place this statement
    (if {@qtr}=0 then true else = {@qtr})
    in the parameter place 0 if the qtr is numeric value otherwise place ALL (replace the 0 in the record selection with all if necc)
    this will retrieve all the qtrs or the qtr specified.
    if you create groupings for the qtrs place the value of the qtr in the details section below where you want to display qtr 2.
    you will need to create formulas to differentiate the qtrs.
    if qtr1 in date to date then $ amount
    create a formula for all qtrs. this will display the dollar or value for the qtr date range only. otherwise a zero or null will be displayed.
    right click on the section and go to section expert
    in supress section click on the formual button
    if qtr=1 then true. (keep in mind it is a supression formula so true will supress the qtr, false will display)
    then on the values in the the detail section you can supress those based upon a formula also like above.

  • Report date prompt issue on the Sharepoint

    Hi,
    I am trying to run SSRS report on the sharePoint, but I am getting below error message "
    The
    value provided for the report parameter 'startdate' is not valid for its type.
    --->
    Microsoft.ReportingServices.Diagnostics.Utilities.ReportParameterTypeMismatchException:
    The value provided for the report parameter 'startdate' is not valid for its
    type."
    Can you suggest what's the cause of this?
    Many Thanks.

    Hi Aruna,
    From the error message, the value of the parameter didn't match the type of the parameter. Please re-open the report and enter an available value for the datetime.
    There are some similar posts about this issue, please take a look at:
    https://social.technet.microsoft.com/Forums/en-US/5bbc510d-6826-4a53-ade6-df71e0a4ed05/the-value-provided-for-the-report-parameter-startdate-is-not-valid-for-its-type?forum=sqlreportingservices
    https://technet.microsoft.com/en-us/library/aa256400(v=sql.80).aspx
    http://stackoverflow.com/questions/1442743/passing-date-as-a-parameter-to-a-subreport-another-report-to-use-as-a-parameter
    If this issue still exists, I suggest you create a new thread on SSRS forum. The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their
    knowledge or learn from your interaction with us. Thank you for your understanding.
    SSRS:
    https://social.technet.microsoft.com/Forums/en-US/home?forum=sqlreportingservices
    Thanks,
    Wendy
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Date range to be displayed  & Displaying multiple values on the report

    Hi,
    I have date range parameters, but I also need it to be displayed it on the report. Is there any way I can display it. E.G If a parameter is created one can drag and drop it on the report if it needs to be displayed on the report, I tried to do the same for the date range parameter but it does not work.
    Also If a parameter is created by selecting the option 'Allow Multiple Values', and if you drag and drop it on the report only the first value is displayed and the rest does not show. Has anyone tried this before and been successful in displaying multiple values in the report.
    Thanks in advance.

    Hi,
    A multi-value parameter is actually treated as an array in Crystal Reports.
    To display the values selected in the parameter, create a formula from the Field Explorer and type this code:
    Join({?ParameterName},",");
    Place this formula on the header or the footer sections of the report.
    Regarding the date range issue, please follow Sastry's advice and it should work fine.
    Make sure you're using the parameter in the Minimum and Maximum functions. For eg: If I was to create a date range parameter called OrderDate, my formula to show the start date would look like this:
    Minimum({?OrderDate})
    -Abhilash

  • CUIC Hourly Interval Query Throughout Date Range (SQL Squirrel Stuff)

    I’m trying to create a specific report in CUIC using the "Contact Service Queue Activity Report by Interval” canned report.  The objective is to query intervals (by hour), throughout the whole reporting time frame.  This can be done by interval and reported per day in the canned report, but I’m trying to get the values per interval without the day displayed.  For example, I’d like a report that shows total calls per hour (8-9 am, 9-10, 10-11am etc) throughout the reporting date range. The report would look like this:
    Interval Start Time  Interval End Time     CSQ Name     Calls Presented    Handled
    8:00:00 AM     9:00:00 AM     CSQ_     41     40
    9:00:00 AM     10:00:00 AM     CSQ_     63     60
    10:00:00 AM     11:00:00 AM     CSQ_     50     50
    Instead of this:
    Interval Start Time  Interval End Time     CSQ Name     Calls Presented    Handled
    3/3/14 8:00     3/3/14 9:00     CSQ_     16     16
    3/3/14 9:00     3/3/14 10:00     CSQ_     23     21
    3/3/14 10:00     3/3/14 11:00     CSQ_     24     24
    3/4/14 8:00     3/4/14 9:00     CSQ_     13     13
    3/4/14 9:00     3/4/14 10:00     CSQ_     26     25
    3/4/14 10:00     3/4/14 11:00     CSQ_     14     14
    3/5/14 8:00     3/5/14 9:00     CSQ_     12     11
    3/5/14 9:00     3/5/14 10:00     CSQ_     14     14
    3/5/14 10:00     3/5/14 11:00     CSQ_     12     12

    Hi
    So you want the report to add up all the calls between 9-10am, e.g. if you run it for a week it would add up the calls for each day between 9 and 10 am and show a single total for that hour?
    Aaron

  • Date range in report output

    Hi Abaper,
    I have a requirment to display range of date in report output . I have fixed output to 7 days.
    when ever i input date range 7 days its display fine but when i input 3 days the report output date is display upto 3 is fine but in 5th to 7th column date should not display correct format.
    below is my code.
    date = p_date-low.
    wa_date-dat = date.
    APPEND wa_date TO it_date.
    CLEAR  wa_date.
    IF date LT p_date-high.
      date1 = p_date-low + 1.
      wa_date-dat = date1.
      APPEND wa_date TO it_date.
      CLEAR  wa_date.
    ENDIF.
    IF date1 LT p_date-high.
      date2 = date1 + 1.
      wa_date-dat = date2.
      APPEND wa_date TO it_date.
      CLEAR  wa_date.
    ENDIF.
    IF date2 LT p_date-high.
      date3 = date2 + 1.
      wa_date-dat = date3.
      APPEND wa_date TO it_date.
      CLEAR  wa_date.
    ENDIF.
    IF date3 LT p_date-high.
      date4 = date3 + 1.
      wa_date-dat = date4.
      APPEND wa_date TO it_date.
      CLEAR  wa_date.
    ENDIF.
    IF date4 LT p_date-high.
      date5 = date4 + 1.
      wa_date-dat = date5.
      APPEND wa_date TO it_date.
      CLEAR  wa_date.
    ENDIF.
    IF date5 LT p_date-high.
      date6 = date5 + 1.
      wa_date-dat = date6.
      APPEND wa_date TO it_date.
      CLEAR  wa_date.
    ENDIF.
    Can any one help me on this issue.
    Thanks in Advance.
    Thanks & Regards,
    Amit

    Hi Amit,
    pls see the code below:
    date = p_date-low.
    wa_date-dat = date.
    APPEND wa_date TO it_date.
    CLEAR wa_date.
    IF date LT p_date-high AND date is not initial.
    date1 = p_date-low + 1.
    wa_date-dat = date1.
    APPEND wa_date TO it_date.
    CLEAR wa_date.
    ENDIF.
    IF date1 LT p_date-high AND date1 is not initial.
    date2 = date1 + 1.
    wa_date-dat = date2.
    APPEND wa_date TO it_date.
    CLEAR wa_date.
    ENDIF.
    IF date2 LT p_date-high AND date2 is not initial.
    date3 = date2 + 1.
    wa_date-dat = date3.
    APPEND wa_date TO it_date.
    CLEAR wa_date.
    ENDIF.
    IF date3 LT p_date-high.
    date4 = date3 + 1.
    wa_date-dat = date4.
    APPEND wa_date TO it_date.
    CLEAR wa_date.
    ENDIF.
    Pls add the condition also in ur check for all the IF conditions..and just see if it works...
    Keerthi

  • XL Reporter - Selection of date range for report templates

    Dear All,
    I want to create a report using XL reporter and attach it to the main SAP B1 reports module . For this I have created the template using report composer .
    Issue:
    I have only one sub-period (ie,year wise in the posting periods)
    how i can select the date range in the Composer and attach it to the main menu.
    Regards,
    Suresh Kannan.P.

    Suresh,
                1. Goto Report Designer
                2. there u can find "Advanced Report Builder" on left side of the window
                3. At the below u can find three buttons like "Parameters", "Properties","Apply"
                4. Click on "Parameters"
                5. then Parameters window will populate
                6. Click the new Button
                7. Name: give as u like
                    Category: Literal
                    Type: Date
                    Attribute: Leave blank
                    Default Vale: Leave Blank
                    Prompt: From Date
             This is the process to create the parameters.
    create two parameters. one is fdate and ldate.

  • No Data in Reports Details in Custom date range

    Hello, iTunes U Public Site Manager Admins.
    As the iTunes U Public Site Manager admin, I've been trying to access our institution's iTunes U Reports Details for a couple of days. (I send a monthly report of usage to our course/collection contributors.) When I custom the date range, under Details, there is zero entry; "No data available in table" message is shown.
    This feature had been working well since Apple iTunes U added this enhancement on August 13, 2013. The report Details showed the exact stats for Browse, Subscribe, Download, Stream, and Enclosure for each course/collection in the custom date range.
    Now under "Details", the data is shown only when the date range is Last 30 Days. It shows no data in custom date range when the Calendar is used to select a Start Date and End Date.
    Has anyone else noticed this problem?
    Thanks.
    Q. Wang

    Erik.
    I used your suggestion and it worked very well. This is how I did it.
    Export the range of data that includes Feb. 1-Feb. 28, 2014 as .tsv file.
    Open that file in Excel.
    Add a blank column next to the Date column. Use function =Month() to just extract the month into the new column. Fill down the whole column. Then copy and paste special (value) into the same column (I have over 26,000 rows of data in the file.) Converting to Value will allow for the next step of PivotTable.
    Create a PivotTable for the 26,000 rows of data. Use Month as the Report filter, iTunes_ID as the Row Labels, Select Browse, Subscribe, etc. as the Sum Values. (The result is a summary table with about 200 rows.)
    I then do a Vlookup to my premade Master file to add Category (course, collection, resources) and Instructor Name to each of the 200 rows.
    That will do it for my monthly report.
    Thanks for your tip again. I did not know the .tsv file would have DATE for each item.
    Sincerely,
    Q. Wang

  • Date range query  problem  in report

    Hi all,
    I have created a report based on query and i want to put date range selection but query giving problem.
    If i am creating select list selection then it is working fine means it will display all records on the particular date.
    But what i need is that user will enter date range as creation_date1,creation_date2 and query should return all the records between these date range. i want to pass it by creating items, i created two items and passing creation_date range to display all records but not displaying and if not passing date then should take null as default and display all records
    Here is the query:
    /* Formatted on 2006/12/10 20:01 (Formatter Plus v4.8.0) */
    SELECT tsh."SR_HEADER_ID", tsh."SALES_DEPT_NUMBER", tsh."COUNTRY",
    tsh."LOCAL_REPORT_NUMBER", tsh."ISSUE_DATE", tsh."SUBJECT",
    tsh."MACHINE_SERIAL_NUMBER", tsh."MACHINE_TYPE", tsh."MACHINE_HOURS",
    tsh."STATUS"
    FROM "TRX_SR_HEADERS" tsh, "TRX_SR_PARTS" tsp
    WHERE (tsh.status LIKE :p23_status_sp OR tsh.status IS NULL)
    AND (tsh.machine_type LIKE :p23_machine_type_sp)
    AND ( tsh.machine_serial_number LIKE
    TO_CHAR (:p23_machine_serial_number_sp)
    OR tsh.machine_serial_number IS NULL
    AND ( TO_CHAR (tsh.failure_date, 'DD-MON-YY') LIKE
    TO_CHAR (:p23_failure_date_sp)
    OR TO_CHAR (tsh.failure_date, 'DD-MON-YY') IS NULL
    AND ( TO_CHAR (tsh.creation_date, 'DD-MON-YY')
    BETWEEN TO_CHAR (:p23_creation_date_sp)
    AND TO_CHAR (:p23_creation_date_sp1)
    OR TO_CHAR (tsh.creation_date, 'DD-MON-YY') IS NULL
    AND (tsh.issue_date LIKE :p23_date_of_issue_sp OR tsh.issue_date IS NULL)
    AND (tsh.country LIKE :p23_country_sp OR tsh.country IS NULL)
    AND ( tsh.local_report_number LIKE TO_CHAR (:p23_local_rep_num_sp)
    OR tsh.local_report_number IS NULL
    AND ( tsp.part_number LIKE TO_CHAR (:p23_part_number_sp)
    OR tsp.part_number IS NULL
    AND tsh.machine_type IN (
    SELECT DISTINCT machine_type
    FROM trx_sales_dept_machine_list
    WHERE sales_department_id IN (
    SELECT DISTINCT sales_department_id
    FROM trx_user_sales_department
    WHERE UPPER (user_name) =
    UPPER ('&APP_USER.'))
    AND SYSDATE >= valid_from)
    AND tsh.sr_header_id = tsp.sr_header_id
    can any one tell me wat is wroung in this query.
    Any other way to write this?
    Thank You,
    Amit

    Hi User....
    Here is some date range SQL that my teams uses with some success:
    For date columns that do not contain NULL values, try this (note the TRUNC, it might help with your "today" problem).
    The hard coded dates allow users to leave the FROM and TO dates blank and still get sensible results (ie a blank TO date field asks for all dates in the future.
    AND TRUNC(DATE_IN_DATABASE)
    BETWEEN
    decode( :P1_DATE_FROM,
    TO_DATE('01-JAN-1900'),
    :P1_DATE_FROM)
    AND
    decode( :P1_DATE_TO,
    TO_DATE('31-DEC-3000'),:
    :P1_DATE_TO)
    For date columns that contain NULL values, try this (a little bit trickier):
    AND nvl(TRUNC(DATE_IN_DATABASE),
    decode( :P1_DATE_FROM,
    decode( :P1_DATE_TO,
    TO_DATE('30-DEC-3000'),
    NULL),
    NULL)
    BETWEEN
    decode( :P1_DATE_FROM,
    TO_DATE('01-JAN-1900'),
    :P1_DATE_FROM)
    AND
    decode( :P1_DATE_TO,
    TO_DATE('31-DEC-3000'),
    :P1_DATE_TO)
    Note the 30-DEC-3000 versus 31-DEC-3000. This trick returns the NULL dates when the FROM and TO date range items are both blank.
    I hope this helps.
    By the way, does anyone have a better way of doing this? The requirement is given a date column in a database and a FROM and a TO date item on a page,
    find all of the dates in the database between the FROM and TO dates. If the FROM date is blank, assume the user want all dates in the past (excluding NULL dates). If the TO date is blank, assume that the user wants all of the dates in the future (excluding NULL dates). If both FROM and TO dates are blank, return all of the dates in the databse (including NULL dates).
    Cheers,
    Patrick

  • Report for open invoice value against GR done within a date range

    Dear experts ,
    I need a report  between date ranges for which there is a GR done , but invoice is pending .
    Where can i get this ? 
    Regards
    Anis

    hi,
    You can  check few default PO reports wid proper paramater in it
    or
    Can check table EKBE
    or
    Check PO history in the PO doc
    Or
    Check the ME80FN
    Regards
    Priyanka.P

  • Devolped an ALV report for daily cash receipts for selected date range

    hi,   
                 how to devlop an ALV report for daily cash receipts for selected date range.for this report what are the tables and fields we have to use.what is the selectionscreen&what is logic.give me sample report.

    hi,   
                 how to devlop an ALV report for daily cash receipts for selected date range.for this report what are the tables and fields we have to use.what is the selectionscreen&what is logic.give me sample report.

  • Devloped an ALV report for daily cash receipts for selected date range

    hi,   
                 how to devlop an ALV report for daily cash receipts for selected date range.for this report what are the tables and fields we have to use.what is the selectionscreen&what is logic.give me sample report.

    Hi,
    You can develop simple reports using Report Painter.
    You may be also interested in:
    Check report SAPMF05A for credit memo
    See the following Std reports on Payment Advices execute the Tcodes:
    S_ALR_87009888
    S_ALR_87009889
    S_ALR_87009890
    S_ALR_87009891
    S_ALR_87009892
    S_ALR_87009893
    S_ALR_87009978
    S_ALR_87009979
    S_ALR_87009980
    S_ALR_87009981
    S_ALR_87009982
    S_ALR_87009983
    S_ALR_87010056
    S_ALR_87010057
    S_ALR_87010058
    S_ALR_87010059
    S_ALR_87010060
    S_ALR_87010061
    S_ALR_87010066
    S_ALR_87010067
    S_ALR_87012106
    S_ALR_87012107
    S_ALR_87012108
    S_ALR_87012109
    S_ALR_87012110
    S_ALR_87012111
    S_ALR_87012116
    S_ALR_87012117
    S_ALR_87012200
    S_ALR_87012201
    S_ALR_87012202
    S_ALR_870122
    S_ALR_87012204
    S_ALR_87012205
    S_ALR_87012350
    S_ALR_87012351
    S_ALR_87012352
    S_ALR_87012353
    S_ALR_87012354
    S_ALR_87012355
    sample ALV report:
    tables:
    marav. "Table MARA and table MAKT
    Data to be displayed in ALV
    Using the following syntax, REUSE_ALV_FIELDCATALOG_MERGE can auto-
    matically determine the fieldstructure from this source program
    Data:
    begin of imat occurs 100,
    matnr like marav-matnr, "Material number
    maktx like marav-maktx, "Material short text
    matkl like marav-matkl, "Material group (so you can test to make
                            " intermediate sums)
    ntgew like marav-ntgew, "Net weight, numeric field (so you can test to
                            "make sums)
    gewei like marav-gewei, "weight unit (just to be complete)
    end of imat.
    Other data needed
    field to store report name
    data i_repid like sy-repid.
    field to check table length
    data i_lines like sy-tabix.
    Data for ALV display
    TYPE-POOLS: SLIS.
    data int_fcat type SLIS_T_FIELDCAT_ALV.
    select-options:
    s_matnr for marav-matnr matchcode object MAT1.
    start-of-selection.
    read data into table imat
      select * from marav
      into corresponding fields of table imat
      where
      matnr in s_matnr.
    end-of-selection.
    Now, we start with ALV
    To use ALV, we need a DDIC-structure or a thing called Fieldcatalogue.
    The fieldcatalouge can be generated by FUNCTION
    'REUSE_ALV_FIELDCATALOG_MERGE' from an internal table from any
    report source, including this report.
    The only problem one might have is that the report and table names
    need to be in capital letters. (I had it )
    Store report name
    i_repid = sy-repid.
    Create Fieldcatalogue from internal table
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_PROGRAM_NAME         = sy-repid
                I_INTERNAL_TABNAME     = 'IMAT'  "capital letters!
                I_INCLNAME             = sy-repid
           CHANGING
                CT_FIELDCAT            = int_fcat
           EXCEPTIONS
                INCONSISTENT_INTERFACE = 1
                PROGRAM_ERROR          = 2
                OTHERS                 = 3.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM       = i_repid
                I_STRUCTURE_NAME         = 'marav'
                I_DEFAULT                = 'X'
                I_SAVE                   = 'A'
           TABLES
                T_OUTTAB                 = imat.
      IF SY-SUBRC <> 0.
        WRITE: 'SY-SUBRC: ', SY-SUBRC .
      ENDIF.
    Hope this will help.
    Regards,
    Naveen.

Maybe you are looking for