Reg alv grid display exporting to excel sheet
hi experts,
I have done an ALV report using reuse_alv_grid _display , out put is fine , but when i click on excel view icon i could only see an excel sheet without any data ., but when i use export to local file and choose spread sheet its giving the data in excel, but the user wants to click only the excel view icon., please help me out.
Note : i have already tried changing the macro security in excel to Low .
see it will give you the Status message as ...
<b>View cannot be switched: Product is not installed or integration is not active.</b>
it means the Excel Integration was not done in you sap system . ask basis there will be a Patch for it ... once it was applied automatically in all the ALV the excel view will work
in my system it was working
Girish
Similar Messages
-
Problem while alv grid display exporting to excel sheet
Hi,
I have done an ALV report using reuse_alv_grid _display , out put is fine , but when i click on excel view icon i could only see an excel sheet without any data ., but when i use export to local file and choose spread sheet its giving the data in excel, but the user wants to click only the excel view icon.
Best RegardsHi,
Check this link
[Problem with Excel button in ALV Grid...URGENT;
Regards,
Sathish Reddy. -
Error While ALV Grid is exported to Excel.
Hi Experts,
I get an error OBJECTS_NOT_CHARLIKE , while I try to download an ALV Grid , to an excel file using the standard icon Export present on the ALV Grid.
Regards.
Edited by: sunitha j on May 19, 2009 1:15 PMThis happens when your output list contains qty. or amount fields.
To fix the error use sap table name instead of your internal table name while preparing field catalog.
In case you are forced to use int. table name while preparing field catalog , add "quantity" field for qty figures and "currency" field for amount figures.
Example :
it_catalog-fieldname = 'MENGE'.
it_catalog-quantity = 'NOS'.
it_catalog-tabname = 'i_bseg'.
it_catalog-seltext_s = 'Quantity'.
APPEND it_catalog TO it_fieldcat.
it_catalog-fieldname = 'DMBTR'.
it_catalog-tabname = 'i_bseg'.
it_catalog-seltext_s = 'Amount'.
it_catalog-currency = 'INR'.
APPEND it_catalog TO it_fieldcat. -
Hi Expert,
I am facing simple problem regarding alv display.
While retrieving data, records are shown in internal table (It_final), but it doesn't goes to alv display in output.
The code is:
FORM merge_data .
SORT it_qasr BY probenr prueflos vorglfnr.
LOOP AT it_qasr INTO wa_qasr.
w_mittelwert = wa_qasr-mittelwert.
READ TABLE it_qapp INTO wa_qapp WITH KEY prueflos = wa_qasr-prueflos
vorglfnr = wa_qasr-vorglfnr
probenr = wa_qasr-probenr.
wa_final-userd1 = wa_qapp-userd1.
wa_final-usert1 = wa_qapp-usert1.
wa_final-userc1 = wa_qapp-userc1.
SHIFT wa_final-userc1 LEFT DELETING LEADING '0'.
wa_final-userc2 = wa_qapp-userc2.
READ TABLE it_plmk INTO wa_plmk WITH KEY merknr = wa_qasr-merknr
plnnr = wa_mapl-plnnr.
plnkn = wa_qasr-vorglfnr " changed by DEVK909452
READ TABLE it_qpmt INTO wa_qpmt WITH KEY mkmnr = wa_plmk-verwmerkm.
READ TABLE it_qpct INTO wa_qpct WITH KEY codegruppe = wa_qasr-gruppe1
code = wa_qasr-code1.
TRANSLATE wa_qpmt-mkmnr TO UPPER CASE.
IF wa_qpmt-mkmnr CS 'RQZMOI'.
wa_qpmt-mkmnr = 'MOIS_Q'.
ENDIF.
IF wa_qpmt-mkmnr CS 'RIOSI+AL'.
wa_qpmt-mkmnr = 'SIAL_IR'.
ENDIF.
CASE wa_qpmt-mkmnr.
WHEN 'MOIS_Q'.
wa_final-MOIS_Q = w_mittelwert.
WHEN 'SIAL_IR'.
wa_final-SiAl_IR = w_mittelwert.
WHEN 'SHIFT'.
wa_final-shift = wa_qpct-kurztext.
WHEN 'MATERIAL'.
wa_final-material = wa_qpct-kurztext.
ENDCASE.
APPEND wa_final TO it_final.
CLEAR wa_final.
FORM alv_display .
*fieldcatalog template with 105 fields
PERFORM sub_make_field_cat1 USING :
'1' 'USERD1' 'DATE',
'2' 'MATERIAL' 'MATERIAL',
'3' 'USERC2' 'SOURCE',
'4' 'USERC1' 'LOCATION',
'5' 'USERT1' 'TIME',
'6' 'SHIFT' 'SHIFT',
'7' 'MATERIAL' 'MATERIAL',
'8' 'SHIFT' 'SHIFT',
'9' 'MOIS_Q' 'MOISTURE-Q',
'10' 'SI_Q' 'SILICA-Q',
'11' 'AL_Q' 'ALUMINA-Q',
'12' 'FO_Q' 'FERRIC OXIDE-Q',
'13' 'SIZE_Q' 'SIZE-Q',
'14' 'MOIS_IR' 'MOISTURE-IR',
'15' 'TIRON_IR' 'TOTAL IRON-IR',
'16' 'SI_IR' 'SILICA-IR',
'17' 'AL_IR' 'ALUMINA-IR',
'18' 'SIAL_IR' 'SILICA + ALUMINA-IR',
'19' 'P_IR' 'PHOSPHOROUS-IR',
'20' 'L_O_I_IR' 'LOSS ON IGNITION-IR',
'21' 'MN_IR' 'MANGANESS-IR',
'22' 'TITOX_IR' 'TITANIUM OXIDE-IR',
'23' 'ALK_IR' 'ALKALIES-IR',
'24' 'SUL_IR' 'SULPHUR-IR',
'25' 'TIND_IR' 'TUMBLER INDEX-IR',
'26' 'ABBIND_IR' 'ABBRATION INDEX-IR',
'27' 'BDEN_IR' 'BULK DENSITY-IR',
'28' 'SIZE_IR' 'SIZE-IR',
'29' 'MOIS_IRF' 'MOISTURE-IRF',
'30' 'TIRON_IRF' 'TOTAL IRON-IRF',
'31' 'SI_IRF' 'SILICA-IRF',
'32' 'AL_IRF' 'ALUMINA-IRF',
'33' 'P_IRF' 'PHOSPHOROUS-IRF',
'34' 'L_O_I_IRF' 'LOSS ON IGNITION-IRF',
'35' 'MOIS_COKE' 'MOISTURE-COKE',
'36' 'VOL_MAT_COKE' 'VOLATILE MATTER-COKE',
'37' 'ASH_COKE' 'ASH-COKE',
'38' 'FIX_CA_COKE' 'FIXED CARBON-COKE',
'39' 'SUL_COKE' 'SULPHUR-COKE',
'40' 'P_COKE' 'PHOSPHOROUS-COKE',
'41' 'ALK_COKE' 'ALKALIES-COKE',
'42' 'SI_COKE' 'SILICA-COKE',
'43' 'AL_COKE' 'ALUMINA-COKE',
'44' 'FEO_COKE' 'FERRIC OXIDE-COKE',
'45' 'CAO_COKE' 'CALCIUM OXIDE-COKE',
'46' 'MGO_COKE' 'MAGNESIUM OXIDE-COKE',
'47' 'PPOX_COKE' 'PHOSPHOROUS PENTAOXIDE-COKE',
'48' 'SIZE_COKE' 'SIZE-COKE',
'49' 'MOIS_LS' 'MOISTURE-LS',
'50' 'SI_LS' 'SILICA-LS',
'51' 'AL_LS' 'ALUMINA-LS',
'52' 'FEO_LS' 'FERRIC OXIDE-LS',
'53' 'CAO_LS' 'CALCIUM OXIDE-LS',
'54' 'MGO_LS' 'MAGNESIUM OXIDE-LS',
'55' 'ALK_LS' 'ALKALIES-LS',
'56' 'SIZE_LS' 'SIZE-LS',
'57' 'MOIS_LSF' 'MOISTURE-LSF',
'58' 'SI_LSF' 'SILICA-LSF',
'59' 'AL_LSF' 'ALUMINA-LSF',
'60' 'FEO_LSF' 'FERRIC OXIDE-LSF',
'61' 'CAO_LSF' 'CALCIUM OXIDE-LSF',
'62' 'MGO_LSF' 'MAGNESIUM OXIDE-LSF',
'63' 'SIZE_LSF' 'SIZE-LSF',
'64' 'MOIS_D' 'MOISTURE-D',
'65' 'SI_D' 'SILICA-D',
'66' 'AL_D' 'ALUMINA-D',
'67' 'FEO_D' 'FERRIC OXIDE-D',
'68' 'CAO_D' 'CALCIUM OXIDE-D',
'69' 'MGO_D' 'MAGNESIUM OXIDE-D',
'70' 'ALK_D' 'ALKALIES-D',
'71' 'SIZE_D' 'SIZE-D',
'72' 'MOIS_DF' 'MOISTURE-DF',
'73' 'SI_DF' 'SILICA-DF',
'74' 'AL_DF' 'ALUMINA-DF',
'75' 'FEO_DF' 'FERRIC OXIDE-DF',
'76' 'CAO_DF' 'CALCIUM OXIDE-DF',
'77' 'MGO_DF' 'MAGNESIUM OXIDE-DF',
'78' 'SIZE_DF' 'SIZE-DF',
'79' 'MOIS_MO' 'MOISTURE-MO',
'80' 'SI_MO' 'SILICA-MO',
'81' 'AL_MO' 'ALUMINA-MO',
'82' 'TIRON_MO' 'TOTAL IRON-MO',
'83' 'MN_MO' 'MANGENESE-MO',
'84' 'P_MO' 'PHOSPHAROUS-MO',
'85' 'ALK_MO' 'ALKALIES-MO',
'86' 'SIZE_MO' 'SIZE-MO',
'87' 'MOIS_STR' 'MOISTURE-STR',
'88' 'SI_STR' 'SILICA-STR',
'89' 'AL_STR' 'ALUMINA-STR',
'90' 'TIRON_STR' 'TOTAL IRON-STR',
'91' 'FO_STR' 'FERROUS OXOIDE-STR',
'92' 'P_STR' 'PHOSPHAROUS-STR',
'93' 'CAO_STR' 'CALCIUM OXIDE-STR',
'94' 'MGO_STR' 'MAGNESIUM OXIDE-STR',
'95' 'TIND_STR' 'TUMBLER INDEX-STR',
'96' 'ABBIND_STR' 'ABBRATION INDEX-STR',
'97' 'CAOSIO2_STR' 'CAO / SIO2-STR',
'98' 'SI_SLG' 'SILICA-SLG',
'99' 'AL_SLG' 'ALUMINA-SLG',
'100' 'FEO_SLG' 'FERRIC OXIDE-SLG',
'101' 'CAO_SLG' 'CALCIUM OXIDE-SLG',
'102' 'MGO_SLG' 'MAGNESIUM OXIDE-SLG',
'103' 'MNO_SLG' 'MANGANESE OXIDE-SLG',
'104' 'FO_SLG' 'FERROUS OXIDE-SLG',
'105' 'BAS_SLG' 'BASICITY-SLG'.
is_layout-zebra = 'X'.
is_layout-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
is_layout = is_layout
it_fieldcat = it_fieldcat
i_save = 'X'
is_variant = gs_variant
TABLES
t_outtab = it_final
EXCEPTIONS
program_error = 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. " ALV_DISPLAY
form SUB_MAKE_FIELD_CAT1 using p_col TYPE char3
p_fnam TYPE char30
p_text TYPE char30.
is_fieldcat-col_pos = p_col.
is_fieldcat-fieldname = p_fnam.
is_fieldcat-seltext_m = p_text.
APPEND is_fieldcat TO it_fieldcat.
endform. " SUB_MAKE_FIELD_CAT1
This is the code i have.
In debugging, i found data in internal table (it_final). But, it doesn't display in output.
Please help me in this regard?
Thanks in advance....
Sai..
Edited by: Sai Babu on Sep 16, 2008 3:07 PMSai Babu wrote:
> Any experts.........
no,No,NO....
There is no expert(active since last 3months or so) beyond him
Specially in ALV moreover in OOPS ALV
Edited by: Ámit Güjärgoüd on Sep 16, 2008 3:19 PM -
To get own Filed Desc. like ALV Grid while exporting to ALV using standard
Hi all,
How to get the custom field heading when we export to XLS using the standard Functionality/button available in ALV grid to export to spread sheet.
I mean is there anything in ALV field catalog /something by which we can have our custom heading , the way we do in ALV grid output using the button available to do export .
Note: I am not talking about any FM , its the standrad button available in ALV grid by which we can do export to spread sheet , currently its taking the small text of the data element field level.
RegardsHi,
Modify your fieldcatelog before calling the grid display FM. Remove data element reference (ref_fieldname) and change ddictxt, seltext_s, seltext_m and seltext_l fields to the text you want.
Dataelement texts can be found in table DD04T.
Thanks,
Vinod. -
Leading Zeros Missing - When exporting data from ALV grid display to Excel
Hi,
Am exporting the data from ALV GRID DISPLAY to Excel sheet using standard toolbar icon 'Local file'
the leading zeros displayed in the ALV output is missing in the EXCEL sheet.
(eg) in ALV o/p - 0029.
in Excel - Only 29 is appearing.
As per the requiement i have to show the leading zeros in excel also.
Pls help on this issue.
Thanks in advance..Hi ,
Please set the property :
wa_fieldcat-lzero = 'X' .
when you are creating field catalog for display alv data .
your prob will solved .
Regards ,
Nilesh Jain -
Not able to download all the rows to excel sheet from alv grid display
Hi experts,
I am not able to download all the rows which are displayed in alv grid display for some material numbers.
for some materials i am able to download, i used two ways to download 1) from icon(local file) on grid 2) menu list->export.
i checked in debugging till selecting the spread sheet pop up window, i am able to see all the data in internal table.
Can you suggest me what will be the problem....
thanks in advance,hi sandeep,
sorry for didnt specify clearly.
note: EX: "asaasdada in this sentence i said " this symbol is special character not the text.
building final internal table code
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
capid = p_capid
datuv = sy-datum
ehndl = '1'
mktls = 'X'
mehrs = 'X'
mmory = '1'
mtnrv = p_matnr
stlal = '1'
stpst = 0
svwvo = 'X'
werks = p_werks
vrsvo = 'X'
TABLES
stb = i_stb
EXCEPTIONS
alt_not_found = 1
call_invalid = 2
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
no_plant_data = 6
no_suitable_bom_found = 7
conversion_error = 8
OTHERS = 9.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
i_stb1[] = i_stb[].
IF NOT i_stb1[] IS INITIAL.
SORT i_stb1 BY idnrk.
DELETE ADJACENT DUPLICATES FROM i_stb1 COMPARING idnrk.
SELECT bmatn ematn FROM ampl INTO TABLE i_ampl
FOR ALL ENTRIES IN i_stb1
WHERE bmatn = i_stb1-idnrk AND
datuv LE sy-datum AND
datub GE sy-datum.
SELECT
matnr
bwkey
verpr
stprs
bwprh
FROM mbew
INTO TABLE i_mbew
FOR ALL ENTRIES IN i_stb1
WHERE
matnr EQ i_stb1-idnrk AND
bwkey EQ i_stb1-werks.
IF NOT i_stb1[] IS INITIAL.
SELECT matnr werks beskz
dzeit webaz plifz
ekgrp
INTO TABLE i_marc
FROM marc
FOR ALL ENTRIES IN i_stb1
WHERE matnr = i_stb1-idnrk
AND werks = i_stb1-werks.
SORT i_marc BY matnr werks.
ENDIF.
CLEAR i_ekpo.
CLEAR i_vend.
IF NOT i_stb1[] IS INITIAL.
SELECT ebeln ebelp matnr werks loekz aedat
netpr peinh
INTO TABLE i_ekpo
FROM ekpo
FOR ALL ENTRIES IN i_stb1
WHERE matnr = i_stb1-idnrk
AND werks = i_stb1-werks.
SORT i_ekpo BY matnr ASCENDING
aedat DESCENDING
ebeln DESCENDING
ebelp DESCENDING.
IF NOT i_ekpo IS INITIAL.
SELECT k~ebeln k~lifnr l~name1
INTO TABLE i_vend
FROM ekko AS k INNER JOIN lfa1 AS l
ON k~lifnr EQ l~lifnr
FOR ALL ENTRIES IN i_ekpo
WHERE ebeln = i_ekpo-ebeln.
SORT i_vend BY ebeln.
ENDIF.
ENDIF.
ENDIF.
i_ampl1[] = i_ampl[].
IF NOT i_ampl1[] IS INITIAL.
SORT i_ampl1 BY ematn.
DELETE ADJACENT DUPLICATES FROM i_ampl1 COMPARING ematn.
SELECT matnr mfrpn mfrnr FROM mara INTO TABLE i_mara
FOR ALL ENTRIES IN i_ampl1
WHERE matnr = i_ampl1-ematn.
ENDIF.
SORT i_ampl BY bmatn.
IF NOT i_stb[] IS INITIAL.
SELECT stlty stlnr stlkn stpoz idnrk potx1 potx2
INTO TABLE i_stpo
FROM stpo
FOR ALL ENTRIES IN i_stb
WHERE stlty = i_stb-stlty
AND stlnr = i_stb-stlnr
AND stlkn = i_stb-stlkn
AND stpoz = i_stb-stpoz
AND idnrk = i_stb-idnrk.
SORT i_stpo BY stlty stlnr stlkn stpoz idnrk.
ENDIF.
LOOP AT i_stb INTO wa_stb.
READ TABLE i_marc INTO wa_marc
WITH KEY matnr = wa_stb-idnrk
werks = wa_stb-werks
BINARY SEARCH.
IF sy-subrc = 0.
wa_outtab-beskz = wa_marc-beskz.
wa_outtab-dzeit = wa_marc-dzeit.
wa_outtab-webaz = wa_marc-webaz.
wa_outtab-plifz = wa_marc-plifz.
wa_outtab-ekgrp = wa_marc-ekgrp.
ENDIF.
READ TABLE i_ekpo INTO wa_ekpo
WITH KEY matnr = wa_stb-idnrk.
IF sy-subrc = 0.
wa_outtab-netpr = wa_ekpo-netpr.
wa_outtab-peinh = wa_ekpo-peinh.
READ TABLE i_vend INTO wa_vend
WITH KEY ebeln = wa_ekpo-ebeln
BINARY SEARCH.
IF sy-subrc = 0.
wa_outtab-lifnr = wa_vend-lifnr.
wa_outtab-name_sup = wa_vend-name1.
ENDIF.
ENDIF.
READ TABLE i_stpo INTO wa_stpo
WITH KEY stlty = wa_stb-stlty
stlnr = wa_stb-stlnr
stlkn = wa_stb-stlkn
stpoz = wa_stb-stpoz
idnrk = wa_stb-idnrk
BINARY SEARCH.
IF sy-subrc = 0.
wa_outtab-potx1 = wa_stpo-potx1.
wa_outtab-potx2 = wa_stpo-potx2.
ENDIF.
READ TABLE i_mbew INTO wa_mbew
WITH KEY
matnr = wa_stb-idnrk
bwkey = wa_stb-werks.
IF sy-subrc IS INITIAL.
MOVE:
wa_mbew-verpr TO wa_outtab-verpr,
wa_mbew-stprs TO wa_outtab-stprs,
wa_mbew-bwprh TO wa_outtab-bwprh.
ENDIF.
wa_outtab-matnr = p_matnr.
wa_outtab-posnr = wa_stb-posnr.
wa_outtab-stufe = wa_stb-stufe.
wa_outtab-idnrk = wa_stb-idnrk.
wa_outtab-ojtxb = wa_stb-ojtxp.
wa_outtab-menge = wa_stb-menge.
wa_outtab-meins = wa_stb-meins.
MOVE: wa_stb-zzitem_draw_no TO wa_outtab-zzitem_draw_no.
IF wa_stb-upskz = 'X'.
SELECT * FROM stpu INTO TABLE i_stpu
WHERE stlty = wa_stb-stlty AND
stlnr = wa_stb-stlnr AND
stlkn = wa_stb-stlkn AND
stpoz = wa_stb-stpoz.
ENDIF.
LOOP AT i_stpu INTO wa_stpu.
wa_outtab-upmng = wa_stpu-upmng.
wa_outtab-ebort = wa_stpu-ebort.
wa_outtab-uposz = wa_stpu-uposz.
CONCATENATE v_ebort wa_stpu-ebort INTO v_ebort
SEPARATED BY space.
ENDLOOP.
MOVE strlen( v_ebort ) TO v_len.
MOVE: 0 TO x,
128 TO y.
DATA : lt_tab TYPE TABLE OF swastrtab.
DATA : ls_tab LIKE LINE OF lt_tab.
DATA : lv_ebort TYPE string.
CLEAR lv_ebort. CLEAR lt_tab.
MOVE v_ebort TO lv_ebort.
CALL FUNCTION 'SWA_STRING_SPLIT'
EXPORTING
input_string = lv_ebort
max_component_length = 128
TABLES
string_components = lt_tab
EXCEPTIONS
max_component_length_invalid = 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.
IF lt_tab[] IS NOT INITIAL.
LOOP AT lt_tab INTO ls_tab.
CLEAR lv_ebort.
MOVE: ls_tab-str TO lv_ebort.
CONDENSE lv_ebort.
MOVE lv_ebort TO wa_outtab-ebort.
APPEND wa_outtab TO i_outtab.
CLEAR:
wa_outtab-matnr,
wa_outtab-posnr,
wa_outtab-zzitem_draw_no,
wa_outtab-ojtxb,
wa_outtab-menge,
wa_outtab-meins,
wa_outtab-uposz,
wa_outtab-upmng,
wa_outtab-verpr,
wa_outtab-stprs,
wa_outtab-bwprh,
wa_outtab-lifnr,
wa_outtab-name_sup,
wa_outtab-potx1,
wa_outtab-potx2,
wa_outtab-netpr,
wa_outtab-peinh.
* wa_outtab-idnrk.
ENDLOOP.
ELSE.
APPEND wa_outtab TO i_outtab.
ENDIF.
CLEAR v_ebort.
CLEAR: wa_stpu.
REFRESH: i_stpu.
LOOP AT i_ampl INTO wa_ampl WHERE bmatn = wa_stb-idnrk.
READ TABLE i_mara INTO wa_mara WITH TABLE KEY matnr = wa_ampl-ematn.
IF sy-subrc = 0.
LOOP AT i_outtab INTO wa_outtab
WHERE
idnrk = wa_stb-idnrk AND
flag NE 'X'.
wa_outtab-mfrpn = wa_mara-mfrpn.
wa_outtab-mfrnr = wa_mara-mfrnr.
SELECT SINGLE name1 FROM lfa1 INTO wa_outtab-name1 WHERE lifnr = wa_mara-mfrnr.
MOVE 'X' TO wa_outtab-flag.
MODIFY i_outtab FROM wa_outtab
TRANSPORTING mfrpn mfrnr name1 flag.
EXIT.
ENDLOOP.
IF sy-subrc <> 0.
CLEAR:
wa_outtab-matnr,
wa_outtab-posnr,
wa_outtab-zzitem_draw_no,
wa_outtab-ojtxb,
wa_outtab-ebort,
* wa_outtab-idnrk,
wa_outtab-menge,
wa_outtab-meins,
wa_outtab-uposz,
wa_outtab-upmng,
wa_outtab-verpr,
wa_outtab-stprs,
wa_outtab-bwprh,
wa_outtab-lifnr,
wa_outtab-name_sup,
wa_outtab-potx1,
wa_outtab-potx2,
wa_outtab-netpr,
wa_outtab-peinh.
wa_outtab-mfrpn = wa_mara-mfrpn.
wa_outtab-mfrnr = wa_mara-mfrnr.
SELECT SINGLE name1 FROM lfa1 INTO wa_outtab-name1 WHERE lifnr = wa_mara-mfrnr.
APPEND wa_outtab TO i_outtab.
ENDIF.
ENDIF.
REFRESH i_stpu.
CLEAR i_stpu.
ENDLOOP. CLEAR: wa_matnr1, wa_mfrnr, wa_outtab.
ENDLOOP.
Edited by: srinivasareddy j on Mar 9, 2011 7:16 AM
Edited by: srinivasareddy j on Mar 9, 2011 7:20 AM -
Short dump when exporting the ALV grid report in to spread sheet
HI,
I am facing a problem when downloading ALV grid report in to spread sheet LIST>EXPORT>LOCAL FILE -->SPREADSHEET.
in shotdump the cursor shows : "assign cline+cbegin(clength) to <field_cont>."
In SAP internal table LIST,in the first record the value of the filed LENG is 0. when i have changed this value ex:10 etc it is coming properly.
Kindly help me
NagendraIs this a standard SAP report, or your own? Can you tell what your report does, if it is a custom ALV report?
-
hi all,
i have an issue in which i fetch data from mkpf and mseg tables into my final internal table everytin is fine and i want to display the data in alv and download it to excel sheet so the problem is while im running the prog im gettin an error in reuse_alv_list_display the code is as follows:
it_final_tab is my final internal table
wt_fieldcat is for building field catalog
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = wlv_repid
IS_LAYOUT = wls_layout
IT_FIELDCAT = wt_fieldcat[]
I_DEFAULT = 'X'
I_SAVE = 'X'
IT_EVENTS = wlt_events[]
TABLES
T_OUTTAB = it_final_tab[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
the error is "field string is not yet set". its eatin my brain so can any one plz help me out. Point are rewarded for correct solution
thanks in advance
anupama.Hi Anupama,
Fieldcatalog information through your internal table wt_fieldcat[]
is not being passed properly. That is causing the problem.
Can I have ur fullcode so that we can check it out. Otherwise refer sample code on ALV grid.
REPORT zvenkat_alv_grid.
TABLES:t001.
"Types
TYPES:
BEGIN OF t_1001,
bukrs TYPE t001-bukrs,
butxt TYPE t001-butxt,
ort01 TYPE t001-ort01,
land1 TYPE t001-land1,
END OF t_1001.
"Work area
DATA:
w_t001 TYPE t_1001.
"Internal table
DATA:
i_t001 TYPE STANDARD TABLE OF t_1001.
" ALV Declarations
* Types Pools
TYPE-POOLS:
slis.
* Types
TYPES:
t_fieldcat TYPE slis_fieldcat_alv,
t_events TYPE slis_alv_event,
t_layout TYPE slis_layout_alv.
* Workareas
DATA:
w_fieldcat TYPE t_fieldcat,
w_events TYPE t_events,
w_layout TYPE t_layout.
* Internal Tables
DATA:
i_fieldcat TYPE STANDARD TABLE OF t_fieldcat,
i_events TYPE STANDARD TABLE OF t_events.
*& start of selection
START-OF-SELECTION.
PERFORM get_data.
*& end-of-selection.
END-OF-SELECTION.
PERFORM build_fieldcatlog.
PERFORM build_events.
PERFORM build_layout.
PERFORM list_display.
*& Form get_data
FORM get_data .
SELECT bukrs
butxt
ort01
land1
FROM t001
INTO TABLE i_t001
UP TO 30 ROWS.
ENDFORM. " get_data
*& Form build_fieldcatlog
FORM build_fieldcatlog .
CLEAR:w_fieldcat,i_fieldcat[].
PERFORM build_fcatalog USING:
'BUKRS' 'I_T001' 'BUKRS',
'BUTXT' 'I_T001' 'BUTXT',
'ORT01' 'I_T001' 'ORT01',
'LAND1' 'I_T001' 'LAND1'.
ENDFORM. "BUILD_FIELDCATLOG
*& Form BUILD_FCATALOG
FORM build_fcatalog USING l_field l_tab l_text.
w_fieldcat-fieldname = l_field.
w_fieldcat-tabname = l_tab.
w_fieldcat-seltext_m = l_text.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
ENDFORM. " build_fieldcatlog
*& Form build_events
* text
FORM build_events.
CLEAR :
w_events, i_events[].
w_events-name = 'TOP_OF_PAGE'."Event Name
w_events-form = 'TOP_OF_PAGE'."Callback event subroutine
APPEND w_events TO i_events.
CLEAR w_events.
ENDFORM. "build_events
*& Form build_layout
FORM build_layout .
w_layout-colwidth_optimize = 'X'.
w_layout-zebra = 'X'.
ENDFORM. " build_layout
*& Form list_display
FORM list_display .
DATA:
l_program TYPE sy-repid.
l_program = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_program
is_layout = w_layout
it_fieldcat = i_fieldcat
it_events = i_events
TABLES
t_outtab = i_t001
EXCEPTIONS
program_error = 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. " list_display
*& Form top_of_page
FORM top_of_page.
DATA :
li_header TYPE slis_t_listheader,
w_header LIKE LINE OF li_header.
DATA:
l_date TYPE char10.
WRITE sy-datum TO l_date.
w_header-typ = 'H'.
CONCATENATE sy-repid ':' 'From Date' l_date INTO w_header-info SEPARATED BY space.
APPEND w_header TO li_header.
CLEAR w_header.
w_header-typ = 'S'.
w_header-info = sy-title.
APPEND w_header TO li_header.
CLEAR w_header.
w_header-typ = 'A'.
w_header-info = sy-uname.
APPEND w_header TO li_header.
CLEAR w_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = li_header.
ENDFORM. "top_of_page
I hope that it helps you.
Regards,
Venkat.O -
Remove buttons in ALV grid display in ABAP Web Dynpro
Hi,
Sub: ALV grid-->Web Dynpro ABAP.
Request guidance to prevent display of the buttons "Microsoft Excel" and "Print Version" (which provide options to export the ALV grid output into an Excel format document).
Is there a way we could hide this from being displayed on the ALV grid in a Web dynpro ABAP component output?
Thanks very much.
Best Regards,
AdiHi Adithya,
really simple solution is to call cl_salv_wd_model_table_util=>if_salv_wd_table_util_stdfuncs=>set_all( abap_false ). This deactivates all ALV functionality.
For individual setting cl_salv_wd_config_table if_salv_wd_standard_functions~set_<x>_allowed.
- Michelle -
Field Catolgue in alv grid display
Hi Abapers,
I need to display the percentage rows with decimals and other rows without decimal . Is their any option in field catalog to do like this. Or tell me any other alternative to achieve this.
sno total col1 col2 col3
1 220 100 20 100
2 320 120 50 150
tot 540 220 70 250
per 40.74 1.87 and so on
or ,
I have two different internal tables how can i put it in one field catalog to pass it to alv grid display.
Regards,
PriyaDon't do total by your self in the Pogram.
in the Fieldcatalog there is an Attribute which will do total & Average .
Enable it so that from one internal table data it self it will do good.
example program
Below is an example ABAP program which will populate a simple internal table(it_ekpo) with data and
display it using the basic ALV grid functionality(including column total). The example details the main
sections of coding required to implement the ALV grid functionality:
Data declaration
Data retrieval
Build fieldcatalog
Build layout setup
REPORT zdemo_alvgrid .
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
* Build Fieldcatalog for ALV Report
form build_fieldcatalog.
* There are a number of ways to create a fieldcat.
* For the purpose of this example i will build the fieldcatalog manualy
* by populating the internal table fields individually and then
* appending the rows. This method can be the most time consuming but can
* also allow you more control of the final product.
* Beware though, you need to ensure that all fields required are
* populated. When using some of functionality available via ALV, such as
* total. You may need to provide more information than if you were
* simply displaying the result
* I.e. Field type may be required in-order for
* the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
* fieldcatalog-do_sum = 'X'.
* fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'. "Display column total
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
* Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
* gd_layout-totals_only = 'X'.
* gd_layout-f2code = 'DISP'. "Sets fcode for when double
* "click(press f2)
* gd_layout-zebra = 'X'.
* gd_layout-group_change_edit = 'X'.
* gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
* Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
* i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
* i_callback_user_command = 'USER_COMMAND'
* i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
* it_special_groups = gd_tabgroup
* IT_EVENTS = GT_XEVENTS
i_save = 'X'
* is_variant = z_template
tables
t_outtab = it_ekko
exceptions
program_error = 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. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
* Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into table it_ekko.
endform. " DATA_RETRIEVAL
gowri
Message was edited by:
Gowri Krishna -
EDIT THE FIELV VALUE IN ALV GRID DISPLAY
Hi Guru ,
How can I edit the value of a particular one or two fields in ALV GRID DISPLAY .
Please reply mehi,
1.Set status of all cells to editable using the layout structure.
2.Use SET_READY_FOR_INPUT to activate the edit feature initially.
(state "editable activated").
3.Use IS_READY_FOR_INPUT to fetch current substate of editable cells.
4.Use SET_READY_FOR_INPUT to switch between the substates.
CALL METHOD g_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_layout = gs_layout
CHANGING it_outtab = gt_outtab.
*§2.Use SET_READY_FOR_INPUT to allow editing initially.
* (state "editable and ready for input").
CALL METHOD g_grid->set_ready_for_input
EXPORTING i_ready_for_input = 1.
*Use IS_READY_FOR_INPUT to fetch current substate of editable cells.
IF g_grid->is_ready_for_input( ) EQ 0.
*Use SET_READY_FOR_INPUT to switch between the substates.
CALL METHOD g_grid->set_ready_for_input
EXPORTING i_ready_for_input = 1.
ELSE.
CALL METHOD g_grid->set_ready_for_input
EXPORTING i_ready_for_input = 0.
ENDIF. -
Update values in AlV grid display after entering value
Hi,
I have an issue in ALV grid display.
Let me explain.
i have 8 fields to display in which one is editiable.
Fields are: date
material,
material Description,
Opening Stock,
Closing stock- ( this field is editiable)
Closing stock,
Received Stock,
Actual production.
Actual production = Closing stock + removal stock
- receipt stock - opening stock.
when i change the value of closing stock and press enter, actual production should get update, the new values should display.
Thany you in advance.Hi,
Please refer the code below:
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
Thanks,
Sriram Ponna. -
How to capture the checkbox status in ALV Grid display
I need some immediate help regarding Grid ALV.
My Requirement: I need to display an ALV grid report along with checkboxes. Further, I need to provide an option wherein the user can checkboxes and select the records that I need to process further (by clicking the process button on the ALV Report).
My Query: The problem here is that I am not able to capture the status of the checkboxes. This means that I am not able to capture which of the records have been selected by checking their resp checkboxes.
Solutions that I have tried: I have tried capturing the same at user command by checking the value in slis_selfield. But all the records show the value as 1 for the checkbox field.
Kinldy suggest how to go about it.
I am not using Object Oriented ALV. Please suggest something to be used in ALV Grid display in 4.6C version.
Regards,
NamrataHere is a Sample code , it might help you
TABLES : sflight.
TYPE-POOLS: slis.
DATA : w_repid LIKE sy-repid.
w_repid = sy-repid.
DATA: BEGIN OF it_sflight OCCURS 0,
checkbox(1),
carrid LIKE sflight-carrid,
END OF it_sflight.
*layout
DATA: wa_layout TYPE slis_layout_alv.
*field catalog
DATA: it_fieldcatalog TYPE slis_t_fieldcat_alv,
wa_fieldcatalog TYPE slis_fieldcat_alv.
START-OF-SELECTION.
SELECT carrid FROM sflight
INTO CORRESPONDING FIELDS OF TABLE it_sflight.
END-OF-SELECTION.
CLEAR it_fieldcatalog.
REFRESH it_fieldcatalog.
wa_fieldcatalog-fieldname = 'CHECKBOX'.
wa_fieldcatalog-outputlen = '3'.
wa_fieldcatalog-col_pos = '1'.
wa_fieldcatalog-seltext_m = 'Chk'.
wa_fieldcatalog-checkbox = 'X'.
wa_fieldcatalog-edit = 'X'.
APPEND wa_fieldcatalog TO it_fieldcatalog.
CLEAR wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'CARRID'.
wa_fieldcatalog-outputlen = '10'.
wa_fieldcatalog-col_pos = '2'.
wa_fieldcatalog-seltext_m = 'Carrid'.
APPEND wa_fieldcatalog TO it_fieldcatalog.
CLEAR wa_fieldcatalog.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
is_layout = wa_layout
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fieldcatalog
TABLES
t_outtab = it_sflight
EXCEPTIONS
program_error = 1
OTHERS = 2.
*& Form USER_COMMAND
FORM user_command USING p_ucomm TYPE sy-ucomm
p_selfld TYPE slis_selfield.
CASE p_ucomm.
WHEN '&DATA_SAVE'.
DATA ref1 TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref1.
CALL METHOD ref1->check_changed_data.
LOOP AT it_sflight WHERE checkbox = 'X'.
DELETE it_sflight INDEX sy-tabix.
ENDLOOP.
p_selfld-refresh = 'X'.
ENDCASE.
ENDFORM. "user_command -
How to color a row in ALV grid display
Hi,
A few rows in the output of ALV grid display should be shown in different color.How can I achieve this?Hi,
Try out this code
DATA : BEGIN OF G_T_CASH OCCURS 0,
PARTICULARS TYPE CHAR120,
AMOUNT1 TYPE CHAR20,
AMOUNT2 TYPE CHAR20,
AMOUNT3 TYPE CHAR20,
ROW_COLOR TYPE CHAR4,----
add this in the internal table for alv
END OF G_T_CASH.
CLEAR G_WA_CASH.
G_WA_CASH-PARTICULARS = 'Opening Cash Balance'.
G_WA_CASH-AMOUNT1 = G_DMBTR.
G_WA_CASH-AMOUNT2 = ''.
G_WA_CASH-AMOUNT3 = ''.
while appending other values also add the following code
G_WA_CASH-ROW_COLOR = 'C200'.----- C200 depicts light gray color
APPEND G_WA_CASH TO G_T_CASH.
add the following code in layout
MOVE 'ROW_COLOR' TO WA_LS_LAYOUT-INFO_FIELDNAME.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_BYPASSING_BUFFER = ' '
I_SAVE = 'A'
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = WA_LS_LAYOUT
IT_FIELDCAT = G_T_CATALOG
IT_EVENTS = GT_EVENTS
TABLES
T_OUTTAB = G_T_CASH[]
EXCEPTIONS
PROGRAM_ERROR = 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.
Let me know if the problem still persist.
Regards,
Janaki
Maybe you are looking for
-
Error in Starting WebSphere Application Server
Hello, when I'm starting my WebSphere Aplication Server 6.0, it get an error. I tried a lot of things, but I don't know where is the problem. Can yo help me??? Thank you very much, KiM ============================================= Console Output: ===
-
Apple Remote Desktop and Projectors
I work on feature films doing interactive graphics. I use mostly Macs and I would like to be able to control multple projectors over the network using ARD. I can only control one Mac at a time, but I can send global Unix commands. Has anyone tried th
-
under the RETAINED EARING ACCOUNTS what accounts are created?
-
Error message: application not found
When I try to download an e-book from the public library to my Kobo e-reader, I get the above message
-
What's doing in EditAction?
hi all. please teach me. what's doing in EditAction? and How to realize without using EditAction I want value from ViewForm(ActionForm) because i want use <bean:write>tag in jsp after this action ex) import oracle.jbo.html.struts11.actions.EditAction