Header in the Report

Hi All,
Does anybody have any idea about how to get the selection parameters entered through variables by the user in the header of the report.
Though the values of the selection parameters get displayed in the o/p display of BEx Analyser by default, but is there any way of adding a header to the report and display these selection parameters in the header as a label.
That means the basic requirment is dynamically changing header of the report.
Regards,
Varada

Hi Varada,
First of all, make sure that your elements are displayed: Layout -> Display text elements -> All.
Then choose an Excel menu option Tools -> Macro -> VB editor. Put inside the SAPBEXonRefresh sub definition the following code.
Dim txt1row As Integer
Dim ws As Worksheet
txt1row = 15
Set ws = resultArea.Parent
ws.Cells(1, 1) = ws.Cells(1, 1) & " - " & ws.Cells(txt1row, 2)
txt1row is a number of row where your text element is sitting. You can add some additional text if you want to. In this example to the existing report header the text element from the 15th row (through “ – “) will be added.
Best regards,
Eugene

Similar Messages

  • How to have some fields in the header of the report

    Hi All,
    we would like to have some fields in the header of the report (every page but the first page), but Word won’t let you insert fields into the header. Are there any work arounds to do something like that?
    Thanks,
    Vandana

    'Insert Menu -> Field' does not work for headers.
    Try this. Say if you want to insert a XML tag named TRX_NUMBER in header. Put <?TRX_NUMBER?> in the header. This will display TRX_NUMBER tag in header.

  • Heading in the report as Vendor name

    Hi SDN,
    I am using " Email(Bursting)" feature to burst reports by Vendor.Vendor  is the Characteristic value by which we are bursting. Also Email address is attribute of Vendor so we are sending the reports to their email addresses.
    The data is broken by each Vendor and the report  is fine.
    I want to have the heading by Vendor i.e have Vendor name.
    How I can find the heading dynamically without having to have broadcast settings for eachVendor and hardcoded Heading.
    Any light?
    Thanks in Advance
    Advika

    Hi Advika,
    You can try putting text variables with replacement path in the query title.
    Your texts variables are populated dynamically depending on the variables values typed.
    you can create a text variable with replacement path on vendor at the query properties level.
    Try and revert.
    Cheers,
    Tanish

  • How to put detail level data in the header of my report

    I have this XML from PIR05.rdf
    <?xml version="1.0" encoding="UTF-8" ?>
    <!-- Generated by Oracle Reports version 6.0.8.28.0 -->
    <PIR05>
    <LIST_G_ITEM_NO>
    <G_ITEM_NO>
    <PAGE_NO>0</PAGE_NO>
    <ITEM_NO>4242301</ITEM_NO>
    <ITEM_DESC1>13MM Aries Cell Assembly</ITEM_DESC1>
    <LOT_NO>562354</LOT_NO>
    <LOT_DESC>4242301</LOT_DESC>
    <SUBLOT_NO></SUBLOT_NO>
    <LOCATION>WOR RECV</LOCATION>
    <GRADE_CODE>NONE</GRADE_CODE>
    <ITEM_UM>Each</ITEM_UM>
    <ITEM_UM2></ITEM_UM2>
    <LINE_NO>603</LINE_NO>
    <COUNT_NO>603</COUNT_NO>
    <P_ITEMUM2LABEL> </P_ITEMUM2LABEL>
    <P_ITEMUM2DASH> </P_ITEMUM2DASH>
    <F_ITEMUM2>1</F_ITEMUM2>
    <P_CSITEMUM2_LABEL> </P_CSITEMUM2_LABEL>
    <P_CSITEMUM2_DASH> </P_CSITEMUM2_DASH>
    </G_ITEM_NO>
    </LIST_G_ITEM_NO>
    <WHSE_DESC>OPM INVENTORY ORG</WHSE_DESC>
    <CS_NODATA>617</CS_NODATA>
    <CYCLE_NO>000000014</CYCLE_NO>
    <WHSE_OUT>WOR</WHSE_OUT>
    <DATE_OUT>2010-11-23T16:12:13+00:00</DATE_OUT>
    </PIR05>
    I have a template where I have a header section and a lines section which breaks the page on the value of the LOCATION. I would like to put the value of the LOCATION in the HEADER of the report. How do I reference the current value of LOCATION, for example on page 30?
    The report looks like this:
    whse_out cycle_no
    location lot_no
    location lot_no
    New page
    whse_out cycle_no
    location lot_no
    location lot_no
    How can I get the value of LOCATION in my "HEADER" section and have it be the same value as the first location listed on the page?

    Hi,
    you need to create an automated section break, .. in your for loop, add @section to the syntax.. that will create a section break everytime the node enters a new location info.. in the header just put in the tag for the location, it will pick up the first location and display it there..
    -domnic
    p.s. if youre not able to do it, send me your template with a sample XML file, ill see what i can do.

  • Adding an image from the web to the report in the header with other Text

    I am attempting to fix a Crystal Report where I have a Logo positioned in the upper left corner of the Report Header.  The Report Header also includes 2 text fields.  One is fixed data and the other is a date.  I have mastered the img src but I cannot get the two text fields to display to the right of the image.  They will always push to the line below.  I have tried putting them in different sections and underlying the next section, and all other settings that I can think of.  What I must have would be similar to this:
    |                . "UPDATE"
    Image
    |                . "DATE"
    I have even tried suppressing all headers and using multiple detail sections to no avail.  I am using Crystal Reports 2008

    I have found the answer or should I say the cause of my problem.  It is that Microsoft in their infinite wisdom have changed the way (or engine) their Outlook (post version 2003) handles html.  They now use the "engine" from their 'Word' program which cannot handle most compound formatting.  To handle this program, you have to build it all on one level.  To solve my Header problem, I was forced to recreate my graphic to include the Header text, place that graphic on the top of the page and build my form below,  an entire line at a time.  Multiple objects on the same line would look great in Outlook prior to '2007' but may be in any order or grouping in '2007' and after See this explanation...
    [http://blogs.sitepoint.com/2007/01/10/microsoft-breaks-html-email-rendering-in-outlook/]

  • Not Able to Generate Out of the Report by adding the new 2 fields

    Hi,
    I'm Very new to ABAP. I have created one report. after 2 new fields added they are EKNAM and EKGRP.
    The Thing is the remaining fields are displaying in the output. The Newly added fields are not displaying the out. I was able to add this 2 fields in the head of the report. But issue is not able to get the data on these 2 fields.
    Please see the below program and any one please help me out to display the data in this report for the fields eknam and ekgrp.
    TABLES: eban,
            lfa1,
            ekko,
            t024,
            v_username.
    DATA: BEGIN OF i_req_items OCCURS 10,
            ernam LIKE eban-ernam,         "Created by
            lifnr LIKE eban-lifnr,         "Desired vendor
            ebeln LIKE eban-ebeln,         "PO Number
            ebelp LIKE eban-ebelp,         "PO Item
            eknam LIKE t024-eknam,         "Pur.Grp Name
            ekgrp LIKE t024-ekgrp,         "Pur.Grp Number
            flief LIKE eban-flief,         "Fixed vendor
            name1 LIKE lfa1-name1,         "Vendor name
            badat LIKE eban-badat,         "Creation date
            erdat LIKE eban-erdat,         "Change date
            banfn LIKE eban-banfn,         "Requisition no.
            bnfpo LIKE eban-bnfpo,         "Req. item no.
            bsart LIKE eban-bsart,         "Document type
            knttp LIKE eban-knttp,         "Acct.assgmt category
            txz01 LIKE eban-txz01,         "PO item description
            menge LIKE eban-menge,         "Quantity
            preis LIKE eban-preis,         "Price
            peinh LIKE eban-peinh,         "Price unit
            value(14) TYPE p DECIMALS 2,   "Item Value
          END OF i_req_items.
    DATA: BEGIN OF i_reqs OCCURS 10,
            ernam LIKE eban-ernam,         "Created by
            persn LIKE usr21-persnumber,   "Person number
            uname LIKE adrp-name_text,     "User name
            lifnr LIKE eban-lifnr,         "Vendor
            name1 LIKE lfa1-name1,         "Vendor name
            badat LIKE eban-badat,         "Creation date
            banfn LIKE eban-banfn,         "Requisition no.
            bnfpo LIKE eban-bnfpo,         "Req. item no.
            bsart LIKE eban-bsart,         "Document type
            knttp LIKE eban-knttp,         "Acct.assgmt category
            txz01 LIKE eban-txz01,         "PO item description
            eknam like t024-eknam,         "Purchase Grp Name
            ekgrp like t024-ekgrp,         "Purchase Grp Number
            value(14) TYPE p DECIMALS 2,   "Item Value
          END OF i_reqs.
    DATA: BEGIN OF i_req_keys OCCURS 0,
            ernam LIKE eban-ernam,         "Created by
            lifnr LIKE eban-lifnr,         "Desired vendor
            erdat LIKE eban-erdat,         "Create or Change date
            banfn LIKE eban-banfn,         "Requisition no.
            bnfpo LIKE eban-bnfpo,         "Req. item no.
            eknam like t024-eknam,         "Purchase Grp Name
            ekgrp like t024-ekgrp,         "Purchase Grp number
          END OF i_req_keys.
    DATA: BEGIN OF i_req_keeper OCCURS 0,
            ernam LIKE eban-ernam,         "Created by
            lifnr LIKE eban-lifnr,         "Desired vendor
            banfn LIKE eban-banfn,         "Requisition no
          END OF i_req_keeper.
    DATA: wa_reqitems LIKE i_req_items.
    DATA: BEGIN OF i_export OCCURS 10,
           record(150) TYPE c,
          END OF i_export.
    CONSTANTS
    CONSTANTS:
          c_doccat       LIKE eban-bstyp  VALUE 'B',
          c_creind       LIKE eban-estkz  VALUE 'R',
          c_delflag      LIKE eban-loekz  VALUE 'L',
          c_write(5)     TYPE c   VALUE 'WRITE',
          c_slash(1)     TYPE c   VALUE '/',
    *start ESPZC U8DK900439
         c_delimiter    TYPE x   VALUE '09',
           c_delimiter    TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
    *end ESPZC U8DK900439
          c_sc(1)        TYPE c   VALUE ';',
          c_x(1)         TYPE c   VALUE 'X',
          c_usd(1)       TYPE c   VALUE '2',
          c_export LIKE authb-filename VALUE '/BAY2/UBEM_SPLIT_REQS'.
    WORKING VARIABLES
    DATA: w_report_id   LIKE syst-repid,
          w_sttime      LIKE syst-uzeit,
          w_rpt_pagno   LIKE syst-pagno,
          w_rc          LIKE sy-subrc,
          w_datelow     LIKE eban-badat,
          w_datehigh    LIKE eban-badat,
          w_export      LIKE c_export,
          w_records     TYPE i,
          w_message(50) TYPE c.
    TYPES number TYPE i.
    SELECTION SCREEN / PARAMETERS
    SELECTION-SCREEN BEGIN OF BLOCK org WITH FRAME TITLE text-001.
    PARAMETERS: p_purorg LIKE eban-ekorg OBLIGATORY DEFAULT 'US02'.
    SELECT-OPTIONS: s_doctyp FOR eban-bsart,
                    s_date FOR eban-badat.
    PARAMETERS: p_timper(2) TYPE n.
    SELECTION-SCREEN: COMMENT 37(37) text-002.
    SELECTION-SCREEN END OF BLOCK org.
    SELECTION-SCREEN BEGIN OF BLOCK outp WITH FRAME TITLE text-003.
    PARAMETERS: p_onlin  RADIOBUTTON GROUP outp DEFAULT 'X',
                p_servr  RADIOBUTTON GROUP outp.
    SELECTION-SCREEN END OF BLOCK outp.
    AT SELECTION SCREEN
    AT SELECTION-SCREEN.
      IF p_servr = c_x.
        CLEAR w_rc.
        PERFORM authority_check_dataset USING    w_export
                                        CHANGING w_rc.
        IF w_rc <> 0.
          MESSAGE e532 WITH text-006 w_export.
        ENDIF.
        CLEAR w_rc.
        PERFORM verify_unix_path_and_file CHANGING w_rc.
        IF w_rc <> 0.
          MESSAGE e531 WITH w_message.
        ENDIF.
      ENDIF.
      INITIALIZATION EVENT
    INITIALIZATION.
      PERFORM get_filename.
      MOVE  syst-uzeit  TO   w_sttime.
      MOVE  syst-repid  TO   w_report_id.
      CLEAR: w_rpt_pagno.
    START-OF-SELECTION.
      PERFORM get_data.
      IF p_onlin = c_x.
        IF w_records GT 0.
          PERFORM print_report_header.
          PERFORM write_report.
        ELSE.
          MESSAGE i531 WITH text-007.
        ENDIF.
      ELSEIF p_servr = c_x.
        PERFORM write_export.
      ENDIF.
    END-OF-SELECTION.
    ---- F O R M   R O U T I N E S -
    *&     FORM get_filename
    FORM get_filename.
      CALL FUNCTION 'FILE_GET_NAME'
        EXPORTING
          logical_filename = c_export
        IMPORTING
          file_name        = w_export
        EXCEPTIONS
          file_not_found   = 1
          OTHERS           = 2.
      IF sy-subrc <> 0.
      ENDIF.
    ENDFORM.                    " get_filename
      FORM authority_check_dataset
    FORM authority_check_dataset USING    p_filename
                                 CHANGING p_rc.
      CALL FUNCTION 'AUTHORITY_CHECK_DATASET'
        EXPORTING
          activity         = c_write
          filename         = p_filename
        EXCEPTIONS
          no_authority     = 1
          activity_unknown = 2
          OTHERS           = 3.
      p_rc = sy-subrc.
    ENDFORM.                    "authority_check_dataset
        FORM verify_unix_path_and_file
    FORM verify_unix_path_and_file CHANGING p_rc.
    *start ESPZC U8DK900439
    OPEN DATASET w_export FOR OUTPUT IN TEXT MODE
         MESSAGE w_message.
      OPEN DATASET w_export FOR OUTPUT IN TEXT MODE ENCODING DEFAULT
          MESSAGE w_message.
    *end ESPZC U8DK900439
      p_rc = sy-subrc.
    ENDFORM.                    "verify_unix_path_and_file
      FORM get_data
    FORM get_data.
      CLEAR w_datelow.
      CLEAR w_datehigh.
      w_datelow = s_date-low - p_timper.
    w_datehigh = s_date-high + p_timper.
      w_datehigh = s_date-high.
      SELECT ernam lifnr ebeln ebelp flief badat erdat banfn bnfpo bsart
            knttp menge preis peinh txz01
       FROM eban
       INTO CORRESPONDING FIELDS OF TABLE i_req_items
          WHERE bstyp = c_doccat
            AND estkz = c_creind
            AND knttp <> space
            AND bsart IN s_doctyp
            AND loekz <> c_delflag
            AND ekorg EQ p_purorg
           AND ( ( badat BETWEEN w_datelow and w_datehigh ) OR
            ( erdat BETWEEN w_datelow AND w_datehigh ) ).
            AND  erdat BETWEEN w_datelow AND w_datehigh.
      IF sy-subrc = 0.
        LOOP AT i_req_items.
          IF i_req_items-lifnr IS INITIAL.
            IF NOT i_req_items-flief IS INITIAL.
              MOVE i_req_items-flief TO i_req_items-lifnr.
              MODIFY i_req_items.
            ENDIF.
            IF NOT i_req_items-ebeln IS INITIAL.
              SELECT lifnr FROM ekko
                  INTO i_req_items-lifnr
                  WHERE ebeln = i_req_items-ebeln.
              ENDSELECT.
              MODIFY i_req_items.
            ENDIF.
          ENDIF.
          IF i_req_items-erdat GT i_req_items-badat.
            MOVE i_req_items-erdat TO i_req_items-badat.
            MODIFY i_req_items.
          ENDIF.
        ENDLOOP.
        PERFORM weed_out_unique_records.
        PERFORM apply_time_period.
        SORT i_req_items BY ernam lifnr banfn bnfpo.
        LOOP AT i_req_items.
          i_req_items-value = ( i_req_items-menge *
               ( i_req_items-preis / i_req_items-peinh ) ).
          MODIFY i_req_items.
        ENDLOOP.
    Getting vendor name from table LFA1 -
        CLEAR i_req_items.
        LOOP AT i_req_items.
          SELECT SINGLE name1 FROM lfa1
            INTO i_req_items-name1
              WHERE lifnr = i_req_items-lifnr.
          MODIFY i_req_items.
        ENDLOOP.
        LOOP AT i_req_items.
          MOVE-CORRESPONDING i_req_items TO i_reqs.
    Getting user name from view v_username -
          SELECT SINGLE name_text
           FROM v_username INTO i_reqs-uname
          WHERE bname = i_reqs-ernam.
          APPEND i_reqs.
        ENDLOOP.
      ENDIF.
      DESCRIBE TABLE i_reqs LINES w_records.
    ENDFORM.                        "Get_data
      FORM print_report_header
    FORM print_report_header.
      ADD  1   TO   w_rpt_pagno.
      CALL FUNCTION '/BAY2/UBEXBH_BAYER_HEADR_FUN'
        EXPORTING
          f_jobname        = text-020
          f_business_group = text-021
          f_report_title   = text-022
          f_repid          = w_report_id
          f_sysid          = syst-sysid
          f_linsz          = syst-linsz
          f_pagno          = w_rpt_pagno
          f_mandt          = syst-mandt
          f_datum          = syst-datum
          f_uzeit          = w_sttime.
      FORMAT COLOR COL_HEADING.
      WRITE:  /1     text-010,      "Created by CWID & user name
              29     text-011,      "Vendor #
              38     text-012,      "Vendor Name
              69     text-013,      "Req Number
              79     text-014,      "/Item
              87     text-015,      "Created On
              98     text-017,      "A (AcctAssgmtCat)
             100(14) text-019 RIGHT-JUSTIFIED,  "Item Value
             116(30) text-018,      "Item Description
             148     text-030,      "Pur.Grp Name
             170     text-031.      "Pur.Grp Number
      FORMAT COLOR OFF.
      ULINE.
    ENDFORM.                             "print_report_header
    *&      Form  WRITE_REPORT
    FORM write_report.
      LOOP AT i_reqs.
        WRITE: /1 i_reqs-ernam,
                9(18) i_reqs-uname,
               29 i_reqs-lifnr,
               38(30) i_reqs-name1,
               69 i_reqs-banfn,
               79 c_slash,
               80 i_reqs-bnfpo,
               87 i_reqs-badat,
               98 i_reqs-knttp,
              100(14) i_reqs-value CURRENCY c_usd,
              116(30) i_reqs-txz01,
              145 i_reqs-eknam,
              160 i_reqs-ekgrp.
      ENDLOOP.
    ENDFORM.                    "write_report
    *&      Form  WRITE_EXPORT
    FORM write_export.
      DATA: l_value(14)    TYPE c,
            l_bsart(100)   TYPE c,
            l_uname(7)     TYPE c,
            l_records(5)   TYPE c,
            l_header(150)  TYPE c,
            l_params(150)  TYPE c,
            i_char         TYPE i.
      LOOP AT i_reqs.
        CLEAR l_value.
        CLEAR l_uname.
        l_value = i_reqs-value.
        l_uname = sy-uname.
        CONCATENATE: i_reqs-uname
                     i_reqs-ernam
                     i_reqs-lifnr
                     i_reqs-name1
                     i_reqs-banfn
                     i_reqs-bnfpo
                     i_reqs-badat
                     i_reqs-knttp
                     l_value
                     i_reqs-txz01 INTO i_export
                                  SEPARATED BY c_delimiter.
        APPEND i_export.
      ENDLOOP.
      CONCATENATE: text-008   "Created By Name
                   text-009   "CWID
                   text-011   "Vendor No
                   text-012   "Vendor Name
                   text-013   "Req Number
                   text-023   "Item
                   text-015   "Created On
                   text-017   "A
                   text-019   "Item Value
                   text-018   "Item Description
                   text-030   "Purchase Grp name
                   text-031   "Purchase Grp number
                   INTO l_header SEPARATED BY c_delimiter.
      INSERT l_header INTO i_export INDEX 1.
      IF sy-batch IS INITIAL.
        MOVE sy-uname TO l_uname.
      ELSE.
        MOVE text-024 TO l_uname.
      ENDIF.
      PERFORM collect_bsart CHANGING l_bsart
                                     i_char.
      l_records = w_records.
      CONCATENATE: sy-sysid
                   p_purorg
                   l_bsart(i_char)
                   s_date-low
                   s_date-high
                   p_timper
                   l_uname
                   sy-datum
                   l_records INTO l_params
                             SEPARATED BY c_delimiter.
      INSERT l_params INTO i_export INDEX 1.
      LOOP AT i_export.
        CONDENSE i_export NO-GAPS.
        TRANSFER i_export TO w_export.
      ENDLOOP.
      CLOSE DATASET w_export.
      MESSAGE s533 WITH text-028 w_export text-029.
    ENDFORM.                    "write_export
    *&      FORM collect_bsart
    FORM collect_bsart CHANGING p_bsart
                                p_char.
      CLEAR p_bsart.
      LOOP AT s_doctyp.
        IF sy-tabix = 1.
          p_bsart = s_doctyp-low.
        ELSE.
          CONCATENATE: p_bsart c_sc s_doctyp-low INTO p_bsart.
        ENDIF.
      ENDLOOP.
      CONDENSE p_bsart NO-GAPS.
      p_char = strlen( p_bsart ).
    ENDFORM.                      "collect_bsart
    *&      Form  WEED_OUT_UNIQUE_RECORDS
    FORM weed_out_unique_records.
      DATA: i_l_req_items LIKE i_req_items OCCURS 0 WITH HEADER LINE.
      DATA: i_l_req_final_items LIKE i_req_items OCCURS 0 WITH HEADER LINE.
      DATA: l_count TYPE i,
            l_sy_tabix LIKE sy-tabix,
            l_banfn    LIKE eban-banfn.
      REFRESH i_l_req_items.
      REFRESH i_l_req_final_items.
      CLEAR l_banfn.
      i_l_req_items[]       = i_req_items[].
      i_l_req_final_items[] = i_req_items[].
      SORT i_req_items         BY ernam lifnr.
      SORT i_l_req_items       BY ernam lifnr.
      SORT i_l_req_final_items BY ernam lifnr.
      LOOP AT i_l_req_items.
        l_banfn = i_l_req_items-banfn.
        CLEAR l_count.
        LOOP AT i_req_items
            WHERE ernam = i_l_req_items-ernam
              AND lifnr = i_l_req_items-lifnr.
          IF i_req_items-banfn <> l_banfn.
            ADD +1 TO l_count.
          ENDIF.
        ENDLOOP.
        IF NOT ( l_count > 0 ).
          LOOP AT i_l_req_final_items
            WHERE ernam = i_l_req_items-ernam
              AND lifnr = i_l_req_items-lifnr.
            DELETE i_l_req_final_items.
          ENDLOOP.
        ENDIF.
      ENDLOOP.
      REFRESH i_req_items.
      i_req_items[] = i_l_req_final_items[].
    ENDFORM.                    " WEED_OUT_UNIQUE_RECORDS
    *&      Form  APPLY_TIME_PERIOD
    FORM apply_time_period.
      DATA: l_i_req_keys LIKE i_req_keys.
      DATA: l_days_diff          TYPE p,
            l_no_of_key_recs     TYPE i,
            l_next_item          LIKE sy-tabix,
            l_finished_with_keys TYPE c VALUE 'N',
            l_add_line           TYPE c VALUE 'N',
            l_count              TYPE i,
            l_req_ernam          LIKE eban-ernam,
            l_req_lifnr          LIKE lfa1-lifnr,
            l_req_banfn          LIKE eban-banfn,
            l_save_tabix         like sy-tabix.
      REFRESH: i_req_keys, i_req_keeper.
      LOOP AT i_req_items.
        MOVE-CORRESPONDING i_req_items TO
                           i_req_keys.
        IF i_req_items-erdat IS INITIAL.
          i_req_keys-erdat = i_req_items-badat.
        ENDIF.
        APPEND i_req_keys.
      ENDLOOP.
      SORT i_req_keys BY ernam lifnr erdat.
      CLEAR l_no_of_key_recs.
      DESCRIBE TABLE i_req_keys LINES l_no_of_key_recs.
      LOOP AT i_req_keys.
        IF l_add_line = 'Y'.
          MOVE-CORRESPONDING i_req_keys
                          TO i_req_keeper.
          APPEND i_req_keeper.
          l_add_line = 'N'.
        ENDIF.
        IF l_finished_with_keys = 'Y'.
          EXIT.
        ENDIF.
        CLEAR l_next_item.
        l_save_tabix = sy-tabix.
        COMPUTE l_next_item = sy-tabix + 1.
        IF l_next_item = l_no_of_key_recs.
          l_finished_with_keys = 'Y'.
        ENDIF.
        clear: l_i_req_keys.
        READ TABLE i_req_keys INDEX l_next_item
            INTO l_i_req_keys.
        sy-tabix = l_save_tabix.
        CLEAR l_days_diff.
        l_days_diff = l_i_req_keys-erdat -
                      i_req_keys-erdat.
        IF l_i_req_keys-ernam  =
           i_req_keys-ernam                  AND
           l_i_req_keys-lifnr  =
           i_req_keys-lifnr                  AND
           l_i_req_keys-banfn  <>
           i_req_keys-banfn                  AND
           l_days_diff         <= p_timper.
          MOVE-CORRESPONDING i_req_keys
                          TO i_req_keeper.
          APPEND i_req_keeper.
          l_add_line = 'Y'.
        ENDIF.
      ENDLOOP.
      DELETE ADJACENT DUPLICATES FROM i_req_keeper
                            COMPARING ALL FIELDS.
      SORT i_req_keeper BY ernam lifnr banfn.
      LOOP AT i_req_items.
        CLEAR l_count.
        CLEAR: l_req_ernam,
               l_req_lifnr,
               l_req_banfn.
        l_req_ernam = i_req_items-ernam.
        l_req_lifnr = i_req_items-lifnr.
        l_req_banfn = i_req_items-banfn.
        LOOP AT i_req_keeper
            WHERE ernam = i_req_items-ernam
              AND lifnr = i_req_items-lifnr
              AND banfn = i_req_items-banfn.
          ADD +1 TO l_count.
        ENDLOOP.
        IF NOT ( l_count > 0 ).
          LOOP AT i_req_items
            WHERE ernam = l_req_ernam
              AND lifnr = l_req_lifnr
              AND banfn = l_req_banfn.
            DELETE i_req_items.
          ENDLOOP.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " APPLY_TIME_PERIOD

    Rajesh,
    Put a breakpoint and try to debug the report step by step.
    You will findout the reason very easily.
    Whenever you have a select and are trying to append into an internal table, keep checking your internal table if it is been populated with the correct records.
    This way, you will findout the cause and can correct is accordingly.
    Thanks,
    Suresh Ganti

  • Could not able to show a scalar value in Page Header/Group Header of the re

    Hi,
    I could not able to show a scalar value in Page Header/Group Header of the report which is returned from Sub-report. But I am able to display it in both Group Footer and Page Footer.
    I used shared variable in formula filed of both main and sub report and both are placed in the main and sub-report.
    Please do needful.
    Thanks & Regards,
    Mani G.S.

    You can only show Shared variables in main report in a location after the subreport has executed.
    If you want to show values in page header or group header you must place subreport in a section above these. This is unlikely to be possible so you will have to live with displaying results in Group/page footer.
    Alternatively you can execute subreport twice, once where subreport is hidden in a section above page/group header and pass summary figure you require and then again where you currently have subreport so you can see details as required.
    Ian

  • Header Columns for Reports

    Hi Guys
    Here is a quick question for you. I have a table that gives a breakdown of the number of people in a course by year. I.e Each year contains a count of Male, Female and Total Male & female
    It maps fine in Discoverer. But is there any way to put a heading across the report so it looks something like this
    COURSE YEAR 1 YEAR 2 YEAR3
    M F T M F T M F T
    Business 10 10 20 5 7 12 20 50 70
    IT ....
    Maths 5 2 7 11 2 13 5 7 12
    Can you put a place holder in there or something?
    Thanks

    Hi all
    Yes, BI Publisher can now be integrated with Discoverer. However, it's not free so please check out the licensing costs before jumping in with both feet. The last I heard is that BI Publisher will add an additional $40k per CPU to your BI server license so while it is very affordable it is something that you have to take into account and probably budget for. This is why I am starting to think that perhaps BI Publisher should be installed onto its own server.
    I heard at an Oracle conference that BI Publisher running on a 4 CPU box can handle 120,000 reports an hour. Impressive huh? What this also means is that you probably don't want to put it onto your 4-CPU application server and that a smaller 2-CPU server will more than likely suffice.
    Also, and this may catch a lot of folks out, the integration between BI Publisher and Discoverer will only work if you have installed the full application server with OID. It will not work with stand-alone Discoverer. Therefore if you are using stand-alone Discoverer you will also have to upgrade to the full server, complete with Infrastructure and OID as well as pay the additional license fees for that upgrade.
    I'd be happy for anyone from Oracle to contradict what I have said as that would ease the pain for a lot of my clients.
    Best wishes
    Michael

  • How to pass values to be displayed on the report?

    I have an ASP.Net page that has values from the user that needs to be displayed in the page header of the report. Those values need to be passed to the report.
    I am using Crystal Reports 2011.  The code behind for ASP.Net page is written in VB.Net.
    I had thought of using Parameter fields in the report and using the SetParameterValue method of ReportDocument but I am not familiar with using Parameter fields.
    How to set up the report to do this?
    Sincerely,
    Keith Jackson

    Hi Keith
    DJ has some very good suggestions, but the first thing we want to do is to make sure the report works in the designer as you want it to. Reading this thread, I'm a bit unsure if the report does actually work in the designer - can you please comment on that?
    If it does, I like to go from simple as far as coding is concerned. In this case, that would mean not worrying about the parameters or logon and let the report engine do the heavy lifting for us:
    Create a new project. Throw a CR viewer on a form and add one line of code in page load:
    CrystalReportViewer1.ReportSource = <path to the report>
    The engine will prompt for the db logon as well as the parameters. Fill those out. The report should then display on the screen.
    From here we can get fancy and add DB logon code as well as the parameter code.
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada
    Follow us on Twitter

  • Printing the header of a report  and checking the join statement...

    Hi All,
    This report of mne is working fine but there are things that i want to include: when i print this report i want it to display heading of which is in the html_top_of_page but it does not print it, i am not familiar with smart forms so i won't be able to use smart forms.If anyone can help me out i will really appreciated and will immediately reward points......please help me guys as the due date is very close...and please check the joins on the select statement, not sure whether i've joined the tables properly!
    REPORT  Z_ORDER_AUDIT_NEW.
    TYPE-POOLS: SLIS.
                   LIST OF TABLES
    Tables: vbak, likp, vbrk, kna1, vbrp, nast.
                         DEFINITION OF FIELDS                               *
    DATA: itb_fieldcat TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
          w_fieldcat TYPE slis_fieldcat_alv.
    DATA: w_cnt LIKE sy-tabix.
    DATA: lv_layout TYPE slis_layout_alv,
          lv_tab_group TYPE slis_t_sp_group_alv,
          lv_repid LIKE sy-repid,
          lv_events TYPE slis_t_event,
          lv_print  TYPE slis_print_alv,
          lv_user   TYPE slis_formname VALUE 'USER_COMMAND'.
             SELECTION SCREEN                                                 *
    SELECT-OPTIONS:
      s_lfdat FOR likp-lfdat,
      s_imwrk FOR likp-imwrk.
                 DEFINITION OF AN INTERNAL TABLE                              *
    DATA: Begin of i_ordertab occurs 0,
             audat  LIKE vbak-audat,
             vbeln  LIKE vbak-vbeln,
             lfdat  LIKE likp-lfdat,
             erdat  LIKE likp-erdat,
             vbeln1 LIKE likp-vbeln,
             vbeln2 LIKE vbrk-vbeln,
             erdat1 LIKE vbrk-erdat,
             kunrg  LIKE vbrk-kunrg,
             name1  LIKE kna1-name1,
             regio  LIKE vbrk-regio,
             inco1  LIKE vbrk-inco1,
             vrkme  LIKE vbrp-vrkme,
             ntgew  LIKE vbrp-ntgew,
             gewei  LIKE vbrp-gewei,
             volum  LIKE vbrp-volum,
             voleh  LIKE vbrp-voleh,
             netwr  LIKE vbrk-netwr,
           End of i_ordertab.
                   READ THE DATA                                               *
      SELECT vbakaudat vbakvbeln likplfdat likperdat likpvbeln vbrkvbeln
             vbrkerdat vbrkkunrg kna1name1 vbrkregio vbrkinco1 vbrpvrkme
             vbrpntgew vbrpgewei vbrpvolum vbrpvoleh vbrk~netwr
             FROM likp join kna1 on likpkunnr EQ kna1kunnr
                       join vbrk on kna1kunnr EQ vbrkkunrg
                       join vbrp on vbrkvbeln EQ vbrpvbeln
                       join vbak on kna1kunnr EQ vbakkunnr
             INTO i_ordertab
             WHERE likp~lfdat IN s_lfdat
             AND   likp~imwrk IN s_imwrk.
             APPEND i_ordertab.
      ENDSELECT.
                         PERFORM STATEMENTS                                   *
    PERFORM build_fieldcatalog.
    PERFORM build_layout.
    PERFORM build_event.
    PERFORM build_print.
    PERFORM display_alv_report.
    FORM build_fieldcatalog.
      w_cnt = 1.
      itb_fieldcat-fieldname = 'AUDAT'.
      itb_fieldcat-seltext_m = 'Document date'.
      itb_fieldcat-col_pos   = w_cnt.
      itb_fieldcat-emphasize = 'X'.
      itb_fieldcat-key       = 'X'.
      APPEND itb_fieldcat TO itb_fieldcat.
      CLEAR itb_fieldcat.
      w_cnt = w_cnt + 1.
      itb_fieldcat-fieldname = 'VBELN'.
      itb_fieldcat-seltext_m = 'S/O number'.
      itb_fieldcat-col_pos   = w_cnt.
      itb_fieldcat-emphasize = 'X'.
      APPEND itb_fieldcat TO itb_fieldcat.
      CLEAR itb_fieldcat.
      w_cnt = w_cnt + 1.
      itb_fieldcat-fieldname = 'LFDAT'.
      itb_fieldcat-seltext_m = 'Deliv. date'.
      itb_fieldcat-col_pos   = w_cnt.
      itb_fieldcat-emphasize = 'X'.
      APPEND itb_fieldcat TO itb_fieldcat.
      CLEAR itb_fieldcat.
      w_cnt = w_cnt + 1.
      itb_fieldcat-fieldname = 'ERDAT'.
      itb_fieldcat-seltext_m = 'Del. Crt Date'.
      itb_fieldcat-col_pos   = w_cnt.
      itb_fieldcat-emphasize = 'X'.
      APPEND itb_fieldcat TO itb_fieldcat.
      CLEAR itb_fieldcat.
      w_cnt = w_cnt + 1.
      itb_fieldcat-fieldname = 'VBELN1'.
      itb_fieldcat-seltext_m = 'Delivery No.'.
      itb_fieldcat-col_pos   = w_cnt.
      itb_fieldcat-emphasize = 'X'.
      APPEND itb_fieldcat TO itb_fieldcat.
      CLEAR itb_fieldcat.
      w_cnt = w_cnt + 1.
      itb_fieldcat-fieldname = 'VBELN2'.
      itb_fieldcat-seltext_m = 'Invoice No.'.
      itb_fieldcat-col_pos   = w_cnt.
      itb_fieldcat-emphasize = 'X'.
      APPEND itb_fieldcat TO itb_fieldcat.
      CLEAR itb_fieldcat.
      w_cnt = w_cnt + 1.
      itb_fieldcat-fieldname = 'ERDAT1'.
      itb_fieldcat-seltext_m = 'Invoice Date'.
      itb_fieldcat-col_pos   = w_cnt.
      itb_fieldcat-emphasize = 'X'.
      APPEND itb_fieldcat TO itb_fieldcat.
      CLEAR itb_fieldcat.
      w_cnt = w_cnt + 1.
      itb_fieldcat-fieldname = 'KUNRG'.
      itb_fieldcat-seltext_m = 'Payer'.
      itb_fieldcat-col_pos   = w_cnt.
      itb_fieldcat-emphasize = 'X'.
      APPEND itb_fieldcat TO itb_fieldcat.
      CLEAR itb_fieldcat.
      w_cnt = w_cnt + 1.
      itb_fieldcat-fieldname = 'NAME1'.
      itb_fieldcat-seltext_m = 'Payer-Description'.
      itb_fieldcat-col_pos   = w_cnt.
      itb_fieldcat-emphasize = 'X'.
      APPEND itb_fieldcat TO itb_fieldcat.
      CLEAR itb_fieldcat.
      w_cnt = w_cnt + 1.
      itb_fieldcat-fieldname = 'REGIO'.
      itb_fieldcat-seltext_m = 'Region'.
      itb_fieldcat-col_pos   = w_cnt.
      itb_fieldcat-emphasize = 'X'.
      APPEND itb_fieldcat TO itb_fieldcat.
      CLEAR itb_fieldcat.
      w_cnt = w_cnt + 1.
      itb_fieldcat-fieldname = 'INCO1'.
      itb_fieldcat-seltext_m = 'Incoterms'.
      itb_fieldcat-col_pos   = w_cnt.
      itb_fieldcat-emphasize = 'X'.
      APPEND itb_fieldcat TO itb_fieldcat.
      CLEAR itb_fieldcat.
      w_cnt = w_cnt + 1.
      itb_fieldcat-fieldname = 'VRKME'.
      itb_fieldcat-seltext_m = 'Billed Quantity'.
      itb_fieldcat-col_pos   = w_cnt.
      itb_fieldcat-emphasize = 'X'.
      APPEND itb_fieldcat TO itb_fieldcat.
      CLEAR itb_fieldcat.
      w_cnt = w_cnt + 1.
      itb_fieldcat-fieldname = 'NTGEW'.
      itb_fieldcat-seltext_m = 'Net weight'.
      itb_fieldcat-col_pos   = w_cnt.
      itb_fieldcat-emphasize = 'X'.
      APPEND itb_fieldcat TO itb_fieldcat.
      CLEAR itb_fieldcat.
      w_cnt = w_cnt + 1.
      itb_fieldcat-fieldname = 'GEWEI'.
      itb_fieldcat-seltext_m = 'Weight Unit'.
      itb_fieldcat-col_pos   = w_cnt.
      itb_fieldcat-emphasize = 'X'.
      APPEND itb_fieldcat TO itb_fieldcat.
      CLEAR itb_fieldcat.
      w_cnt = w_cnt + 1.
      itb_fieldcat-fieldname = 'VOLUM'.
      itb_fieldcat-seltext_m = 'Volume'.
      itb_fieldcat-col_pos   = w_cnt.
      itb_fieldcat-emphasize = 'X'.
      APPEND itb_fieldcat TO itb_fieldcat.
      CLEAR itb_fieldcat.
      w_cnt = w_cnt + 1.
      itb_fieldcat-fieldname = 'VOLEH'.
      itb_fieldcat-seltext_m = 'VOLUME UNIT'.
      itb_fieldcat-col_pos   = w_cnt.
      itb_fieldcat-emphasize = 'X'.
      APPEND itb_fieldcat TO itb_fieldcat.
      CLEAR itb_fieldcat.
      w_cnt = w_cnt + 1.
      itb_fieldcat-fieldname = 'NETWR'.
      itb_fieldcat-seltext_m = 'Net Value'.
      itb_fieldcat-col_pos   = w_cnt.
      itb_fieldcat-emphasize = 'X'.
      itb_fieldcat-ref_tabname  = 'VBRK' .
      itb_fieldcat-ref_fieldname = 'NETWR' .
      itb_fieldcat-do_sum = 'X' .
      APPEND itb_fieldcat TO itb_fieldcat.
      CLEAR itb_fieldcat.
    ENDFORM.
    FORM build_layout.
        lv_layout-no_input           = 'X'.
        lv_layout-colwidth_optimize  = 'X'.
        lv_layout-totals_text        = 'Totals'(201).
        lv_layout-detail_popup       = 'X'.
    ENDFORM.
    FORM build_event.
      DATA i_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
         EXPORTING
           i_list_type = 0
         IMPORTING
           et_events   = lv_events[].
       READ TABLE lv_events WITH KEY name = slis_ev_user_command
                            INTO i_event.
       if sy-subrc = 0.
         MOVE lv_user TO i_event-form.
         APPEND i_event TO lv_events.
       endif.
    ENDFORM.
    FORM build_print.
         lv_print-reserve_lines = '2'.
         lv_print-no_coverpage  = 'X'.
    ENDFORM.
    *&          FUNCTION ALV DISPLAY
    FORM display_alv_report.
    lv_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
       I_CALLBACK_PROGRAM             = lv_repid
       I_CALLBACK_USER_COMMAND        = slis_ev_user_command
       I_CALLBACK_HTML_TOP_OF_PAGE    = 'HTML_TOP_OF_PAGE' " see FORM
       I_CALLBACK_HTML_END_OF_LIST    = 'END_OF_LIST_HTML'   "see FORM
       IS_LAYOUT                      = lv_layout
       IT_FIELDCAT                    = itb_fieldcat[]
       IT_SPECIAL_GROUPS              = lv_tab_group
       I_SAVE                         = 'X'
       IT_EVENTS                      = lv_events
       IS_PRINT                       = lv_print
      TABLES
        t_outtab                      = i_ordertab
      EXCEPTIONS
        PROGRAM_ERROR                 = 1
        OTHERS                        = 2.
    IF sy-subrc <> 0.
    ENDIF.
    ENDFORM.
    *&      Form  html_top_of_page
    FORM html_top_of_page USING document TYPE REF TO cl_dd_document.
      DATA: text TYPE sdydo_text_element.
      CALL METHOD document->add_gap
        EXPORTING
          width = 100.
      text =  'Cadbury: Daily Audit of Orders'.
      CALL METHOD document->add_text
        EXPORTING
          text      = text
          sap_style = 'HEADING'.
      CALL METHOD document->new_line.
      CALL METHOD document->new_line.
      CALL METHOD document->new_line.
      text = 'User Name : '.
      CALL METHOD document->add_text
        EXPORTING
          text         = text
          sap_emphasis = 'Strong'.
      CALL METHOD document->add_gap
        EXPORTING
          width = 6.
      text = sy-uname.
      CALL METHOD document->add_text
        EXPORTING
          text      = text
          sap_style = 'Key'.
      CALL METHOD document->add_gap
        EXPORTING
          width = 50.
      text = 'Date : '.
      CALL METHOD document->add_text
        EXPORTING
          text         = text
          sap_emphasis = 'Strong'.
      CALL METHOD document->add_gap
        EXPORTING
          width = 6.
      text = sy-datum.
      CALL METHOD document->add_text
        EXPORTING
          text      = text
          sap_style = 'Key'.
      CALL METHOD document->add_gap
        EXPORTING
          width = 50.
      text = 'Time : '.
      CALL METHOD document->add_text
        EXPORTING
          text         = text
          sap_emphasis = 'Strong'.
      CALL METHOD document->add_gap
        EXPORTING
          width = 6.
      text = sy-uzeit.
      CALL METHOD document->add_text
        EXPORTING
          text      = text
          sap_style = 'Key'.
    ENDFORM.
    FORM end_of_list_html USING end TYPE REF TO cl_dd_document.
    DATA: ls_text TYPE sdydo_text_element,
        l_grid TYPE REF TO cl_gui_alv_grid,
        f(14) TYPE c VALUE 'SET_ROW_HEIGHT',
        w_lines type i,
        w_lines1(9) type n.
    DESCRIBE TABLE i_ordertab LINES w_lines.
    w_lines1 = w_lines.
    concatenate: 'TOTAL NUMBER OF RECORDS SELECTED:  ' w_lines1 INTO ls_text
                                  SEPARATED BY space.
    adds test (via variable)
       CALL METHOD end->add_text
      EXPORTING
        text = ls_text
        sap_emphasis = 'strong'.
    adds new line (start new line)
       CALL METHOD end->new_line.
    *set height of this section
       CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING
         e_grid = l_grid.
        CALL METHOD l_grid->parent->parent->(f)
        EXPORTING
          id = 3
          height = 14.
    ENDFORM. "end_of_list_html.
    --END OF THE REPORT--

    Hi
    1. first remove the ENDSELECT..use INTO table itab or INTO CORRESPONDING fields, Since you are joining the  more tables this will take lot of time.
    2. You are just using two fields from LIKP as selection screen  fields to fetch the so much data.
    see the table linkings apartfrom KUNNR between the tables
    LIKP-VBELN = LIPS-VBELN
    LIPS-VGBEL = VBAK-VBELN and  LIPS-VGPOS = VBAP-POSNR
    and
    VBRP-AUBEL = VBAK-VBELN and VBRP-AUPOS = VBAP-POSNR and
    VBRP-VGBEL = LIKP-VBELN  and VBRP-VGPOS = LIPS-POSNR
    use the above links and code again.
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Problem in alv report coumn header in the background while using salv

    Hi  all,
            now i am working on  alv report for this i have used salv i mean oops alv ,So here i am facing one issue while executing the report  in background
            the report column headers are not displaying properly as it is displaying in front end.
           In the back ground it is always displaying column header as data element field label short text. i have written a code to pick the long text
           but it is working fine if run the report in the frontend where as in the backgroiund it is always displaying short text but it is wrong.
    here i am attaching the output screen shots in front end and background.

    Hi Satish,
    I have tried this scenario with Reuse ALV grid 1st i found the same issue as u said in background job,
    then i set in field catalog as,
    wa_fcat-ddictxt = 'L'. Now its working fine. L stands for long text.
    Before...
    After...
    For LVC u can try the below fields in fieldcatlog.
    COLDDICTXT = 'L'.
    SELDDICTXT = 'L'

  • Eliminate page heading in the spool of ALV report

    Hi,
    We are running the ALV report in the background, and when we view the spool
    the page heading and the column heading is displayed for all the pages, Is there some way to
    eliminate this.
    The download from the on-line exec is fine,but the download from the spool includes the column
    headings for each page. Is there some way to check if the ALV report is run in the batch mode
    and to disable the heading from Page 2 to N.
    Appreciate any input.
    Thank you
    Lalitha

    Hi,
    I need to avoid the column headings also, I need the heading in the first page, but not on the subsequent pages.
    Is there any setting in the ALV function modules to prevent this ?
    So wanted to know if there is some setting to accomplish that.
    Thank you
    Lalitha

  • How to remove header on last page of the report?

    I am working on a RTF template for PO report. This is the format of the rtf i have.
    <?start:body?>
    <?for-each@section:G_HEADERS?>
    All header fields
    <?for-each:G_LINES?>
    All Line Fields
    <?end for-each?> --Line End
    <?end for-each?> --Header End
    <?end body?>
    Give Section Break <Next Page>
    Terms and Condition should come here on a new page
    When I insert a section break for new page, the header that is on my 1st page of the template is repeating. Is there a way that I can stop the header from repeating on the last page? Please help me out with this issue.
    Thanks,
    Swetha

    Thanks jimr for the response. This solved my problem.
    The steps I followed are:
    Click on section2 header. click on 'Link to previous'button on the headers toolbar so the link between section1 and section2 is removed.
    Remove the header on the new page (section2). The header on the 1st page is retained while the header on the 2nd page is removed.
    Thanks,
    Swetha
    Message was edited by:
    Swetha

  • How to get header in the ALV report

    Hi
    I want to print header in the ALV report.But i am not getting that.Plz see my program it is getting error and also not printing header.If there is any error means plz give me the solution.In this program there is an error.
    REPORT  ZREPORT_ALV .
    TYPE-POOLS : slis.
    tables:vbak,vbap.
    DATA:  report_id LIKE sy-repid.
    DATA: I_LAYOUT TYPE SLIS_LAYOUT_ALV.
    data: heading        TYPE slis_t_listheader,
          wa_header      TYPE slis_listheader,
         events         TYPE slis_t_event.
    data: l_string type c.
    data: ivariant(1) type c,
          itvariant like disvariant,
          w_variant like disvariant.
    initialization.
    REPORT_ID = SY-REPID.
    PERFORM pgm. "F1000_LAYOUT_INIT. "using I_LAYOUT.
    ivariant = 'A'.
    *PERFORM init.
    itvariant = w_variant.
    select-options:so_vbeln for vbap-vbeln.
    data:itab like vbak occurs 0 with header line.
    data:itab1 like vbap occurs 0 with header line.
    start-of-selection.
    select * from vbak into table itab where vbeln in so_vbeln.
    if not itab[] is initial.
    select * from vbap into table itab1
    for all entries in itab
    where vbeln = itab-vbeln.
    endif.
    data:ls_fieldcat TYPE slis_fieldcat_alv,
    lt_fieldcat1  TYPE slis_t_fieldcat_alv.
    ****For alv display
    IF NOT itab1[] IS INITIAL.
       DEFINE ls_fieldcat.
       add 1 to ls_fieldcat-col_pos.
        ls_fieldcat-fieldname    = &1.
        ls_fieldcat-outputlen    = &2.
        ls_fieldcat-seltext_l    = &3.
         ls_fieldcat-emphasize  = &4.
        append ls_fieldcat to lt_fieldcat1.
        clear ls_fieldcat.
      END-OF-DEFINITION.
        ls_fieldcat 'VBELN'           '10'     'Sales Order Number'.
       ls_fieldcat 'POSNR'           '6'        'SO Item'.
        ls_fieldcat 'MATNR'           '13'      'Material No'.
    m_fieldcat1 'NETWR'           '13'        'Amount'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
      I_CALLBACK_PROGRAM                = sy-repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
    I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
       IS_LAYOUT                         =  I_LAYOUT
       IT_FIELDCAT                       =  lt_fieldcat1
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =   ITVARIANT
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      TABLES
        T_OUTTAB                          =  itab1
    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.
    endif.
    CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
       I_SAVE              = ivariant
      CHANGING
       CS_VARIANT          = itvariant
    EXCEPTIONS
      WRONG_INPUT         = 1
      NOT_FOUND           = 2
      PROGRAM_ERROR       = 3
      OTHERS              = 4
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    FORM  pgm. "F1000_LAYOUT_INIT. "USING I_LAYOUT TYPE SLIS_LAYOUT_ALV.
    CLEAR I_LAYOUT.
    i_layout-colwidth_optimize = 'X'.
    I_LAYOUT-key_hotspot = u2018Xu2019.
    I_LAYOUT-hotspot_fieldname =  MATNR.
    ENDFORM.
    *regarding logo and header,,,,
    *first store the logo in T-code OAOR, then call that in your report.....
    *data: heading        TYPE slis_t_listheader,
         wa_header      TYPE slis_listheader,
        events         TYPE slis_t_event.
    To display TOP_OF_PAGE.
    FORM top_of_page.
      DATA : text(40),txtdt(40).
      CLEAR l_string.
      l_string = 'JCB India Limited'(hd2).
      wa_header-typ  = 'H'.
      wa_header-info = l_string.
      APPEND wa_header TO heading.                              " index 1.
      CLEAR l_string.
      WRITE :'Number of records:' TO text,'dbcnt' TO text+20 LEFT-JUSTIFIED.
      wa_header-typ  = 'S'.
      wa_header-info = text.
      APPEND wa_header TO heading.
    CLEAR l_string.
    wa_header-typ  = 'S'.
    WRITE : 'Report Run Date  :' TO txtdt,sy-datum TO txtdt+20 DD/MM/YY.
    WRITE sy-datum TO dat DD/MM/YY.
    wa_header-info = txtdt.
    APPEND wa_header TO heading.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
         i_logo             = 'ENJOYSAP_LOGO'
          it_list_commentary = heading.
      CLEAR heading.
    ENDFORM.                    "top_of_page
    *to execute top-of-page you have to create events.
    *for ex......
    FORM create_event USING p_events TYPE slis_t_event.
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = p_events.
      READ TABLE p_events WITH KEY name = slis_ev_top_of_page
                             INTO ls_event.
      IF sy-subrc = 0.
        MOVE formname_top_of_page TO ls_event-form.
        APPEND ls_event TO p_events.
      ENDIF.
    ENDFORM.                    " create_event

    Hi,
       Find below code for your question, you may get some idea,,
    *& Report  ZACTIONGRIDPRACTICE
    REPORT  ZACTIONGRIDPRACTICE.
    *data declarations.....
    TYPE-POOLS SLIS.
    TABLES : T529T ,PA0000.
    data : gd_repid type  sy-repid.
    DATA : LD_COLOR(10) TYPE N.
    DATA : GD_TAB_GROUP TYPE SLIS_T_SP_GROUP_ALV.
    Data:  is_fieldcat TYPE slis_fieldcat_alv.
    DATA : GD_LAYOUT TYPE SLIS_LAYOUT_ALV.
    DATA : GD_DATUM TYPE DATUM.
    DATA : BEGIN OF WA_TABLE,
                    MASSN TYPE T529T-MASSN,
                    MNTXT TYPE T529T-MNTXT,
                    userg type userg,
                    TOTAL TYPE I ,
                    begda type begda,
                    endda type endda,
                    april type i,
                    SLNO TYPE I,
                      LINE_COLOR(4) TYPE C,
                    END OF WA_TABLE,
                    IT_TABLE LIKE TABLE OF WA_TABLE.
    data : april type i.
    DATA : TEMP TYPE C.
    data :    LT_PA0000 TYPE TABLE OF PA0000,
              LT_PA0000_T typE TABLE OF PA0000 with header line.
    DATA : IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
            WA_FCAT LIKE LINE OF IT_FCAT.
    DATA : IT_EVENTS TYPE SLIS_T_EVENT,
            WA_EVENTS LIKE LINE OF IT_EVENTS.
            wa_events-form = 'HEADER'.
    WA_EVENTS-NAME = 'TOP_OF_PAGE'.
    APPEND WA_EVENTS TO IT_EVENTS.
    PERFORM HEADER.
    DATA : SLNO TYPE I.
    DATA : lv_output      TYPE  dats.
    CALL FUNCTION 'ZHR_RE_BE_CALC_START_DATE'
      EXPORTING
        id_daberi   = sy-datum
      IMPORTING
        ed_date_cor = lv_output.
    select-options...
    selection-screen BEGIN OF BLOCK B WITH FRAME TITLE TEXT-003.
    select-options : s_date for sy-datum OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK B.
    lv_output = sy-datum - 27.
    INITIALIZATION.
    S_DATE-LOW = lv_output.
    S_DATE-HIGH = SY-DATUM.
    S_DATE-SIGN = 'I'.
    S_DATE-OPTION = 'BT'.
    APPEND s_date.
    *AT SELECTION-SCREEN ON S_DATE.
    *SELECT MASSN INTO TABLE IT_TABLE FROM PA0000 WHERE BEGDA IN S_DATE.
    *SELECT STATEMENTS....
    start-of-selection.
      SELECT   t529t~MASSN t529t~MNTXT  INTO TABLE IT_table  FROM T529T where SPRSL EQ 'E' and t529t~massn in ('10','13','16','20','28','30','45','01','03') .
    DATUM IN S_DATE.
    PERFORM LAYOUT.
      loop at it_table into wa_table.
    LD_COLOR = 2.
      LD_COLOR = LD_COLOR + 1.
    if LD_COLOR = 8.
    LD_COLOR = 1.
    endif.
    concatenate 'C' '1' '11'  into wa_table-LINE_COLOR . "='C410'.
    modify it_table from wa_table.
    endloop.
      LOOP AT IT_TABLE INTO WA_TABLE." = 'C410'.
    select massn from pa0000 into table lt_pa0000 where begda in s_date and  massn = wa_table-massn.
    *write : / sy-dbcnt.  gt s_date-low and endda lt s_date-high
    *DESCRIBE TABLE LT_PA0000_t LINES LV_LINES.
    move sy-dbcnt to wa_table-total.
    READ TABLE lt_pa0000 INTO LT_PA0000_T WITH KEY MASSN = wa_TABLE-MASSN BINARY SEARCH.
    DESCRIBE TABLE LT_PA0000_t LINES LV_LINES.
    MOVE  LV_LINES to  wa_TABLE-TOTAL.
      MODIFY IT_TABLE FROM WA_TABLE.
    MOVE SY-TABIX TO WA_TABLE-SLNO.
      MODIFY IT_TABLE FROM WA_TABLE.
    REFRESH : LT_PA0000_t.
    CLEAR : LV_LINES.
      ENDLOOP.
    loop at it_table into wa_table.
    SELECT MASSN FROM PA0000 INTO TABLE lt_pa0000 where begda between '01.02.2008' and '20.02.2008'.
    MOVE SY-DBCNT TO   WA_TABLE-APRIL.
    MODIFY IT_TABLE FROM WA_TABLE.
    *endloop.
    *PERFORM STATEMENTS...
    PERFORM FCAT USING '1' 'MASSN' 'ACTIONCODE'.
    PERFORM FCAT USING '2' 'MNTXT' 'ACTION TYPE'.
    PERFORM fcat USING '3' 'TOTAL' 'TOTAL'.
    DEFINE m_fieldcat.
        is_fieldcat-fieldname = &1.
        is_fieldcat-hotspot = &2.
        is_fieldcat-seltext_m = &3.
        is_fieldcat-col_pos = &4.
        is_fieldcat-outputlen = &5.
        is_fieldcat-hotspot = &6.
        append is_fieldcat to it_fcat.
        clear is_fieldcat.
      END-OF-DEFINITION.
       m_fieldcat 'SLNO' '' Text-012 '1' '17'  ''.
      m_fieldcat 'MASSN' '' Text-010 '2' '40'  ''.
      m_fieldcat 'MNTXT'  ''  Text-009  '3' '50' ''  .
      m_fieldcat 'TOTAL'  ''  Text-011  '4' '10' 'X'.
      m_fieldcat 'april'  ''  Text-013  '5' '10' 'X'.
    *FOR DISPLAYING THE RECORDS...
    gd_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = gd_repid
      IS_LAYOUT = GD_LAYOUT
      I_CALLBACK_USER_COMMAND           = ' '
       I_GRID_TITLE                      = 'REPORT'
       IS_LAYOUT                         = gd_LAYOUT
       IT_FIELDCAT                       = IT_FCAT
       I_SAVE                            = 'X'
       IT_EVENTS                         = IT_EVENTS
      TABLES
        T_OUTTAB                          = IT_TABLE.
    **&      Form  FCAT
    *FORM FCAT  USING   FP_COL_POS
                     FP_FIELDNAME
                     FP_SELTEXT_M.
    WA_FCAT-COL_POS = FP_COL_POS.
    WA_FCAT-FIELDNAME = FP_FIELDNAME.
    wa_fcat-seltext_m = fp_seltext_m.
    APPEND WA_FCAT TO IT_FCAT.
    ENDFORM.
    *&      Form  HEADER
          text
    -->  p1        text
    <--  p2        text
    form header .
      DATA : IT_HEADER TYPE SLIS_T_LISTHEADER,
            WA_HEADER LIKE LINE OF it_header.
      WA_HEADER-TYP = 'H'.
      WA_HEADER-INFO = 'ACTION TYPE REPORT'.
      APPEND WA_HEADER TO IT_HEADER.
      wa_header-typ  = 'S'.
      wa_header-key = Text-022.
      CONCATENATE  s_date-low+6(2) '.'
                   s_date-low+4(2) '.'
                   s_date-low(4)
                   temp
                   '.     TO      .'
                   s_date-high+6(2) '.'
                   s_date-high+4(2) '.'
                   s_date-high(4)
                   INTO wa_header-info SEPARATED BY space.
      APPEND wa_header TO it_header.
      CLEAR wa_header.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = IT_HEADER
          I_LOGO             = 'HRRU_51050061'.
    *select single bstkd into CORRESPONDING FIELDS OF gt_vbkd
    *from vbkd where vbeln = rt_outtab-vgbel
    *and posnr = '000000'.
    *rt_outtab-bstkd = gt_vbkd-bstkd.
    ENDFORM.                    " HEADER
    *&      Form  LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM LAYOUT .
    GD_LAYOUT-NO_INPUT = ''.
    gd_layout-colwidth_optimize = ''.
    gd_layout-totals_text = 'TOTALS'(201).
    gd_layout-info_fieldname =      'LINE_COLOR'.
    ENDFORM.                    " LAYOUT

  • Sorting the report by clicking the column header

    Hello,
    Currently working on a requirement where i need to sort the report by clicking the column header. Can anyone please help me on this.
    Suppose i have 3 colums deptno,dname,sal fields in my report. if i click deptno column header,  report has to sort by deptno.Like that i need for other columns also.
    Any help is really appreciated
    Thanks
    Ram

    Hello,
    You can sort the fields using method suggested by Cauvery. However if you would like to have Ascending/ Descending sort order control at column header, then would require to implement few additional steps.
    First do the sorting of field using the way suggested by Cauvery. Once sorting is done, right  click on the column name and  select the option ' Bind Sort Control'. You will see the sorted field in the window. select the field and click ok.
    Now you would get 2 arrows on column. If you click upper arrow, fields would be sorted in Ascending Order and if you click on down arrow, it would  be in Descending order.
    Regards,
    Chinmay Athavale

Maybe you are looking for

  • FTP and DHCP Server on Windows Server 2012

    Our company recently bought several Dell Wyse R10L Devices from another company. We can use these to make remote connections to a remote server but we have a problem when we use two monitors. The picture stretches across two monitors. On the official

  • Trying to download iOS 5 it says there is a problem with my Windows Installer Package?Help?

    I'm trying to download the iOS 5 and I get almost all the way done but then it stops when it's on Status and goes to an error and says "There is a problem with this windows Installer Package.  A program run as part of the set up did not finish as exp

  • Hibernate not working with linux 3.7

    Greetings folks. Since kernel 3.7 I have not been able to hibernate my computer. Suspension, though, works fine. I do not know how to log that kernel panic, I manage to shoot a video with my mobile phone and apparently there is a WARNING: at arch/x86

  • HP 6313 ALL-IN-ONE

    My Hp 6313 All-in-one printer keep on saying paper jam but there is no paper any where in the printer, Can someone help Please

  • Is uncompressed 8-bit PAL 48 KHz the most compatible format for a HDV dvd

    I have shot a project in HDV, edited in HDV sequence. I now want to produce a dvd, that is compatible on both widescreen and 4:3 tv's. A friend suggested exporting a quicktime movie in uncompressed 8-bit PAL 48 KHz to ensure maximum compatibility. Wo