ALV List header shifting to next coloumn when transfer to excel sheet

Hi,
  When i am transferring the data to excel sheet like
After Executing click LOCAL FILE then click on spreadsheet RADIO BUTTON. My header is shifting one right colomn.
I tried with COL_len but my issued is not resolved
REPORT  ZTEST_AMIT  no standard page heading line-size 350.                             .
TYPE-POOLS: SLIS.
DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
      IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
      L_LAYOUT type slis_layout_alv,
      x_events type slis_alv_event,
      it_events type SLIS_T_EVENT.
DATA: BEGIN OF ITAB OCCURS 0,
      VBELN LIKE VBAK-VBELN,
      POSNR LIKE VBAP-POSNR,
      MALE(40) type c,
      female(20) type c,
     END OF ITAB.
SELECT VBELN
       POSNR
       FROM VBAP
       UP TO 20 ROWS
       INTO TABLE ITAB.
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-SELTEXT_L = 'VBELN'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 1.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-SELTEXT_L = 'POSNR'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 2.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'MALE'.
X_FIELDCAT-SELTEXT_L = 'MALE'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 3.
x_fieldcat-outputlen = 10.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'FEMALE'.
X_FIELDCAT-SELTEXT_L = 'FEMALE'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 4.
x_fieldcat-just = 'C'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
  x_events-NAME = SLIS_EV_TOP_OF_PAGE.
  x_events-FORM = 'TOP_OF_PAGE'.
  APPEND x_events  TO iT_EVENTS.
  CLEAR x_events .
  L_LAYOUT-NO_COLHEAD = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_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_STRUCTURE_NAME               =
   IS_LAYOUT                      = l_layout
   IT_FIELDCAT                    = it_fieldcat
  IT_EXCLUDING                   =
  IT_SPECIAL_GROUPS              =
  IT_SORT                        =
  IT_FILTER                      =
  IS_SEL_HIDE                    =
   I_DEFAULT                      = 'X'
  I_SAVE                         = ' '
  IS_VARIANT                     =
   IT_EVENTS                      = 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
IMPORTING
  E_EXIT_CAUSED_BY_CALLER        =
  ES_EXIT_CAUSED_BY_USER         =
  TABLES
    t_outtab                       = itab
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 TOP_OF_PAGE.
*-To display the headers for main list
    FORMAT COLOR COL_HEADING.
        WRITE: / SY-ULINE(45).
    WRITE: /   SY-VLINE,
          (8) ' ' ,
               SY-VLINE,
          (8)  ' ' ,
               SY-VLINE,
          (19) '***'(015) centered,
               sy-vline.
    WRITE: /   SY-VLINE,
(8)        'VBELN' ,
               SY-VLINE,
(8) 'POSNR'(014) ,
               SY-VLINE,
          (8) 'MALE'(020) ,
               sy-vline,
           (8)  'FMALE'(015) ,
               sy-vline.
    FORMAT COLOR OFF.
ENDFORM.
Message was edited by: amit teja
Message was edited by: amit teja
Message was edited by: amit teja
Message was edited by: amit teja

for sorting
for the para meter: IT_SORT in FM
take that type as: SLIS_SORTINFO_ALV
and for the fileds give d valus as per ur requirement...
fileds r:  SPOS
           FIELDNAME
           TABNAME
           UP
           DOWN
           GROUP
           SUBTOT
           COMP
           EXPA
           OBLIGATORY
ramesh.

Similar Messages

  • Traffic lights in ALV list header

    how do i display traffic lights as icons in ALV list header. for example, in the code below, i want to display a green icon at the end of closed items and a red icon at the end of the open items:
                closed : 4 [green-icon]
                open   : 2  [red-icon]
    CLEAR header_alv_wa-info.
      header_alv_wa-key  = 'closed:'.
      header_alv_wa-info = gv_closed.
      header_alv_wa-typ  = 'S'.
      APPEND header_alv_wa TO headeralv.
      CLEAR header_alv_wa-info.
      header_alv_wa-typ  = 'S'.
      header_alv_wa-key  = 'open:'.
      header_alv_wa-info = gv_open.
      APPEND header_alv_wa TO headeralv.

    Hi,
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    the above links will give u the code for the same..
    Regards,
    Aparna

  • Writing selections in  alv list header

    Hi,
    in alv list header i have to show the values entered in selection screen.
    ex.
    Current year    : 2008
    current period  : 03
    report ID          : R_123
    company code : I BT  AA to BB
                            I BT  CC to DD
                            I EQ  FF
    in the above example first three are parameters and  company code is select-option, for parameters i can display what i want, but for company code( which is select option) it is showing only first line and not showing other lines.
    at the time of filling list header table for select-option, i am looping the select-option, first i am filling with  typ, key and info and for other i am filling only info, if i fill typ, key also for other recoreds also it is showing the  company code in all lines  as below ....
    company code  : I BT  AA to BB
    company code : I BT  CC to DD
    company code : I EQ  FF
    can any one suggest to get the list header as shown at the begining....
    thanks,
    bhushan

    Hi,
    Check this sample code. Here plant and date are selection screen paramters.
    Plant
      lwa_header-typ  = 'S'.
      lwa_header-key  = text-t47.
    If the select option for plant is 'EQ'
      LOOP AT s_werks.                                       "#EC *
        IF s_werks-option = 'EQ'.
          lwa_plant-werks = s_werks-low.
          APPEND lwa_plant TO lt_plant.
          CLEAR lwa_plant.
    If the select option for plant is 'BT'
        ELSEIF s_werks-option = 'BT'.
          CONCATENATE s_werks-low
                      text-t50
                      s_werks-high
            INTO lf_plant.
          lwa_header-info = lf_plant.
          APPEND lwa_header TO gt_header.
          CLEAR lwa_header.
        ENDIF.
      ENDLOOP.
      IF s_werks-option = 'EQ'.
        READ TABLE lt_plant INTO lwa_plant INDEX 1.
        lwa_header-info = lwa_plant-werks.
        APPEND lwa_header TO gt_header.
        CLEAR lwa_header.
        LOOP AT lt_plant INTO lwa_plant FROM 2.
          lwa_header-typ   = 'S'.
          lwa_header-key   = ''.
          lwa_header-info  =  lwa_plant-werks.
          APPEND lwa_header TO gt_header.
          CLEAR: lwa_header.
        ENDLOOP.
      ENDIF.
    Post date Range
      lwa_header-typ   = 'S'.
      lwa_header-key   = text-t33.
    If the select option for post date is 'EQ'
      LOOP AT s_budat.                                      "#EC *
        IF s_budat-option = 'EQ'.
          CONCATENATE s_budat-low+6(2) '.'
                      s_budat-low+4(2) '.'
                      s_budat-low(4) INTO lf_range.
        For multiple values
          IF lf_date_tmp IS INITIAL.
            lwa_date-date = lf_range.
            APPEND lwa_date TO lt_date.
          ELSE.
            lwa_date-date = lf_range.
            APPEND lwa_date TO lt_date.
          ENDIF.
      If the select option for post date is 'BT'
        ELSEIF s_budat-option = 'BT'.
          CONCATENATE s_budat-low+6(2) '.'
                      s_budat-low+4(2) '.'
                      s_budat-low(4) text-t49
                      s_budat-high+6(2) '.'
                      s_budat-high+4(2) '.'
                      s_budat-high(4) INTO lf_range .
          lwa_header-info  =  lf_range.
          CLEAR lf_range.
        ENDIF.
      ENDLOOP.
      IF s_budat-option = 'EQ'.
        READ TABLE lt_date INTO lwa_date INDEX 1.
        lwa_header-info  =  lwa_date-date.
        APPEND lwa_header TO gt_header.
        CLEAR: lwa_header.
        LOOP AT lt_date INTO lwa_date FROM 2.
          lwa_header-typ   = 'S'.
          lwa_header-key   = ''.
          lwa_header-info  =  lwa_date-date.
          APPEND lwa_header TO gt_header.
          CLEAR: lwa_header.
        ENDLOOP.
      ENDIF.
    Appending work area to the header table
      APPEND lwa_header TO gt_header.
      CLEAR lwa_header.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = gt_header.
    <REMOVED BY MODERATOR>
    Regards,
    Ramya
    Edited by: Alvaro Tejada Galindo on Apr 8, 2008 4:30 PM

  • Alv list header problem

    Hai Friends,
    In my ALV List header..i am writing date , time and my program name.
    but all are coming on left side.
    can i get date on left side, program name on centered and time on write side.
    my code is like this.
    FORM list_headers.
          lists-typ = 'H'.
          lists-info = text-010.
          APPEND lists.
          CLEAR lists.
          lists-typ = 'S'.
          lists-key = text-011.
          CONCATENATE sy-datum+6(2) '/'
                      sy-datum+4(2) '/'
                      sy-datum+0(4) INTO lists-info.
          APPEND lists.
          CLEAR lists.
          lists-typ = 'S'.
          lists-key = text-012.
          CONCATENATE sy-uzeit+0(2) ':'
                      sy-uzeit+2(2) ':'
                      sy-uzeit+4(2) INTO lists-info.
          APPEND lists.
          CLEAR lists.
    ENDFORM.

    Hi again,
    1. first of all how are u writing / displaying
       the alv header ?
    2. using documentary write ?
       then also, u can use one variable of
      length 100 and use this concept.
    3. If u are using top_of_page
      event,
      in this event, WE CAN use WRITE.
      (i have used it, and it
      works fantastic)
                  (not in case of alv grid)
    4. My point is, what ever u are using,
       use on variable of length 100.
      WRITE value INTO variable.
      using offset
      and then proceed further.
    regards,
    amit m.

  • Export the list of the prices of the materials at an Excel sheet

    If we use PR00 condition for price of the materials, how can we export the list of the prices of the materials at an Excel sheet? Can we use V/LA or V/LD ?
    Thanks in advance.

    Go to menu bar select"System"-->list>Save--->localfile-->and then save it in spred sheet.

  • Reg: Adding spaces between texts in ALV list header

    Hi All,
    I was implementing a client requirement for ALV. The list header should contain something of this format.
    Pgm Id:               ZZZ01
    After this list header it is ALV display.
    I did this using the concatenate statement.
    ex: Concatenate 'PgmID' sy-repid into listheader seperated by space.
    But this is not showing spaces between text in ALV display. See I want a tabspace between the texts in headr. Any idea on how to mak it?
    Rakesh

    Depending on Fontsize the space might be so narrow that you believe its not there.
    check in the debugger if there is really a space in the string, the clause "separated by space" will insert one for sure.
    May be you'reshowing the ALV before you are modifying the listheader?
    Another approach is using strings, blanks at the end of a string are not deleted
    concatenate 'ABC ' 'XYZ' into s.
    and
    concatenate `ABC ` `XYZ` into s.
    will give different results, be aware of the difference in the quots in both cases. Using the second example you can insert as many blanks as you want.

  • Number formatting in ALV list header

    Hi,
    I am using an ALV with a list header. Code is as follows:
    FORM ALV_SHOW.
       DATA G_CALLBACK_PROG LIKE SY-REPID.
       G_CALLBACK_PROG = SY-REPID.
       CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
             I_CALLBACK_PROGRAM      = G_CALLBACK_PROG
             I_SAVE                  = 'U'
             IT_FIELDCAT             = ITAB_FIELDCATALOG
             IS_LAYOUT               = GS_LAYOUT
             I_CALLBACK_TOP_OF_PAGE  = 'TOP-OF-PAGE'
          TABLES
             T_OUTTAB               = ITAB_SUB_SEARCH.
    ENDFORM.  "alv_show.
    FORM TOP-OF-PAGE.
    ALV Header declarations
       DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
             WA_HEADER TYPE SLIS_LISTHEADER,
             T_LINE LIKE WA_HEADER-INFO,
             LD_LINES TYPE I,
             LD_LINESC(10) TYPE C.
       DATA: SHHLDR_INFO LIKE ZSH_SHHLDR.
    Title
       WA_HEADER-TYP  = 'H'.
       WA_HEADER-INFO = 'Some Title'.
       APPEND WA_HEADER TO T_HEADER.
       CLEAR WA_HEADER.
       CLEAR SHHLDR_INFO.
       READ TABLE ITAB_SUB_SEARCH INDEX 1.
       SELECT SINGLE * FROM ZSH_SHHLDR INTO SHHLDR_INFO WHERE FOLIO EQ
          ITAB_SUB_SEARCH-FOLIO.
       WA_HEADER-TYP = 'S'.
       WA_HEADER-KEY = 'Holding '.
       WA_HEADER-INFO = SHHLDR_INFO-SHHOL.
       APPEND WA_HEADER TO T_HEADER.
       CLEAR: WA_HEADER.
       CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
          EXPORTING
             IT_LIST_COMMENTARY = T_HEADER.
    ENDFORM.   " top-of-page
    The problem is that the number for 'Holding' is displayed in the ALV header without any formatting, i.e.
    SOME TITLE
    Holding 2375385
    I want it to be displayed like:
    SOME TITLE
    Holding 2,375,385
    Is there any way to achieve this? Help is appreciated, thanks.
    Regards

    Hi
    Use WRITE statament
    WA_HEADER-TYP = 'S'.
    WA_HEADER-KEY = 'Holding '.
    *WA_HEADER-INFO = SHHLDR_INFO-SHHOL.
    WRITE SHHLDR_INFO-SHHOL TO WA_HEADER-INFO.
    APPEND WA_HEADER TO T_HEADER.
    If SHHLDR_INFO-SHHOL is amout, it would be better you used CURRENCY option
    WA_HEADER-TYP = 'S'.
    WA_HEADER-KEY = 'Holding '.
    *WA_HEADER-INFO = SHHLDR_INFO-SHHOL.
    WRITE SHHLDR_INFO-SHHOL CURRENCY <currency> TO WA_HEADER-INFO.
    APPEND WA_HEADER TO T_HEADER.
    Max

  • Company Logo in ALV List Header

    Hi,
    I have created an ALV list and would like to put our company logo in the header. How can I do this?
    Thanks,
    Shah.

    Hi,
    In the transaction OAOR, you should be able to insert your company Logo.
    GOTO - OAOR (Business Document Navigator)
    Give Class Name - PICTURES Class Type - OT..... then Execute
    It will show you the list, then select ENJOYSAP_LOGO.
    On that list, you will find one control with a "create" tab.
    Click std. doc types.
    Select SCREEN and double-click.
    It will push FILE selection screen.
    Select your company logo (.gif) and press OK.
    It will ask for a description- for instance: "company logo".
    It will let you know your doc has been stored successfully.
    You can find your logo under ENJOYSAP_LOGO->Screen->company logo.
    Just run your ALV program, you should find your company logo in place of the EnjoySAP logo.
    Reward points if found helpfull..
    Cheers,
    Chandra Sekhar.

  • Display Logo in ALV LIST header

    Hi Experts!!
    I need the logo to be displayed in the header of ALV LIST but not the grid display. I searched for this, and got the results for ALV grid display. Kindly let me know if there's any way of printing the logo in the ALV List display. I hope that's possible with oops.
    Please help me out.
    Thanks and Regards,
    Seenu

    hello srinivas,
    Check the Examples in LIBS trxn,
    see the example One-Line List with Top of Page
    regards,
    Shweta

  • Alv list header alignment

    hi frnd's,
    I am using an alv list viewer,in top of page i am displaying some text i want to align the text sy-datum to right corner of the page.

    Hi Suganya, alignment in ALV header is only possible if you are using ALV LIST, in that case you can use the write statement in the event TOP_OF_PAGE; but if you are using ALV GRID, then this is not posibble since ALV GRID's header has fixed positions according to the text tipe (H, S) or the logo.
    Hope it helps
    Jesus

  • ALV list Header details scattered

    Hi All,
    I have a ALV-LIST report output but the header details displayed are scattered in output. Can you suggest how to align all deatils properly aligned.

    Hi again,
    1. first of all how are u writing / displaying
       the alv header ?
    2. using documentary write ?
       then also, u can use one variable of
      length 100 and use this concept.
    3. If u are using top_of_page
      event,
      in this event, WE CAN use WRITE.
      (i have used it, and it
      works fantastic)
                  (not in case of alv grid)
    4. My point is, what ever u are using,
       use on variable of length 100.
      WRITE value INTO variable.
      using offset
      and then proceed further.
    regards,
    amit m.

  • ALV list heade problem

    Hi all,
    I have created list heade r using FM commentary_wirite.
    the parameter slis_listheader-info has length of only 60 characters.
    So my header is getting truncated .
    Plase suggest me on how to increase the length.
    Regards,
    Naveen

    hey u need to consider slis_t_listheader
    typ(1) type c,   " H = Header, S = Selection, A = Action
    key(20) type c,
    seggregate u r text and give some text in header and some other in selection ..and some other in action
    i hope this may help u......
    reward points if helpful

  • Alv output splitting into two rows when converting into excel sheet.

    Hi frends,
    I have alv report with 60 fields . The report output is coming currently .  But when i am exporting into excel sheet from the option local file--> speadsheet  each row is splitting into two rows including header in excel sheet.
    Please provide your valuable suggestions to avoid this.
    Regards,
    Ramu .
    Edited by: Ramu.K on Sep 8, 2009 5:59 PM

    Hi,
    Please use the grid option and with the Spreadsheet button (CntrShiftF7). Do  "Save as" and save it as excel. It should work.
    Regards,
    Pradyumna

  • ALV Report to be send as a mail as an Excel sheet attachment

    Hi,
             I have designed a Report that has the mailing functionality by attaching the ALV report output in the Excel sheet.
    1. I am using SUBMITT PROGRAM....EXPORTING MEMORY ID.
              Here  I am retrieving the required ALV report.
    2. I am passing of ALV Report output to internal table, say XLS_TAB using FM LIST_TO_ASCI.
    I can see the data in the internal table. But the problem is when the report output has many columns (i.e) greater than 255 Char, the columns get truncated(data is missed).
    So, how to prevent the missing of the columns. I don't want split each record into new line. Because, when it is passed to Excel, each record should be in a single line without missing any column.
                   If you say the FM can be valid upto 255 Char, what can be the alternative solution?
    Immediate response is appreciated.
    Thanks for your help.
    Sravan.

    Hi deepan
    DESCRIBE TABLE objtxt LINES tab_lines.
      READ TABLE objtxt INDEX tab_lines.
    docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ) . <---- make it 1024 instead of 255
      CLEAR objpack-transf_bin.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = gv_tab_lines.
    objpack-doc_type = RAW
      APPEND objpack
    then looping contents of the final table to OBJBIN1.
    DESCRIBE TABLE objbin1 LINES tab_lines.
      objpack-doc_size = tab_lines * 255 .    <-------- make it has 1024 instead of 255
      objpack-transf_bin = 'X'.
      objpack-head_start = 1.
      objpack-head_num = 1.
      objpack-body_start = 1.
      objpack-body_num = tab_lines.
      objpack-doc_type = .XLS
      APPEND objpack.
    Regards
    vijay

  • Change color in alv list header

    hi experts,
    how can i change the color in a alv header... for example...
    number         docum     year  
    001              13245      2006
    002              13245      2007
    the header.. number, docum and year appears in light blue (all the cell) , how can i do that it appears without a color like the regular rows.
    thx in  advance

    Hi Carlos,
    FORM HEADING.
      FORMAT INTENSIFIED OFF.              " Remove any INTENSIFIED
      ULINE AT (WIDTH).                    " Upper frame border
      FORMAT COLOR COL_HEADING INTENSIFIED." Title color
      WRITE: / SY-VLINE.                   " Left border
      WRITE: 'No |Colour        |intensified    |intensified off|',
             'inverse' NO-GAP.
      WRITE: AT WIDTH SY-VLINE.            " Right border
      ULINE AT (WIDTH).                    " Line below titles
      FORMAT COLOR OFF.
    ENDFORM.
    regards,
    Prabhudas

Maybe you are looking for

  • Import to Elements Organiser Causes Elements to Crash

    I am having trouble importing AVCHD (.mts) files in to Elements Organizer.  Part way through the import, Elements crashes with no helpful message.  I have just checked the Video Card compatibilty list and notive that the NVIDIA GeForce 8600M GT is no

  • STO Document Type (UB) Issue

    Dear All, I am facing a problem in the document type UB. I was copied standard document type 'UB' as "ZUB' and creat STO with the document type ZUB .I was trying to make delivery with MM route (GI in 351 and GR in 101). At the time of making GI in mi

  • BOM material in VA01.

    Hi gurus, when i do sales order VA01 with BOM material (non sotck ) only price it s appearing in gray colour. but below components are not appearing in gray colour. and it s having different Item catagery with Z. how to get the Components (stok mater

  • How to purchase? Pay-per-use?

    We've developed an application with our free $15 a month developer account, and we're planning to use it in a big webcast event next week. There will be over 1000 contributer in the event so, we'd like to purchase more credits. But we couldn't find h

  • Minimize, Maximize buttons

    Hi, Anyone has an idea on how to modifiy the front panel when running to only show the close button (X) without the Minimize and Maximize/Restore on the top right hand side. Thank you.