No decimals in ALV presentation
Hello everyone,
I have an ALV that shows 40 columns with quantities. The ALV is referenced to a specific structure created in SE11 that has all 40 fiels of type MENGE1.
The quantities shown are allways going to be integers, so i don't need the 3 decimals that type quantity has. How can i hide them ?
I tried field decimals_out in fieldcatalog, but probably i'm not doing it right...
Can anyone help me ?
Thank you in advance,
Nuno
Hello Always Learner,
So, that means i would have to add 40 new fields to my structure of type p decimals 0. Isn't there a way to just hide the decimals with a loop in the form that creates the field catalog?
I'm trying to avoid to modify the structure created bu other developer and used in other programs.
Edited by: Nuno Santos on Mar 12, 2009 12:07 PM
Similar Messages
-
How to remove displaying decimals in ALV report(using FM) ?
HI Sri,
Pass the values into a variable of type i.
data : var type i,
var1 type f value '2.111'.
var = var1.
or else
change the field catalog this way ..
<b>lv_cat-decimals_out = '0'.</b>
Regards,
Santosh -
Problem in displaying decimals in ALV
Hello Everyone,
I am facing problem in displaying decimals in ALV
Here i want to display 1.00000- but is displaying as 1,000.00-
Is there any solution by not using REPLACE and changing the user settings. Please let me know. <removed by moderator>
Thanks in advance.
Radha.
Edited by: Thomas Zloch on Dec 12, 2011 6:23 PM- If this is a currency amount or a quantity, did you correctly define the link to currency code or quantity unit of measure ?
(Many available documents to read like [Value Display with Currency/Quantity Unit|http://help.sap.com/saphelp_erp2004/helpdata/en/ff/4649b1f17411d2b486006094192fe3/frameset.htm])
- If this is not such a field, but a basic numeric type, did you try to fill DECIMALS_O in the field catalog ?
Regards,
Raymond -
I want to hide decimals in ALV report. I have written next code.
WHEN 'EXI_PP'.
t_alv_fieldcat-col_pos = 5.
t_alv_fieldcat-datatype = 'QUAN'.
t_alv_fieldcat-decimals_out = 0.
t_alv_fieldcat-reptext_ddic = 'Exis. GT'.
t_alv_fieldcat-do_sum = 'X'. "Realizar suma
WHEN 'EXI_CUA'.
t_alv_fieldcat-col_pos = 6.
t_alv_fieldcat-decimals_out = 0.
t_alv_fieldcat-reptext_ddic = 'Exis. ZF'.
t_alv_fieldcat-do_sum = 'X'. "Realizar suma
MODIFY t_alv_fieldcat .
But report still showing decimals . some body could help me please?????Hi,
Try this way
t_alv_fieldcat-datatype = 'QUAN'.
t_alv_fieldcat-decimals_out = 0'.
a® -
Currency field with Decimals in ALV
Hi,
Im having a problem with display of currency field wityh decimals.
My currency field is declared as type dmbtr ( whis is currency field data element in standard).
I have some amount say 1589.00 which is Korean currency. But this Korean currency doesnt have any decimals.
(My source field is always 2 decimals irrecpective of curency. It will store as below,
if value 100 JPY--> TABLE STORE 100.00
200 SGD --.> 200.00
500 KRW --> 500.00
sO MY source field always maintained with 2 decimals)
In alv im using the currency field so that it displays the correct decimals.
wa_fcat-cfieldname = 'WAERS'.
wa_fcat-ctabname = 'IT_FINAL_ALV'.
wa_fcat-datatype = 'CURR'.
Now IN alv it displays 158,900 which is not correct.
My requirement is I have display this value as 1589 for Korean currency(as it doesnt have any decimals)
( I observed that the value is always stored with 2 decimals in database field)
if value 1589.00 and output currency is JPY(japan) IT HAS TO Display 1589.000.
Can anybody give any hint..?
Message was edited by:
agrud agrudplease try like this it should work..
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'. "Display column total
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
reward points if it is usefull .....
Girish -
Hi,
I want to Display Quantity fields (AFVV-LMNGA) with no decimals in ALV. I have used DECIMALS_OUT = 0.
But it is not working.
Can any one help me.
Thanks,
KishoreHi Kishore,
Have you added datatype along with your decimals_out.
wa_fieldcat-datatype = 'INT4'. "any data type that you are using.
add the above in your field calalog and test.
Cheers!!
VEnk@ -
Hi,
I am populating field quantity (13+3 decimals) in ALV.
I want it to appear without decimal places.
how should i get rid of it?
there is a field called 'decimals_out' in ALV field catalogue. How to use this..? I am passing '0' in that but its not working for me..
Reply quickly,
Regs,
Ags..Here is code:
PERFORM populate_fieldcat USING:
'MOQ' 'GI_ALV_OUTPUT' text-038 ' ' '15' ' ',
'AUMNG' 'GI_ALV_OUTPUT' text-039 ' ' '15' '0'.
*& Form populate_fieldcat
Subroutine to populate the field catlogue
FORM populate_fieldcat USING fv_fnam
fv_tabnam
fv_headtxt
fv_nozero
fv_length
fv_decimals.
CLEAR gw_afield.
gw_afield-fieldname = fv_fnam.
gw_afield-tabname = fv_tabnam.
gw_afield-seltext_l = fv_headtxt.
gw_afield-no_zero = fv_nozero.
gw_afield-outputlen = fv_length.
gw_afield-decimals_out = fv_decimals.
IF fv_fnam = 'SCMNG' OR
fv_fnam = 'AUMNG'.
gw_afield-decimals_out = '0'.
gw_afield-datatype = 'QUAN'.
ENDIF.
APPEND gw_afield TO gi_fieldcatalog.
ENDFORM. " populate_fieldcat
I am passing gi_fieldcatalog to FUNCTION 'REUSE_ALV_GRID_DISPLAY':---
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_bypassing_buffer = 'X'
i_buffer_active = ' '
i_callback_program = lv_report
i_callback_pf_status_set = gc_status
i_callback_user_command = gc_user_command
i_callback_top_of_page = gc_top_of_page
is_layout = gw_layout
it_fieldcat = gi_fieldcatalog
it_sort = gi_sort
i_save = gc_save
is_variant = gw_variant
it_events = gi_events
IMPORTING
e_exit_caused_by_caller = gv_exit_caused_by_caller
es_exit_caused_by_user = gw_exit_caused_by_user
TABLES
t_outtab = gi_output
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE s010 DISPLAY LIKE gc_e.
LEAVE LIST-PROCESSING.
ENDIF. -
Dump when changing the value for a field (of 13 decimals) in alv grid.
Hi Group,
Its giving a dump when user is trying to change the value.
dump description: Unable to interpret "70,000 " as a number.
what is happening here is, the original value is 50,000 and he is deleting 5 and replacing it with 7, here its throwing the dump.
If he removes the complete number 50,000 and then gives 70000 its taking the value.
I tried to use, the decimals options in alv field catalog but to no joy.
Please can you give me an advice on this.
Many Thanks.the problem is the comma in the 70,000....that's an alpha character.... Normally, we expect SAP to display numeric fields in a appropriate format, based upon their numeric type, but trying to forcibly insert '70,000' into a true numeric-type field can generate an 'unable to interpret xxx,xxxx as number' error.
You could experiment with changing your ALV column to a char17 (or appropriate width) and putting your numeric value into that to display, then converting back to type P, or other field type in the table, in a column that is not displayed, when the user changes the value.... essentially two columns, one not displayed with a routine to copy/convert the numeric field into the alpha field and the reverse when the field is changed.
But, the better solution is probably for the user to understand that they're seeing a formatted numeric field, and that they need to replace the entire value with the only possible punctuation being a decimal and (if necessary) a negative sign. -
How to remove the display of DECIMALS in ALV? Any Falg?
Hi Experts,
One simle dount that, I am getting some values in some fields as 12.34; 11.22 etc - 2 decimals, but, am looking to hv as 12; 11 - NO DECIMALS.
So, I looked any flag in Fileds catalog, Lay out in SLIS, but, did not find any flag?
now, am getting it by moving to a P type field.
But, pls. let me know that How to get it done in ALV w/ SLIS? wht is the flag?
thanqCheck the field catalog, there is a field called decimals_out, set this to 0(zero).
Regards,
Rich Heilman -
Problem in hiding decimals for ALV reprt
I am trying to hide decimal in ALV report. following is part of a code which I have written. I have checked gt_fieldcat in debug, fieldcat is updated with value for ls_ftcat-decimals_out. But somehow report is still showing decimals.Please help...?
FORM modify_fieldcat .
DATA: ls_ftcat TYPE slis_fieldcat_alv.
IF gt_fieldcat[] IS NOT INITIAL.
LOOP AT gt_fieldcat INTO ls_ftcat.
CASE ls_ftcat-fieldname.
WHEN 'TOT_COST'.
ls_ftcat-seltext_l = 'TOTAL COST PER UNIT'.
ls_ftcat-ddictxt = 'L'.
ls_ftcat-just = 'R'.
ls_ftcat-decimals_out = '0'.
MODIFY gt_fieldcat FROM ls_ftcat.Hi prafulla,
instead of giving
<b>ls_ftcat-decimals_out = '0'.</b>
Give this way
<b>ls_ftcat-DECIMALS_O = '0'.</b>
It will show you ALV control number of decimal places for output.
regards,
venu. -
Require editable quantity value without Decimals in ALV display
I'm displaying the ALV with quantity in editable mode where the end user gives the quantity value.I need to restrict the user to give the value as a whole number i.e without decimals. How can we do it in ALV. I tried the same by giving the field as type 'N' but still, i can give the value with decimals. It is showing an error since this being an interactive ALV, on clicking the button,the proceess is taking value. Would you guide me
Thanks
RavindraHi,
In the fieldcatalog you should have a field decimals_out, you can set the output decimals there, try setting it in 0.
Hope it helps. -
Hi All,
Can anyone suggest me the sites where I could get useful information regarding complete ALV Reports.
Give me useful information so that I can make a good PPT presentation
Thanks & Regards,
A.M.K.Hi!
See SAP LIST VIEWER - THE NEW PROGRAMMING MODEL on this site (https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5dc3e690-0201-0010-1ebf-b85b3bed962d).
Best!
Jim -
ALV column with variable number of decimals to be displayed
Hi,
I've an ALV where I need to display a numeric column with a variable number of decimal row-by-row, from 0 (no decimals) to 4.
I've declared the numeric field as TYPE P DECIMALS 4.
I've tried with DECMLFIELD in ALV catalog, and this works for 1 to n decimals, but when I leave the field indicated in DECMLFIELD equal to 0, ALV shows the default number of decimals of the field (4 in that case).
Any help will be very appreciated.
Thanks.
JordiNo, I didn't try EDIT_MASK.
How should I use it to format output to display decimals or not depending on the row?
I have 2 kinds of values, all stored in a TYPE P DECIMALS 4: Those that really are an integer (decimals should not be displayed for that ones) and the values that really have 4 decimals (which should be displayed with decimals in ALV).
Example:
13,0000 should be displayed as 13
0,4567 should be displayed as 0,4567
With EDIT_MASK could I do that?
Thank you very much. -
***INCLUDE LUCR_LSTF03 .
*& Form display_detail_list
FORM display_detail_list_subscreen.
IF g_display_detail_again IS INITIAL.
IF g_display_detail_next IS INITIAL.
* Header text is displayed as dyn. document
IF go_dydo IS INITIAL.
CREATE OBJECT go_dydo.
ELSE.
FREE go_dydo.
CLEAR go_dydo.
CREATE OBJECT go_dydo.
PERFORM free_create_screen_objects.
ENDIF.
ELSE.
IF NOT go_dydo->html_control IS INITIAL.
CALL METHOD go_splitter_container->remove_control
EXPORTING
row = 1
column = 1.
ENDIF.
ENDIF.
ENDIF.
* Initialize document
CALL METHOD go_dydo->initialize_document.
IF LINES( gt_header ) > 0.
* Build and display detail-header
PERFORM build_header TABLES gt_header
USING go_dydo
gs_header.
ENDIF.
* Merge header-document
CALL METHOD go_dydo->merge_document.
* set toolbar-added functions for detailed list
REFRESH gt_toolbar.
IF go_model->ds_tx_data_io_type-documents IS BOUND. "mb210303
PERFORM fill_tool_tab USING:
gt_toolbar gs_toolbar 'UCR_DUMMY' '1',
gt_toolbar gs_toolbar 'UCR_ENTRIES' '2',
gt_toolbar gs_toolbar 'UCR_DUMMY' '3',
gt_toolbar gs_toolbar 'UCR_PREV' '4',
gt_toolbar gs_toolbar 'UCR_NEXT' '5',
gt_toolbar gs_toolbar 'UCR_DUMMY' '6'.
ELSE. "mb210202 beg.
PERFORM fill_tool_tab USING:
gt_toolbar gs_toolbar 'UCR_DUMMY' '1',
gt_toolbar gs_toolbar 'UCR_PREV' '2',
gt_toolbar gs_toolbar 'UCR_NEXT' '3',
gt_toolbar gs_toolbar 'UCR_DUMMY' '4'.
ENDIF. "mb210202 end.
SET HANDLER go_event_grid->handle_toolbar_comp FOR go_grid.
* Display header
CALL METHOD go_dydo->display_document
EXPORTING
parent = go_container_head.
* Set header-control visible with user set or
* predefined height
IF NOT go_splitter_container IS INITIAL.
IF g_height IS INITIAL.
g_height = 27.
ENDIF.
CALL METHOD go_splitter_container->set_row_height
EXPORTING
id = 1
height = g_height.
ENDIF.
* display detail-list
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
i_bypassing_buffer = 'X'
is_layout = gs_layout_save
it_toolbar_excluding = gt_exclude_toolbar
CHANGING
it_fieldcatalog = gt_fieldcat_d
it_outtab = <gt_outtab_detail>.
IF NOT g_display_detail_next IS INITIAL.
CALL METHOD go_grid->refresh_table_display.
ENDIF.
* Set cursor on selected row if necesary
IF NOT gt_row_id_detail IS INITIAL.
CALL METHOD go_grid->set_selected_rows
EXPORTING
it_index_rows = gt_row_id_detail.
REFRESH gt_row_id_detail.
ENDIF.
CLEAR: g_display_detail_next,
g_display_detail_again.
ENDFORM. " display_detail_list_subscreen
*& Form display_main_list
FORM display_main_list_subscreen. "using i_reporting_logic type uc_flg.
CLEAR g_detail.
* set toolbar-added functions
REFRESH gt_toolbar.
IF go_model->ds_tx_data_io_type IS NOT INITIAL.
IF go_model->ds_tx_data_io_type-documents IS BOUND. "mb210303
* and i_reporting_logic is initial.
PERFORM fill_tool_tab USING:
gt_toolbar gs_toolbar 'UCR_DUMMY' '1',
gt_toolbar gs_toolbar 'UCR_ENTRIES' '2',
gt_toolbar gs_toolbar 'UCR_DUMMY' '3',
gt_toolbar gs_toolbar 'UCR_SEL_COND' '4',
gt_toolbar gs_toolbar 'UCR_DUMMY' '5'.
ELSE.
PERFORM fill_tool_tab USING:
gt_toolbar gs_toolbar 'UCR_DUMMY' '1',
gt_toolbar gs_toolbar 'UCR_SEL_COND' '2',
gt_toolbar gs_toolbar 'UCR_DUMMY' '3'.
ENDIF. "mb210303
SET HANDLER go_event_grid->handle_toolbar_comp FOR go_grid.
ELSE .
PERFORM fill_tool_tab USING:
gt_toolbar gs_toolbar 'UCR_DUMMY' '1',
gt_toolbar gs_toolbar 'UCR_SEL_COND' '2',
gt_toolbar gs_toolbar 'UCR_DUMMY' '3'.
SET HANDLER go_event_grid->handle_toolbar_comp FOR go_grid.
ENDIF.
* Set header-control invisible while main-list is displayed
IF NOT go_splitter_container IS INITIAL.
* Header container can be set visible by user on main-screen
CALL METHOD go_splitter_container->set_row_height
EXPORTING
id = 1
height = 0.
IF NOT go_dydo IS INITIAL.
* Display last header if user wants to set it visible
CALL METHOD go_dydo->display_document
EXPORTING
parent = go_container_head.
ENDIF.
ENDIF.
* subscreen with main list simply is started once again
* prepared with current user settings
IF ( LINES( gt_fieldcat_save ) > 0 ) AND
NOT g_display_main_again IS INITIAL.
REFRESH gt_fieldcat.
gt_fieldcat[] = gt_fieldcat_save[].
* clear g_display_main_again.
* is necessary, because current_frontend_fieldcat must be set
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
i_bypassing_buffer = 'X'
i_save = g_save
is_layout = gs_layout
is_variant = gs_variant
it_special_groups = gt_sgrp "mb110403
it_toolbar_excluding = gt_exclude_toolbar
CHANGING
it_fieldcatalog = gt_fieldcat
it_outtab = <gt_outtab>.
* set current fieldcat
CALL METHOD go_grid->set_frontend_fieldcatalog
EXPORTING
it_fieldcatalog = gt_fieldcat.
* now reset other current layout-infos if necessary
PERFORM set_current_layout USING go_grid
gt_filter_save
gt_sort_save
gs_layout_save.
* display current main-list
CALL METHOD go_grid->refresh_table_display.
REFRESH: gt_fieldcat_save, gt_filter_save, gt_sort_save.
CLEAR : gs_layout_save.
ELSE.
* Show ALV
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
i_bypassing_buffer = 'X'
i_save = g_save
is_layout = gs_layout
is_variant = gs_variant
it_special_groups = gt_sgrp "mb110403
it_toolbar_excluding = gt_exclude_toolbar
CHANGING
it_sort = gt_sort
it_fieldcatalog = gt_fieldcat
it_outtab = <gt_outtab>.
CLEAR g_display_detail_again.
g_display_main_again = 'X'.
ENDIF.
* Set cursor on selected row if necesary
IF NOT gt_row_id IS INITIAL.
CALL METHOD go_grid->set_selected_rows
EXPORTING
it_index_rows = gt_row_id.
ENDIF.
ENDFORM. " display_main_list_subscreen
*& Form display_message
FORM display_message USING lo_grid_object TYPE REF TO cl_gui_alv_grid
lf_refresh_msg_table TYPE c.
DATA: l_lines TYPE i,
ls_layout TYPE lvc_s_layo.
* header_main is not used by Worbench
IF g_subscreen IS INITIAL.
PERFORM header_main.
ENDIF.
g_no_data = 'X'.
* if first data selection results no data gt_parameter_save must be
* filled from lt_parameter to take care of further user changed
* parameters from list screen
DESCRIBE TABLE gt_parameter_save LINES l_lines.
IF l_lines = 0.
gt_parameter_save[] = gt_parameter[].
ENDIF.
PERFORM no_data_selected IN PROGRAM (gc_progname)
USING gt_fieldcat_mess
gs_fieldcat_mess
gt_message
gs_message
text-101
text-102
'TEXT'
'LT_MESSAGE'
lf_refresh_msg_table " 'X'
space. " 'C610'. no color, accessibility
*** Start of Comment By Ramesh Babu N,IBM - C1DK900725 ***
* Set header-control invisible while main-list is displayed
* IF NOT go_splitter_container IS INITIAL.
* CALL METHOD go_splitter_container->set_row_height
* EXPORTING
* id = 1
* height = 0.
* CALL METHOD go_splitter_container->set_row_sash
* EXPORTING
* id = 1
* type = cl_gui_splitter_container=>type_sashvisible
* value = cl_gui_splitter_container=>false.
* ENDIF.
*** End of Comment By Ramesh Babu N,IBM - C1DK900725 ***
* display messages
* ls_layout-no_toolbar = 'X'.
CALL METHOD lo_grid_object->set_table_for_first_display
EXPORTING
i_bypassing_buffer = 'X'
it_toolbar_excluding = gt_exclude_toolbar_mess
is_layout = ls_layout
CHANGING
it_fieldcatalog = gt_fieldcat_mess
it_outtab = gt_message.
*** Start of Comment By Ramesh Babu N,IBM - C1DK900725 ***
* Event-Handler for docking-container
* IF go_event_dock IS INITIAL.
* CREATE OBJECT go_event_dock.
* ENDIF.
*** End of Comment By Ramesh Babu N,IBM - C1DK900725 ***
IF go_parameter IS INITIAL.
CALL METHOD cl_uc_parameter=>get_instance
IMPORTING
eo_instance = go_parameter.
ENDIF.
*** Start of Comment By Ramesh Babu N,IBM - C1DK900725 ***
* SET HANDLER go_event_dock->handle_new_parameters FOR go_parameter.
*** End of Comment By Ramesh Babu N,IBM - C1DK900725 ***
ENDFORM. " display_message
*& Form sub_download_data
* Used for downloading BCS data to a TAB delimited file in Custom task *
* <--ct_data HASHED TABLE
FORM f_download_data USING ct_task TYPE uc_task
ct_sel TYPE uc0_ts_sel
gt_param TYPE ucm_ts_parameter
CHANGING ct_message TYPE uc0_t_message
ct_data TYPE HASHED TABLE..
* SUBROUTINE DESCRIPION: Used for downloading BCS data to file in Custome Task
* DEVELOPER: Ramesh Babu Nalla , IBM
* CREATION DATE: 2007-10-11
* DER NUMBER: None
* TRANSPORT NUMBER(S): C1DK900725
* REVISION HISTORY-----------------------------------------------------*
* REVISION NO: C1DK900725 REFERENCE NO: None
* DEVELOPER: Ramesh Babu N,IBM DATE: 2007-10-11
* DESCRIPTION: Copied from SAP FM UCR_LST_LOGIC *
CONSTANTS : c_task01 TYPE uc_task VALUE 'T2700',
c_task02 TYPE uc_task VALUE 'T2490'.
TYPES: BEGIN OF ty_download,
** /bic/zcs_comp TYPE char08, " Unilever-Company
** /bic/zcs_item TYPE char10, " Unilever-Item
** /1fb/move_type TYPE char03, " Unilever-Movement type
** /bic/zcs_pcom TYPE char08, " Unilever-Partner Company
** /bic/zcs_invc TYPE char08, " Unilever-Investee Company
** /bic/zcs_cang TYPE char03, " Unilever-Cost Analysis Group
** /bic/zcs_ad TYPE char08, " Unilever-Aquisitions/Disposals
** /bic/zcs_cd TYPE char08, " Unilever-Continued/Discontinued Ops.
** /bic/zcs_prgp TYPE char08, " Unilever-Product Category
/bic/zfb_comp TYPE char08, " Unilever-Company
/bic/zfb_item TYPE char10, " Unilever-Item
/bic/zfb_move TYPE char03, " Unilever-Movement type
/bic/zfb_pcom TYPE char08, " Unilever-Partner Company
/bic/zfb_invc TYPE char08, " Unilever-Investee Company
/bic/zfb_cang TYPE char03, " Unilever-Cost Analysis Group
/bic/zfb_ad TYPE char08, " Unilever-Aquisitions/Disposals
/bic/zfb_cd TYPE char08, " Unilever-Continued/Discontinued Ops.
/bic/zfb_prgp TYPE char08, " Unilever-Product Category
/1fb/cs_trn_lc TYPE string, " Unilever-Period value in Local currency
/1fb/cs_trn_qty TYPE string, " Unilever-Periodic quantity
unit type string,
END OF ty_download.
* flag
DATA flg_chk TYPE c.
DATA: lr_s_data_out TYPE REF TO data,
lr_t_data_out TYPE REF TO data,
l_outtype TYPE field_type VALUE 'UCR_SX_TX_DATA_LST',
lr TYPE REF TO data,
lo_conv TYPE REF TO lcl_convert_output,
lt_char TYPE lcl_convert_output=>th_comp,
ls_comp TYPE lcl_convert_output=>s_comp,
lr_s_data TYPE REF TO data,
lr_t_data TYPE REF TO data,
l_filename TYPE string,
l_action TYPE i,
l_path TYPE string,
l_seperator TYPE char01 VALUE 'X',
l_fullpath TYPE string,
l_mmyy TYPE string,
lr_sel_data TYPE REF TO data,
lr_t_val TYPE REF TO data,
lr_t_final TYPE REF TO data,
lr_val TYPE REF TO data,
ls_download TYPE REF TO data,
lt_download TYPE REF TO data,
ls_sel TYPE REF TO data,
ls_msg TYPE uc0_s_message.
** SOC by Dpak-------------------------------------------------------------------------------------------
** Changed by Deepak N Jain, IBM on 16/11/2006 as the corresponding field name assigned by Ramesh from
** the structure <LS_DATA_OUT> are not matching. This is because of the new cube from whch the Financial
** data is coming now. The new cube is ZFBCS_T1 which has replaced the old cube ZCS_T1.
** Hence, Short Dump on Execution.
** DATA: l_comp TYPE string VALUE '/BIC/ZCS_COMP', " Unilever-Company
** l_cgcomp TYPE string VALUE '/1FB/SEM_CGCOMP'," Unilever-Consolidation Group
** l_pcomp TYPE string VALUE '/BIC/ZCS_PCOM', " Unilever-Partner Company
** l_doct TYPE string VALUE '/BIC/ZCS_DOCT', " Unilever-Document type
** l_plevel TYPE string VALUE 'CS_PLEVEL', " Unilever-Posting Level
** l_tc TYPE string VALUE '/1FB/CS_TRN_TC', " Unilever-Period value in Transaction currency
** l_qty TYPE string VALUE '/1FB/CS_TRN_QTY'," Unilever-Periodic quantity
** l_trn_lc TYPE string VALUE '/1FB/CS_TRN_LC', " Unilever-Period value in Local currency
** l_bu TYPE string VALUE '/BIC/ZCS_PROF', " Unilever-Business Unit/Cost Centre
** l_low TYPE string VALUE 'LOW'.
DATA: l_comp TYPE string VALUE '/BIC/ZFB_COMP', " Unilever-Company
l_cgcomp TYPE string VALUE '/BIC/ZFB_CG1', " Unilever-Consolidation Group
l_pcomp TYPE string VALUE '/BIC/ZFB_PCOM', " Unilever-Partner Company
l_doct TYPE string VALUE '/BIC/ZFB_DOCT', " Unilever-Document type
l_invc TYPE string VALUE '/BIC/ZFB_INVC', " Unilever-Investee Company
l_plevel TYPE string VALUE 'CS_PLEVEL', " Unilever-Posting Level
l_tc TYPE string VALUE '/1FB/CS_TRN_TC', " Unilever-Period value in Transaction currency
l_qty TYPE string VALUE '/1FB/CS_TRN_QTY'," Unilever-Periodic quantity
l_trn_lc TYPE string VALUE '/1FB/CS_TRN_LC', " Unilever-Period value in Local currency
l_bu TYPE string VALUE '/BIC/ZCS_PROF', " Unilever-Business Unit/Cost Centre
l_low TYPE string VALUE 'LOW',
l_unit TYPE string VALUE 'UNIT'.
** EOC by Dpak-----------------------------------------------------------------------------------------------
** future use **
** FISCVARNT TYPE L0002FISCVARNT,
** FISCPERIOD TYPE L0002FISCPERIOD,
** /BIC/ZFB_VERS TYPE L0002/BIC/ZFB_VERS,
** /BIC/ZFB_CG1 TYPE L0002/BIC/ZFB_CG1,
** /BIC/ZFB_COMP TYPE L0002/BIC/ZFB_COMP,
** /1FB/CS_CHART TYPE L0002/1FB/CS_CHART,
** /BIC/ZFB_MOVE TYPE L0002/BIC/ZFB_MOVE,
** /BIC/ZFB_PCOM TYPE L0002/BIC/ZFB_PCOM,
** ACQ_YEAR TYPE L0002ACQ_YEAR,
** ACQ_PER TYPE L0002ACQ_PER,
** /BIC/ZFB_INVC TYPE L0002/BIC/ZFB_INVC,
** /BIC/ZFB_ALCO TYPE L0002/BIC/ZFB_ALCO,
** CS_PLEVEL TYPE L0002CS_PLEVEL,
** /BIC/ZFB_DOCT TYPE L0002/BIC/ZFB_DOCT,
** BCS_CTFLG TYPE L0002BCS_CTFLG,
** UNIT TYPE L0002UNIT,
** /1FB/CURKEY_TC TYPE L0002/1FB/CURKEY_TC,
** /1FB/CURKEY_LC TYPE L0002/1FB/CURKEY_LC,
** /1FB/CURKEY_GC TYPE L0002/1FB/CURKEY_GC,
** /BIC/ZFB_PRGP TYPE L0002/BIC/ZFB_PRGP,
** /BIC/ZFB_COUN TYPE L0002/BIC/ZFB_COUN,
** /BIC/ZFB_CANG TYPE L0002/BIC/ZFB_CANG,
** /1FB/FUNC_AREA TYPE L0002/1FB/FUNC_AREA,
** /BIC/ZFB_CT TYPE L0002/BIC/ZFB_CT,
** /BIC/ZFB_CD TYPE L0002/BIC/ZFB_CD,
** /BIC/ZFB_AD TYPE L0002/BIC/ZFB_AD,
** /BIC/ZFB_FR01 TYPE L0002/BIC/ZFB_FR01,
** /BIC/ZFB_FR02 TYPE L0002/BIC/ZFB_FR02,
** FISCYEAR TYPE L0002FISCYEAR,
** /BIC/ZFB_ITEM TYPE L0002/BIC/ZFB_ITEM,
** future use **
FIELD-SYMBOLS: <lt_data_out> TYPE STANDARD TABLE,
<ls_data_out> TYPE ANY,
<ls_data> TYPE ANY,
<ls_data_cop> TYPE ANY,
<lt_data_std> TYPE STANDARD TABLE,
<ls_data_std> TYPE ANY,
<ls_download> TYPE ANY,
<lt_download> TYPE STANDARD TABLE,
<comp> TYPE ANY,
<cgcomp> TYPE ANY,
<pcomp> TYPE ANY,
<doct> TYPE ANY,
<plevel> TYPE ANY,
<tc> TYPE ANY,
<invc> TYPE ANY,
<qty> TYPE ANY,
<unit> TYPE ANY,
<trn_lc> TYPE ANY,
<comp1> TYPE ANY,
<cgcomp1> TYPE ANY,
<pcomp1> TYPE ANY,
<doct1> TYPE ANY,
<plevel1> TYPE ANY,
<tc1> TYPE ANY,
<invc1> TYPE ANY,
<qty1> TYPE ANY,
<trn_lc1> TYPE ANY,
<unit1> TYPE ANY,
<bu> TYPE ANY,
<bu1> TYPE ANY,
<low> TYPE ANY,
<l_year> TYPE ANY ,
<l_period> TYPE ANY ,
<l_mmyy> TYPE ANY,
<ls_sel_data> TYPE ANY,
<ls_val> TYPE zbcs_check_val,
<lt_t_val> TYPE STANDARD TABLE,
<lt_t_final> TYPE STANDARD TABLE.
**************** Begin Of Addtion - ASIF MAQBOOL ******************
Data: BEGIN OF l_s_tab,
values TYPE C LENGTH 400,
end OF l_s_tab,
gs_param LIKE LINE OF gt_param,
l_temp_store LIKE gt_param.
Field-SYMBOLS: <gt_param> TYPE ANY TABLE,
<final_gt> TYPE any ,
<gs_fieldname> TYPE any,
<gs_value> TYPE any.
Data: l_t_tab TYPE TABLE OF string INITIAL SIZE 0,
str TYPE string,
str1 TYPE string.
**************** End Of Addtion - ASIF MAQBOOL ******************
* create Line-structure of data table
CREATE DATA lr_s_data LIKE LINE OF ct_data.
ASSIGN lr_s_data->* TO <ls_data_std>.
** create cumulation table
CREATE DATA lr_t_data LIKE STANDARD TABLE OF <ls_data_std>.
ASSIGN lr_t_data->* TO <lt_data_std>.
LOOP AT ct_data INTO <ls_data_std>.
COLLECT <ls_data_std> INTO <lt_data_std>.
ENDLOOP.
FREE ct_data.
* get reference for outtab / create outtab
CALL METHOD go_model->create_data_reference
EXPORTING
io_tx_data_io_type = go_model->ds_tx_data_io_type-totals
i_type = l_outtype "'UCR_SX_TX_DATA_LST'
IMPORTING
er_data = lr_s_data_out.
ASSIGN lr_s_data_out->* TO <ls_data_out>.
ASSIGN lr_s_data_out->* TO <ls_data_cop>.
CREATE DATA lr_t_data_out LIKE STANDARD TABLE OF <ls_data_out>.
ASSIGN lr_t_data_out->* TO <lt_data_out>.
CREATE DATA lr LIKE LINE OF <lt_data_std>.
ASSIGN lr->* TO <ls_data>.
CALL METHOD lcl_convert_output=>get_instance
EXPORTING
io_model = go_model
it_char = lt_char
IMPORTING
eo_instance = lo_conv
CHANGING
cs_data = <ls_data>.
ASSIGN: l_comp TO <comp>,
l_cgcomp TO <cgcomp>,
l_pcomp TO <pcomp>,
l_invc TO <invc>,
l_doct TO <doct>,
l_plevel TO <plevel>,
l_tc TO <tc>,
l_qty TO <qty>,
l_trn_lc TO <trn_lc>,
l_bu TO <bu>,
l_mmyy TO <l_mmyy>,
l_low TO <low>,
l_unit TO <unit>.
LOOP AT <lt_data_std> INTO <ls_data>. " loop
CALL METHOD lo_conv->convert_output. "end of "wis240605
* fill outtab
ASSIGN COMPONENT if_uc_model=>gc_type_comp_s_char
OF STRUCTURE <ls_data> TO <ls_data_cop>.
MOVE-CORRESPONDING <ls_data_cop> TO <ls_data_out>.
ASSIGN COMPONENT if_uc_model=>gc_type_comp_s_kfig
OF STRUCTURE <ls_data> TO <ls_data_cop>.
MOVE-CORRESPONDING <ls_data_cop> TO <ls_data_out>.
IF ct_task = c_task01 OR ct_task = space . "'it can be T2700 or blank
***** aggregate the transactionaldata for given Rules *****
ASSIGN COMPONENT : <comp> OF STRUCTURE <ls_data_out> TO <comp1>,
<cgcomp> OF STRUCTURE <ls_data_out> TO <cgcomp1>,
<pcomp> OF STRUCTURE <ls_data_out> TO <pcomp1>,
<doct> OF STRUCTURE <ls_data_out> TO <doct1>,
<invc> OF STRUCTURE <ls_data_out> TO <invc1>, "added by Asif M.
<plevel> OF STRUCTURE <ls_data_out> TO <plevel1>,
<tc> OF STRUCTURE <ls_data_out> TO <tc1>,
<qty> OF STRUCTURE <ls_data_out> TO <qty1>,
<trn_lc> OF STRUCTURE <ls_data_out> TO <trn_lc1>.
**** 1st Rule ****
* dont include records where '/1FB/CS_TRN_QTY' and '/1FB/CS_TRN_LC' are blank
IF <trn_lc1> = 0 AND <qty1> = 0.
CONTINUE.
ENDIF.
**** 2nd Rule ****
* delete the Posting levels if it is > 1 and clear to blank CS_PLEVEL
CHECK <plevel1> LE 1.
CLEAR <plevel1>.
**** 3rd Rule ****
* replace the Unilever Company with CG without prefix G and compare with Partner comp for deletion
* /BIC/ZCS_COMP with /1FB/SEM_CGCOMP and check with /BIC/ZCS_PCOM
IF ct_task <> space.
*** code added by Ramesh for the removal GBRNCH records while downloading the file.
**** code for removal of GBRNCH records only - Hardcode - sample code
* IF <cgcomp1> <> 'GBRNCH'. " to avoid BRNCH records
** replace Company with CG without prefix G when task name is not blank
* <comp1> = <cgcomp1>+1.
* ELSE.
* CONTINUE.
* ENDIF.
**** code for removal of GBRNCH records only - Hardcode - sample code
*** the assumption here,is consider only records with Legal entity as numeric excepting the first character
IF <cgcomp1>+1 CN sy-abcde. " to avoid BRNCH records
* replace Company with CG without prefix G when task name is not blank
<comp1> = <cgcomp1>+1.
ELSE.
CONTINUE.
ENDIF.
ENDIF.
* removing leading zero's as SAP sometimes adding them to <pcomp1>.
* CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
* EXPORTING
* input = <pcomp1>
* IMPORTING
* output = <pcomp1>.
PERFORM f_alpha_conversion USING <comp1>
CHANGING <comp1>.
PERFORM f_alpha_conversion USING <pcomp1>
CHANGING <pcomp1>.
" removing leading zero's from Investee Unit company - Added By Asif Maqbool, IBM/Unilever, 25/01/2008.
PERFORM f_alpha_conversion USING <invc1>
CHANGING <invc1>.
CHECK <comp1> <> <pcomp1>.
**** 4rth Rule ****
* initialise Document type & PV TC to blank /BIC/ZCS_DOCT & /1FB/CS_TRN_TC
CLEAR: <doct1>,<tc1>.
ENDIF.
COLLECT: <ls_data_out> INTO <lt_data_out>.
ENDLOOP. " end loop
IF <lt_data_out> IS INITIAL.
PERFORM f_build_msgs USING 'UCM0'
'W'
'053'
text-102
space "ct_task
space
space
CHANGING ct_message.
RETURN.
MESSAGE e208(00) WITH text-102.
EXIT.
ENDIF.
* perform various steps based on task name
CASE ct_task.
WHEN c_task01 OR space. " 'T2700' or blank
* download the data into a tab delimited file
**** start of Task 0001 ****
* create Line-structure of download table
CREATE DATA ls_download TYPE ty_download.
ASSIGN ls_download->* TO <ls_download>.
** create Download data internal table for task T2700
CREATE DATA lt_download LIKE STANDARD TABLE OF <ls_download>.
ASSIGN lt_download->* TO <lt_download>.
LOOP AT <lt_data_out> INTO <ls_data_out>.
MOVE-CORRESPONDING <ls_data_out> TO <ls_download>.
ASSIGN COMPONENT <trn_lc> OF STRUCTURE <ls_download> TO <trn_lc1>.
*** 6th Rule **********************
" Check for values, if present remove decimals, if not present clear it of (blank).
UNASSIGN <qty1>.
ASSIGN COMPONENT <qty> of STRUCTURE <ls_download> to <qty1>.
ASSIGN COMPONENT <unit> of STRUCTURE <ls_download> to <unit1>.
if <unit1> = '' OR <unit1> <> '%'.
REPLACE ALL OCCURRENCES OF '.' in <qty1> WITH '' RESPECTING CASE.
<qty1> = ''.
endif.
if <unit1> <> '' And <qty1> <> ''.
<unit1> = ''. " We dont need unit downloaded.
REPLACE ALL OCCURRENCES OF '.' in <qty1> WITH '' RESPECTING CASE.
<qty1> = <qty1>+0(2).
endif.
**** 5th Rule ****
* Move the Negative sign to front
PERFORM f_put_sign_in_front CHANGING <trn_lc1>.
INSERT <ls_download> INTO TABLE <lt_download>.
ENDLOOP.
* move the aggregated data to final table for display
FREE ct_data.
ct_data = <lt_data_out>.
CLEAR: l_path,l_filename,l_fullpath,l_action.
CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'
EXPORTING
window_title = 'Download aggregated BCS data to Tab Delimited file'
default_extension = 'txt'
* DEFAULT_FILE_NAME = dynamic file name as like ALE settings
file_filter = 'Text files (*.txt)'
IMPORTING
filename = l_filename
path = l_path
fullpath = l_fullpath
user_action = l_action .
CALL METHOD cl_gui_cfw=>flush.
" *************************** START OF CHANGE - ASIF MAQBOOL ************************
IF l_action = 0 OR l_action = 1.
ASSIGN gt_param TO <gt_param>.
APPEND '100' to l_t_tab.
READ TABLE gt_param INDEX 6 INTO gs_param.
ASSIGN COMPONENT 2 OF STRUCTURE gs_param to <gs_value>.
APPEND <gs_value> to l_t_tab.
Clear gs_param.
READ TABLE gt_param INDEX 4 INTO gs_param.
ASSIGN COMPONENT 2 OF STRUCTURE gs_param to <gs_value>.
APPEND <gs_value> to l_t_tab.
* LOOP AT <gt_param> INTO gs_param.
* ASSIGN COMPONENT 1 OF STRUCTURE gs_param to <gs_fieldname>.
* CASE <gs_fieldname>.
* WHEN '/BIC/ZFB_VERS'.
* APPEND '100' to l_t_tab.
* WHEN 'FISCPERIOD'.
* ASSIGN COMPONENT 2 OF STRUCTURE gs_param to <gs_value>.
* APPEND <gs_value> to l_t_tab.
* WHEN 'FISCYEAR'.
* ASSIGN COMPONENT 2 OF STRUCTURE gs_param to <gs_value>.
* APPEND <gs_value> to l_t_tab.
* WHEN OTHERS.
* ENDCASE.
* ENDLOOP.
CONCATENATE LINES OF l_t_tab INTO str1 SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
CLEAR l_t_tab.
INSERT str1 INTO TABLE l_t_tab.
ASSIGN l_t_tab TO <final_gt>.
" To Start by adding the Header Data.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = l_fullpath
write_field_separator = l_seperator "SPACE
CHANGING
data_tab = <final_gt>
EXCEPTIONS
file_write_error = 1.
" Now append the Data after the header data insertion.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = l_fullpath
write_field_separator = l_seperator "SPACE
append = 'X'
CHANGING
data_tab = <lt_download>
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24.
" *************************** END OF CHANGE - ASIF MAQBOOL ************************
IF sy-subrc <> 0.
* MESSAHi,
I am also from same project.
We are facing a problem with this code.
How can I increase the length of the field obtained by this method.
CALL METHOD go_model->create_data_reference
EXPORTING
io_tx_data_io_type = go_model->ds_tx_data_io_type-totals
i_type = l_outtype "'UCR_SX_TX_DATA_LST'
IMPORTING
er_data = lr_s_data_out.
ASSIGN lr_s_data_out->* TO <ls_data_out>.
We are getting data overflow error when we try to move some large value to one of the field in <ls_data_out>.
we can avoid this if the field length is increased.
Waiting for your reply.
Regards
Madhu G S -
Adding dynamic attributes to static context node
Hi All,
I have defined a context node LINES with several attributes. This is done staticly during developmenttime.
During run-time node LINES is extended with several attributes dynamicly. See below:
10 HEADER_GUID ->
11 DETAIL_GUID ->
12 EXTERNAL_ID ->
13 OBJECT_TYPE ->
14 IN_OUT_PLAN ->
15 TRAFFIC_LIGHT_1 ->
16 TRAFFIC_LIGHT_2 ->
17 TRAFFIC_LIGHT_3 ->
18 TRAFFIC_LIGHT_4 ->
19 _LOCATION \TYPE=STRING ->
20 _ZZTOPGROUPING \TYPE=STRING ->
21 _STATUS \TYPE=STRING ->
22 _100000200 \TYPE=STRING ->
19..22 are added dynamicly.
I have an internal table that matches de new context. This <fs_tb_tree_new> I want to bind like:
*&- bind table
lr_node->bind_table( new_items = <fs_tb_tree_new>
set_initial_elements = abap_true ).
In <fs_tb_tree_new> the dynamicly added attrbutes contains values e.g. (the static attributes also have values via <fs_tb_tree_new>):
_LOCATION _ZZTOPGROUPING _STATUS _100000200
5 Africa 0002 Reporting Entity 0.000
6 Russia, CIS 0003 Identify 0.000
An ALV presents the values of the attribute. But.... only the values of the static part are presented, not the dynamic attributes added during runtime.
Please advise what I forget or do wrong .
Thanks in advance.
JohnI solved the issue:
If you use a combination of static attributes added with dynanic attributes (during runtime) for dynamic ALV, I advise to create a new node and bind the values to this new created node:
Cheers, John
wd_this->extend_context( EXPORTING im_struc_descr = lr_cl_abap_structdescr
IMPORTING ex_node = lr_node_alv ).
Method:
*&- Create new dynamic context LINES_DYN
Node for alv-table
lr_node_info = wd_context->get_node_info( ).
CALL METHOD lr_node_info->add_new_child_node
EXPORTING
name = 'LINES_NEW'
static_element_rtti = im_struc_descr
is_static = abap_true
is_multiple = abap_true
is_multiple_selection = abap_false
RECEIVING
child_node_info = lr_subnode_info.
lr_node = lr_subnode_info->get_parent( ).
lr_node = wd_context->get_child_node( 'LINES_NEW' ).
ex_node = lr_node.
*&- bind table for alv
lr_node_alv->bind_table( new_items = <fs_tb_tree_new>
set_initial_elements = abap_true ).
Maybe you are looking for
-
i know thee are many topis on quality, but everyone i read has a slightly different need than me.-- I have a dv video that was created in FCP 5 and when i export it and burn it, it looks horrible on my tv. the text is pixelated and parts of the image
-
How to set the value of process variables/payload using a managed bean?
Hello, Someone can give me an example about how to set the values of a process payload in a managed bean? thank you!
-
Maximum ethernet frame size on usb adapter
Hi. I know the usb ethernet adapter on macbook air is fast ethernet, not gigabit. I would like to know if it is possible to select an ethernet frame size larger than 1500 bytes anyway. Most machines on my Lan cope with larger frames (MTU=5000). Acces
-
in Acrobat 9.5.4 - How to get back to regular image?
-
HT1349 I cannot access Apple TV (2nd gen) from my Macbook or iPad2.
I keep receiving a message that I need turn on Home Sharing in iTunes, but it's already on. After I try a few times to connect, I receive an error code (-150006). On top of that, the Air Play icon seems to appear intermittently while I'm in iTunes. I