Display data on top of page and sort issue. Pls help

Hi guys,
I need some help. I can't seem to get the code to work. Below is my code to display the ALV. It works fine but I want it to print some top of page details according to the SORT (grouping) but the sort isn't even working?
http://i987.photobucket.com/albums/ae354/runningandrew/2010/Other_Random/Screenshot1.jpg
HEre is screenshot of the output
Sales Order Number : 1100001541      
Purchase Order Number : 4500352015   
Distributor Number : 20061            <====
Ship To Name : ALPHA EZZ EL ARAB CO.,
Order Date : 29.04.2010              
Delivery Date : 29.04.2010           
There should be another one printing  but its not.
Sales Order Number : 1100001542       <=====
Purchase Order Number : 4500352015   
Distributor Number : 20063            <=====
Ship To Name : ALPHA EZZ EL ARAB CO.,
Order Date : 29.04.2010              
Delivery Date : 29.04.2010           
My it_report structure is
BEGIN OF t_report,
         ebeln      TYPE bapivbeln-vbeln,
         purch_no   TYPE bstnk,
         kunnr      TYPE kunnr,
         wename1    TYPE name1_gp,
         order_date TYPE edatu_vbak,
         vdate      TYPE vbak-vdatu,
         matnr      TYPE matnr,
         matnr_txt  TYPE arktx,
         qty        TYPE kwmeng,
       END OF t_report.
Here are the sort fields
PERFORM add_sort_key USING: 'EBELN'      'X'    'X',
                              'PURCH_NO'   'X'    'X',
                              'KUNNR'      'X'    'X'.
FORM add_sort_key  USING  pv_field    TYPE any
                          pv_ascen    TYPE any
                          pv_group    TYPE any.
  it_alv_sort-fieldname = pv_field.
  it_alv_sort-up        = pv_ascen.
  it_alv_sort-group     = pv_group.
  APPEND it_alv_sort.
  CLEAR it_alv_sort.
  it_sort_new-fieldname = pv_field.
  APPEND it_sort_new.
  CLEAR it_sort_new.
ENDFORM.                    " ADD_SORT_KEY
Here is my display ALV part
v_repid = sy-repid.
  CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
    EXPORTING
      i_callback_program = v_repid.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
      EXPORTING
        is_layout                  = l_alv_layout
        it_fieldcat                = it_alv_fieldcat[]
        i_tabname                  = c_it_report
        it_events                  = it_alv_events[]
        it_sort                    = it_sort_new[]
      TABLES
        t_outtab                   = it_report
Edited by: Slow ABAPer on Apr 29, 2010 5:43 AM

Hi,
You should always put the code in the tags as :
for it to be displayed as proper code.
With Regards,
Samreen.

Similar Messages

  • Tap picture in Photos App and rotate - issue / Pls help

    Hello all,
    Subject: iPhone 3Gs / 4.0.1
    Application: Photos App (default Apple application)
    Issue: tapping landscape pictures with phone in vertical position and rotate them goes on black screen
    Description:
    I am with iphone in normal (vertical position) and i go to photos app in order to scroll some pictures that were taken in landscape position.
    Everything is normal. I double tap it in order to zoom it.
    I rotate the phone in landscape position and the screen goes BLACK.
    I rotate it in portrait mode and picture is back on screen.
    Question: where is the problem ?
    Tests results:
    I tried to make several tests to identify the problem.
    Before I want to say that i tried restore / reset / etc.
    1. The pictures that are taken in portrait mode are not affected on double tap and rotate thing.
    2. Works if you zoom manualy (not by double tap) and scroll to a corner of a landscape picture before you rotate the phone.
    I add that any other application works fine on rotate / zoom / etc even photos app works OK if i dont double tap the picture before i rotate it.
    Still after the tests i am not able to identify where is the problem so i ask the comunity if can help me to identify it.
    thx in advance,

    Is anyone with same model 3gs / 4.0.1 who can check if have same problem ?
    Are only 4 steps:
    1. Open Photo App with phone in vertical position
    2. Select a landscape picture
    3. Double tape it (will zoom automaticaly)
    4. Rotate the phone in landscape position and write down the results.
    thx guys for your help,

  • Reg: Download alv grid data with top of page into excel sheet

    Hi All,
    I have a selection screen with radio button for download .
    If that radio button was selected then the data will download into excel sheet (like if we execute normal ALV grid display from there we can download top-of-page and body as it is).
    AOO : 2009P               
    Fiscal year : 2009               
    Posting period : 00               
    Local Currency : USD               
    CO Area Currency :               
    Accounting standard:               
    Sector : 23               
    BB code     Period Value LC     Periodic Quantity
    AHDKGKAJ   200                         0

    Did not get your question

  • I can get text messages and get this at the top of page 'Messages (-1)' can anyone help please?

    I can not get or see any text messages and get this at the top of page 'Messages (-1)' can anyone help please?

    For details of how to restore it, see https://support.mozilla.com/kb/menu+bar+is+missing

  • Can anyone help me in iphone mobile, i had lost my data in phone, because i restore my phone without backup, how can i get my old data, i lost my photos and videos... help me

    can anyone help me in iphone mobile, i had lost my data in phone, because i restore my phone without backup, how can i get my old data, i lost my photos and videos... help me

    Sorry Raj,
    If you did not back up your information, and you have now restored your phone, then your information is not recoverable.
    Sorry,
    GB

  • How do I delete my old iMessage email and change to my current one, that Im using when I buy apps and so on. The old one wont go away when I turn iMessage on and of again. pls help

    How do I delete my old iMessage email and change to my current one, that Im using when I buy apps and so on. The old one wont go away when I turn iMessage on and of again. pls help
    Anyone had the same?

    How do I delete my old iMessage email and change to my current one, that Im using when I buy apps and so on. The old one wont go away when I turn iMessage on and of again. pls help
    Anyone had the same?

  • When printing, the name & web address accross top of page and date at bottom are garbled, why?

    I just downloaded the ff4 yesterday. When I printed pages from the web the name of the site and address that prints across the top of each page is garbled and so is the page # and date that prints across the bottom of each page. How do I correct this. I need this info. Example: printing bank balances, I can compare balances based on the date I accessed which is printed at the bottom of each page. I never had this problem with the previous version of firefox.

    Does that happen on all pages or only on some?
    You can try to reset the print prefs on the about:config page.<br />
    * http://kb.mozillazine.org/Problems_printing_web_pages
    You can open about: pages via the location bar like you open a website.

  • HELP! retrieving and displaying data with JavaBean but Page is Blank!!

    Please help. I am trying to display data for user by appending the userid as parameter in the URL but I get a blank page and nothing displays in my jsp page.
    //info.java
    package database;
    public class Info{
    private String user;
    public Info(){
    public void setuser(String user)
        this.user = user;
      public String getuser()
        return user;
       public Collection getInfo() throws NamingException, SQLException {
                    ArrayList list = new ArrayList();
                    InitialContext initCtx = new InitialContext();
                    //OTHER CONNECTION STATEMENTS
    String sql = "SELECT ADDR FROM TABLENAME WHERE user=' ?'";
                    try {
                            conn = ds.getConnection();
    pstmt = conn.prepareStatement(sql);
    pstmt.setString(1, this.user);
    rs = pstmt.executeQuery();
    while(rs.next()) {
            InfoBean tsel = new InfoBean(rs.getString("addr"), this.user);
    list.add(tsel);
          //catch SQLexception
    } finally {
    try{
               if (initCtx != null)  initCtx.close();
            if (rs != null)  rs.close();
            if (pstmt != null) pstmt.close();
            if (conn != null) conn.close();
    //catch SQLException statment
          return list;
    //InfoBean.java
    package database;
    public class infoBean
    private String user;
    private String addr;
    public infoBean(){
    public infoBean(String addr, String user)
    this.user = user;
    this.addr = addr;
    public String getaddr()
    return addr;
    public String getuser(){
    return user;
    public void setaddr(String addr){
    this.addr = addr;
    public void setuser(String user){
    this.user = user;
    //index.jsp
    <jsp:useBean id="row" class="database.Info" scope="request">
    <jsp:setProperty name="row" property="user" param="user"/>
    </jsp:useBean>
    <c:if test=${!empty param.user}">
    <c:forEach items="${row.info}" var="t1">
    <td>${t1.addr}</td<>
    </c:forEach>
    </c:if>

    OK, before we all go rummaging through your code--does your SQL statement return values when you execute it as a stand alone adhoc query?

  • To hide some headings in top of page during sorting of fields...

    dear experts,
    I have a report in which i am fetching multiple company codes in report and in o/p they are displayed according to company codes, but during sorting of any field in list i want to hide some of the headings in top of page...for any of the radio buttons the headings which i want to hide are...
    1) company code
    2) opening balance and
    3) closing balance
    please help...my code is as follows...
    TYPE-POOLS:slis.
    TABLES:bkpf,bseg,kna1,bsid.
    TYPES:BEGIN OF ty_bsad,
    bukrs TYPE bsad-bukrs,
    gjahr TYPE bsad-gjahr,
    kunnr TYPE bsad-kunnr,
    belnr TYPE bsad-belnr,
    budat TYPE bsad-budat,
    xblnr TYPE bsad-xblnr,
    bldat TYPE bsad-bldat,
    augdt TYPE bsad-augdt,
    dmbtr type bsad-dmbtr,
    END OF ty_bsad.
    TYPES:BEGIN OF ty_kna1,
    kunnr TYPE kna1-kunnr,
    name1 TYPE kna1-name1,
    city  TYPE kna1-ort01,
    END OF ty_kna1.
    TYPES:BEGIN OF ty_knb1,
    kunnr TYPE knb1-kunnr,
    bukrs TYPE knb1-bukrs,
    vzskz TYPE knb1-vzskz,
    END OF ty_knb1.
    TYPES:BEGIN OF ty_bkpf,
    bukrs TYPE bkpf-bukrs,
    gjahr TYPE bkpf-gjahr,
    hwaer TYPE bkpf-hwaer,
    kursf TYPE bkpf-kursf,
    bktxt TYPE bkpf-bktxt,
    belnr TYPE bkpf-belnr,
    budat TYPE bkpf-budat,
    xblnr TYPE bkpf-xblnr,
    bldat TYPE bkpf-bldat,
    waers TYPE bkpf-waers,
    END OF ty_bkpf.
    TYPES:BEGIN OF ty_bsid,
    bukrs TYPE bsid-bukrs,
    gjahr TYPE bsid-gjahr,
    kunnr TYPE bsid-kunnr,
    belnr TYPE bsid-belnr,
    budat TYPE bsid-budat,
    xblnr TYPE bsid-xblnr,
    bldat TYPE bsid-bldat,
    augdt TYPE bsid-augdt,
    dmbtr type bsid-dmbtr,
    END OF ty_bsid.
    TYPES:BEGIN OF ty_bseg,
    bukrs TYPE bseg-bukrs,
    gjahr TYPE bseg-gjahr,
    belnr TYPE bseg-belnr,
    kunnr TYPE bseg-kunnr,
    werks TYPE bseg-werks,
    umskz TYPE bseg-umskz,
    zuonr TYPE bseg-zuonr,
    dmbtr TYPE bseg-dmbtr,
    zbd1t TYPE bseg-zbd1t,
    sgtxt TYPE bseg-sgtxt,
    shkzg TYPE bseg-shkzg,
    zterm TYPE bseg-zterm,
    zfbdt TYPE bseg-zfbdt,
    END OF ty_bseg.
    TYPES:BEGIN OF ty_open,
    bukrs TYPE bsid-bukrs,
    shkzg TYPE bsid-shkzg,
    dmbtr TYPE bsid-dmbtr,
    umskz TYPE bsid-umskz,
    END OF ty_open.
    **Main internal Table
    **For both open & cleared Customer
    DATA:BEGIN OF it_main_all OCCURS 0,
    bukrs TYPE bsad-bukrs,
    gjahr TYPE bsad-gjahr,
    kunnr TYPE bsad-kunnr,
    belnr TYPE bsad-belnr,
    budat TYPE bsad-budat,
    xblnr TYPE bsad-xblnr,
    bldat TYPE bsad-bldat,
    augdt TYPE bsad-augdt,
    dmbtr type bsad-dmbtr,
    hwaer TYPE bkpf-hwaer,
    kursf TYPE bkpf-kursf,
    bktxt TYPE bkpf-bktxt,
    name TYPE kna1-name1,
    city TYPE kna1-ort01,
    vzskz TYPE knb1-vzskz,
    lights TYPE c,
    END OF it_main_all.
    **For Opening balance
    DATA:BEGIN OF it_main_open1 OCCURS 0,
    bukrs TYPE bsid-bukrs,
    opening TYPE p DECIMALS 2,
    END OF it_main_open1.
    **Internal tables
    DATA : t_bsad TYPE STANDARD TABLE OF ty_bsad,
    w_bsad TYPE ty_bsad,
    t_bkpf TYPE STANDARD TABLE OF ty_bkpf,
    w_bkpf TYPE ty_bkpf,
    t_kna1 TYPE STANDARD TABLE OF ty_kna1,
    w_kna1 TYPE ty_kna1,
    t_knb1 TYPE STANDARD TABLE OF ty_knb1,
    w_knb1 TYPE ty_knb1,
    t_bsid TYPE STANDARD TABLE OF ty_bsid,
    w_bsid TYPE ty_bsid,
    t_bseg TYPE STANDARD TABLE OF ty_bseg,
    w_bseg TYPE ty_bseg,
    t_open TYPE STANDARD TABLE OF ty_open,
    w_open TYPE ty_open.
    **ALV display variables
    DATA:fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
    gd_layout TYPE slis_layout_alv,
    gt_events TYPE slis_t_event,
    gt_list_top_of_page TYPE slis_t_listheader,
    heading TYPE slis_t_listheader,
    g_save(1) TYPE c,
    g_exit(1) TYPE c,
    g_variant TYPE disvariant,
    gx_variant TYPE disvariant,
    it_sort TYPE slis_t_sortinfo_alv,
    x_sort TYPE slis_sortinfo_alv.
    **Selection Screens
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS:s_bukrs FOR bkpf-bukrs OBLIGATORY,
    s_gjahr FOR bkpf-gjahr OBLIGATORY NO-EXTENSION NO INTERVALS,
    s_kunnr FOR bseg-kunnr OBLIGATORY NO-EXTENSION NO INTERVALS,
    s_name1 FOR kna1-name1 NO-EXTENSION NO INTERVALS,
    s_date FOR bkpf-budat OBLIGATORY,
    s_umskz FOR bsid-umskz.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
    PARAMETERS:xnorm AS CHECKBOX DEFAULT 'X',
    xshbv AS CHECKBOX.
    SELECTION-SCREEN END OF BLOCK b3.
    DATA:golive TYPE d VALUE '20080401',
    date TYPE d,
    date1 TYPE d,
    closing TYPE p DECIMALS 2 VALUE 0,
    opening TYPE p DECIMALS 2 VALUE 0.
    **Start Of Selection
    START-OF-SELECTION.
    PERFORM get_data.
    PERFORM events.
    PERFORM f_layout.
    PERFORM display.
    FORM get_data .
    **Open Customers master data
    SELECT
    bukrs gjahr kunnr belnr budat xblnr bldat augdt dmbtr
    FROM bsid
    INTO TABLE t_bsid
    WHERE bukrs IN s_bukrs
    AND gjahr IN s_gjahr
    AND kunnr IN s_kunnr
    AND budat IN s_date
    AND umskz IN s_umskz.
    **Clear Customers master data
    SELECT
    bukrs gjahr kunnr belnr budat xblnr bldat augdt dmbtr
    FROM bsad
    INTO TABLE t_bsad
    WHERE bukrs IN s_bukrs
    AND gjahr IN s_gjahr
    AND kunnr IN s_kunnr
    AND budat IN s_date
    AND umskz IN s_umskz.
    ****Open Customers data
    IF NOT t_bsid[] IS INITIAL.
    SORT t_bsid BY bukrs bldat.
    SELECT
    bukrs gjahr hwaer kursf bktxt belnr
    FROM bkpf
    INTO CORRESPONDING FIELDS OF TABLE t_bkpf
    FOR ALL ENTRIES IN t_bsid
    WHERE bukrs = t_bsid-bukrs
    AND gjahr = t_bsid-gjahr
    AND belnr = t_bsid-belnr.
    SORT t_bkpf.
    SELECT
    kunnr name1 ort01
    FROM kna1
    INTO TABLE t_kna1
    FOR ALL ENTRIES IN t_bsid
    WHERE kunnr = t_bsid-kunnr
    AND name1 IN s_name1.
    SORT t_kna1.
    SELECT
    kunnr bukrs vzskz
    FROM knb1
    INTO TABLE t_knb1
    FOR ALL ENTRIES IN t_bsid
    WHERE kunnr = t_bsid-kunnr
    AND bukrs = t_bsid-bukrs.
    SORT t_knb1.
    LOOP AT t_bsid INTO w_bsid.
    it_main_all-bukrs = w_bsid-bukrs.
    it_main_all-kunnr = w_bsid-kunnr.
    it_main_all-gjahr = w_bsid-gjahr.
    it_main_all-belnr = w_bsid-belnr.
    it_main_all-budat = w_bsid-budat.
    it_main_all-xblnr = w_bsid-xblnr.
    it_main_all-bldat = w_bsid-bldat.
    READ TABLE t_bkpf INTO w_bkpf WITH KEY bukrs = w_bsid-bukrs gjahr = w_bsid-gjahr belnr = w_bsid-belnr BINARY SEARCH.
    IF sy-subrc EQ 0.
    it_main_all-hwaer = w_bkpf-hwaer.
    it_main_all-kursf = w_bkpf-kursf.
    it_main_all-bktxt = w_bkpf-bktxt.
    ENDIF.
    READ TABLE t_kna1 INTO w_kna1 WITH KEY kunnr = w_bsid-kunnr BINARY SEARCH.
    IF sy-subrc EQ 0.
    it_main_all-name = w_kna1-name1.
    it_main_all-city = w_kna1-city.
    ENDIF.
    READ TABLE t_knb1 INTO w_knb1 WITH KEY kunnr = w_bsid-kunnr BINARY SEARCH.
    IF sy-subrc EQ 0.
    it_main_all-vzskz = w_knb1-vzskz.
    ENDIF.
    it_main_all-lights = '1'.
    APPEND it_main_all.
    CLEAR it_main_all.
    CLEAR : w_bsid, w_bkpf, w_kna1, w_knb1.
    ENDLOOP .
    ENDIF.
    **Clear customers data
    IF NOT t_bsad[] IS INITIAL.
    SORT t_bsad BY bukrs bldat.
    SELECT
    bukrs gjahr hwaer kursf bktxt belnr
    FROM bkpf
    INTO CORRESPONDING FIELDS OF TABLE t_bkpf
    FOR ALL ENTRIES IN t_bsad
    WHERE bukrs = t_bsad-bukrs
    AND gjahr = t_bsad-gjahr
    AND belnr = t_bsad-belnr.
    SORT t_bkpf.
    SELECT
    kunnr name1 ort01
    FROM kna1
    INTO TABLE t_kna1
    FOR ALL ENTRIES IN t_bsad
    WHERE kunnr = t_bsad-kunnr
    AND name1 IN s_name1.
    SORT t_kna1.
    SELECT
    kunnr bukrs vzskz
    FROM knb1
    INTO TABLE t_knb1
    FOR ALL ENTRIES IN t_bsad
    WHERE kunnr = t_bsad-kunnr
    AND bukrs = t_bsad-bukrs.
    SORT t_knb1.
    LOOP AT t_bsad INTO w_bsad.
    it_main_all-bukrs = w_bsad-bukrs.
    it_main_all-gjahr = w_bsad-gjahr.
    it_main_all-kunnr = w_bsad-kunnr.
    it_main_all-belnr = w_bsad-belnr.
    it_main_all-budat = w_bsad-budat.
    it_main_all-xblnr = w_bsad-xblnr.
    it_main_all-bldat = w_bsad-bldat.
    READ TABLE t_bkpf INTO w_bkpf WITH KEY bukrs = w_bsad-bukrs gjahr = w_bsad-gjahr belnr = w_bsad-belnr BINARY SEARCH.
    IF sy-subrc EQ 0.
    it_main_all-hwaer = w_bkpf-hwaer.
    it_main_all-kursf = w_bkpf-kursf.
    it_main_all-bktxt = w_bkpf-bktxt.
    ENDIF.
    READ TABLE t_kna1 INTO w_kna1 WITH KEY kunnr = w_bsad-kunnr BINARY SEARCH.
    IF sy-subrc EQ 0.
    it_main_all-name = w_kna1-name1.
    it_main_all-city = w_kna1-city.
    ENDIF.
    READ TABLE t_knb1 INTO w_knb1 WITH KEY kunnr = w_bsad-kunnr BINARY SEARCH.
    IF sy-subrc EQ 0.
    it_main_all-vzskz = w_knb1-vzskz.
    ENDIF.
    it_main_all-lights = '3'.
    APPEND it_main_all.
    CLEAR : w_bsad, w_bkpf, w_kna1, w_knb1.
    ENDLOOP .
    ENDIF.
    ENDFORM.                    " get_data
    *&      Form  events
    FORM events .
    DATA : l_i_event TYPE slis_alv_event.
    l_i_event-name = 'TOP_OF_PAGE' .
    l_i_event-form = 'TOP2' .
    APPEND l_i_event TO gt_events .
    CLEAR l_i_event .
    ENDFORM.                    " events
    *&      Form  f_layout
    FORM f_layout .
    CLEAR gd_layout.
    gd_layout-detail_popup = 'X'.
    gd_layout-zebra = 'X'.
    gd_layout-no_vline = ' '.
    gd_layout-lights_fieldname = 'LIGHTS'.
    gd_layout-colwidth_optimize = 'X'.
    ENDFORM.                    " f_layout
    *&      Form  display
    FORM display .
    fieldcatalog-fieldname = 'BUKRS'.
    fieldcatalog-tabname = 'IT_MAIN_ALL'.
    fieldcatalog-seltext_m = 'Company Code'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'GJAHR'.
    fieldcatalog-tabname = 'IT_MAIN_ALL'.
    fieldcatalog-seltext_m = 'Fiscal year'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'BELNR'.
    fieldcatalog-tabname = 'IT_MAIN_ALL'.
    fieldcatalog-seltext_m = 'Doc No.'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'BLDAT'.
    fieldcatalog-tabname = 'IT_MAIN_ALL'.
    fieldcatalog-seltext_m = 'Doc Date'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'BUDAT'.
    fieldcatalog-tabname = 'IT_MAIN_ALL'.
    fieldcatalog-seltext_m = 'Posting date'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'DMBTR'.
    fieldcatalog-tabname = 'IT_MAIN_ALL'.
    fieldcatalog-seltext_m = 'Amt in local cur.'.
    fieldcatalog-do_sum = 'X'.
    fieldcatalog-just = 'R'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    **For Subtotal of fields
    x_sort-fieldname = 'BUKRS' .
    x_sort-group     = '*'.
    x_sort-subtot    = 'X'.
    APPEND x_sort TO it_sort.
    CLEAR x_sort .
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program      = sy-repid
    is_layout               = gd_layout
    it_fieldcat             = fieldcatalog[]
    it_sort                 = it_sort
    i_default               = 'X'
    it_events               = gt_events[]
    TABLES
    t_outtab                = it_main_all
    EXCEPTIONS
    program_error           = 1
    OTHERS                  = 2.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDFORM.
    *&      Form  top_of_page
    FORM top_of_page.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    i_logo             = 'RUCHI_LOGO'
    it_list_commentary = heading[].
    ENDFORM.
    *&      Form  opening
    FORM opening USING p_bukrs TYPE bsid-bukrs.
    DATA : opdate TYPE d.
    IF s_date-low < golive.
    opening = 0.
    ELSE.
    opdate = s_date-low - 1.
    SELECT
    bukrs shkzg dmbtr umskz
    FROM bsid
    INTO TABLE t_open
    WHERE bukrs IN s_bukrs
    AND kunnr IN s_kunnr
    AND gjahr IN s_gjahr
    AND budat <= opdate.
    LOOP AT t_open INTO w_open.
    IF w_open-shkzg = 'S'.
    opening = opening + w_open-dmbtr.
    ELSEIF w_open-shkzg = 'H'.
    w_open-dmbtr = w_open-dmbtr * ( -1 ).
    opening = opening + w_open-dmbtr .
    ENDIF.
    CLEAR : w_open.
    ENDLOOP.
    SELECT
    bukrs shkzg dmbtr umskz
    FROM bsad
    INTO TABLE t_open
    WHERE bukrs IN s_bukrs
    AND kunnr IN s_kunnr
    AND gjahr IN s_gjahr
    AND budat <= opdate.
    LOOP AT t_open INTO w_open.
    IF w_open-shkzg = 'S'.
    opening = opening + w_open-dmbtr.
    ELSEIF w_open-shkzg = 'H'.
    w_open-dmbtr = w_open-dmbtr * ( -1 ).
    opening = opening + w_open-dmbtr.
    ENDIF.
    CLEAR w_open.
    ENDLOOP.
    ENDIF.
    ENDFORM.
    *&      Form  top2
    FORM top2 .
    date  = s_date-low.
    date1 = s_date-high.
    WRITE : / 'CUSTOMER LEDGER FOR ALL ITEMS' COLOR 7.
    WRITE : / 'Customer Code:', it_main_all-kunnr.
    WRITE : / 'Customer Name:', it_main_all-name.
    WRITE : / 'Customer City:', it_main_all-city.
    ON CHANGE OF it_main_all-bukrs.
    WRITE : / 'Company Code:' COLOR 3 , it_main_all-bukrs COLOR 3.
    PERFORM opening USING it_main_all-bukrs.
    PERFORM closing USING it_main_all-bukrs.
    WRITE : / 'Opening Balance : Rs.' , opening .
    WRITE : / 'Closing Balance : Rs.' , closing .
    ENDON.
    CLEAR : closing, opening.
    IF date1 IS INITIAL.
    WRITE : / 'Date:', date DD/MM/YYYY.
    ELSE.
    WRITE : / 'Date:' , date DD/MM/YYYY, ' to ', date1 DD/MM/YYYY.
    ENDIF.
    ENDFORM.
    *&Form  closing
    FORM closing USING c_bukrs TYPE bsid-bukrs.
    LOOP AT it_main_all WHERE bukrs = c_bukrs.
    closing = closing + it_main_all-dmbtr.
    ENDLOOP .
    closing = closing + opening .
    ENDFORM.
    Edited by: Vishu on Apr 20, 2009 9:32 AM

    it can be done with the help of a system code 'sy-xcode'. it is initialised the time list is sorted so just keeping a check point, we can solve this problem.
    Vishu Khandelwal

  • How to display values in top of page in ALV report

    Hai,
      This is my billing report program, i developed that object by using ALV but i could not able to use Top-of-page. please any one correct my code,
    *& Report  ZE0232_ALV_BILLING                                          *
    report  ze0232_alv_billing.
    type-pools: slis.
    data: repid like sy-repid.
    data: fieldcatalog type slis_t_fieldcat_alv,
          wa_fieldcatalog type slis_fieldcat_alv.
    data : ievent type slis_t_event,
    wevent type slis_alv_event.
    data: sal_text like tvkot-vtext,
          DIS_TEXT LIKE TVTWT-VTEXT,
          DIV_TEXT LIKE TSPAT-VTEXT.
    tables: vbrk.
    data: begin of i_vbrk occurs 0,
          vbeln like vbrk-vbeln,
          fkdat like vbrk-fkdat,
          erdat like vbrk-erdat,
          kunrg like vbrk-kunrg,
          name1 like kna1-name1,
          netwr like vbrk-netwr,
          stext like tvkot-vtext,
          dtext like tvtwt-vtext,
          divtext like tspat-vtext,
          end of i_vbrk.
    selection-screen begin of block billing with frame.
    parameters: salesorg like vbrk-vkorg.
    select-options: dischanl for vbrk-vtweg,
                    division for vbrk-spart,
                    bildat for vbrk-fkdat.
    selection-screen end of block billing.
    select vbeln fkdat erdat kunrg netwr from vbrk into corresponding fields of table i_vbrk where vkorg = salesorg
                                                                                    and vtweg in dischanl
                                                                                    and spart in division
                                                                                    and fkdat in bildat.
    select vtext from tvkot into sal_text where vkorg = salesorg and spras = 'EN'.
    endselect.
    select vtext from TVTWT into DIS_text where VTWEG IN dischanl and spras = 'EN'.
    endselect.
    select vtext from TSPAT into DIV_text where SPART IN DIVISION and spras = 'EN'.
    endselect.
    loop at i_vbrk.
      move: sal_text to i_vbrk-stext,
            DIS_TEXT TO I_VBRK-DTEXT,
            DIV_TEXT TO I_VBRK-DIVTEXT.
      modify i_vbrk.
    endloop.
    perform get_fieldcatalog.
    call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
        i_callback_program                = repid
      I_GRID_TITLE                      =
        i_callback_top_of_page            = 'TOPS'
        it_fieldcat                       = fieldcatalog
      tables
        t_outtab                          = i_vbrk
    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.
    *&      Form  GET_FIELDCATALOG
          text
    <b>form tops.
      write :/ 'Hai Welcome'.
    endform.                    "tops</b>&----
    *&      Form  get_fieldcatalog
          text
    form get_fieldcatalog.
      wa_fieldcatalog-col_pos = '1'.
      wa_fieldcatalog-fieldname = 'VBELN'.
      wa_fieldcatalog-tabname   = 'I_VBAK'.
      wa_fieldcatalog-seltext_m = 'SALES DOCUMENT'.
    WA_fieldcatalog-rollname  = 'VBELN'.
      wa_fieldcatalog-hotspot   = 'X'.
      append wa_fieldcatalog to fieldcatalog.
      clear wa_fieldcatalog.
      wa_fieldcatalog-col_pos = '2'.
      wa_fieldcatalog-fieldname = 'FKDAT'.
      wa_fieldcatalog-tabname   = 'I_VBAK'.
      wa_fieldcatalog-seltext_m = 'BILL DATE'.
    WA_fieldcatalog-rollname  = 'VBELN'.
    WA_fieldcatalog-hotspot   = 'X'.
      append wa_fieldcatalog to fieldcatalog.
      clear wa_fieldcatalog.
      wa_fieldcatalog-col_pos = '3'.
      wa_fieldcatalog-fieldname = 'ERDAT'.
      wa_fieldcatalog-tabname   = 'I_VBAK'.
      wa_fieldcatalog-seltext_m = 'CREATED DATE'.
      append wa_fieldcatalog to fieldcatalog.
      clear wa_fieldcatalog.
      wa_fieldcatalog-col_pos = '4'.
      wa_fieldcatalog-fieldname = 'KUNRG'.
      wa_fieldcatalog-tabname   = 'I_VBAK'.
      wa_fieldcatalog-seltext_m = 'CUSTOMER NO'.
      append wa_fieldcatalog to fieldcatalog.
      clear wa_fieldcatalog.
      wa_fieldcatalog-col_pos = '5'.
      wa_fieldcatalog-fieldname = 'NAME1'.
      wa_fieldcatalog-tabname   = 'I_VBAK'.
      wa_fieldcatalog-seltext_m = 'CUSTOMER NAME'.
      append wa_fieldcatalog to fieldcatalog.
      clear wa_fieldcatalog.
      wa_fieldcatalog-col_pos = '6'.
      wa_fieldcatalog-fieldname = 'NETWR'.
      wa_fieldcatalog-tabname   = 'I_VBAK'.
      wa_fieldcatalog-seltext_m = 'NET VALUE'.
      append wa_fieldcatalog to fieldcatalog.
      clear wa_fieldcatalog.
      wa_fieldcatalog-col_pos = '7'.
      wa_fieldcatalog-fieldname = 'STEXT'.
      wa_fieldcatalog-tabname   = 'I_VBAK'.
      wa_fieldcatalog-seltext_m = 'SALES ORG'.
      append wa_fieldcatalog to fieldcatalog.
      clear wa_fieldcatalog.
      wa_fieldcatalog-col_pos = '8'.
      wa_fieldcatalog-fieldname = 'DTEXT'.
      wa_fieldcatalog-tabname   = 'I_VBAK'.
      wa_fieldcatalog-seltext_m = 'DIS.CHANNEL'.
      append wa_fieldcatalog to fieldcatalog.
      clear wa_fieldcatalog.
      wa_fieldcatalog-col_pos = '9'.
      wa_fieldcatalog-fieldname = 'DIVTEXT'.
      wa_fieldcatalog-tabname   = 'I_VBAK'.
      wa_fieldcatalog-seltext_m = 'DIVISION'.
      append wa_fieldcatalog to fieldcatalog.
      clear wa_fieldcatalog.
    endform.                    "GET_FIELDCATALOG

    HI see this report
    you can know how to write TOP-OF_PAGE code
    and insert LOGO also
    *& Report  ZTEST_ALV_LOGO
    REPORT  ztest_alv_logo.
    TYPE-POOLS : slis.
    *ALV Formatting tables /structures
    DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: gt_events   TYPE slis_t_event.
    DATA: gs_layout   TYPE slis_layout_alv.
    DATA: gt_page     TYPE slis_t_listheader.
    DATA: gs_page     TYPE slis_listheader.
    DATA: v_repid     LIKE sy-repid.
    *ALV Formatting work area
    DATA: w_fieldcat TYPE slis_fieldcat_alv.
    DATA: w_events   TYPE slis_alv_event.
    DATA: gt_bsid TYPE TABLE OF bsid WITH HEADER LINE.
    INITIALIZATION.
      PERFORM build_events.
      PERFORM build_page_header.
    START-OF-SELECTION.
    *perform build_comment.     "top_of_page - in initialization at present
      SELECT * FROM bsid INTO TABLE gt_bsid UP TO 10 ROWS.
    *perform populate_for_fm using '1' '3' 'BUKRS' '8' 'GT_BSID' 'Whee'.
    *USING = Row, Column, Field name, display length, table name, heading
    *OR
      PERFORM build_fieldcat.
      gs_layout-zebra = 'X'.
    *top of page event does not work without I_callback_program
      v_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program                = v_repid
          i_structure_name                  = 'BSID'
       i_background_id                   = 'ALV_BACKGROUND'
          i_grid_title                      = 'This is the grid title'
      I_GRID_SETTINGS                   =
          is_layout                         = gs_layout
          it_fieldcat                       = gt_fieldcat[]
          it_events                         = gt_events[]
        TABLES
          t_outtab                          = gt_bsid.
    Form..............:  populate_for_fm
    Description.......:  Populates fields for function module used in ALV
    FORM populate_for_fm USING p_row
                               p_col
                               p_fieldname
                               p_len
                               p_table
                               p_desc.
      w_fieldcat-row_pos      = p_row.          "Row Position
      w_fieldcat-col_pos      = p_col.          "Column Position
      w_fieldcat-fieldname    = p_fieldname.    "Field name
      w_fieldcat-outputlen    = p_len.          "Column Lenth
      w_fieldcat-tabname      = p_table.        "Table name
      w_fieldcat-reptext_ddic = p_desc.         "Field Description
      w_fieldcat-input        = '1'.
      APPEND w_fieldcat TO gt_fieldcat.
      CLEAR w_fieldcat.
    ENDFORM.                    " populate_for_fm
    *&      Form  build_events
    FORM build_events.
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = gt_events.
      READ TABLE gt_events
                 WITH KEY name =  slis_ev_user_command
                 INTO ls_event.
      IF sy-subrc = 0.
        MOVE slis_ev_user_command TO ls_event-form.
        APPEND ls_event TO gt_events.
      ENDIF.
      READ TABLE gt_events
                 WITH KEY name =  slis_ev_top_of_page
                 INTO ls_event.
      IF sy-subrc = 0.
        MOVE slis_ev_top_of_page TO ls_event-form.
        APPEND ls_event TO gt_events.
      ENDIF.
    ENDFORM.                    " build_events
    *&      Form  USER_COMMAND
    When user command is called it uses 2 parameters. The itab
    passed to the ALV is in whatever order it currently is on screen.
    Therefore, you can read table itab index rs_selfield-tabindex to get
    all data from the table. You can also check r_ucomm and code
    accordingly.
    FORM user_command USING  r_ucomm     LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
      READ TABLE gt_bsid INDEX rs_selfield-tabindex.
    error checking etc.
      SET PARAMETER ID 'KUN' FIELD gt_bsid-kunnr.
      CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
    ENDFORM.                    "user_command
    *&      Form  top_of_page
    Your own company logo can go here if it has been saved (OAOR)
    If the logo is larger than the size of the headings in gt_page,
    the window will not show full logo and will have a scroll bar. Thus,
    it is a good idea to have a standard ALV header if you are going to
    use logos in your top of page.
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = gt_page
          i_logo             = 'ENJOYSAP_LOGO'.
    ENDFORM.                    "top_of_page
    *&      Form  build_fieldcat
    *Many and varied fields are available here. Have a look at documentation
    *for FM REUSE_ALV_LIST_DISPLAY and REUSE_ALV_FIELDCATALOG_MERGE
    FORM build_fieldcat.
      w_fieldcat-fieldname  = 'BUDAT'.
      w_fieldcat-seltext_m  = 'Dte pst'.
      w_fieldcat-ddictxt(1) = 'M'.
      w_fieldcat-edit = 'x'.
    Can change the position of fields if you do not want them in order
    of the DDIC or itab
    w_fieldcat-row_pos = '1'.
    w_fieldcat-col_pos = '10'.
      APPEND w_fieldcat TO gt_fieldcat.
      CLEAR w_fieldcat.
    ENDFORM.                    " build_fieldcat
    *&      Form  build_page_header
          gt_page is used in top of page (ALV subroutine - NOT event)
          *H = Header, S = Selection, A = Action
    FORM build_page_header.
    For Headers, Key is not printed and is irrelevant. Will not cause
    a syntax error, but is not used.
      gs_page-typ  = 'H'.
      gs_page-info = 'Header 1'.
      APPEND gs_page TO gt_page.
      gs_page-typ  = 'H'.
      gs_page-info = 'Header 2'.
      APPEND gs_page TO gt_page.
    For Selections, the Key is printed (bold). It can be anything up to 20
    bytes. It gets printed in order of code here, not by key value.
      gs_page-typ  = 'S'.
      gs_page-key  = 'And the winner is:'.
      gs_page-info = 'Selection 1'.
      APPEND gs_page TO gt_page.
      gs_page-typ  = 'S'.
      gs_page-key  = 'Runner up:'.
      gs_page-info = 'Selection 2'.
      APPEND gs_page TO gt_page.
    For Action, Key is also irrelevant.
      gs_page-typ  = 'A'.
      gs_page-info = 'Action goes here'.
      APPEND gs_page TO gt_page.
    ENDFORM.                    " build_page_header
    <b>Reward if useful</b>

  • Displaying one field in first page and other field in last page (header)

    Hi
    We are using following way to print headers but we need one field (WO START) to display in first page and another field (WO END) to display in last page
    If output is only 1 page then both needs to be printed on same page
    <?for-each@section:G_WORK_ORDER?>
    WO START This needs to be printed on first page only
    WO END This needs to be printed on last page only
    <?for-each:G_OPERATION?> <?end for-each?>
    <?end for-each?>
    Let us know if any fix for this
    Thanks
    Kamalakar.G
    Edited by: kamalakarg on Sep 21, 2012 4:53 PM

    Hi Kamalakar,
    Send me sample XML data and RTF template i will try on my side. email me [email protected]
    Thanks,
    Omkar Deshpande.

  • A variable from START-OF-SELECTION to be displayed at the TOP-OF-PAGE?

    Hi
    I want to display a variable (by WRITE ststement) which is populated under the the event start-of-selection in the top-of-page event.
    Is it possible to do that and if yes then How can I do it?
    Thanks

    i think top-of-page will trigger when it gets the first write statement. so
    start-of-selection.
    var = 100.
    write : / 'This is in start-of-selection'.
    top-of-page.
    write : / var.
    so the thing is you have to assign the value to your variable before first write statement.
    regards
    shiba dutta

  • How to display data with the same text and key in the drop down list?

    Hi All,
    Would like so to seek for you advice on the above mention topic. How to display the data with the same text and key using function module 'VRM_SET_VALUES'. From my testing by writing a program, this function module will only show the text and key if both have different data. Please find the coding as below. Is the normal behaviour of this function module? How to overcome this problem? Thanks in advance.
    REPORT ZTESTING.
    TYPE-POOLS: VRM.
    DATA: NAME  TYPE VRM_ID,
          LIST  TYPE VRM_VALUES,
          VALUE LIKE LINE OF LIST,
          c(20) type c.
    *      c = 'select any'.
    data:begin of itab occurs 0,
          kunnr like kna1-kunnr,
          name1 like kna1-name1,
         end of itab.
    data:begin of jtab occurs 0,
          kunnr like kna1-kunnr,
          land1 like kna1-land1,
         end of jtab.
    PARAMETERS: p_list(20) AS LISTBOX VISIBLE LENGTH 20
                              default 'SELECT'.
    AT SELECTION-SCREEN OUTPUT.
    NAME = 'p_list'.
    VALUE-KEY = 'Name'.     "---> Data for key is the same with text
    VALUE-TEXT = 'Name'.    "--> Data for text is the same with key
    APPEND VALUE TO LIST.
    VALUE-KEY = '2'.
    VALUE-TEXT = 'Country'.
    APPEND VALUE TO LIST.
    CALL FUNCTION 'VRM_SET_VALUES' EXPORTING ID = NAME VALUES = LIST.
    start-of-selection.
    select kunnr name1 up to 20 rows from kna1 into table itab.
    select kunnr land1 up to 20 rows from kna1 into table jtab.
    case p_list.
    when '1'.
    loop at itab.
    write:/ itab-kunnr,itab-name1.
    endloop.
    when '2'.
    loop at jtab.
    write:/ jtab-kunnr,jtab-land1.
    endloop.
    endcase.
    <Added code tags>
    Moderator Message: Please use the "code" tags to format your code snippet.
    Edited by: Suhas Saha on Nov 17, 2011 11:19 AM

    shawnTan wrote:
    Hi All,
    >
    > Would like so to seek for you advice on the above mention topic. How to display the data with the same text and key using function module 'VRM_SET_VALUES'. From my testing by writing a program, this function module will only show the text and key if both have different data. Please find the coding as below. Is the normal behaviour of this function module? How to overcome this problem? Thanks in advance.
    >
    >
    REPORT ZTESTING.
    >
    > TYPE-POOLS: VRM.
    >
    > DATA: NAME  TYPE VRM_ID,
    >       LIST  TYPE VRM_VALUES,
    >       VALUE LIKE LINE OF LIST,
    >       c(20) type c.
    >
    > *      c = 'select any'.
    >
    > data:begin of itab occurs 0,
    >       kunnr like kna1-kunnr,
    >       name1 like kna1-name1,
    >      end of itab.
    >
    > data:begin of jtab occurs 0,
    >       kunnr like kna1-kunnr,
    >       land1 like kna1-land1,
    >      end of jtab.
    >
    > PARAMETERS: p_list(20) AS LISTBOX VISIBLE LENGTH 20
    >                           default 'SELECT'.
    >
    > AT SELECTION-SCREEN OUTPUT.
    >
    > NAME = 'p_list'.
    >
    > VALUE-KEY = 'Name'.     "---> Data for key is the same with text
    > VALUE-TEXT = 'Name'.    "--> Data for text is the same with key
    > APPEND VALUE TO LIST.
    >
    > VALUE-KEY = '2'.
    > VALUE-TEXT = 'Country'.
    > APPEND VALUE TO LIST.
    >
    > CALL FUNCTION 'VRM_SET_VALUES' EXPORTING ID = NAME VALUES = LIST.
    >
    > start-of-selection.
    > select kunnr name1 up to 20 rows from kna1 into table itab.
    > select kunnr land1 up to 20 rows from kna1 into table jtab.
    >
    > case p_list.
    > when '1'.
    > loop at itab.
    > write:/ itab-kunnr,itab-name1.
    > endloop.
    >
    > when '2'.
    > loop at jtab.
    > write:/ jtab-kunnr,jtab-land1.
    > endloop.
    > endcase.
    >
    > <Added code tags>
    >
    > Moderator Message: Please use the "code" tags to format your code snippet.
    >
    > Edited by: Suhas Saha on Nov 17, 2011 11:19 AM
    This surely seems to be a bug to me(if not by design),  did you check for any SAP notes? Perhaps a front end trace can help(Note 407743) !
    -Rajesh.

  • What is the bar that appears at the top of pages and how do I get rid of it?

    Whenever a page is showing on the screen, a bar appears at the top of the page with a lot of squares ending with a square that says "diagnose." It sometimes causes a printing problem when the document prints out so small that you can't read it.

    It sounds like some kind of advertising. Often behaviors that affect multiple sites are caused by an add-on, particularly an extension. You may want to review your extensions on the following page and disable ALL nonessential extensions.
    orange Firefox button ''or'' classic Tools menu > Add-ons > Extensions category
    After restarting Firefox, is the bar gone?

  • I am unable to make an outline from a blank page. The option to choose the outline from the icon on the top of page and the view tab are not available to me.

    I just started using Pages and when I try to make an outline from a new blank page I am unable to choose it from the toolbar or the view tab. Please help. Thanks!

    drakanamor,
    It's possible that you have strayed into the Page Layout section of the Pages templates. Page Layout templates have no Text layer, or frame, in which to show the outline view, so the option is unavaiable.
    Choose one of the Word Processing Templates.
    Jerry

Maybe you are looking for

  • Help me install adobe flash player on my mac ?

    Can you help me istall flash player on my Mac

  • HLS creates internal clock enable??

    In HLS (2015.2), I created a simple comparator circuit. The HLS C-simulation worked fine. The HLS C-function compares 8-bit integers received from an 8-bit data bus against a fixed array of 8-bit integers. If the first integer matches, a counter is i

  • UIButton with the same style of default UIAlertView button

    Is there a way to get the same style of standard UIAlertView buttons. I've tried to add an UIThreePartButton (the private class of buttons used in UIAlertView) but it does not work. The result still: http://www.malcom-mac.com/image1.png Thank you

  • Trouble in loading XML form

    Hi guys, I've managed to save a form in the <b>Add</b> mode to an XML file. An error dialog, stating that there was an error on Datasource, showed on the screen when I was trying to load it with some UI coding. Anyway, the form was successfully loade

  • ADF FACES showOneTabs and selectOrderShuttle can't cowork

    I'm new to ADF FACES. My ADF FACES is EA10. The code excerpt from EA10's demo works fine when: <?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2" xmlns:f="http://java.sun.com