ALV Grid merge cells horizontally for specific record
Hi Experts,
We have a requirement regarding ALV Grid developement.
In ALV Grid, we will have multiple records as normal output.
Output will be as below.
In that, we need Summery Text should be in from Field 2 * to* Field 6 as a single Cell and below that all output
will be normal each cell wise.
That Summery will come for each new Field1.
OUTPUT
Field1 Field2 Field3 Field4 Field5 Field6 Field7 Field8 Field9
001 | . .... .. .. Summery ........... | 10 | 20 | 30
001 | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 |
001 | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 |
001 | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 |
001 | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 |
Thanks & regards
Manglesh
Hi Manglesh,
sorry ALV is not as flexible as Excel may be.
You can only define a header in that way but it would be above the column headings.
The ALV table display allows only to change the width of the whole column.
Regards,
Clemens
Similar Messages
-
ALV Grid - capturing the data of checked records
Hi All,
I have a report with ALV Grid display and it displays the contents of a custom table. Each record has a CHBOX, and I want to capture the data of all checked records in to an internal table when 'create Order' button is pressed. Please help me.
Thanks,
Neelu.Hi neelu,
Find attached complete code for the check box in ALV
REPORT ZTESTPRG .
TABLES AND DATA DECLARATION.
*TABLES: mara,makt.",marc.
data syrepid like sy-repid.
data sydatum(10). " LIKE sy-datum.
data sypagno(3) type n.
WHEN USING MORE THAN ONE TABLE IN ALV WE NEEED TO DECLARE THE TYPE
GROUP (TYPE-POOLS--------->SLIS)
type-pools : slis.
INTERNAL TABLE DECLARATION.
INTERNAL TABLE TO HOLD THE VALUES FROM THE MARA TABLE
data: begin of t_mara occurs 0,
matnr like mara-matnr,
meins like mara-meins,
mtart like mara-mtart,
matkl like mara-matkl,
end of t_mara.
INTERNAL TABLE TO HOLD THE CONTENTS FROM THE EKKO TABLE
data : begin of t_marc occurs 0,
matnr like mara-matnr,
werks like marc-werks,
minbe like marc-minbe.
data: end of t_marc.
INTERNAL TABLE TO HOLD THE VALUES FROM MAKT TABLE.
data : begin of t_makt occurs 0,
matnr like mara-matnr,
maktx like makt-maktx,
spras like makt-spras,
end of t_makt.
INTERNAL TABLE WHICH ACTUALLY MERGES ALL THE OTHER INTERNAL TABLES.
data: begin of itab1 occurs 0,
chkbox(1) type c,
matnr like mara-matnr,
meins like mara-meins,
maktx like makt-maktx,
spras like makt-spras,
werks like marc-werks,
minbe like marc-minbe,
end of itab1.
THE FOLLOWING DECLARATION IS USED FOR DEFINING THE FIELDCAT
AND THE LAYOUT FOR THE ALV.
HERE AS slis_t_fieldcat_alv IS A INTERNAL TABLE WITHOUT A HEADER LINE
WE EXPLICITELY DEFINE AN INTERNAL TABLE OF THE SAME STRUCTURE AS THAT
OF slis_t_fieldcat_alv BUT WITH A HEADER LINE IN THE DEFINITION.
THIS IS DONE TO MAKE THE CODE SIMPLER.
OTHERWISE WE MAY HAVE TO DEFINE THE STRUCTURE AS IN THE NORMAL SAP
PROGRAMS.
IN THE FIELDCATALOG TABLE WE ACTUALLY PASS THE FIELDS FROM ONE OR
MORE TABLES AND CREATE A STRUCTURE
IN THE LAYOUT STRUCTURE WE BASICALLY DEFINE THE FORMATTING OPTIONS
LIKE DISPLAY IN THE ZEBRA PATTERN ,THE HOTSPOT OPTIONS ETC.
data: fieldcatalog type slis_t_fieldcat_alv with header line,
fieldlayout type slis_layout_alv.
DECLARING THE EVENTTABLE INTERNL TABLE FOR USING EVENTS LIKE
TOP-OF-PAGE ETC.
data : eventstab type slis_t_event with header line.
DECLARING AN INTERNAL TABLE TO HOLD THE DATA FOR THE TOP-OF-PAGE
data : heading type slis_t_listheader with header line.
data : heading1 type slis_t_listheader with header line.
data : heading2 type slis_t_listheader with header line.
data : heading3 type slis_t_listheader with header line.
data : heading4 type slis_t_listheader with header line.
data : heading5 type slis_t_listheader with header line.
data : heading6 type slis_t_listheader with header line.
data : heading7 type slis_t_listheader with header line.
data : heading8 type slis_t_listheader with header line.
STRUCTURE TO PASS THE COLOR ATTRIBUTES FOR DISPLAY.
data : colorstruct type slis_coltypes.
INITIALIZATION. *
initialization.
syrepid = sy-repid.
sypagno = sy-pagno.
clear fieldcatalog.
START-OF-SELECTION. *
start-of-selection.
SUBROUTINE TO POPULATE THE COLORSTRUCT
perform fill_colorstruct using colorstruct.
SUBROUTINE TO POPULATE THE FIELDS OF THE FIELD CATALOGUE
perform populate_fieldcatalog.
SUBROUTINE TO SELECT DATA FROM VARIOUS TABLES AND POPULATE IT IN THE
INTERNAL TABLE.
perform selectdata_and_sort.
SUBROUTINE TO POPULATE THE LAYOUT STRUCTURE.
perform populate_layout using fieldlayout.
SUBROUTINE TO CALL THE FUNCTION MERGE TO ENSURE PROPER DISPLAY.
perform merge_fieldcatalog.
SUBROUTINE TO POPULATE THE EVENTSTAB.
perform fill_eventstab tables eventstab.
SUBROUTINE TO POPULATE THE HEADING TABLES.
perform fill_headingtable tables heading using 'HEADING'.
perform fill_headingtable tables heading1 using 'HEADING1'.
perform fill_headingtable tables heading2 using 'HEADING2'.
perform fill_headingtable tables heading3 using 'HEADING3'.
perform fill_headingtable tables heading4 using 'HEADING4'.
perform fill_headingtable tables heading5 using 'HEADING5'.
perform fill_headingtable tables heading6 using 'HEADING6'.
perform fill_headingtable tables heading7 using 'HEADING7'.
perform fill_headingtable tables heading8 using 'HEADING8'.
SUBROUTINE TO DISPLAY THE LIST.
perform display_alv_list.
FORMS
IN THIS SUBROUTINE WE POPULATE THE FIELDCATALOG TABLE WITH THE NAMES
OF THE TABLE,FIELDNAME,WHETHER IT IS KEY FIELD OR NOT,HEADING AND
COLUMN JUSTIFICATION.
form populate_fieldcatalog.
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MATNR' 'X' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MEINS' ' '.
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MAKTX' ' ' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MTART' ' ' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MATKL' ' ' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'SPRAS' ' ' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'WERKS' ' ' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MINBE' ' ' .
endform. " POPULATE_FIELDCATALOG
FORM FILL_FIELDS_OF_FIELDCATALOG *
--> FIELDCATALOG *
--> P_TABNAME *
--> P_FIELDNAME *
--> P_KEY *
--> P_KEY *
form fill_fields_of_fieldcatalog tables fieldcatalog
structure fieldcatalog
using p_tabname
p_fieldname
p_key.
p_no_out.
fieldcatalog-tabname = p_tabname.
fieldcatalog-fieldname = p_fieldname.
fieldcatalog-key = p_key.
fieldcatalog-emphasize = '1234'.
*fieldcatalog-no_out = p_no_out.
append fieldcatalog.
endform. " FILL_FIELDSOFFIELDCATALOG
FORM POPULATE_LAYOUT *
--> FIELDLAYOUT *
form populate_layout using fieldlayout type slis_layout_alv.
fieldlayout-f2code = '&ETA' .
fieldlayout-zebra = 'X'.
FOR THE WINDOW TITLE.
fieldlayout-window_titlebar = 'ALV with Events'.
fieldlayout-colwidth_optimize = 'X'.
fieldlayout-no_vline = ' '.
*fieldlayout-no_input = 'X'.
fieldlayout-confirmation_prompt = ''.
fieldlayout-key_hotspot = 'X'.
This removes the column headings if the flag is set to 'X'
fieldlayout-no_colhead = ' '.
*fieldlayout-hotspot_fieldname = 'MAKTX'.
fieldlayout-detail_popup = 'X'.
fieldlayout-coltab_fieldname = 'X'.
fieldlayout-box_fieldname = 'CHKBOX'.
fieldlayout-edit_mode = 'X'.
endform. " POPULATE_LAYOUT
FORM SELECTDATA_AND_SORT *
form selectdata_and_sort.
select matnr meins mtart matkl from mara
into corresponding fields of t_mara
up to 500 rows .
select matnr maktx spras from makt
into corresponding fields of t_makt
where matnr = t_mara-matnr and
spras = sy-langu.
select matnr werks minbe from marc
into corresponding fields of t_marc
where matnr = t_mara-matnr.
append t_marc.
endselect.
append t_makt.
endselect.
append t_mara.
endselect.
perform populate_itab1.
sort itab1 by matnr.
endform. " SELECTDATA_AND_SORT
FORM MERGE_FIELDCATALOG *
form merge_fieldcatalog.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = syrepid
i_internal_tabname = 'ITAB1'
i_structure_name = 'COLORSTRUCT'
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = syrepid
changing
ct_fieldcat = fieldcatalog[]
exceptions
inconsistent_interface = 1
program_error = 2
others = 3.
endform. " MERGE_FIELDCATALOG
IN THIS FUNCTION THE MINIMUM PARAMETERS THAT WE NEED TO PASS IS AS
FOLLOWS:-
i_callback_program --> CALLING PROGRAM NAME
i_structure_name --> STRUCTURE NAME.
is_layout --> LAYOUT NAME.
it_fieldcat ---> BODY OF THE FIELD CATALOGUE INTERNAL TABLE
form display_alv_list.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
i_callback_program = syrepid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
i_structure_name = 'ITAB1'
is_layout = fieldlayout
it_fieldcat = fieldcatalog[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
THE FOLLOWING PARAMETER IS SET AS 'A' INORDER TO DISPLAY THE STANDARD
TOOL BAR
i_save = 'A'
IS_VARIANT = ' '
it_events = eventstab[]
IT_EVENT_EXIT =
IS_PRINT =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = itab1
exceptions
program_error = 1
others = 2.
endform. " DISPLAY_ALV_LIST
*& Form POPULATE_ITAB1
text
--> p1 text
<-- p2 text
form populate_itab1.
loop at t_mara.
loop at t_makt where matnr = t_mara-matnr.
loop at t_marc where matnr = t_mara-matnr.
move-corresponding t_mara to itab1.
move-corresponding t_makt to itab1.
move-corresponding t_marc to itab1.
append itab1.
endloop.
endloop.
endloop.
endform. " POPULATE_ITAB1
*& Form FILL_EVENTSTAB
text
-->P_EVENTSTAB text *
form fill_eventstab tables p_eventstab structure eventstab.
WHEN THE FOLLOWING FUNCTION IS CALLED THE SYSTEM POPULATES THE
INTERNAL TABLE EVENTSTAB WITH A LIST OF EVENTS NAME.
AS SHOWN BELOW WHEN USING I_LIST_TYPE = 0 THE FUNCTION RETURNS 14
EVENTS NAME.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = p_eventstab[]
exceptions
list_type_wrong = 1
others = 2.
BY CALLING THE ABOVE FUNCTION WE FIRST POPULATE THE EVENTSTAB WITH
THE PREDEFINED EVENTS AND THEN WE MOVE THE FORM NAME AS SHOWN BELOW.
WE ASSIGN A FORM NAME TO THE EVENT AS REQUIRED BY THE USER.
FORM NAME CAN BE ANYTHING.THE PERFORM STATEMENT FOR THIS FORM
IS DYNAMICALY CALLED.
read table p_eventstab with key name = slis_ev_top_of_page.
if sy-subrc = 0 .
move 'TOP_OF_PAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_top_of_coverpage.
if sy-subrc = 0 .
move 'TOP_OF_COVERPAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_end_of_coverpage .
if sy-subrc = 0 .
move 'END_OF_COVERPAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_foreign_top_of_page.
if sy-subrc = 0 .
move 'FOREIGN_TOP_OF_PAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_foreign_end_of_page.
if sy-subrc = 0 .
move 'FOREIGN_END_OF_PAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_list_modify.
if sy-subrc = 0 .
move 'LIST_MODIFY' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_top_of_list.
if sy-subrc = 0 .
move 'TOP_OF_LIST' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_end_of_page.
if sy-subrc = 0 .
move 'END_OF_PAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_end_of_list .
if sy-subrc = 0 .
move 'END_OF_LIST' to p_eventstab-form.
append p_eventstab.
endif.
endform. " FILL_EVENTSTAB
*& Form FILL_HEADINGTABLE
text
-->P_HEADING text *
form fill_headingtable tables p_heading structure heading
using tablename.
case tablename.
when 'HEADING'.
p_heading-typ = 'H'.
concatenate
' REPORT NAME:-' syrepid
' ABB Industry Pte Ltd' into p_heading-info.
append p_heading.
write sy-datum using edit mask '__/__/____' to sydatum.
concatenate
' DATE:-' sydatum ' USER: ' sy-uname 'PAGE NO:' sypagno
into p_heading-info.
append p_heading.
when 'HEADING1'.
p_heading-typ = 'H'.
p_heading-info = 'TOP-OF-COVER-PAGE'.
append p_heading.
when 'HEADING2'.
p_heading-typ = 'H'.
p_heading-info = 'END-OF-COVER-PAGE'.
append p_heading.
when 'HEADING3'.
p_heading-typ = 'H'.
p_heading-info = 'FOREIGN-TOP-OF-PAGE'.
append p_heading.
when 'HEADING4'.
p_heading-typ = 'H'.
p_heading-info = 'FOREIGN-END-OF-PAGE'.
append p_heading.
WHEN 'HEADING5'.
P_HEADING-TYP = 'H'.
P_HEADING-INFO = 'LIST-MODIFY'.
APPEND P_HEADING.
when 'HEADING6'.
p_heading-typ = 'H'.
p_heading-info = 'END-OF-PAGE'.
append p_heading.
when 'HEADING7'.
p_heading-typ = 'H'.
p_heading-info = 'END-OF-LIST'.
append p_heading.
when 'HEADING8'.
p_heading-typ = 'H'.
p_heading-info = 'TOP-OF-LIST'.
append p_heading.
endcase.
endform. " FILL_HEADINGTABLE
FORM TOP_OF_PAGE *
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading[]
exceptions
others = 1.
endform.
*& Form FILL_COLORSTRUCT
text
-->P_COLORSTRUCT text *
form fill_colorstruct using p_colorstruct type slis_coltypes .
p_colorstruct-heacolfir-col = 6.
p_colorstruct-heacolfir-int = 1.
p_colorstruct-heacolfir-inv = 1.
endform. " FILL_COLORSTRUCT
FORM TOP_OF_COVERPAGE *
form top_of_coverpage.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading1[]
exceptions
others = 1.
endform.
FORM END_OF_COVERPAGE *
form end_of_coverpage.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading2[]
exceptions
others = 1.
endform.
FORM FOREIGN_TOP_OF_PAGE *
form foreign_top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading3[]
exceptions
others = 1.
endform.
FORM FOREIGN_END_OF_PAGE *
form foreign_end_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading4[]
exceptions
others = 1.
endform.
FORM LIST_MODIFY *
*FORM LIST_MODIFY.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = HEADING5[]
EXCEPTIONS
OTHERS = 1.
*ENDFORM.
FORM END_OF_PAGE *
form end_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading6[]
exceptions
others = 1.
endform.
FORM END_OF_LIST *
form end_of_list.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading7[]
exceptions
others = 1.
endform.
FORM TOP_OF_LIST *
form top_of_list.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading8[]
exceptions
others = 1.
endform.
*--- End of Program
Thanks
Mahesh -
Hi all,
I have a requirement to print an ALV grid display exactly in the same format as we see in output. That is, if the cells are merged in ALV then in Print also they should come as merged.
But when I am printing the ALV output it does not give merged cells. I am using OO ALV.
Is my requirement feasible. If yes, Please help me to proceed?
Thanks,
DayaHi Daya,
In the ALV grid control print or print preview, cells that have identical content are not merged. This is necessary in order to be able to distinguish between blank cells and cells that only become blank after merging. The standard behaviour for the different ALV lists is described in Note 447055.
Regards,
Md Ziauddin -
ALV GRID Report is not showing all records which is in internal table
hi all,
have one doubt. please clarify me. ALV Report is working fine since long tiem. But suddenly this report is showing few records only for the given input. Example: it_main table have 50 records, but output is showing only 10 records only. (we have not made any modifications in this report).
temporarily i have given excel output file from it_main table. excel file is showing all records.
here it_main have all the records. but output is showing few records only. it is not showing any error. i have tested with REUSE_ALV_LIST_DISPLAY function also. but it also showing same results(few records only.)
please give me some idea.
FORM display_alv_report.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = sy-repid
is_layout = wa_layout
it_fieldcat = it_fcat
it_events = it_events
i_save = 'A'
is_variant = wa_variant
TABLES
t_outtab = it_main
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE text-204 " 'Error in Display the list'
TYPE 'I'.
LEAVE TO LIST-PROCESSING.
ENDIF.
ENDFORM. . "DISPLAY_ALV_REPORT
Best Regards,
Srinivashi
Please study this program and give me suggestions.
ALV Declaration
DATA : it_events TYPE slis_t_event, "ALV event
it_fcat TYPE slis_t_fieldcat_alv, "Field catalog
it_list_top_of_page TYPE slis_t_listheader,
c_tabname TYPE slis_tabname VALUE 'IT_MAIN'.
DATA : wa_layout TYPE slis_layout_alv,
wa_event TYPE slis_alv_event,
wa_fcat TYPE slis_fieldcat_alv,
wa_variant TYPE disvariant.
START-OF-SELECTION.
PERFORM material_pass.
PERFORM data_retrieval.
END-OF-SELECTION.
PERFORM sub_display_report.
FORM sub_display_report .
DATA status(1).
IF r1 = 'X'.
PERFORM build_fieldcatalog USING :
'1' 'ERDAT' 'S.O DATE' '' '10' 'X',
'2' 'VBELN' 'SALE ORDER' '' '10' 'X',
'3' 'POSNR' 'SALE ITEM' '' '6' '',
'4' 'BSTKD' 'CUSTOMER PO' '' '35' '',
'5' 'BEZEI' 'REASON FOR REJECTION' '' '40' '',
'6' 'PLNUM' 'PLANNED ORDER' '' '10' '',
'7' 'AUFNR' 'PROD.ORDER.' '' '12' '',
'8' 'MATNR' 'MATERIAL NUMBER' '' '18' '',
'9' 'MAKTX' 'MATERIAL DESCRIPTION' '' '40' '',
'10' 'WERKS' 'PLANT' '' '4' '',
'11' 'KWMENG' 'SALE ORDER QTY' '' '15' '',
'12' 'VRKME' 'UNIT' '' '4' '',
'13' 'GAMNG' 'PROD.ORDER QTY' '' '13' '',
'14' 'IGMNG' 'CONFIRMED ORDER QTY' '' '13' '',
'15' 'GMEIN' 'UNIT' '' '4' '',
'16' 'MENGE' 'G.R QUANTITY' '' '13' '',
'17' 'SOBAL' 'S.O BALANCE' '' '13' '',
'18' 'PRDBAL' 'PROD.BALANCE' '' '13' '',
'19' 'GSM' 'GSM' '' '4' '',
'20' 'SIZE1' 'SIZE1' '' '10' '',
'21' 'SIZE2' 'SIZE2' '' '10' ''.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = pathname
filetype = ftype
append = 'X'
write_field_separator = 'X'
TABLES
data_tab = it_mains
EXCEPTIONS
file_write_error = 1.
IF sy-subrc = 0.
status = 'S'.
ELSE.
status = 'E'.
ENDIF.
ELSEIF r2 = 'X' OR r3 = 'X'.
PERFORM build_fieldcatalog USING :
'1' 'ERDAT' 'S.O DATE' '' '10' 'X',
'2' 'VBELN' 'SALE ORDER' '' '10' 'X',
'3' 'POSNR' 'SALE ITEM' '' '6' '',
'4' 'BSTKD' 'CUSTOMER PO' '' '35' '',
'5' 'BEZEI' 'REASON FOR REJECTION' '' '40' '',
'6' 'PLNUM' 'PLANNED ORDER' '' '10' '',
'7' 'AUFNR' 'PROD.ORDER.' '' '12' '',
'8' 'MATNR' 'MATERIAL NUMBER' '' '18' '',
'9' 'MAKTX' 'MATERIAL DESCRIPTION' '' '40' '',
'10' 'WERKS' 'PLANT' '' '4' '',
'11' 'KWMENG' 'SALE ORDER QTY' '' '15' '',
'12' 'VRKME' 'UNIT' '' '4' '',
'13' 'GAMNG' 'PROD.ORDER QTY' '' '13' '',
'14' 'IGMNG' 'CONFIRMED ORDER QTY' '' '13' '',
'15' 'GMEIN' 'UNIT' '' '4' '',
'16' 'MENGE' 'G.R QUANTITY' '' '13' '',
'17' 'SOBAL' 'S.O BALANCE' '' '13' '',
'18' 'PRDBAL' 'PROD.BALANCE' '' '13' '',
'19' 'GSM' 'GSM' '' '4' '',
'20' 'SIZE1' 'SIZE1' '' '10' '',
'21' 'CUT1' 'CUT1' '' '11' '',
'22' 'SIZE2' 'SIZE2' '' '10' '',
'23' 'CUT2' 'CUT2' '' '11' '',
'24' 'SIZE3' 'SIZE3' '' '10' '',
'25' 'CUT3' 'CUT3' '' '11' '',
'26' 'SIZE4' 'SIZE4' '' '10' '',
'27' 'CUT4' 'CUT4' '' '11' '',
'28' 'SIZE5' 'SIZE5' '' '10' '',
'29' 'CUT5' 'CUT5' '' '11' '',
'30' 'SIZE6' 'SIZE6' '' '10' '',
'31' 'CUT6' 'CUT6' '' '11' ''.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = pathname
filetype = ftype
append = 'X'
write_field_separator = 'X'
TABLES
data_tab = it_mainall
EXCEPTIONS
file_write_error = 1.
IF sy-subrc = 0.
status = 'S'.
ELSE.
status = 'E'.
ENDIF.
ENDIF.
PERFORM build_layout.
PERFORM build_events.
PERFORM sub_comment_build USING it_list_top_of_page.
PERFORM sub_set_variant.
PERFORM display_alv_report.
IF status = 'S'.
MESSAGE 'Excel Output file Downloaded to Given Path' TYPE 'I'.
ELSE.
MESSAGE 'Download Not Possible' TYPE 'I'.
ENDIF.
ENDFORM. " SUB_DISPLAY_REPORT
FORM BUILD_FIELDCATALOG
FORM build_fieldcatalog USING p_col_pos
p_fieldname
p_text
p_datatype
p_outputlen
p_col_freez.
wa_fcat-row_pos = '1'.
wa_fcat-col_pos = p_col_pos.
wa_fcat-fieldname = p_fieldname.
wa_fcat-tabname = c_tabname.
wa_fcat-reptext_ddic = p_text.
wa_fcat-datatype = p_datatype.
wa_fcat-ddic_outputlen = p_outputlen.
wa_fcat-key = p_col_freez.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
FORM build_layout.
CLEAR: wa_layout.
wa_layout-window_titlebar = 'LIST OF GSM WISE OPEN SALE ORDERS'.
wa_layout-colwidth_optimize = 'X'.
wa_layout-totals_text = 'CUMULATIVE'.
ENDFORM. "BUILD_LAYOUT
*& Form BUILD_EVENTS
FORM build_events.
CLEAR wa_event.
REFRESH it_events.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_events
EXCEPTIONS
list_type_wrong = 1
OTHERS = 2.
IF sy-subrc = 0.
READ TABLE it_events INTO wa_event
WITH KEY name = 'TOP_OF_PAGE'.
IF sy-subrc EQ 0.
wa_event-form = 'TOP_OF_PAGE'.
APPEND wa_event TO it_events.
CLEAR wa_event.
ENDIF.
ENDIF.
ENDFORM. "BUILD_EVENTS
-->P_IT_LIST_TOP_OF_PAGE text
FORM sub_comment_build USING it_top_of_page TYPE slis_t_listheader.
DATA ls_line TYPE slis_listheader.
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = str1.
APPEND ls_line TO it_top_of_page.
CLEAR ls_line.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header[].
ENDFORM. " SUB_COMMENT_BUILD
*& Form SUB_SET_VARIANT
text
--> p1 text
<-- p2 text
FORM sub_set_variant .
CLEAR wa_variant.
wa_variant-report = sy-repid.
wa_variant-username = sy-uname.
wa_variant-variant = c_variant.
wa_variant-variant = p_layout.
ENDFORM. " SUB_SET_VARIANT
*& Form DISPLAY_ALV_REPORT
*Display Report Using ALV GRID
FORM display_alv_report.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = sy-repid
i_callback_pf_status_set = c_pf_status
i_callback_user_command = c_user_command
is_layout = wa_layout
it_fieldcat = it_fcat
it_sort = it_sort[]
it_events = it_events
i_save = 'A'
is_variant = wa_variant
TABLES
t_outtab = it_main
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE text-204 " 'Error in Display the list'
TYPE 'I'.
LEAVE TO LIST-PROCESSING.
ENDIF.
ENDFORM. . "DISPLAY_ALV_REPORT
*ALV Report Header
FORM top_of_page.
DATA : t_header TYPE slis_t_listheader WITH HEADER LINE,
wa_header TYPE slis_listheader,
t_line LIKE wa_header-info,
ld_lines TYPE i,
ld_linesc(10) TYPE c.
wa_header-typ = 'H'.
T_HEADER-INFO = 'LIST OF GSM WISE OPEN SALE ORDERS'.
wa_header-info = str1.
APPEND wa_header TO t_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header[].
ENDFORM. "TOP_OF_PAGE
here it_main internal table having all data. but output is showing few records only.
pl. give some idea.
Thanks & Regards
Srinivas. -
Need help in ALV grid editable cells
Hi,
I have created a ALV Grid program in which i made certain cells as editable cells.Now my question is if suppose i have 2 rows in my output then if i change the 2nd rows some cells, then some calculation has to perform till this it is fine but nw i want to modify the 3rd rows some cells as per the changes in 2nd row.
How to do it with ALV oops concepts.
I have refered BCALV_EDIT_02 and BCALV_EDIT_03 these std programs.
Thanks & Regards
MadhuriHello Madhuri
I recommend to do any post-processing of the changed data OUTSIDE your event handler method (HANDLE_DATA_CHANGED).
Within the event handler method do all required validations and the trigger PAI by calling method CL_GUI_CFW=>SET_NEW_OK_CODE (for an example refer to my sample report ZUS_SDN_TWO_ALV_GRIDS in alv)
Now at PAI of your screen you can do any kind of post-processing, calculation, etc. within the itab used for the ALV list.
Regards
Uwe -
ALV grid modifying cell content
Hi ,
I'm woking on a class based ALV GRID program.
In it i have to change the content of one cell when another cell content is changed.
I have done the using
1.Handle data changed in grid
METHOD handle_data_changed.
PERFORM data_changed USING er_data_changed.
ENDMETHOD.
*2
DAta : pw_data_changed2 TYPE REF TO
cl_alv_changed_data_protocol.
CALL METHOD pw_data_changed2->modify_cell
EXPORTING i_tabix = pwl_row_id
i_fieldname = pw_fldname
i_value = pw_fldvalue.
The problem is the cell contents are changing only when i press enter button. Is there any way as soon as i change the contents of one cell other cell contents also changes.
Regards
Srikanthhanks for the suggetions .
When I add the
CALL METHOD w_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
My earlier statements to display the error messages from
CL_ALV_CHANGED_DATA_PROTOCOL are not working (CL_ALV_CHANGED_DATA_PROTOCOL=>ADD_PROTOCOL_ENTRY).
But when I comment
CALL METHOD w_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
and press enter then the error messages in the popup window are displayed.
I tried using CL_GUI_CFW=FLUSH also. But it also not working.
why CL_ALV_CHANGED_DATA_PROTOCOL=>ADD_PROTOCOL_ENTRY is not working when i add mc_evt_modified . -
ALV Grid Layouts - Setting them user-specific
Hi everybody -
I am using the ALV grid layout for a report using function module REUSE_ALV_GRID_DISPLAY. There are a number of fields that are not immediately viewed on screen - they are in hide mode within the field catalog. We want to allow the users to add them / remove them from the report using an ALV variant.
I can allow the users to add/remove with a layout variant no problem - but I am having an issue allowing them to save the variant that they are using to view the data, as user-specific. For whatever reason, they are only allowed to save their layout variants as global - the "User-specific" box is grayed out.
Does anyone know how I can get the "User Specific" box to be NOT grayed out within an ALV grid?
Thanks!
AbbySet the I_SAVE parameter to 'U' in your function call.
Regards
Rich Heilman -
ALV Grid editing cell cursor position
Hello !
i hope i can get the answer to my question here.
i have an alv-grid with editable cells
when i click in one cell (it is a textfield) where there is no more written text it marks the hole cell and when i start to write, it overwrites the whole text.
i would like the cursor to be placed at the end of the field in this case.
when i click in the cell where there is written text it is ok - it puts the cursor to the clicked position.
thanks very much for your help
HelmutHi, i am also facing same probelm.
after call method sender->refresh_table_display.
i am using
call method sender->set_current_cell_via_id
exporting
is_row_id = l_rowid
is_column_id = l_colid.
this will simply select the cell. i am not able to see curser in end or front of the cell.Can anybody please suggest me how to it.
Thanks
Sudhakar -
Help on ALV GRID display outputting format for 2 internal tables
Hi,
I have requirement in ALV GRID where I need to display the data from 2 internal tables. The first internal table has the content of Delivery due list data and second the internal table has the corresponding stock transfer data of the Delivery Due list. I have a checbox on my selection screen, when unchecked it should output the 1st internal table data, i.e for Delivery due list. When it is checked then it should output 1st Internal table data + 2nd internal table data of stock transfer. For example, 1 document delivery due list data and 2nd line for that document should show the stock transfer data. You can also check the transaction code VL10E for that will show a delivery due list...and for stock tranfer,you need to check with Purchase order in in the USer Role tabstrip. Pls suggest.
Regards,
MiraHi,
U can try out this code
REPORT zzz_test NO STANDARD PAGE HEADING
MESSAGE-ID zz.
The Data Declarations
INCLUDE zzm_test_alv_data.
The Selection Screen Definition
INCLUDE zzm_test_alv_selscrn.
The definition and implementation of the event reciever class
INCLUDE zzm_test_alv_class.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM f1000_load_itabs.
END-OF-SELECTION
END-OF-SELECTION.
IF NOT cb_disp IS INITIAL.
CALL SCREEN 9001.
ENDIF.
Include for getting data
INCLUDE zzm_test_alv_forms.
Include for PAI and PBO of screen
INCLUDE zzm_test_alv_screen.
INCLUDE ZZM_TEST_ALV_DATA *
This include has all the data declaration defined
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
Table Declarations:
TABLES: mara,
makt.
Internal Tables:
The following structure type must be defined in the data dictionary
DATA: i_fieldcat TYPE lvc_t_fcat,
i_fieldcat1 TYPE lvc_t_fcat,
i_output1 TYPE STANDARD TABLE OF mara,
i_output2 TYPE STANDARD TABLE OF makt,
Work Areas:
w_output1 TYPE STANDARD TABLE OF mara,
w_output2 TYPE STANDARD TABLE OF makt.
Variable:
DATA: lv_repid LIKE sy-repid.
lv_repid = sy-repid.
INCLUDE ZZM_TEST_ALV_SELSCRN *
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
SELECTION-SCREEN BEGIN OF BLOCK b_main WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP 1.
PARAMETERS: cb_disp AS CHECKBOX.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN END OF BLOCK b_main.
INCLUDE ZZM_TEST_ALV_CLASS *
This include has all the data declaration defined for ALV
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
INCLUDE <icon>.
Predefine a local class for event handling to allow the
declaration of a reference variable before the class is defined.
DATA : o_alvgrid1 TYPE REF TO cl_gui_alv_grid ,
o_alvgrid2 TYPE REF TO cl_gui_alv_grid ,
cont_for_cognos1 TYPE scrfname VALUE 'BCALC_GRID_01_9100',
cont_for_cognos2 TYPE scrfname VALUE 'BCALC_GRID_01_9200',
custom_container1 TYPE REF TO cl_gui_custom_container,
custom_container2 TYPE REF TO cl_gui_custom_container,
Work Area
w_layout TYPE lvc_s_layo ,
w_variant TYPE disvariant.
Constants
CONSTANTS : c_lay(1) TYPE c VALUE 'A' . " All Layouts
CONSTANTS: BEGIN OF c_main_tab,
tab1 LIKE sy-ucomm VALUE 'MAIN_TAB_FC1', "
tab2 LIKE sy-ucomm VALUE 'MAIN_TAB_FC2', "
END OF c_main_tab.
INCLUDE ZZM_TEST_ALV_FORMS *
This Include has the various forms used in the program
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
*& Form f9001_build_field_cat
To Build Field Catalog
-->P_I_FIELDCAT text
-->P_0021 text
FORM f9001_build_field_cat TABLES p_fieldcat STRUCTURE lvc_s_fcat
USING value(p_structure).
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = p_structure
CHANGING
ct_fieldcat = p_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE i005 WITH 'Error in ALV field catalogue creation'.
" text-e05.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " f9001_build_field_cat
*& Form f9000_objects_create
For creating Custom Containers
--> p1 text
<-- p2 text
FORM f9000_objects_create.
CREATE OBJECT custom_container1
EXPORTING
container_name = cont_for_cognos1
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
CREATE OBJECT custom_container2
EXPORTING
container_name = cont_for_cognos2
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc NE 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = lv_repid
txt2 = sy-subrc
txt1 = 'The control could not be created'(510).
ENDIF.
CREATE OBJECT o_alvgrid1
EXPORTING i_parent = custom_container1.
CREATE OBJECT o_alvgrid2
EXPORTING i_parent = custom_container2.
ENDFORM. " f9000_objects_create
*& Form f9003_layout
To define the layout
-->P_SY_TITLE text
-->P_0030 text
-->P_0031 text
-->P_0032 text
FORM f9003_layout USING value(ptitle)
value(pzebra)
value(pmode)
value(pwidth).
w_layout-grid_title = ptitle.
w_layout-zebra = pzebra.
w_layout-sel_mode = pmode.
w_layout-cwidth_opt = pwidth.
w_variant-report = sy-repid.
ENDFORM. " f9003_layout
*& Form f9006_error_handle
To handle event
-->P_PTEXT text
FORM f9006_error_handle USING value(ptext).
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = text-e03 " Error Note
txt2 = sy-subrc
txt1 = ptext.
ENDIF.
ENDFORM. " f9006_error_handle
FORM EXIT_PROGRAM *
FORM exit_program.
CALL METHOD custom_container1->free.
CALL METHOD custom_container2->free.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = lv_repid
txt2 = sy-subrc
txt1 = 'Error in FLush'(500).
ENDIF.
ENDFORM.
*& Form f1000_load_itabs
Select from Database
--> p1 text
<-- p2 text
form f1000_load_itabs.
SELECT * FROM mara
INTO TABLE i_output1
UP TO 50 rows.
SELECT * FROM makt
INTO TABLE i_output2
UP TO 50 rows.
endform. " f1000_load_itabs
INCLUDE ZZM_TEST_ALV_SCREEN *
2/ Description / Include functions
This include contains PBO and PAI events for the screen of report
ZZZJJ_TEST_ALV
3/ Responsibility
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
DATA FOR TABSTRIP 'MAIN_TAB'
CONTROLS: main_tab TYPE TABSTRIP.
DATA: BEGIN OF i_main_tab,
subscreen LIKE sy-dynnr,
prog LIKE sy-repid VALUE
'ZZZ_TEST',
pressed_tab LIKE sy-ucomm VALUE c_main_tab-tab1,
END OF i_main_tab.
*& Module STATUS_9001 OUTPUT
text
MODULE status_9001 OUTPUT.
IF custom_container1 IS INITIAL.
SET PF-STATUS 'ZSTATUS'.
SET TITLEBAR 'ZTITLE'.
Creating Object
PERFORM f9000_objects_create.
Building the field catalog
PERFORM f9001_build_field_cat TABLES i_fieldcat
USING 'MARA'.
PERFORM f9001_build_field_cat TABLES i_fieldcat1
USING 'MAKT'.
Modifying the field catalog
PERFORM f9002_modify_field_cat TABLES i_fieldcat.
For Layout
PERFORM f9003_layout USING sy-title 'X' 'B' 'X'.
ENDIF.
ENDMODULE. " STATUS_9001 OUTPUT
*& Module MAIN_TAB_ACTIVE_TAB_SET OUTPUT
Call method to display in the output grid
MODULE main_tab_active_tab_set OUTPUT.
main_tab-activetab = i_main_tab-pressed_tab.
CASE i_main_tab-pressed_tab.
WHEN c_main_tab-tab1.
To display report
i_main_tab-subscreen = '9100'.
CALL METHOD o_alvgrid1->set_table_for_first_display
EXPORTING
is_variant = w_variant
i_save = c_lay
is_layout = w_layout
CHANGING
it_outtab = i_output1[]
it_fieldcatalog = i_fieldcat[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE i000 WITH text-e06."Error in ALV report display
LEAVE LIST-PROCESSING.
ENDIF.
WHEN c_main_tab-tab2.
To display report
i_main_tab-subscreen = '9200'.
CALL METHOD o_alvgrid2->set_table_for_first_display
EXPORTING
is_variant = w_variant
i_save = c_lay
is_layout = w_layout
CHANGING
it_outtab = i_output2[]
it_fieldcatalog = i_fieldcat1[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE i005 WITH text-e06."Error in ALV report display
LEAVE LIST-PROCESSING.
ENDIF.
WHEN OTHERS.
DO NOTHING
ENDCASE.
ENDMODULE. MAIN_TAB_ACTIVE_TAB_SET OUTPUT
*& Module MAIN_TAB_ACTIVE_TAB_GET INPUT
Check & Process the selected Tab
MODULE main_tab_active_tab_get INPUT.
CASE sy-ucomm.
WHEN c_main_tab-tab1.
i_main_tab-pressed_tab = c_main_tab-tab1.
WHEN c_main_tab-tab2.
i_main_tab-pressed_tab = c_main_tab-tab2.
WHEN OTHERS.
DO NOTHING
ENDCASE.
ENDMODULE. MAIN_TAB_ACTIVE_TAB_GET INPUT
*& Module USER_COMMAND_9001 INPUT
User Command
MODULE user_command_9001 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
PERFORM exit_program.
SET SCREEN '0'.
WHEN 'EXIT' OR 'CANC'.
PERFORM exit_program.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. USER_COMMAND_9000 INPUT
*& Module MAIN_TAB_ACTIVE_TAB_SET INPUT
Set sunscreen
MODULE main_tab_active_tab_set INPUT.
main_tab-activetab = i_main_tab-pressed_tab.
CASE i_main_tab-pressed_tab.
WHEN c_main_tab-tab1.
i_main_tab-subscreen = '9100'.
WHEN c_main_tab-tab2.
i_main_tab-subscreen = '9200'.
WHEN OTHERS.
DO NOTHING
ENDCASE.
ENDMODULE. MAIN_TAB_ACTIVE_TAB_SET INPUT
Thanks & Regards,
Judith. -
Exporting content of ALV grid in Web Dynpro for ABAP
Hello Experts
I have a following request which seems to be giving some headaches.
I need to export results from one of the Web Dynpro reports (ABAP) I have developed to the Excel spreadsheet. Results are stored on ALV component. Request is to add header to export file with additional information like report title, selection criteria, date when report has been executed. By default export file contains only column names and data. I have set the header for ALV grid with all extra information I need to be passed to Excel file but it does not seem to be transferred at all.
At the moment I see 2 possible solutions: 1) write my own Excel export 2) use PDF export where it is possible to set header/footer text. None of these solutions are ideal, I'd rather set header in standard Excel export. Is that even possible? Please help.
Regards
Michael
Edited by: Soltuion Manager on Apr 20, 2009 10:08 AM
Edited by: Soltuion Manager on Apr 20, 2009 10:26 AMHello Michael,
I haven't tried using the builtin functionality of ALV to achieve a similar fnctionality as yours but can suggest you a workaround for that. As how you might be already knowing you can try using the CL_WD_RUNTIME_SERVICES=>attach_file_to_response to download the contents into Excel/notepad/word. So just can modify the internal table to contain the extra information that you need. You can use the approach below for using the attach_file_to_response method:
1) First read the table's data into an internal table.
2) Convert the internal table data to STRING format.
3) Now convert it into tab separated format as how desired.
4) Convert this STRING format to XSTRING format
5) Make use of the attach_file_to_response method.
Regards,
Uday
METHOD onactionon_submit .
DATA: lv_node TYPE REF TO if_wd_context_node,
lt_mara TYPE if_main=>elements_mara,
wa_mara TYPE if_main=>element_mara,
lead_selection_index TYPE i,
mara_string TYPE string,
mara_xstring TYPE xstring.
lv_node = wd_context->get_child_node( name = 'MARA' ).
CALL METHOD lv_node->get_static_attributes_table
IMPORTING
table = lt_mara.
LOOP AT lt_mara INTO wa_mara.
CONCATENATE mara_string
wa_mara-matnr
wa_mara-ersda
wa_mara-ernam
wa_mara-matkl
wa_mara-meins
cl_abap_char_utilities=>cr_lf INTO mara_string
SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
ENDLOOP.
** Now you need to add the column headers & the desired extra information through coding to
** mara_string
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = mara_string
IMPORTING
buffer = mara_xstring.
CL_WD_RUNTIME_SERVICES=>attach_file_to_response( i_filename = 'TEMP.XLS'
i_content = mara_xstring
i_mime_type = 'EXCEL' ).
ENDMETHOD. -
Record selector dont work for specific record selection
Hi,
I have a issue with the record selector in a spotlight.
I want to select specific record, but when I select the check the record don't go in the selected record tab!
the files dataservice.json and endecaBrowserService.json are correctly configure I think. I did compare with the Discover app. but I don't see want would be the issue! not that the dynamic record selection work correctly
endecaBrowserService.json
"host": "W177",
"port": "15101",
"recSpecProp": "Product_SKU",
"recAggregationKey": "Endeca_Rollup_Id",
"recFilter": "",
"recImgUrlProp" : "URL_Thumbnail1",
"recDisplayProps": [ "Brand","Category_EN","Product_SKU"],
"textSearchKey": "interface_EN",
"textSearchMatchMode" : "ALLPARTIAL"
dataservice.json
"jcr:primaryType": "endeca:unstructured",
"host": "W177",
"port": "15101",
"recordSpecName": "Product_SKU",
"aggregationKey": "Endeca_Rollup_Id",
"recordFilter": "",
"wildcardSearchEnabled": false,
"recordNameField": "product_name_en",
"fields": {"Brand" : "", "Category_EN":"","Product_SKU":""}
any Idea
thanksHi TimK,
actualy I dont have space in the record spec, but it look like this 8-474F9138-409-2. I assume that '-' wore bad character like your space.
when I transfore the record spec to 8_474F9138_409_2. the record selector work perfectly
thanks TimK for leading me to the solution
good day -
IsCellEditable() to disable cell editing for specific columns
Hello experts:
My SSCCE for this question is at the below link:
http://forum.java.sun.com/thread.jspa?threadID=5293914&messageID=10244030#10244030
My question is how do I disable cell editing for all but the "Price" column of my table in the SSCCE. I tried adding the below lines of code right after creating the JTable. But get compilation errors.
//Here is the block of code that I am trying to include.
@Override
public boolean isCellEditable(int row, int col) {
if (col == 7) {
return true;
} else {
return false;
} //Below is the method in detail03.java showing the block of code added
private JScrollPane BuildEmptyTable() {
model = new DefaultTableModel();
model.addTableModelListener( this );
model.setColumnIdentifiers(new String[] { "SKU","Qty", "Price"});
tblDetailTest = new JTable(model);
@Override
public boolean isCellEditable(int row, int col) { // <----- I tried placing the
if (col == 7) { // the code block here
return true;
} else {
return false;
tblDetailTest.setRowHeight(20);
tblDetailTest.setPreferredScrollableViewportSize(new Dimension(900, 100));
JTableHeader tblHdr = tblDetailTest.getTableHeader();
tblHdr.setBackground(Color.yellow);
JScrollPane scrollPane = new JScrollPane(tblDetailTest);
return scrollPane;
}Can somebody please guide me? Thank you very much.oops!
Sorry, my bad! I did not tell you what I tried. Following your suggestion, I made the following 2 changes to the code:
In the method, BuildEmptyTable(), where I build the table structure, I have the following statement:
tblDetail = new JTable(model){
public boolean isCellEditable(int row, int col) {
return col == 8;
};And in a separate method after the table is populated with data, I have the below code:
tblDetail.getModel().addTableModelListener(new TableModelListener() {
public void tableChanged(TableModelEvent e) {
if (e.getType() == TableModelEvent.UPDATE)
int row = e.getFirstRow();
int column = e.getColumn();
if (column == 8){
//code here
System.out.println("Updating item price!");
}I do understand that the message gets displayed as many number of times equal to number of rows inserted into the table, because of the UPDATE event. But my problem is I do not know how to make a code change to do what I exactly want, as I have indicated in my previous note. Meaning I want the listener to be called only when the
data in the editable cell changes.
Thank You. -
About ALV Grid's cell merge..Helpppp
Dear gurus:
I just write some code in order to learn alv.
but i find when i sort the data by 'carrid', the cells which have same data was merged. and i declare the cell_merge = space, the result is just the same, how can i solve it? i want the cells not merge.
REPORT zzalv17.
TYPE-POOLS: slis.
TABLES: spfli.
DATA: it_sortinfo TYPE slis_t_sortinfo_alv,
wa_sortinfo TYPE slis_sortinfo_alv,
it_layout TYPE slis_layout_alv,
it_spfli LIKE STANDARD TABLE OF spfli.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE it_spfli
FROM spfli.
CLEAR wa_sortinfo.
wa_sortinfo-spos = 1.
wa_sortinfo-fieldname = 'CARRID'.
wa_sortinfo-up = 'X'.
APPEND wa_sortinfo TO it_sortinfo.
it_layout-zebra = 'X'.
it_layout-detail_popup = 'X'.
it_layout-colwidth_optimize = 'X'.
it_layout-cell_merge = space.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_sort = it_sortinfo
is_layout = it_layout
i_structure_name = 'SPFLI'
i_save = 'X'
TABLES
t_outtab = it_spfli.Its a little miss leading, isn't it. Anyway, I was seeing the same, so I looked into the underlying code, and it is expecting that you pass an "N" in order to suppress the merging, so set it to "N" and it will work.
it_layout-cell_merge = 'N'.
Regards,
RIch Heilman -
ALV Not Fix a Column for specific SAP GUI
Hello Team.
we have a little problem when We try Fix a Column.
We create an ALV report, for user with the SAP GUI 7.20
ls_dispo-FIX_COLUMN = 'X'.
Some user has the Patch Level 4 and the fix column work Fine.
Other has the Patch Level 7, and when the user move the scroll bar, the fixed column not work.
I think Some Difference in parameter configuration in SAP GUI is the problem,
Can you help me.
Best RegardsHi David
I am not sure this might be a solution if you have mentioned all the parameters programatically but you can try if this works
You can compare the Options between the users GUI
Goto ->Customize Local Layout ( Alt + F12 ) on your Logon Screen-> Options
and check if there is any change between these two Patch Levels.
Thanks
Dev -
ALV Grid display cell color based on value ( Function Module ALV )
Hi,
I want to color the cell based on value eg ( Green = Green color, Red = Red color, Amber = Yello color ).
Each and every cell is editable after displaying on screen. once the user clicks update button the contents has to be saved to a custom table.
Can anyone help?
Advance thanksHi,
<li>To get color for the cell, you need to set EMPHASIZE field with below information while building fieldcatalog.
emphasize (highlight columns in color)
value set: SPACE, 'X' or 'Cxyz' (x:'1'-'9'; y,z: '0'=off '1'=on)
'X' = column is colored with the default column highlight color.
'Cxyz' = column is colored with a coded color:
C: Color (coding must begin with C)
x: color number
y: bold
z: inverse
<li> To edit the fields, you need to set EDIT = 'X' or INPUT= 'X' . Try those .
wa_fieldcata-input = 'X'.
<li>you need to set PF status , to do your remaining requirement.
<li>For any help, you have to search the forum .
Thanks
Venkat.O
Maybe you are looking for
-
QHD+ Resolution Scaling Issues Windows 8
I've read that QHD+ resolution monitors like the Dell Precision m3800 with a 3200x1800 resolution screen are having scaling issues with Windows 8, and even 8.1. Some programs scale correctly, but I have specifically heard Adobe programs including Ado
-
I have to send an IDOC to an External R/3(Need to cross the fire wall) system to the IDOC PORT. NO MAPPING IS required. How should I create the Receiver IDOC Adapter? How do I define the RFC Destination? How should I Define the PORT Definition? Shoul
-
Hi everyone, I want to know the operation of FI module,Is there any document I can learn. thanks in advance! best regards, david.
-
Vector mask icon not appearing properly
http://tinypic.com/r/1zlyj6h/5 If you go there you'll see what I mean. I am following all of these tutorials and I come to this one portion where it says to create a vector mask using the shape tool and as far as I can see, all my settings are the s
-
Can I change gridline properties (in the regular tabular display)?
I would like to change the thickness of some of the gridlines in the regular tabular display in Discoverer (not in the graphing component). I have exausted regular sources of info (the manuals, online help, metalink, technet, etc.) and hence my appea