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
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,
bhushanHi,
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 -
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. -
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?
RakeshDepending 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. -
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,
Seenuhello srinivas,
Check the Examples in LIBS trxn,
see the example One-Line List with Top of Page
regards,
Shweta -
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. -
Changing Date Format in ALV List for VKM1 transaction
Hi All,
I have to change date format to MM/DD/YY in the ALV list display of VKM1 transaction. There are user exits available.
I am trying to use EDIT_MASK option of the field catalog.. Without changing the code, I give value as __:__:__ or MM/DD/YY in the EDIT_MASK field of the fieldcatalog during DEBUG. Just before the RESUSE_ALV_LIST_DISPLAY is called.. but it is NOT showing any change in the display.
Please advice any alternate way to do the same.
Thanks a lot.Hi,
If u`ve access to User parameters, try tcode SU01 and give ur user name in the first parameter. Navigate to the defaults tab and you can find options for Date display and decimals display. Now identify the date format to your liking and change the same. From the next logon in ur user name, changes are reflected on your reports.
Reward points if my answer is worthfull.
Regards -
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,
Naveenhey 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 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 tejafor 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. -
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 advanceHi 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 -
Hi All
I want to display company name in middle of the reportin header. can it be possible? Generally it is printed left aligned.
PLs help.Hi, Follow the following code:
REPORT alv_top_of_page.
TABLES : t001.
TYPE-POOLS: slis.
DATA : w_repid LIKE sy-repid.
TYPES : BEGIN OF ty_comp.
INCLUDE STRUCTURE t001.
TYPES : END OF ty_comp.
DATA: wa_layout TYPE slis_layout_alv.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
DATA : it_comp TYPE TABLE OF ty_comp.
INITIALIZATION.
w_repid = sy-repid.
START-OF-SELECTION.
SELECT * FROM t001 INTO TABLE it_comp.
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = w_repid
i_internal_tabname = 'IT_COMP'
i_inclname = w_repid
CHANGING
ct_fieldcat = it_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
is_layout = wa_layout
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_comp
EXCEPTIONS
program_error = 1
OTHERS = 2.
*& 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 = 'Company Code Data'.
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'.
CALL METHOD document->new_line.
CALL METHOD document->new_line.
ENDFORM. "HTML_TOP_OF_PAGE
Regards,
DS -
Hi all,
I want to change date format in ALV list that is displayed in wrong format.
I use this piece of code:
CALL METHOD r_alv_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'ZSTANJEKOMISIONARA'
is_layout = gs_layout
CHANGING
it_outtab = it_stanja
EXCEPTIONS
OTHERS = 4.
Problematic field of structure ZSTANJEKOMISIONARA is defined like this:
VRIJEDI_DO ZEVO_VRIJEDI_DO DATS 8
Now, date is displayed like this: 09.20.3009 insted it should be like this: 30.09.2009.
How can I change this? Thanks.The data is internally stored in an external format. Go back to the program that filled this field, there is something missing there.
Look at FM like
- CONVERT_DATE_TO_INTERN_FORMAT
- CONVERSION_EXIT_PDATE_INPUT
You only keep date in external format when filling a BDC, for most other input mode (BAPI and the like) data must be converted to internal format.
Regards,
Raymond
Maybe you are looking for
-
will a newer version of lightroom LR4m seamlessly use a library from an older version of LR1? Can i just get the newer version, install it and everything works fine? If not what needs to be done. I lost my LR application in a hard drive drama but hav
-
Can SocketChannel.write return -1 ?
Hi, In the SSLEngine documentation sample code it mentions handling a -1 returned by Channel.write() if the channel is closed. This is the only place I've ever seen it mentioned, there's nothing in the javadoc, and I've never come across it in practi
-
Can't start MYSQL in system preferences 10.6 Snow Leopard
Any suggestions? Thanks. 1. There is no error message. 2. Download and servers won't start in MAPP either.
-
Where can I find a download of 7.6.2 iTunes?
I have a Powerbook that I'm running OS 10.3.9 and I need to get iTunes 7.6.2 which is suppose to be the latist version of iTunes that will run on OS 10.3.8.
-
I somehow deleted two of my iCal calendars and need to restore them. If I go to ~/Library/Calendars and try to restore the entire folder, I do not see any change in iCal - however MobileMe sync fires up trying to delete 125 Calendar entries (presumab