Displaying Data Horizontally in ALV
Dear All
This is my Final Internal Table.
Plant Pricing Procedure Material Group Qty
VA01 31 CF 1007
VA01 31 DT 358.6
VA01 31 ED 29.04
VA01 31 ML 52587
VA01 31 SG 1801
VA01 31 SR 10000
VA01 31 SU 17.6
VA01 34 CI 2763
VA01 41 AC 8
VA01 41 CDL 832
Requirement:
Plant Pricing procedure CF DT ED ML SG SR SU CI AC CDL
VA01 31 1007 358.6 29.04 52587 1801 10000 17.6
VA01 34 2763
VA01 41 8 832
How to display the data like this
Hi,
Use the idea given below...
declare an internal table which collects fieldnames.
data : begin of fs,
fieldname(30) type c,
end of fs.
data : itab like table of fs.
fs-fieldname = 'Plant'.
append fs to itab.
fs-fieldname = 'Pricing'.
append fs to itab.
loop at internaltable into workarea.
at new procedure.
fs-fieldname = 'procedure'.
append fs to itab.
endat.
endloop.
" Creating the required list
" The loop below will write the header as required by you on the list...
" i.e. Plant Pricing CF DT ... and so on.... in the same line
loop at itab into fs.
write : fs-fieldname.
endloop.
"Now entering the data
data : w_i type i.
loop at final_internal_table into workarea.
at new procedure.
write : / workarea-plant, workarea-procedure.
endat.
read table itab into fs with key fieldname = workarea-procedure.
" The line below will calculate the offset on the list where exactly it has to print the qty...
w_i = sy-tabix * 30. " as the size of the fieldname is 30 characters...
write at w_i(30) workarea-qty.
endloop.
Please check if this code works...
let me know if you are facing problems with this code
Regards,
Siddarth
Similar Messages
-
How to change font while displaying data through an ALV table in WDA?
Hi all,
I am displaying data through and ALV table. Now I want to change the FONT only for few rows. Is this possible?
If so then do the needful to me..
Thanks & Regards,
Yugesh A.I believe as you have found 'LVC_FIELDCATALOG_MERGE' would only work with the classic dynpro (SAPGUI based) version of the ALV.
You won't be able to control the font the same way in the WDA version of the ALV. You will need to create a custom cell editor for the column(s) in question. You can then bind context attributes to the properties of the cell editor. You will need extra attributes in your bound context to control these settings on the row level. Also you will be restricted by the changing the DESIGN property. This means only the values allowed for the DESIGN of the particluar UI element. For a TextView that wouldn't be the font directly (the font of course comes from the Theme).
DATA l_salv_wd_table TYPE REF TO iwci_salv_wd_table.
l_salv_wd_table = wd_this->wd_cpifc_alv_adv( ).
DATA l_table TYPE REF TO cl_salv_wd_config_table.
l_table = l_salv_wd_table->get_model( ).
data textview type ref to CL_SALV_WD_UIE_TEXT_VIEW.
l_column = l_table->if_salv_wd_column_settings~get_column( 'ADD_PARTICIPANTS' ).
create object textview.
textview->SET_TEXT_FIELDNAME( 'ADD_PARTICIPANTS' ).
textview->set_design_fieldname( 'ADD_DESIGN' ).
textview->set_wrapping( abap_true ).
l_column->set_cell_editor( textview ).
DESIGN supports the following options:
Value
Visual Display
Description
emphasized
Text is highlighted in default size
groupTitle
Header for forms
This enumeration value is deprecated. Instead, use SectionHeader.
header1
Text is highlighted with font size +4 in relation to the default font size.
header2
Text is highlighted with font size +5.08 cm relation to the default font size.
header3
Text is highlighted in default size
header4
Text is highlighted in font size -1 (small) in relation to the default font size (like the legend but highlighted)
label
Text is display in the default font type. A space is always inserted after the text.
label_small
Text is displayed in default font type, as with label, onyl that font size is -1 (like the font size for header4).
legend
Text is displayed with default font type in size -1.
reference
Text is in italics and in default font size.
standard
Text is displayed in default font size. No text attributes are defined for this value.
monospace
Text is displayed in no-proportional font type. Each letter takes up the same space. -
How to display date field in ALV in format 'YYYY-MM-DD'?
Hi experts,
I am not getting displayed the date field in ALV in the format 'YYYY-MM-DD' if it is different than my user setting's format (DD.MM.YYYY).
Tried with the edit mask
LVC_S_FCAT-EDIT_MASK = '____-__-__' but it does not work.
I could not find the conversion routine for this. Is it possible to write customer conversion routine?
I have to use DATE field, otherwise if I display this format in CHAR10 field , sorting in ALV does not work for this field.
PLEASE ANY HELP!
Kind regards,
DanijelaHi,
Use FM FORMAT_DATE_4_OUTPUT.
TYPE-POOLS : slis, KKBLO.
TYPES: BEGIN OF t_data,
sel TYPE char1,
matnr TYPE matnr,
bldat type char10,
END OF t_data.
DATA: it_tab TYPE STANDARD TABLE OF t_data,
it_fcat TYPE slis_t_fieldcat_alv.
DATA: wa_tab TYPE t_data,
wa_fcat TYPE slis_fieldcat_alv,
wa_layout type SLIS_LAYOUT_ALV.
data: lv_repid TYPE syrepid.
data : lv_date type NLEI-IBGDT,
lv_outdate type RN1DATUM-DATEX,
lv_format type RN1DATUM-FORMAT value 'YYYY-MM-DD'.
lv_repid = sy-repid.
lv_date = sy-datum.
CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
EXPORTING
datin = lv_date
format = lv_format
IMPORTING
DATEX = lv_outdate.
move lv_outdate to wa_tab-bldat.
wa_tab-matnr = '0000001'.
APPEND wa_tab TO it_tab.
lv_date = sy-datum + 1.
CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
EXPORTING
datin = lv_date
format = lv_format
IMPORTING
DATEX = lv_outdate.
move lv_outdate to wa_tab-bldat.
wa_tab-matnr = '0000002'.
APPEND wa_tab TO it_tab.
lv_date = sy-datum + 2.
CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
EXPORTING
datin = lv_date
format = lv_format
IMPORTING
DATEX = lv_outdate.
move lv_outdate to wa_tab-bldat.
wa_tab-matnr = '0000003'.
APPEND wa_tab TO it_tab.
wa_fcat-fieldname = 'SEL'.
wa_fcat-ref_fieldname = 'XCHPF'.
wa_fcat-ref_tabname = 'MARA'.
wa_fcat-edit = 'X'.
wa_fcat-checkbox = 'X'.
APPEND wa_fcat TO it_fcat.
CLEAR : wa_fcat.
wa_fcat-fieldname = 'MATNR'.
wa_fcat-ref_fieldname = 'MATNR'.
wa_fcat-ref_tabname = 'MARA'.
APPEND wa_fcat TO it_fcat.
CLEAR : wa_fcat.
wa_fcat-fieldname = 'BLDAT'.
wa_fcat-ref_fieldname = 'BLDAT'.
wa_fcat-ref_tabname = 'BKPF'.
APPEND wa_fcat TO it_fcat.
call 'REUSE_ALV_GRID_DISPLAY'' after this
Edited by: Ankur Parab on Oct 1, 2009 2:50 PM
Edited by: Ankur Parab on Oct 1, 2009 2:51 PM -
How to display data horizontally
Hi,
I have to display data the following format.
sales order item description 01/09/2010 02/09/2010 03/09/2010
100 1 test 3 4 6
in currently i am displaying the following format.
sales order date1 date2 date3
item
description
1.how to fill field catelog.
2. i have written code like below,
wa_lvc_cat-fieldname = 'COLUMNTEXT'.
wa_lvc_cat-ref_table = 'LVC_S_DETA'.
APPEND wa_lvc_cat TO lt_lvc_cat.
wa_fieldcat-fieldname = 'COLUMNTEXT'.
wa_fieldcat-ref_tabname = 'LVC_S_DETA'.
wa_fieldcat-key = 'X'.
APPEND wa_fieldcat TO lt_fieldcat.
DESCRIBE TABLE i_final.
DO sy-tfill TIMES.
For each line, a column 'VALUEx' is created in the fieldcatalog
Build Fieldcatalog
WRITE sy-index TO wa_lvc_cat-fieldname LEFT-JUSTIFIED.
CONCATENATE 'VALUE' wa_lvc_cat-fieldname
INTO wa_lvc_cat-fieldname.
wa_lvc_cat-ref_field = 'VALUE'.
wa_lvc_cat-ref_table = 'LVC_S_DETA'.
APPEND wa_lvc_cat TO lt_lvc_cat.
Build Fieldcatalog
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = wa_lvc_cat-fieldname.
wa_fieldcat-ref_fieldname = 'VALUE'.
wa_fieldcat-ref_tabname = 'LVC_S_DETA'.
APPEND wa_fieldcat TO lt_fieldcat.
ENDDO.
create dynamic internal table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_lvc_cat
IMPORTING
ep_table = l_dyntable.
ASSIGN l_dyntable->* TO <dynamictable>.
create structure as structure of the internal table
CREATE DATA l_structure LIKE LINE OF <dynamictable>.
ASSIGN l_structure->* TO <header>.
create structure = structure of the internal table
CREATE DATA l_structure LIKE i_final.
ASSIGN l_structure->* TO <ls_table>.
create field catalog from our table structure
wa_fieldcat-fieldname = 'DATE'.
wa_fieldcat-tabname = 'I_FINAL'.
APPEND wa_fieldcat TO lt_fieldcatalogue.
wa_fieldcat-fieldname = 'CNT'.
wa_fieldcat-tabname = 'I_FINAL'.
APPEND wa_fieldcat TO lt_fieldcatalogue.
wa_fieldcat-fieldname = 'FUNCT'.
wa_fieldcat-tabname = 'I_FINAL'.
APPEND wa_fieldcat TO lt_fieldcatalogue.
wa_fieldcat-fieldname = 'ITEM'.
wa_fieldcat-tabname = 'I_FINAL'.
APPEND wa_fieldcat TO lt_fieldcatalogue.
wa_fieldcat-fieldname = 'TRANS'.
wa_fieldcat-tabname = 'I_FINAL'.
APPEND wa_fieldcat TO lt_fieldcatalogue.
*call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_structure_name = <LS_TABLE>
changing
ct_fieldcat = lt_fieldcatalogue
exceptions
inconsistent_interface = 1
program_error = 2
others = 3.
*IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
*ENDIF.
DESCRIBE TABLE lt_fieldcatalogue.
fill the internal to display <dynamictable>
DO sy-tfill TIMES.
IF sy-index = 1.
READ TABLE lt_fieldcatalogue INTO wa_fieldcat INDEX 1.
ENDIF.
For each field of it_table
ASSIGN COMPONENT 1 OF STRUCTURE <header> TO <dynheader>.
IF sy-subrc NE 0. EXIT .ENDIF.
READ TABLE lt_fieldcatalogue INTO wa_fieldcat INDEX sy-index.
Fill 1st column
<dynheader> = wa_fieldcat-seltext_m.
IF <dynheader> IS INITIAL.
<dynheader> = wa_fieldcat-fieldname.
ENDIF.
*filling the other columns
LOOP AT i_final INTO <ls_table>.
l_col = sy-tabix + 1.
ASSIGN COMPONENT sy-index OF STRUCTURE <ls_table> TO <dyndata>.
IF sy-subrc NE 0. EXIT .ENDIF.
ASSIGN COMPONENT l_col OF STRUCTURE <header> TO
<dynheader>.
IF sy-subrc NE 0. EXIT .ENDIF.
WRITE <dyndata> TO <dynheader> LEFT-JUSTIFIED.
ENDLOOP.
APPEND <header> TO <dynamictable>.
ENDDO.
*layout for alv output
lt_layout-zebra = 'X'.
lt_layout-no_colhead = 'X'..
lt_layout-colwidth_optimize ='X'.
lt_layout-window_titlebar = 'ALV GRID TRANSPOSED'.
*alv grid output for display
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = lt_layout
it_fieldcat = lt_fieldcat
TABLES
t_outtab = <dynamictable>.
Plz correct me code.here's a sample to prepare a alv-fieldcatalog with many similar value-fields:
*get metadata of itab
DESCRIBE FIELD itab INTO td.
LOOP AT td-types INTO watypes.
READ TABLE td-names INTO wanames INDEX watypes-idx_name.
CHECK sy-subrc = 0.
MOVE wanames-name TO fld-name.
READ TABLE td-names INTO wanames INDEX watypes-idx_help_id .
MOVE wanames-name TO fld-def.
WHILE wanames-continue = '*'.
hindex = watypes-idx_help_id + 1.
READ TABLE td-names INTO wanames INDEX hindex.
CONCATENATE fld-def wanames-name INTO fld-def.
ENDWHILE.
APPEND fld.
ENDLOOP.
*build fieldcatalog
LOOP AT fld.
CLEAR katalog.
katalog-fieldname = fld-name.
IF fld-name = 'RCOMP'
OR fld-name ='GSBER'
OR fld-name ='ITEM'
OR fld-name ='FUNKTION'.
katalog-key = 'X'.
ENDIF.
SPLIT fld-def AT '-' INTO t f.
SELECT SINGLE scrtext_m leng
FROM dd03m INTO: (katalog-reptext_ddic, katalog-outputlen)
WHERE tabname = t
AND fieldname = f
AND ddlanguage = sy-langu.
IF sy-subrc <> 0.
katalog-reptext_ddic = fld-name.
ENDIF.
IF fld-name = 'TXT'.
katalog-outputlen = 30.
ELSEIF fld-name = 'GSBER'.
katalog-outputlen = 4.
ELSE.
katalog-tabname = t.
ENDIF.
*here: different value-fields
IF fld-name BETWEEN 'KSL00' AND 'KSL99'.
IF fld-name <> 'KSL99'.
CONCATENATE 'Periode' fld-name+3(2) '/' jahr INTO
katalog-reptext_ddic SEPARATED BY space.
*hide fields
IF NOT fld-name+3(2) IN buper.
katalog-no_out = 'X'.
ENDIF.
ELSE.
katalog-outputlen = 19.
IF ohnevj = 'X'.
katalog-reptext_ddic = 'Summe'.
ELSE.
*previous year
CONCATENATE 'Periode' buper-low '/' vorjahr INTO
katalog-reptext_ddic SEPARATED BY space.
ENDIF.
ENDIF.
katalog-currency = 'EUR'.
katalog-do_sum = 'X'.
katalog-inttype = 'P'.
katalog-datatype = 'CURR'.
ENDIF.
*hide more fields
CASE fld-name.
WHEN 'GSBER'.
MOVE x_gebe TO katalog-no_out.
katalog-reptext_ddic = 'Gsbr'.
WHEN 'ITEM'.
MOVE x_item TO katalog-no_out.
WHEN 'FUNKTION'.
MOVE x_func TO katalog-no_out.
WHEN 'TXT'.
MOVE x_text TO katalog-no_out.
ENDCASE.
APPEND katalog TO cat.
ENDLOOP.
grx
A. -
Displaying data on an ALV report
Hi Abaper's
I have data that is stored in an internal table and I want to display it in an ALV report, How can I achieve this?
Thanx in advance
ThandieHi,
Try to run the following code you will find the Ans.
TABLES : ekpo.
TYPE-POOLS : slis.
TYPES : BEGIN OF t_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
matnr TYPE ekpo-matnr,
werks TYPE ekpo-werks,
menge TYPE ekpo-menge,
END OF t_ekpo.
*VARIABLES
DATA : check(1),
rep_id TYPE sy-repid.
*INTERNAL TABLE TYPE OF ZEKPO
DATA : it_ekpo TYPE STANDARD TABLE OF t_ekpo WITH HEADER LINE.
*FIELD CATALOG
DATA : it_field TYPE slis_t_fieldcat_alv,
wa_field TYPE slis_fieldcat_alv.
*SORTING
DATA : it_sort TYPE slis_t_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv.
INITIALIZATION.
check = 'X'.
rep_id = sy-repid.
START-OF-SELECTION.
SELECT ebeln
ebelp
matnr
werks
menge
FROM ekpo
INTO CORRESPONDING FIELDS OF TABLE it_ekpo.
* FIELD CATALOG
wa_field-fieldname = 'EBELN'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 10.
wa_field-seltext_l = 'PO #'.
APPEND wa_field TO it_field.
CLEAR wa_field.
wa_field-fieldname = 'EBELP'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 10.
wa_field-seltext_l = 'Line Item'.
APPEND wa_field TO it_field.
CLEAR wa_field.
wa_field-fieldname = 'MATNR'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 15.
wa_field-seltext_l = 'Material'.
APPEND wa_field TO it_field.
CLEAR wa_field.
wa_field-fieldname = 'WERKS'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 6.
wa_field-seltext_l = 'Plant'.
APPEND wa_field TO it_field.
CLEAR wa_field.
wa_field-fieldname = 'MENGE'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 10.
wa_field-seltext_l = 'Qty.'.
* wa_field-outputlen = 17.
* wa_field-edit = 'X'.
wa_field-do_sum = check.
APPEND wa_field TO it_field.
CLEAR wa_field.
* SORT W.R.T. PURCHASE ORDER NUMBER
wa_sort-spos = 1.
wa_sort-fieldname = 'EBELN'.
wa_sort-tabname = 'IT_EKPO'.
wa_sort-up = check.
wa_sort-subtot = check.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
* DISPLAY RECORDS IN ALV GRID
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = rep_id
it_fieldcat = it_field
it_sort = it_sort
TABLES
t_outtab = it_ekpo
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc = 0.
ENDIF.
Kind Regards,
Faisal -
Displaying data from an XMl in horizontal list
Ok so here's the skinny:
I have this flex app that works fine
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" width="100%"
viewSourceURL="srcview/index.html">
<mx:Style source="source.css"/>
<mx:Image x="15" y="4" source="images/title.jpg"
width="210" height="65"/>
<mx:Image source="images/title1.jpg" id="image1"
horizontalAlign="right" verticalAlign="top" top="3" width="784"
height="58" x="241"/>
<mx:XML id="tempXML" source="
http://development.company.net/interface.php?username=user&password=pass&customer= customer&action=showopen&operation=defects&format=xml&critcal=both"
/>
<mx:XMLListCollection id="defectXMLList"
source="{tempXML.defect}" />
<mx:DataGrid id="dataGrid" dataProvider="{defectXMLList}"
width="1024" rowCount="{defectXMLList.length + 1}" x="0" y="62"
borderThickness="2" borderColor="#fda600" themeColor="#fda600"
alternatingItemColors="[#fda600, #ffffff]" cornerRadius="0"
color="#000000" borderStyle="none" alpha="0.73">
<mx:columns>
<mx:DataGridColumn id="assetCol" dataField="asset"
headerText="Asset:" />
<mx:DataGridColumn id="componentCol"
dataField="component" headerText="Component:" />
<mx:DataGridColumn id="conditionCol"
dataField="condition" headerText="Condition:" />
<mx:DataGridColumn id="ffdCol" dataField="ffd"
headerText="FFD:" />
<mx:DataGridColumn id="inspidCol" dataField="inspid"
headerText="Inspection ID:" />
<mx:DataGridColumn id="mileageCol" dataField="mileage"
headerText="Mileage:" />
</mx:columns>
</mx:DataGrid>
</mx:Application>
However they now want to just display the asset and not in a
data grid but as a horizontal list and I have tried and tried to
look for an effective example of this and how to make it work.
I have tried Horizontal List, Vertical List, HBox, and VBox
but all I want the thing to do for now is to just display data
Horizontally.
any help would be greatHorizontalList is what you're looking for. But that alone
won't do. You'll need to write a custom renderer.
Search in the Flex Build helper for how to implement custom
renderer. Essentially, each row that you see in the grid would be
passed to each element in the horizontal list and you can use any
<mxml> or actionscript based component as renderer.
here are some of the topics that will get you started:
Using Item Renderers and Item Editors
Working with item renderers
ATTA -
Need Suggestion in displaying data in ALV.
Hi All Experts,
I have a scepic scenario for which I need your inputs. I am preparing a report which will display data foe entries made in time sheet. The entries in time sheet can be made for anything like a change request on an incident etc. It will have various output fields
And also dates for which entries are made. So it can have date from 1 to 31. This all is
to be displayed in ALV. Now the report can be displayed in two Summarised ways.
One summary can be for a user and another for the object type(incident, change request).
Now if the user wants to see this report for a period more than a month then I have to summarise it against a month too. So am not sure how to handle this. Which type of ALV function module to be used to display this?
Regards,
Sakethello,
I would suggest to go for GRID display - for that you can use either function module or class.
Tips:
If it also need to be summarised by month then add an extra field in fieldcatalog as monthid / monthname.
also it's better to have an extra field for object tyoe (Incident/ change)...
Thanks. -
Display data column wise in alv
my problem is i want to display data in column wise in alv grid display
for example it will display
Name1 Amount
GTS 12000
TSL 8970
MJB 4678
but i want like:
GTS TSL MJB
12000 8970 4678
Edited by: jadav_avani on Nov 15, 2010 8:33 AM
Moderator Message: Search for available information.
Edited by: kishan P on Nov 15, 2010 1:50 PMmy problem is i want to display data in column wise in alv grid display
for example it will display
Name1 Amount
GTS 12000
TSL 8970
MJB 4678
but i want like:
GTS TSL MJB
12000 8970 4678
Edited by: jadav_avani on Nov 15, 2010 8:33 AM
Moderator Message: Search for available information.
Edited by: kishan P on Nov 15, 2010 1:50 PM -
How to display data in alv through double click
Hello Friends,
I am new to this community,please tell me if I make any mistake while posting.
Friends I had written this code. ALV is displayed at first time but when I am double clicking on the row then error is coming related to mismatch of actual and formal paramaters while calling function 'USER_COMMAND'. I am unable to locate where the error is. Please help me out.
REPORT ZALV12.
TYPE-POOLS SLIS.
DATA: it_vbak type standard table of VBAK,
it_vbap type table of VBAP.
DATA: wa_vbak like line of it_vbak,
wa_vbap like line of it_vbap.
DATA syrepid like sy-repid.
DATA:fld_vbak type SLIS_T_FIELDCAT_ALV,
fld_vbap type SLIS_T_FIELDCAT_ALV.
DATA:fld_wa_vbak type SLIS_FIELDCAT_ALV,
fld_wa_vbap type SLIS_FIELDCAT_ALV.
DATA:vevent type SLIS_T_EVENT,
waevent type SLIS_ALV_EVENT.
DATA:LST_HEADR type SLIS_T_LISTHEADER.
DATA title_alv type LVC_TITLE value 'LIST FOR VBAK'.
INITIALIZATION.
syrepid = sy-repid.
perform get_event.
perform populate_event.
perform set_list_headr using LST_HEADR.
perform field_cat.
START-OF-SELECTION.
..... "code for displaying data from table VBAK in ALV.
form USER_COMMAND using R_UCOMM type SY-UCOMM. "error is in this function.
data r_selfield type SLIS_SELFIELD.
case R_UCOMM.
when '&IC1'.
read table it_vbak into wa_vbak index r_selfield-TABINDEX.
perform data_select.
perform list_heading using LST_HEADR.
perform event_get.
perform build_event.
perform alv_display.
endcase.
endform.
form data_select.
select * from VBAP into table it_vbap up to 20 rows.
endform.
form list_heading using i_lst type SLIS_T_LISTHEADER.
data HLINE type SLIS_LISTHEADER.
HLINE-TYP = 'H'.
HLINE-INFO = 'FOR VBAP'.
append HLINE to i_lst.
endform.
form alv_display.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = syrepid
I_STRUCTURE_NAME = 'VBAP'
I_GRID_TITLE = 'SCREEN2_VBAP'
TABLES
T_OUTTAB = it_vbap
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform.
form event_get.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = vevent
EXCEPTIONS
LIST_TYPE_WRONG = 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.
endform.
form build_event.
read table vevent into waevent with key name = 'TOP_OF_PAGE'.
if sy-subrc = 0.
waevent-form = 'F_TOP_OF_PAGE'.
modify vevent from waevent transporting form
where name = 'TOP_OF_PAGE'.
endif.
endform.
form F_TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = LST_HEADR
I_LOGO =
I_END_OF_LIST_GRID =
I_ALV_FORM =
endform.You missed one paramete in user_command form
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
Regards,
Raymond -
Error displaying data in Excel Layout of ALV
Hi,
I am trying to display ALV data in a Excel layout. After changing the layout i am not able to view the data, rather the excel template is alone displayed.
Is there setting that i am supposed. I did not try this on a custom report but i used SE16 to display data.
Any help will be really appreciated!!!
Thanks in advance,
KathirvelHi,
Please make sure that you have made a <b>global</b>
<b>declaration</b> for the ALV Grid control.If not try
with this
Please reward points if this explanation is useful.
Regards,
Siva -
Need to display data on the right side in the header area of alv report.
hi experts,
I want to display data in the header area of alv report on the right side . I have already used function for events on the header side data is getting displayed on the left side .but i want data to be displayed on the right side.
regards,
andrews.Hi,
Hope this below code helps you.
Take care,
Çağatay.
* build header for alv
FORM top_of_page_split USING r_top TYPE REF TO cl_dd_document.
DATA: s_tab TYPE sdydo_text_table,
c_area TYPE REF TO cl_dd_area,
text TYPE sdydo_text_element.
TYPES: BEGIN OF tab_text,
text TYPE sdydo_text_element,
END OF tab_text.
DATA: i_text TYPE TABLE OF tab_text.
DATA: w_text TYPE tab_text.
CALL METHOD r_top->initialize_document.
CALL METHOD r_top->vertical_split
EXPORTING
split_area = r_top
split_width = '70%'
IMPORTING
right_area = c_area.
CONCATENATE sy-datum+4(2)
sy-datum+6(2)
sy-datum(4)
INTO date1.
CONCATENATE 'DATE' date1
INTO w_text-text
SEPARATED BY ':'.
APPEND w_text TO i_text.
CONCATENATE 'time:' sy-uzeit INTO w_text .
APPEND w_text TO i_text.
CONCATENATE 'uesr:' sy-uname INTO w_text .
APPEND w_text TO i_text.
CONCATENATE 'local date:' sy-datlo INTO w_text .
APPEND w_text TO i_text.
CONCATENATE 'time zone:' sy-zonlo INTO w_text .
APPEND w_text TO i_text.
s_tab[] = i_text[].
CALL METHOD c_area->add_text
EXPORTING
text_table = s_tab
fix_lines = 'X'
sap_fontsize = cl_dd_document=>medium
sap_emphasis = cl_dd_document=>strong.
CALL METHOD r_top->add_gap
EXPORTING
width = 60.
text = 'THIS IS REPORT HEADING'.
CALL METHOD r_top->add_text
EXPORTING
text = text
sap_emphasis = 'STRONG'.
CALL METHOD r_top->new_line.
CALL METHOD r_top->add_gap
EXPORTING
width = 70.
text = 'THIS IS REPORT HEADING1'.
CALL METHOD r_top->add_text
EXPORTING
text = text
sap_emphasis = 'STRONG'.
CALL METHOD r_top->new_line.
CALL METHOD r_top->add_gap
EXPORTING
width = 80.
text = 'THIS IS REPORT HEADING2'.
CALL METHOD r_top->add_text
EXPORTING
text = text
sap_emphasis = 'STRONG'.
CALL METHOD r_top->new_line.
text = 'Report Subheading1'.
CALL METHOD r_top->add_text
EXPORTING
text = text
sap_emphasis = 'NORMAL'.
CALL METHOD r_top->new_line.
text = 'Report Subheading2'.
CALL METHOD r_top->add_text
EXPORTING
text = text
sap_emphasis = 'NORMAL'.
CALL METHOD r_top->new_line.
text = 'Report Subheading3'.
CALL METHOD r_top->add_text
EXPORTING
text = text
sap_emphasis = 'NORMAL'.
CALL METHOD r_top->new_line.
ENDFORM. "TOP_OF_PAGE_SPLIT -
To display data in alv for perticular way
in my itab data is like below mentioned way
1 1111 0.00 3404 EUR 53.86 D
2 1111 0.00 1962 USD 1866.58 D
3 1111 0.00 1231 USD 14387.51 D
4 1111 0.00 1231 CAD 18251.13 D
5 1111 1200 CAD 16660.25 0.00 R
6 1111 1200 USD 43908.08 0.00 R
7 1111 1231 CAD 895636.49 0.00 R
8 1111 1231 USD 15470.37 0.00 R
9 1111 1390 USD 11183.27 0.00 R
10 1111 1552 CAD 33149.77 0.00 R
i need to display data in ALV like
company 1111
reciepts payments
1200 CAD 16660.25 3404 EUR 53.86 D
1200 USD 43908.08 1962 USD 1866.58 D
1231 CAD 895636.49 1231 USD 14387.51 D
1231 USD 15470.37 1231 CAD 18251.13 D
1390 USD 11183.27
1552 CAD 33149.77
plz guid me to do this
thanks ,
vamsee
Moderator message: you want the community to figure out the logic and provide the solution -> please try solving this yourself first, search for available information, provide more details about what you are trying to do when posting again.
Edited by: Thomas Zloch on Nov 29, 2010 3:37 PMHi expert,
itab1 data.
1 1111 0.00 3404 EUR 53.86 D
types:begin of ty_data,
fld1 type string,
fld2 type string,
fld3 type string,
fld4 type string,
fld5 type string,
fld6 type string,
end of ty_data.
data:itab type standard table of ty_data,
wa type ty_data.
wa-fld1 = '1'.
wa-fld2 = '111'.
like so on -
append wa to itab.
please create the another internal table for below data.After the we can assign itab1 data to itab2 respective fields.
types:begin of ty_data1,
fld1 type string,
fld2 type string,
fld3 type string,
fld4 type string,
so on
data:itab2 type standard table of ty_data1,
wa2 type ty_data.
loop at itab into wa.
wa2-fld1 = wa-fld3.
wa2-fld2 = wa-fld4.
append wa2 to itab2.
then we create the fieldcatlog for itab2 then only is work.In which u want to display on alv same way we can create.the internaltable(itab2).
regards,
muralii -
How to display table data without using ALV and table element.
Hi,
Its possible to display table data without using ALV and table element.
Every time i am fetching data based on (customer,status) fields and displaying these data in my output using alv
(every time i am fetching single row data ),
But problem is alv occupying more space in the output , i want to display data part only i dont want field names,
settings and header data etc..things.
Give solution to display data part..
Regards,
Rakhi.Hi,
Does you mean that you need ALV without default Function Toolbar...? If this is the case, the easy solution would have been to use Table Element rather. But, if you need to use ALV only without Function Toolbar, you can do away with that as well.
In that case, after calling GET_MODEL, you need to add few more lines of codes to achieve your goal. Those lines are --
DATA LV_VALUE TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
LV_VALUE = LO_INTERFACECONTROLLER->GET_MODEL(
* Standard Filter Function setting to FALSE
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_SORT_COMPLEX_ALLOWED( ABAP_FALSE ).
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_FILTER_COMPLEX_ALLOWED( ABAP_FALSE ).
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_FILTER_FILTERLINE_ALLOWED( ABAP_FALSE ).
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_DISPLAY_SETTINGS_ALLOWED( ABAP_FALSE ).
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_VIEW_LIST_ALLOWED( ABAP_FALSE ).
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_SORT_HEADERCLICK_ALLOWED( ABAP_FALSE ).
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_HIERARCHY_ALLOWED( ABAP_FALSE ).
* Standard Filter Function setting to FALSE Ends
Here as you can easily notice that LV_VALUE is instantiated on CL_SALV_WD_CONFIG_TABLE. Now, using this LV_VALUE, you set standard functions as False to dis-allow their display.
Hope this answers your query.
Thanks.
Kumar Saurav. -
Problem in displaying data in alv grid.
Hi Experts,
I am using the class CL_GUI_ALV_GRID for displaying my data in the ALV Grid.
But I have a requirement
If there are more than one record with the same values in some fields I have to display the values in the first record itself . for other records I have to display the record with the fields having different values of the previous record.
And another requirement is When the user use the scroll bar regarding the same datas, the first record displayed will contain the datas used.
How can we achieve this functionality?
Regards
KasinathHi,
while preparing internal table to be passed to ALV, you have to implement the logic for these scenarios.
Regards,
Raghavendra -
Display Nested table data in an ALV format
Hi All,
Is there any way to display nested table data in an ALV format. This table has 20-30 structures in it and there is no way to create a common structure using all the fields. Kindly let me know what is the best way to display the nested structure data.
Thanks a lot for your responce.
Regards,
PritiREPORT yh_alvtreedemo1.
TYPE-POOLS : fibs,stree.
TYPE-POOLS:slis.
DATA : t_node TYPE snodetext.
DATA : it_node LIKE TABLE OF t_node,
wa_node LIKE t_node.
DATA: t_fieldcat TYPE slis_t_fieldcat_alv,
fs_fieldcat TYPE slis_fieldcat_alv.
DATA:w_repid LIKE sy-repid.
*Internal Table declarations
DATA: BEGIN OF fs_scarr,
carrid LIKE scarr-carrid,
END OF fs_scarr.
DATA:BEGIN OF fs_spfli,
carrid LIKE spfli-carrid,
connid LIKE spfli-connid,
END OF fs_spfli.
DATA:BEGIN OF fs_sflight,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
END OF fs_sflight.
DATA:BEGIN OF fs_sbook,
carrid LIKE sbook-carrid,
connid LIKE sbook-connid,
fldate LIKE sbook-fldate,
bookid LIKE sbook-bookid,
END OF fs_sbook.
DATA:t_scarr LIKE TABLE OF fs_scarr,
t_spfli LIKE TABLE OF fs_spfli,
t_sflight LIKE TABLE OF fs_sflight,
t_sbook LIKE TABLE OF fs_sbook.
START-OF-SELECTION.
PERFORM get_data.
PERFORM build_tree.
PERFORM display_tree.
*& Form get_data
FORM get_data .
SELECT carrid
FROM scarr
INTO TABLE t_scarr.
SELECT carrid
connid
FROM spfli
INTO TABLE t_spfli
FOR ALL ENTRIES IN t_scarr
WHERE carrid EQ t_scarr-carrid.
ENDFORM. " get_data
*& Form build_tree
FORM build_tree .
CLEAR: it_node,
wa_node.
SORT: t_scarr BY carrid,
t_spfli BY carrid connid,
t_sflight BY carrid connid fldate,
t_sbook BY carrid connid fldate bookid.
wa_node-type = 'T'.
wa_node-name = 'Flight Details'.
wa_node-tlevel = '01'.
wa_node-nlength = '15'.
wa_node-color = '4'.
wa_node-text = 'Flight'.
wa_node-tlength ='20'.
wa_node-tcolor = 3.
APPEND wa_node TO it_node.
CLEAR wa_node.
LOOP AT t_scarr INTO fs_scarr.
wa_node-type = 'P'.
wa_node-name = 'CARRID'.
wa_node-tlevel = '02'.
wa_node-nlength = '8'.
wa_node-color = '1'.
wa_node-text = fs_scarr-carrid.
wa_node-tlength ='20'.
wa_node-tcolor = 4.
APPEND wa_node TO it_node.
CLEAR wa_node.
LOOP AT t_spfli INTO fs_spfli WHERE carrid EQ fs_scarr-carrid.
wa_node-type = 'P'.
wa_node-name = 'CONNID'.
wa_node-tlevel = '03'.
wa_node-nlength = '8'.
wa_node-color = '1'.
wa_node-text = fs_spfli-connid.
wa_node-tlength ='20'.
wa_node-tcolor = 4.
APPEND wa_node TO it_node.
CLEAR wa_node.
ENDLOOP.
ENDLOOP.
ENDFORM. " build_tree
*& Form display_tree
FORM display_tree .
CALL FUNCTION 'RS_TREE_CONSTRUCT'
TABLES
nodetab = it_node.
w_repid = sy-repid.
CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
EXPORTING
callback_program = w_repid
callback_user_command = 'USER_COMMAND'
callback_gui_status = 'SET_PF'.
ENDFORM. " display_tree
*& Form pick
* -->COMMAND text
* -->NODE text
FORM user_command TABLES pt_nodes STRUCTURE seucomm
USING pv_command TYPE c
CHANGING pv_exit TYPE c
pv_list_refresh TYPE c.
pv_list_refresh = 'X'.
IF pt_nodes-tlevel = '03'.
CLEAR t_fieldcat[].
SELECT carrid
connid
fldate
FROM sflight
INTO TABLE t_sflight
WHERE connid EQ pt_nodes-text.
fs_fieldcat-col_pos = 1.
fs_fieldcat-fieldname = 'CARRID'.
fs_fieldcat-seltext_m = 'Airlinecarrier'.
fs_fieldcat-key = 'X'.
fs_fieldcat-hotspot = 'X'.
APPEND fs_fieldcat TO t_fieldcat.
CLEAR fs_fieldcat.
fs_fieldcat-col_pos = 2.
fs_fieldcat-fieldname = 'CONNID'.
fs_fieldcat-seltext_m = 'Connection No'.
fs_fieldcat-key = 'X'.
fs_fieldcat-hotspot = 'X'.
APPEND fs_fieldcat TO t_fieldcat.
CLEAR fs_fieldcat.
fs_fieldcat-col_pos = 3.
fs_fieldcat-fieldname = 'FLDATE'.
fs_fieldcat-seltext_m = 'Flight Date'.
fs_fieldcat-key = 'X'.
fs_fieldcat-hotspot = 'X'.
APPEND fs_fieldcat TO t_fieldcat.
CLEAR fs_fieldcat.
w_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = w_repid
it_fieldcat = t_fieldcat[]
TABLES
t_outtab = t_sflight.
ENDIF.
ENDFORM. "pick
*& Form set_pf
* text
FORM set_pf.
SET PF-STATUS 'MYPF'.
ENDFORM. "set_pf
Maybe you are looking for
-
Having looked at the forums and found Adobe support less than helpful I am hopping that the comunite will be able to help me out on these frustrating issues. We are having a number of issues while trying to print from InDesign CS6 to our OKI C830 pri
-
Adding a Z field in Standard Database view
Hi ALL My requirement is to add a z field in a Standard Database View . Please advice how do i go ahead . Urgent help will be appreciated . Thanks Shweta
-
Remove stand alone movie header (window menu)
hi, recently i posted a message similar to this one, somebody told me the 'fscommand' still works in as3 so i could use it, i placed: fscommand("showmenu", false); // << gave error, since it seems it only takes strings tried fscommand("showmenu", "fa
-
Open a new window of the brosewr in a pl/sql portlet
I am designing a pl/sql portlet that the inserted thing in a page of portal and that on having executed opens the page of beginning of an own application of my organization. I want to open this page in a new window of the mariner(browser) but that fa
-
Why are my runtime exe menus jibberish?
Here's the computer systems: Development System: Windows XP LabVIEW 2011 SP1f1 Run-time Systems: Win 7 32-bit with Run-time engine LV 2011 (11.0.0) Win XP 32-bit with Run-time engine LV 2011 SP1 (11.0.1) If I take a VI (this has happened on two VIs n