Format of Column in report ALV.
Dear Experts.
I am creating a report ALV with the tables ANLA, ANLB, ANLC, and this work fine with the data that this display.
The problem that i have is the following:
The columns KANSW , KNAFA of the table ANLC that I display in te report When the currency is USD, I should show the datas with 2 decimals, but with currency COL, I should show this fields without decimals.
In the report ALV this data are show all in the same report ALV, in the same column.
When I am creating the catalog, i use :
gt_fieldcat-decimals_out = 2. and this show good the values when the currency is USD, but the other already show the two decilmals,
How can solve this issue.
Regards
Hi,
Firstly, Go to transaction OY04 to check how many decimal place will print depend on currency code.
Then, while building your fieldcat you should link currency amount to currency unit as below:
gs_fieldcat-fieldname = 'KANSW'.
gs_fieldcat-tabname = 'ITAB'. "assume your internal table while pass to REUSE_ALV...
gs_fieldcat-cfieldname = 'WAERS'. "your currency unit in ITAB
gs_fieldcat-ctabname = 'ITAB'.
*gt_fieldcat-decimals_out = 2 "try to comment this line
append gs_fieldcat to gt_fieldcat.
Please check.
Good luck.
Similar Messages
-
All the columns of an alv grid report are not downloading in excel in 1 lin
Hi All,
I have some 60 columns in my alv grid report and user can download the report using list->export->localfile->spreadsheet.
What the issue is that all the columns are not downloading in one line, instead they split in two rows.
Please help.
Regards,
Neha Patelhi,
just use this procedure it will solve your problem:
Firstly export the data to memory using the FM LIST_FROM_MEMORY.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = t_listobject
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc 0.
MESSAGE e000(su) WITH text-001.
ENDIF.
then i converted it into ASCII using LIST_TO_ASCI,
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = t_xlstab
listobject = t_listobject
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE e003(yuksdbfzs).
ENDIF.
This gives the data in ASCII format separated by '|' and the header has '-', dashes. If you use this internal table directly without any proccesing in SO_NEW_DOCUMENT_ATT_SEND_API1, then you will not get a good excel sheet attachment. To overcome this limitation, i used cl_abap_char_utilities=>newline and cl_abap_char_utilities=>horizontal_tab to add horizontal and vertical tabs to the internal table, replacing all occurences of '|' with
cl_abap_char_utilities=>horizontal_tab.
Set the doc_type as 'XLS', create the body and header using the packing_list and pass the data to be downloaded to SO_NEW_DOCUMENT_ATT_SEND_API1 as contents_bin.
This will create an excel attachment.
Sample code for formatting the data for the attachment in excel format.
u2022 Format the data for excel file download
LOOP AT t_xlstab INTO wa_xlstab .
DESCRIBE TABLE t_xlstab LINES lw_cnt.
CLEAR lw_sytabix.
lw_sytabix = sy-tabix.
u2022 If not new line then replace '|' by tabs
IF NOT wa_xlstab EQ cl_abap_char_utilities=>newline.
REPLACE ALL OCCURRENCES OF '|' IN wa_xlstab
WITH cl_abap_char_utilities=>horizontal_tab.
MODIFY t_xlstab FROM wa_xlstab .
CLEAR wa_xlstab.
wa_xlstab = cl_abap_char_utilities=>newline.
IF lw_cnt NE 0 .
lw_sytabix = lw_sytabix + 1.
u2022 Insert new line for the excel data
INSERT wa_xlstab INTO t_xlstab INDEX lw_sytabix.
lw_cnt = lw_cnt - 1.
ENDIF.
CLEAR wa_xlstab.
ENDIF.
ENDLOOP.
Sample code for creating attachment and sending mail:
FORM send_mail .
u2022 Define the attachment format
lw_doc_type = 'XLS'.
u2022 Create the document which is to be sent
lwa_doc_chng-obj_name = 'List'.
lwa_doc_chng-obj_descr = w_subject. "Subject
lwa_doc_chng-obj_langu = sy-langu.
u2022 Fill the document data and get size of message
LOOP AT t_message.
lt_objtxt = t_message-line.
APPEND lt_objtxt.
ENDLOOP.
DESCRIBE TABLE lt_objtxt LINES lw_tab_lines.
IF lw_tab_lines GT 0.
READ TABLE lt_objtxt INDEX lw_tab_lines.
lwa_doc_chng-doc_size = ( lw_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
lwa_doc_chng-obj_langu = sy-langu.
lwa_doc_chng-sensitivty = 'F'.
ELSE.
lwa_doc_chng-doc_size = 0.
ENDIF.
u2022 Fill Packing List For the body of e-mail
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 0.
lt_packing_list-body_start = 1.
lt_packing_list-body_num = lw_tab_lines.
lt_packing_list-doc_type = 'RAW'.
APPEND lt_packing_list.
u2022 Create the attachment (the list itself)
DESCRIBE TABLE t_xlstab LINES lw_tab_lines.
u2022 Fill the fields of the packing_list for creating the attachment:
lt_packing_list-transf_bin = 'X'.
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 0.
lt_packing_list-body_start = 1.
lt_packing_list-body_num = lw_tab_lines.
lt_packing_list-doc_type = lw_doc_type.
lt_packing_list-obj_name = 'Attach'.
lt_packing_list-obj_descr = w_docdesc.
lt_packing_list-doc_size = lw_tab_lines * 255.
APPEND lt_packing_list.
u2022 Fill the mail recipient list
lt_reclist-rec_type = 'U'.
LOOP AT t_recipient_list.
lt_reclist-receiver = t_recipient_list-address.
APPEND lt_reclist.
ENDLOOP.
u2022 Finally send E-Mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lwa_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
sent_to_all = lw_sent_to_all
TABLES
packing_list = lt_packing_list
object_header = lt_objhead
contents_bin = t_xlstab
contents_txt = lt_objtxt
receivers = lt_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Hope it will help you
Regards
Rahul sharma -
Variable Columns Dispaying in ALV Report
Hi ,
I am working on ALV report . I am displaying 40 static fields and variable fields . Those varaible fields dependent on internal table . In the internal table 3 fields are available
if it contains 1 row then in report variable fields are 3 OR
if it contains 2 rows then in report variable fields are 6 OR
if it contains 3 rows then in report variable fields are 9 OR
if it contains n rows then in report variable fields are 3n.
Example : 1) Internal table have 3 fields sd_active , sd_close , sd_term .
Internal table is i_a936 , Work area w _a936 .
w_a936-sd_active = 'A1'.
w_a936-sd_close = 'B1'.
w_a936-sd_term = 'C1'.
append w_a936 to i_a936.
w_a936-sd_active = 'A2'.
w_a936-sd_close = 'B2'.
w_a936-sd_term = 'C2'.
append w_a936 to i_a936.
Then in final internal table it should display 6 columns like w_final-sd_Active1 ,w_final-sd_close1,w_final-sd_term1 , w_final-sd_Active2 ,w_final-sd_close2,w_final-sd_term2 . Columns in Internal table varies from i_a936 rows .
I am trying to use Dynamic internal table .
Regards
Srihari NerellaHi,
I think this may help you . Use CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
see the link
Dynamic fields to be displayed in ALV
Dynamic column change in Alv
Dynamic Number of Columns in ALV -
Header Column for Report format
Hi All,
Sales
Col 1 Col2 Col3 Col4 Col5 Col6
489 81 38 608 608
408 77 484 484
18 9 27 3 30
300 27 32 358 358
We want Report in this Format. Columns (Col1 ,Col 2,Col 3...) Should be displayed under one header column "Sales" .
How can we achiev this in BW.
Regards,
Ali.Hi,
Create a Formula with SALES and under that you drap and drop all remaining Keyfigures, but you should assign some values for Sales fomrmula.
i.e. one level below. Chaild Node.
Sales
|--Kfig1
|--Kfig1
Thanks
Reddy
Edited by: Surendra Reddy on Dec 7, 2009 9:26 AM -
ALV - format the columns header
Hi all,
ALV list, created with FM REUSE_ALV_GRID_DISPLA, has the yellow background of columns header line and it's fine. When I view ALV in Microsoft Excel format, by pressing the corresponding icon, in the Excel file the color background of the first row (containing the header of the columns) is dark gray. The contents of the header cells are difficult to read because the background is too dark.
My questions are:
1. Can change the color of the column header of the ALV, to have the lightest color in Excel format?
2. Can be written in bold text in columns header of the ALV, to have the text in bold in Excel format?
3. Can write the header columns of the ALV (created with FM, non object oriented) in multiple rows, rather than one line?
Thanks in advance
SerenaYou can change color and text format in excel, when you change excel template.
You can export it in layout change, tab view and select excel and then choose sap_mm.xls (with macros).
rewrite macro for customer exit and import it back to system, then you can make it default. -
Conditional Column Formatting in an Interactive Report?
Is it possible to add conditional column formatting in an Interactive Report in Apex 4.1? I've found numerous examples for older versions using the standard (classic) report, but I haven't found any with the new Interactive Report. Is this possible? and if so, can someone point me in the direction of some documentation or examples?
I simply want to change the color of the text depending on whether a column has a value (eg. Error or Problem).
ThanksJB wrote:
Is it possible to add conditional column formatting in an Interactive Report in Apex 4.1? I've found numerous examples for older versions using the standard (classic) report, but I haven't found any with the new Interactive Report. Is this possible? and if so, can someone point me in the direction of some documentation or examples?
Oracle Application Express (APEX)
As interactive reports lack the HTML Expression feature of standard reports, the simple way to do this unfortunately requires violating the separation of concerns and generating structural (a <tt>span</tt> element) and presentational (an in-line style sheet) aspects in the query:
select
⋮
, case
when trunc(calling_date,'DD') = trunc(sysdate,'DD')
then
'<!-- ' || to_char(calling_date, 'YYYYMMDD') || ' --><span style="color: #3399FF;">' || to_char(calling_date) || '</span>'
else
'<!-- ' || to_char(calling_date, 'YYYYMMDD') || ' --><span>' || to_char(calling_date) || '</span>'
end calling_date
⋮For number/date columns to be properly sortable, the leading edge of the column must be an HTML comment that provides the required sort order using character semantics, as shown here.
The Display As column attribute for such columns must be set to Standard Report Column.
This method has side effects: some IR filters won't work; aggregate calculations can't be applied to the column; and report exports contain the HTML rather than the expected value.
Other approaches involve using Dynamic Actions/jQuery/JavaScript, or using the built-in highlight as suggested above, then saving the highlighted report as the default. -
Additional Lead Column in Report painter
Hi Gurus
Please guide me how to add an additional Lead column in Report painter
Thanks
HirenHi HIren,
There can be only one lead column in report painter.
However within the one lead column you can identify more than one characteristic - e.g. cost center and cost element. You can then identify that both characteristics should be exploded.
If you go Edit > Rows > Explode, you have the opportunity of identifying which characteristic takes presidence over the other, and how they expand. So in this example, Cost center will be 1 and cost element will be 2.
The output will be dependant upon your report layout, but you should have the layout so that you have:
Cost Center A:
- Cost Element A
- Cost Element B:
- Cost Element C:
Cost Center B:
- Cost Element A:
- Cost Element B:
- Cost Element C:
And to distinguish the cost centers from the cost elements, you can format the cost center row "Color for Totals"
Regards,
Gaurav -
I want to hide a column in report 6i
hi
I want to hide a column in report 6i,
I used this code
function F_col_qty3FormatTrigger return boolean is
begin
if :color3 is null then
return (false);
else
return (TRUE);
end if;
end;
plz note that COL_QTY3 and COLOR3 both are from different table
and resulting gave this error
REP-1314 Format trigger 'F_col_qty3' reference column 'color3' at wrong frequency.You can format fields from a lower level group using fields from an upper level field, but not vice versa. This is because for the same upper level field there may exist several values of the lower level field. If this can not happen in your situation, there is no reason to place the fields in different groups.
-
Subtotal text in the 3rd column of the alv list
Hi Guru,
Can anyone know or have some codes on how to implement a subtotal text in the 3rd column of the ALV list. Im using FM REUSE_ALV_HIERSEQ_LIST_DISPLAY to display the report.
Please give some advise or help.
Thanks and rewards is given.Hi my friend,
Insted Using FM REUSE_ALV_HIERSEQ_LIST_DISPLAY
better use REUSE_ALV_GRID_DISPLAY.
in that
it_sort = i_sort[]
constants : c_x type char1 value 'X'.
l_rec_fieldcat_wa-do_sum = c_x.
endif. -
How do I set individual properties for a column in report layout at runtime
How do I set individual properties for a column in report layout at runtime? I need to change this based on a user's input. This is for v10g.
I need to change either the "Read from File" attribute or the "File Format" attribute for one column based on the user's input. IS this possible?
Thanks in advance!Hi,
define 2 columns and use format triggers to show the one or the other column.
Regards
Rainer -
Conditionally Formatting One Column Based On The Value of Another Column
I have the following requirement:
I have 2 columns in a report showing Actual Sales & Budget Sales each year. I am using a bar chart to show the different values for these 2 columns.
I need to conditionally format the column "Actual Sales" so that if it is less than the "Budget Sales" it will appear in red, and green if "Actual Sales" is greater than "Budget Sales." So in a nutshell,
CASE WHEN "Actual Sales" < "Budget Sales" THEN
RED
ELSE
GREEN
END
Thoughts anyone?CASE WHEN (COL1 - COL2) < 0 then Red else Green end
regards
John
http://obiee101.blogspot.com -
Hello,
I've a report-column (varchar2).
In the excel-column this column is displayed as 1,23457E+11 but the origin value is 123456789012. I have the same behavior with a number column.
So I have to format this column in excel to number.
Afterwards the value is displayed fine.
Can I solve this problem in HTMLDB so that our end-users mustn't change the column type?
Thanks in advance
Regards
UlrikeHi,
Try in the report query something like that:
select TO_CHAR(exchange_rate, 'FM99999999.999') from currencies;
Choose format mask appropriate for your needs.
That should solve the problem.
Konstantin -
Is it possible to make a condition for formatting multiple column?
I am working on financial report like Balance Sheet. So that I am going to have 2 column and 1 on left, 2 and 3 on right.
I tried to use format multiple columns but can't find any method to define where to break.when you create a stored procedure or use a command file( i believe) you can create CASE statements
CASE WHEN ='BLUE' THEN 'COLUMN1'
WHEN ='GREEN' THEN 'COLUMN2' END AS BUCKET1
when you use this as the dataset you will see this as a field
you can then group by the fields created. -
Editing a Column in Hirerachial ALV
Hi,
I have ALV Report which had been displayed using CL_SALV_HIERSEQ_TABLE.
Now I got a Requirement To add a column at Item level to add Comments.
Is it possible to Edit a Column in Hirarichal ALV? Is any other way to add comments to the List in a column?
your suggestions are valuable...Please reply..
Thanks,
J.Hi sekhar,
the HIER_SEQ class is for classical LIST output, here (as in all SALV applications) you have no input possibility.
You could add a COMMENT column to your table and program a (double-click?) event. This could issue a popup and ask for the commentary. Then you could modify and refresh the list.
See program SALV_DEMO_HIERSEQ_EVENTS for catching the event. I hope, you can do the rest.
Kind regards,
Clemens -
How to switch off column coloring of alv grid printouts?
Hello World!
Is there any possibility (a customizing option or a parameter) to switch off cell/column coloring of alv grid printouts?
It is very useful to see colored columns in screens, but they are darkened in printouts. How to avoid it?
Thanks and regards,
VladimirHi,
You can have different layouts for a ALV report and each layout the look and feel can be different.
So, the manual activity is the user will have to switch to the B/W layout before printing. I am not sure if you have enabled the LAYOUT option for the user to change it by himself.
I hope I am able to get across my point.
If you are using OO ALV control, you can dynamically change the layout using set_frontend_layout method. The user can also change the layout --
choose Change layout or Settings ® Layout ® Change.
The Change Layout dialog box shows you which columns are currently displayed and which additional columns can be displayed.
Regards,
Ravi
Note - Please mark the helpful answers
Message was edited by: Ravikumar Allampallam
Maybe you are looking for
-
Upgraded to Lion and now my iMac doesn't recognise any sound output devices?
Any ideas on how to solve this? "No output devices found" is what the system preferences show under Output.
-
Low Ink level warning on new inks.
I own a Photosmart c309a and I am about ready to throw the thing out of the window. I purchased all 5 inks required today, printed 1 test photo (6x4), 2 personal photos (6x4) and about 7 test pages as I have not used the printer for a couple of month
-
I installed ilife08 without any problems. When I ran imovie for the first time it imported all my video clips as I hoped it would. After a little while playing around with the new programs I ran a software update which updated iphoto to version 7.0.1
-
I have had BT infinity 6 weeks. It drops connection constantly. I have never encountered such problems with any router. I have tried every suggestion on here that I can think of including splitting networks (2.4 and 5 ghz), turned off smart wireless,
-
How do you copy/install a pre-configure client for Mexico
Is there a pre-configured client for Mexico. If yes, how do you install pre-configured clients. Where do you get information on pre-configured clients Thanks Joe