Which alv-grid for own build
Hi,
how and what kind of ALV i must use to build own ALV-List (columns with content i create).
For understanding:
to test it, i will counting something and show that in a new column (counter). But i dont find any way to do that. In one thread i read "cl_salv_table", in the next "cl_gui_alv_grid", then "fieldcatalog" and so on... i'm confused at the moment.
the only answer i need is:
1. what are the correct way... cl_gui_alv_grid, cl_salv_table, ... i will find a way to create a list like my own conceivabilities. not a classic one.. a new one.
Thats my code, but i dont know how i can create any new column (with a name i give and content i create [anywhere in code - till now not in snipped])
*&---------------------------------------------------------------------*
*& Report ZMW_TESTOBJECTS2
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zmw_testobjects2.
*&---------------------------------------------------------------------*
*& Global Declarations
*&---------------------------------------------------------------------*
TABLES: tabelle1,
tabelle2,
tabelle3.
* SELECTION-SCREEN *
SELECTION-SCREEN BEGIN OF BLOCK choices WITH FRAME.
PARAMETERS:
l_field1 TYPE tabelle1-field1 OBLIGATORY,
l_field2 TYPE tabelle2-field2 OBLIGATORY,
l_field3 TYPE tabelle2-field3,
l_field4 TYPE tabelle1-field4.
SELECTION-SCREEN END OF BLOCK choices.
*&---------------------------------------------------------------------*
*& Class Test Definition
*&---------------------------------------------------------------------*
CLASS test_class DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: read_data,
fill_list.
PRIVATE SECTION.
TYPES: BEGIN OF struc_out_table1,
field3 LIKE tabelle2-field3,
field2 LIKE tabelle2-field2,
field4 LIKE tabelle1-field4,
field1 LIKE tabelle1-field1,
field5 LIKE tabelle3-field5,
END OF struc_out_table1.
CLASS-DATA: it_out_table1 TYPE TABLE OF struc_out_table1,
ctl_salv_list TYPE REF TO cl_salv_table,
ctl_salv_exc TYPE REF TO cx_salv_msg.
ENDCLASS. "test_class DEFINITION
*&---------------------------------------------------------------------*
*& Class Test Implementation
*&---------------------------------------------------------------------*
CLASS test_class IMPLEMENTATION.
*&---------------------------------------------------------------------*
*& Method read_data
*&---------------------------------------------------------------------*
METHOD read_data.
SELECT tabelle2~field2 tabelle2~field3 tabelle1~field1
FROM tabelle2
INNER JOIN tabelle1
ON tabelle2~field3 = tabelle1~field3
INTO CORRESPONDING FIELDS OF TABLE it_out_table1
WHERE tabelle1~field1 = l_field1
AND tabelle2~field2 = l_field2
ORDER BY tabelle2~field3.
CALL METHOD fill_list.
ENDMETHOD. "read_data
*&---------------------------------------------------------------------*
*& Method fill_list
*&---------------------------------------------------------------------*
METHOD fill_list.
TRY.
cl_salv_table=>factory(
EXPORTING
list_display = 'X'
IMPORTING
r_salv_table = ctl_salv_list
CHANGING
t_table = it_out_table1
ctl_salv_list->display( ).
CATCH cx_salv_msg INTO ctl_salv_exc.
MESSAGE ctl_salv_exc TYPE 'I'
DISPLAY LIKE 'E'.
ENDTRY.
ENDMETHOD.
ENDCLASS. "test_class IMPLEMENTATION
START-OF-SELECTION.
test_class=>read_data( ).
Hi Marc,
You may use any of the above ALVs. Either should suit your requirements.
If I understand you correctly, you want to add an extra column in the displayed ALV grid/table. The values to be displayed in this additional column are not present in the Tables, but you want to calculate the values at runtime.
As you know already, the ALV needs a field-catalog [FC] and a table storing the data [IT].
Please do the following.
1. Create a local structure (LS) having the relevant database tables and your new columns. You can't use a DB structure if all the columns you want to show are not present in the DB structure.
2. Create a internal table with line type LS. This table (IT) has to be passed to the ALV.
3. Manually fill the columns in the IT as you need it.
If you are using FM 'REUSE_ALV_FIELDCATALOG_MERGE' to build your field-catalog, your problem is solved here. Instead of the DB structure, you have to pass your own structure to this FM.
However, if you are using manual creation of the FC, you'll need to append additional rows to the FC manually.
Cheers!
Abhinava
Similar Messages
-
Hi experts.
Can someone assist me with information on using ALV grid for data input. Please give a simple example if possible.
I am mainly interested in the part in which we can transfer data from the grid changing the internal table's data.Try this code:
REPORT z_demo_alv_jg.
TYPE-POOLS *
TYPE-POOLS: slis.
INTERNAL TABLES/WORK AREAS/VARIABLES *
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
w_field TYPE slis_fieldcat_alv,
p_table LIKE dd02l-tabname,
dy_table TYPE REF TO data,
dy_tab TYPE REF TO data,
dy_line TYPE REF TO data.
FIELD-SYMBOLS *
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
<dyn_wa> TYPE ANY,
<dyn_field> TYPE ANY,
<dyn_tab_temp> TYPE STANDARD TABLE.
SELECTION SCREEN *
PARAMETERS: tabname(30) TYPE c,
lines(5) TYPE n.
START-OF-SELECTION *
START-OF-SELECTION.
Storing table name
p_table = tabname.
Create internal table dynamically with the stucture of table name
entered in the selection screen
CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_table->* TO <dyn_table>.
IF sy-subrc <> 0.
MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'.
LEAVE TO LIST-PROCESSING.
ENDIF.
Create workarea for the table
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.
Create another temp. table
CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_tab->* TO <dyn_tab_temp>.
SORT i_fieldcat BY col_pos.
Select data from table
SELECT * FROM (p_table)
INTO TABLE <dyn_table>
UP TO lines ROWS.
REFRESH <dyn_tab_temp>.
Display report
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'SET_PF_STATUS'
TABLES
t_outtab = <dyn_table>
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
*& Form SET_PF_STATUS
Setting custom PF-Status
-->RT_EXTAB Excluding table
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'Z_STANDARD'.
ENDFORM. "SET_PF_STATUS
*& Form user_command
Handling custom function codes
-->R_UCOMM Function code value
-->RS_SELFIELD Info. of cursor position in ALV
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
Local data declaration
DATA: li_tab TYPE REF TO data,
l_line TYPE REF TO data.
Local field-symbols
FIELD-SYMBOLS:<l_tab> TYPE table,
<l_wa> TYPE ANY.
Create table
CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN li_tab->* TO <l_tab>.
Create workarea
CREATE DATA l_line LIKE LINE OF <l_tab>.
ASSIGN l_line->* TO <l_wa>.
CASE r_ucomm.
When a record is selected
WHEN '&IC1'.
Read the selected record
READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
rs_selfield-tabindex.
IF sy-subrc = 0.
Store the record in an internal table
APPEND <dyn_wa> TO <l_tab>.
Fetch the field catalog info
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'Z_DEMO_PDF_JG'
i_structure_name = p_table
CHANGING
ct_fieldcat = i_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc = 0.
Make all the fields input enabled except key fields*
w_field-input = 'X'.
MODIFY i_fieldcat FROM w_field TRANSPORTING input
WHERE key IS INITIAL.
ENDIF.
Display the record for editing purpose
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
it_fieldcat = i_fieldcat
i_screen_start_column = 10
i_screen_start_line = 15
i_screen_end_column = 200
i_screen_end_line = 20
TABLES
t_outtab = <l_tab>
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc = 0.
Read the modified data
READ TABLE <l_tab> INDEX 1 INTO <l_wa>.
If the record is changed then track its index no.
and populate it in an internal table for future
action
IF sy-subrc = 0 AND <dyn_wa> <> <l_wa>.
<dyn_wa> = <l_wa>.
i_index = rs_selfield-tabindex.
APPEND i_index.
ENDIF.
ENDIF.
ENDIF.
When save button is pressed
WHEN 'SAVE'.
Sort the index table
SORT i_index.
Delete all duplicate records
DELETE ADJACENT DUPLICATES FROM i_index.
LOOP AT i_index.
Find out the changes in the internal table
and populate these changes in another internal table
READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX i_index.
IF sy-subrc = 0.
APPEND <dyn_wa> TO <dyn_tab_temp>.
ENDIF.
ENDLOOP.
Lock the table
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc = 0.
Modify the database table with these changes
MODIFY (p_table) FROM TABLE <dyn_tab_temp>.
REFRESH <dyn_tab_temp>.
Unlock the table
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table.
ENDIF.
ENDCASE.
rs_selfield-refresh = 'X'.
ENDFORM. "user_command -
F4 help not reflecting in ALV Grid for fixed values specified in domain
Hi experts,
As per subject i have a field for which i have assigned 5 fixed values in the domain level (of that field) . The problem is when i am displaying my ALV grid output i need a F4 help and F4 Option for the same is not reflecting and i have assigned in the field catlog as shown bellow.
wa_fcat-fieldname = 'ZDEPLOY'.
wa_fcat-tabname = 'IT_FINAL'.
wa_fcat-f4availabl = 'X'.
wa_fcat-key = 'X'.
WA_FCAT-SELTEXT_L = 'Deployment Planned'.
wa_fcat-outputlen = '25'.
WA_FCAT-EDIT = 'X'.
WA_FCAT-REF_FIELDNAME = 'ZDEPLOY'.
WA_FCAT-REF_TABNAME = 'ZETMDEPL'.
APPEND WA_FCAT TO IT_FIELDCAT.
CLEAR WA_FCAT.
for the above field the f4 help is not reflecting.
Intrestingly i have another field which i have declared using the same procedure for which my F4 help (with fixed values ) is reflecting in the same program .with the values as shown below
wa_fcat-fieldname = 'ZFINAL'.
wa_fcat-tabname = 'IT_FINAL'.
WA_FCAT-SELTEXT_L = 'Final Status'.
wa_fcat-outputlen = '10'.
WA_FCAT-EDIT = 'X'.
wa_fcat-ref_fieldname = 'ZFINAL'.
wa_fcat-ref_tabname = 'ZETMDEPL'.
APPEND WA_FCAT TO IT_FIELDCAT.
CLEAR WA_FCAT.
can u plz suggest me with a solution .
Regards,
Edited by: abhilash aswath on Oct 20, 2010 3:32 PM
Moderator message: please do not use SMS speak.
Edited by: Thomas Zloch on Oct 20, 2010 3:58 PMhi,
There was a mismatch of characteristics. I resolved by matching the same. -
Dear friends,
How can I set a ALV Grid layout for the MB5M report? I get the data in two rows when I download the report. Instead I want it in a single row. I tried to change the layout but without success. Please help.Hi,
Wtih the help of ABAPer you can use your own report with your requirement.
Regards,
MBKM -
Hotspot click for only some rows in ALV grid for a particular column ?
Hi there,
In ALV grid, we can make Hotspot enable for all rows in a specified column
by specifying in the fieldcatalog with Hotspot attribute set as true.
But I want to enable Hotspot only for certain rows in the particular column. I tried with MC_STYLE4_LINK , but I didnt got the required result.
So , how could I achieve that in ALV grid.
Points would be rewarded for helpful answers.
Regards,
Anil .Hi,
You can do it for a column. Please refer to the code snippet below,
DATA : it_fcat TYPE lvc_t_fcat,
wa_fcat LIKE LINE OF it_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_BUFFER_ACTIVE =
i_structure_name = 'SMMW_ALERTS_ICON_S'
I_CLIENT_NEVER_DISPLAY = 'X'
I_BYPASSING_BUFFER =
I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = it_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3
LOOP AT it_fcat INTO wa_fcat.
IF wa_fcat-fieldname = 'STATUS'.
wa_fcat-hotspot = 'X'.
MODIFY it_fcat FROM wa_fcat.
CLEAR wa_fcat.
ENDIF.
ENDLOOP.
CALL METHOD l_obj_alv_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'SMMW_ALERTS_ICON_S'
CHANGING
it_outtab = lt_alerts_st
it_fieldcatalog = it_fcat.
In the above replace the structure 'SMMW_ALERTS_ICON_S' with your structure and column 'STATUS' with your desired column.
Hope this helps,
Regards,
Vinodh -
Subtotal in ALV grid for a particular type and Grand total in ALV
Hi,
I need to have sub total for a particular type(eg: goods, services).. and grand total at end in ALV grid..
ALV output required as below:
Type VAT registration number Country Total Gross Amounts Total Tax Amounts Total Amount, ex-tax
Goods ATU12345678 AT 222.42 0 222.42
Goods NL123456789B02 NL 3,417.00 0 3,417.00
Goods Total 3,639.42 - 3,639.42
Services ATU12345678 AT 2,342.34 0 2,342.34
Services NL123456789B02 NL 223.33 0 223.33
Services Total 2,565.67 - 2,565.67
Grand Total 6,205.09 - 6,205.09
Let me as to how to achieve the above type in ALV grid...
Regards
Shivacheck this link..
Grand Totals in ALV grid disply function module
or do like this..
REPORT ZALVTESTFORSUBTOTAL.
tables:pa0008.
type-pools:slis.
types:begin of ty_pa0008,
pernr like pa0008-pernr,
begda like pa0008-begda,
endda like pa0008-endda,
ansal like pa0008-ansal,
lga01 like pa0008-lga01,
bet01 like pa0008-bet01,
end of ty_pa0008.
data:it_pa0008 type standard table of ty_pa0008 with header line.
data:it_fieldcat type SLIS_T_FIELDCAT_ALV,
wa_fieldcat type slis_fieldcat_alv,
it_layout type slis_layout_alv,
WA_events TYPE slis_alv_event,
it_events TYPE slis_t_event.
select-options:s_pernr for pa0008-pernr.
start-of-selection.
perform getD_data.
perform disp_alv.
*& Form getD_data
text
--> p1 text
<-- p2 text
form getD_data .
select pernr
begda
endda
ansal
lga01
bet01
from pa0008
into table it_pa0008
where pernr in s_pernr.
sort it_pa0008 by pernr begda descending.
endform. " getD_data
*& Form disp_alv
text
--> p1 text
<-- p2 text
form disp_alv .
wa_fieldcat-fieldname = 'PERNR'.
wa_FIELDCAT-REPTEXT_DDIC = 'Personnel no'.
*WA_FIELDCAT-no_subtotals = 'X'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'BEGDA'.
wa_FIELDCAT-REPTEXT_DDIC = 'Start date'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'ENDDA'.
wa_FIELDCAT-REPTEXT_DDIC = 'End date'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'ANSAL'.
wa_FIELDCAT-REPTEXT_DDIC = 'Annula salary'.
wa_fieldcat-do_sum = 'X'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'LGA01'.
wa_FIELDCAT-REPTEXT_DDIC = 'Wage Type'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'BET01'.
wa_FIELDCAT-REPTEXT_DDIC = 'Amount for wagetype'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
DATA: sort TYPE slis_sortinfo_alv,
it_sort TYPE slis_t_sortinfo_alv.
sort-fieldname = 'PERNR'.
sort-subtot = 'X'.
SORT-UP = 'X'.
APPEND sort TO it_sort.
*sort-fieldname = 'BEGDA'.
*SORT-NO_SUBTOTS = 'X'.
*APPEND sort TO it_sort.
IT_layout-totals_text = 'total text'.
IT_layout-subtotals_text = 'Subtotal text'.
*WA_EVENTS-NAME = 'SUBTOTAL TEXT'.
*WA_EVENTS-FORM = 'SUBTOTAL TEXT'.
*APPEND WA_EVENTS TO IT_EVENTS.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
IS_LAYOUT = it_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
it_sort = it_sort
it_events = it_events
TABLES
t_outtab = it_pa0008 .
endform. " disp_alv -
Urgent : Problem with Editable ALV Grid for Quantity and Currency Fields
Hi All,
I am using Editable ALV Grid display and have quantity and value as editable fields in the display.
When user changes these values these values are not changing properly .
For the quantity field the domain is MENG13 with 3 deciamal places and here if we enter 500 it takes it as 0.500 .
The same problem is for the currency field. Here the Domain is WERT7 with 3 decimal places.
Here also it takes last 2 digits after decimal places by default.
Please advice how to get proper values in this case from ALV editable fields.
Thanks and Regards
Harshad
Edited by: Harshad Rahirkar on Dec 25, 2007 7:39 AMfor all the currency field , it will display like that only.
u have to manipulate uin program before displaying.
if they are giving 500, in program multiply with 100 and move it to table.
when u are getting from table, divinde and display.
this is what I am doing.
Reward if helpfull. -
ALV GRID with own EXCEL-Template
Hallo,
I have Problem with using ALV-Grid with a own created
template.
At First I copy the SAP_OM.XLS template to CUS_OM.XLS.
Then I update it by deleting all sheets, but not RAWDATA.
When I use this template in ALV-GRID, it would be the right one, but it his no Data.
The security settings in Excel are correct.
Can anyone help me to show the data like the normal
ALV-GRID??
thanks DieterHi
Check this link...
How to send data to different tabs of an excel sheet? -
Generic function displaying alv grid for undefined structure
Hi experts,
I'm doing my first steps on abap development (Totally noob).
I'm writing some little reports based on simple selections (1 or 2 tables).
In every report, I've defined a structure (internal table) that i'm displaying with an ALV Grid.
In every report, I need to create a catalog for my structure in order to make the alv grid working.
What I would like to do is :
Create a function that receives a undefined structure (for all my reports) as a parameter.
This function sould create the catalog for the coresponding structure and call the alv grid function to display the data's contained in this structure.
The goal is : In every report, I would like to use this function to show the selected data's without taking care of catalogs, alv grid, etc...
Is it possible ?
I really don't see how I can do that... Does anybody already tried something like that ?
Thank you for your help
Regards
QuentinHi,
In this method Pass the structure name-
CALL METHOD gh_grid->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = "<- here pass the structure
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT = "<-Layout variable if using layout
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
it_outtab = gt_line[]
it_fieldcatalog = gt_fieldcat
IT_SORT =
IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4 -
Like SM30 ,table should be display in editable ALV Grid(for Dynamic DB )
Hi Friends,
plese help me how to display ALV grid in editable mode for differnt types of data base tables.
same as like SM30 transaction.
Moderator message: please search for available information/documentation/previous discussions before asking.
Edited by: Thomas Zloch on Nov 11, 2010 6:40 PMHi,
In SLIS_T_FIELDCAT_ALV you specify the field as edit = X.
Give it as mentioned, where you assign fieldname and positions etc.
Thanks&Regards -
Simple tutorial for using alv-grid for data entry into table, please!
Hi friends,
I urgently need a basic, simple tutorial or step-by-step or sample code on the following:
I want to have a alv-grid like entry list where i can add/remove additional lines/entries that then are saved into an internal table. Please help me with that, as i studied already some documents but do not really get the idea of how to do - <REMOVED BY MODERATOR>
Thanks in advance,
Edited by: Alvaro Tejada Galindo on Jan 11, 2008 6:18 PMhi clemens,
follow this link it may be useful to u
http://www.sap-basis-abap.com/sapab033.htm
http://www.abapprogramming.blogspot.com/2007/04/alv-details.html
for tutorial on alv:
http://www.sapbrainsonline.com/TUTORIALS/TECHNICAL/ALV_tutorial.html
i have pdf material also ican give it to you if u give your email id.
hope this helps you
regards,
sravanthi -
How can i validate on ALV grid for the user
Dear Freinds,
I have developed one custom report using ALV Grid program , as per the requirement i have to enter on the
data and when i press the value save the program sumits the data into my custom table . Till here every thing is fine
but one particular field i have declared as Char1 in my internal table , on the ALV output it is allowing me to enter
more than one character eg : it is allowing me to enter as Hyderabad .........even though i have declared as char 1 in the internal table ....however it is saving in the database table as H only that is correct.......but it is giving confusion to user
i want to validate that user shouldnt allow to enter more than one character in the alv output of the input field .
Please could any one let me know how can i validate.
regard
divyaHi,
check that field length in the final internal table .
might be that filed lenth in final internal table declartion is more than 1 char.
regards,
Rama reddy
Edited by: ram reddy on Jul 15, 2009 7:57 AM -
Excel download from ALV grid, for characters more than 1020
Hi,
When i am trying to download the report which is having character more than 1020, it is coming in two rows. I want all fields in one row. Please give solutions.
I am using below field catalog.
Car Eligibility
CLEAR lw_fieldcat.
lw_fieldcat-fieldname = text-001.
lw_fieldcat-reptext_ddic = text-011.
lw_fieldcat-tabname = text-021
APPEND lw_fieldcat TO gt_fieldcat.
I am using below FM.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = gt_layout
it_fieldcat = gt_fieldcat[]
it_sort = gt_sort[]
it_events = gt_events[]
TABLES
t_outtab = gt_data
EXCEPTIONS
program_error = 1
OTHERS = 2.
Thanks in Advance,
Ravi Kumarravi,
its not about how you have used your field catalog or how you called ALV FM. its excel download functionality,
what you need to do is:
set pf-status '<<some value>>' -> you can find where to pass in ALV FM call.
then add a application toolbar button though this pf status.
then at use_command event, check sy-ucomm and if its the same as your new icons fcode then use the method to download it in excel. -
Hi All,
I'm using ALV grid for my report output. I'm building the fieldcatalog where i'm passing hotspot for a field. Which has output either yes/no.
Now i need the hand button to be displayed only for records with Yes,so that it can be drilled down.
For No hand symbol should nt come. Is there any way to control hotspot at record level.
Please help.
Thanks,
BharathiHi,<BR>
<BR>
The following code is a template for your requirement:<BR>
<BR>
types: begin of t_data,<BR>
flg(3) type c,<BR>
sty type lvc_t_styl,<BR>
end of t_data,<BR>
t_tdata type table of t_data.<BR>
<BR>
DATA: i_fcat type LVC_T_FCAT,<BR>
s_fcat type lvc_s_fcat,<BR>
s_lay type lvc_s_layo,<BR>
s_sty type lvc_s_styl,<BR>
i_data type t_tdata,<BR>
s_data type t_data.<BR>
<BR>
s_lay-stylefname = 'STY'.<BR>
<BR>
s_fcat-FIELDNAME = 'FLG'.<BR>
APPEND s_fcat to i_fcat.<BR>
<BR>
CLEAR: s_data.<BR>
s_data-flg = 'Yes'.<BR>
s_sty-FIELDNAME = 'FLG'.<BR>
s_sty-style = CL_GUI_ALV_GRID=>MC_STYLE_HOTSPOT.<BR>
insert s_sty into TABLE s_data-sty.<BR>
APPEND s_data to i_data.<BR>
<BR>
CLEAR: s_data.<BR>
s_data-flg = 'No'.<BR>
s_sty-FIELDNAME = 'FLG'.<BR>
s_sty-style = CL_GUI_ALV_GRID=>MC_STYLE_HOTSPOT_NO.<BR>
insert s_sty into TABLE s_data-sty.<BR>
APPEND s_data to i_data.<BR>
<BR>
CLEAR: s_data.<BR>
s_data-flg = 'No'.<BR>
s_sty-FIELDNAME = 'FLG'.<BR>
s_sty-style = CL_GUI_ALV_GRID=>MC_STYLE_HOTSPOT_NO.<BR>
insert s_sty into TABLE s_data-sty.<BR>
APPEND s_data to i_data.<BR>
<BR>
CLEAR: s_data.<BR>
s_data-flg = 'Yes'.<BR>
s_sty-FIELDNAME = 'FLG'.<BR>
s_sty-style = CL_GUI_ALV_GRID=>MC_STYLE_HOTSPOT.<BR>
insert s_sty into TABLE s_data-sty.<BR>
APPEND s_data to i_data.<BR>
<BR>
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'<BR>
EXPORTING<BR>
I_INTERFACE_CHECK = ' '<BR>
I_BYPASSING_BUFFER =<BR>
I_BUFFER_ACTIVE =<BR>
I_CALLBACK_PROGRAM = ' '<BR>
I_CALLBACK_PF_STATUS_SET = ' '<BR>
I_CALLBACK_USER_COMMAND = ' '<BR>
I_CALLBACK_TOP_OF_PAGE = ' '<BR>
I_CALLBACK_HTML_TOP_OF_PAGE = ' '<BR>
I_CALLBACK_HTML_END_OF_LIST = ' '<BR>
I_STRUCTURE_NAME =<BR>
I_BACKGROUND_ID = ' '<BR>
I_GRID_TITLE =<BR>
I_GRID_SETTINGS =<BR>
IS_LAYOUT_LVC = s_lay<BR>
IT_FIELDCAT_LVC = i_fcat<BR>
IT_EXCLUDING =<BR>
IT_SPECIAL_GROUPS_LVC =<BR>
IT_SORT_LVC =<BR>
IT_FILTER_LVC =<BR>
IT_HYPERLINK =<BR>
IS_SEL_HIDE =<BR>
I_DEFAULT = 'X'<BR>
I_SAVE = ' '<BR>
IS_VARIANT =<BR>
IT_EVENTS =<BR>
IT_EVENT_EXIT =<BR>
IS_PRINT_LVC =<BR>
IS_REPREP_ID_LVC =<BR>
I_SCREEN_START_COLUMN = 0<BR>
I_SCREEN_START_LINE = 0<BR>
I_SCREEN_END_COLUMN = 0<BR>
I_SCREEN_END_LINE = 0<BR>
I_HTML_HEIGHT_TOP =<BR>
I_HTML_HEIGHT_END =<BR>
IT_EXCEPT_QINFO_LVC =<BR>
IR_SALV_FULLSCREEN_ADAPTER =<BR>
IMPORTING<BR>
E_EXIT_CAUSED_BY_CALLER =<BR>
ES_EXIT_CAUSED_BY_USER =<BR>
TABLES<BR>
T_OUTTAB = i_data<BR>
EXCEPTIONS<BR>
PROGRAM_ERROR = 1<BR>
OTHERS = 2<BR>
.<BR>
IF SY-SUBRC <> 0.<BR>
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO<BR>
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.<BR>
ENDIF.<BR>
<BR>
Thanks,<BR>
Kiruba.<BR> -
Downloads from ALV GRID-Text conversion to dates in EXCEL
When downloading table displays of data from ALV-GRID for excel spreadsheet, we end of with files that have a header and various line ifnromation. IF we manually clear up the display, then we can have the individicual column headers used and force them to text but if we just call the file up as an EXCEL spreadsheet, some part numbers such 12-3465 appear in Excel as Dec-65.
The following is an example of the record (but it is word wrapped within this display limit). In actuality, the verbage enclosed with the <b> represent the start of the lines that have actual display data running out about 90 characters.
Suggestions on how to make the download immediately correct in Excel direct from SAP ALV-GRID without cleaning out the heading lines and manually forcing the affected columns to TEXT format?
thanks
<b>03/02/2007</b> Dynamic List Display 1
<b>Materials-Inforecord Details Report</b>
<b>Purchasing Org: ILMO</b>
<b>Report Run Date:03/02/2007</b> <b>Report Time:14:31:16</b>
<b>Plnt Mat Grp Vendor Name 1 Material Material</b> description Vendor Cat Mfr MPN PC Item Chg. OUn Eq to BUn Net price Per OPUn Inforecord PGr Mv Avg per ValCl
<b>0042 04 106070 BURROWS COMPANY</b> 184110 Glv Exam Ltx Non Ster 02-5001 TILLOTSON 02-5001 CA 2,000 EA 93.40 1 CA 5300006999 999 93.40 2,000 6438there are different options to export to excel which all behave differently, if you go for the menu ->export it differs from the export button from the alv buttonbar.
try the different export to excel options perhaps there is one that behaves the way you want
kind regards
arthur de smidt
Maybe you are looking for
-
Cannot delete folders from favorites library, script error
version 21. It hangs up every time I try to delete a folder from bookmarks. I'm working in the show all bookmarks window. I get this error and it hangs. Eventually, sometimes, it's still deleting, but not before hanging for minutes. A script on this
-
Unable to get imessage working, comes up green instead of blue
I'm uable to get imessage working, text comes up green instead of blue. I have my setting, message, imessage turned on. What am I doing wrong?
-
Hi SAP Gurus, Tcode F-47 is not allowing advance payment for Asset PO.Then I made suppressed field as optional . Then also I am not able to get Asset number filed in the F-47.Can you pl.throw some light on this issue. Thanks in advance
-
Message Mapping not getting Activated
Hi Experts, I have done a simple Message Mapping. I am unable to Activate it. The same screen is visible and it is stucked up. When i closed the ESR and again i am trying to activate Message Mapping it is showing the same screen. Even i chekced the L
-
TS1389 How to deauthorize all my computer at once?
Hi I need to deauthorize all my computer at once, because some of my computer was broke down and I cannot deauthorize my itunes anymore. Please help me... Thank You Henry Riobuya