Subtotal in alv grid output.
hi experts,
i want to display subtotal in the alv output using control break statement, without using alv functionality and layout.
my code is given below, how can i add subtotal field and display them in alv ,
*& Report Y_VARUNSHARMA
REPORT Y_VARUNSHARMA.
TABLES: VBAK.
TYPE-POOLS: SLIS.
TYPES: BEGIN OF T_ITAB,
VBELN LIKE VBAK-VBELN,
ERDAT LIKE VBAK-ERDAT,
ERNAM LIKE VBAK-ERNAM,
ANGDT LIKE VBAK-ANGDT,
BNDDT LIKE VBAK-BNDDT,
AUART LIKE VBAK-AUART,
POSNR LIKE VBAP-POSNR,
MATNR LIKE VBAP-MATNR,
CHARG LIKE VBAP-CHARG,
MAKTX LIKE MAKT-MAKTX,
NETPR LIKE VBAP-NETPR,
VGBEL LIKE VBAK-VGBEL,
MEINS LIKE VBAP-MEINS,
SMENG LIKE VBAP-SMENG,
END OF T_ITAB.
DATA: G_REPID LIKE SY-REPID.
DATA: WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA: I_ITAB TYPE T_ITAB OCCURS 0,
WA_ITAB TYPE T_ITAB.
DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV ,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: I_LISTHEADER TYPE SLIS_T_LISTHEADER,
WA_LISTHEADER TYPE SLIS_LISTHEADER.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: DOCNO FOR VBAK-VBELN.
PARAMETER DOCTYPE LIKE VBAK-AUART.
SELECT-OPTIONS: DATE FOR SY-DATUM.
SELECTION-SCREEN SKIP 2.
PARAMETER P_CHECK AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK B1.
INITIALIZATION.
G_REPID = SY-REPID.
PERFORM BUILD_CATALOGE.
PERFORM LIST_HEADER.
PERFORM SET_LAYOUT.
AT SELECTION-SCREEN.
IF DOCNO-LOW = '' .
MESSAGE E000(ZVARUN) .
elseif DOCNO-HIGH = '' .
MESSAGE E001(ZVARUN) .
ENDIF.
START-OF-SELECTION.
PERFORM GET_DATA.
*PERFORM DISPLAY.
END-OF-SELECTION.
IF P_CHECK = 'X'.
PERFORM DOWNLOAD_EXCEL.
ELSE.
PERFORM DISPLAY.
ENDIF.
FORM DOWNLOAD_EXCEL.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'C:\FILE.XLS'
FILETYPE = 'XLS'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = I_ITAB
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
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_CATALOGE.
WA_FIELDCAT-FIELDNAME = 'VBELN'.
WA_FIELDCAT-SELTEXT_M = 'SALES DOC'.
*WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ERDAT'.
WA_FIELDCAT-SELTEXT_M = 'DATE'.
*WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ERNAM'.
WA_FIELDCAT-SELTEXT_M = 'NAME'.
*WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ANGDT'.
WA_FIELDCAT-SELTEXT_M = 'VALID FR'.
*WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'BNDDT'.
WA_FIELDCAT-SELTEXT_M = 'VALID TO'.
*WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'AUART'.
WA_FIELDCAT-SELTEXT_M = 'DOC TYPE'.
*WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'POSNR'.
WA_FIELDCAT-SELTEXT_M = 'DOC ITEM'.
*WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO'.
*WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'CHARG'.
WA_FIELDCAT-SELTEXT_M = 'BATCH NO'.
*WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'MAKTX'.
WA_FIELDCAT-SELTEXT_M = 'MATERIAL DESC'.
WA_FIELDCAT-EDIT = 'X'.
*WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'NETPR'.
WA_FIELDCAT-SELTEXT_M = 'UNIT PRICE'.
*WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'VGBEL'.
WA_FIELDCAT-SELTEXT_M = 'RFR DOC NO'.
*WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'MEINS'.
WA_FIELDCAT-SELTEXT_M = 'UNIT'.
*WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'SMENG'.
WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
*WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM.
FORM LIST_HEADER.
WA_LISTHEADER-TYP = 'H'.
WA_LISTHEADER-INFO = 'RJT COMPUSOLUTIONS'.
APPEND WA_LISTHEADER TO I_LISTHEADER.
CLEAR WA_LISTHEADER.
ENDFORM.
FORM SET_LAYOUT.
WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
ENDFORM.
FORM DISPLAY.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = I_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = I_ITAB
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.
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_LISTHEADER
I_LOGO = 'RJT'
I_END_OF_LIST_GRID =
I_ALV_FORM =
ENDFORM.
FORM GET_DATA.
SELECT AVBELN AERDAT AERNAM AANGDT ABNDDT AAUART AVGBEL BPOSNR BMATNR BCHARG BMEINS BSMENG BNETPR CMAKTX INTO CORRESPONDING FIELDS OF TABLE I_ITAB FROM ( ( VBAK AS A INNER JOIN VBAP AS B
ON AVBELN = BVBELN ) INNER JOIN MAKT AS C ON BMATNR = CMATNR ) WHERE AVBELN IN DOCNO AND AAUART = DOCTYPE .
ENDFORM.
FORM USER_COMMAND USING L_UCOMM LIKE SY-UCOMM L_SELFIELD TYPE SLIS_SELFIELD.
CASE L_UCOMM.
WHEN '&IC1'.
IF L_SELFIELD-FIELDNAME = 'VBELN'.
CALL TRANSACTION 'VA02'.
ELSEIF
L_SELFIELD-FIELDNAME = 'MATNR'.
CALL TRANSACTION 'MM02'.
ENDIF.
ENDCASE.
ENDFORM.
Hi,
That I guess is difficult. Only way is to append a new line with your subtotal to the output table with the subtotal filled in appro. field.
Santhosh
Similar Messages
-
F4 - Help for field in ALV Grid Output
Hi,
I generated a report which gives output in ALV Grid output.
In the output, 1 of the field is editable.Here, for this field I need to have my own F4-Help.
I think the procedure to be followed is:--
Create a Search Help in SE11.
Link the Search Help to the editable field.
Please let me know if its the correct procedure.
I f yes, how can I link user defined Search Help to the editable field?
Thanks,
Shivaa........Hi siva,
you can also do that way.
while filling the fieldcatalog use the parameter F4AVAILABL
for more info check
F4 help in ALV Grid...
f4 help for a field in alv grid
hope it helps you
Thanks!
Edited by: Prasanth on Mar 6, 2009 3:59 PM -
How to send the ALV GRID output to spool by using the print button in std t
How to send the ALV GRID output to spool by using the print button in standard tool bar.
We have created a button in the va02 transaction. If user click on the button the new screen will be display on that screen we are populating the alv grid output using the oops concept. But i am unable to send the output to spool using the print button in the standard tool bar.
I am able to display the Print parameter dialog box but i am not able to send it to spool.
Kindly help.
Thanks In Advance.
G.V.RamanaHi Shaik,
There is not properties button in my print screen.
MODULE user_command_0900 INPUT.
WHEN 'EXCEL'.
PERFORM excel_download.
WHEN 'PRI'.
PERFORM print_output.
form Print_output.
CALL FUNCTION 'RSPO_LIST_LAYOUT_FITS'
EXPORTING
columns = 80
device = 'ANY '
lines = 65
maxpenality = 1999
TABLES
layouts = lt_layouts1
EXCEPTIONS
unknown_device = 1
OTHERS = 2.
IF sy-subrc = 0.
LOOP AT lt_layouts1.
IF lt_layouts1-penality < 1000 AND
lt_layouts1-penality < l_min_penality.
l_layout = lt_layouts1-layout.
l_min_penality = lt_layouts1-penality.
ENDIF.
ENDLOOP.
IF NOT l_layout IS INITIAL.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
mode = 'CURRENT'
line_size = 80 "#EC *
new_list_id = l_new_list_id
no_dialog = l_no_dialog
layout = l_layout
IMPORTING
out_archive_parameters = rs_arc_params
out_parameters = rs_pri_params
valid = l_valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF sy-subrc NE 0. " INS SLIN
ENDIF. " INS SLIN
IF rs_pri_params-linsz LT 80 OR
rs_pri_params-linsz LT gt_stack-s_lprint-width.
gt_stack-print_line_break = 'X'.
ELSE.
CLEAR gt_stack-print_line_break.
ENDIF.
IF l_valid NE 'X'.
rs_pri_params = ls_pri_params_sav.
rs_arc_params = ls_arc_params_sav.
ENDIF.
ENDIF.
ENDIF.
endform. " Print_output
CALL METHOD gv_cost_tot_alv_grand->set_table_for_first_display
EXPORTING
is_layout = gs_layout_cost_tot_grand
CHANGING
it_fieldcatalog = gt_fcat_cost_tot_grand[]
it_outtab = gt_cost_tot_grand[].
Please check my code -
In ME2N report for PO- How to get or add Vendor name in ALV grid output
Hl Everyone
How to get or add Vendor Name and payment terms in the ALV grid output for the follwing reports like ME2N and ME2V.
cuurently i am in 4.7 E version.
Kindly suggest..........
thanks in advance
Regards
PrashanthHi Pankaj
I knew that vendor name field is avaiable in ECC versions, but how to get the same field(vendor name) in 4.7 E vesion.
Kindly suggest
Regards
Prashanth -
How to download alv grid output(with field catalog) into excel file format
Hi all,
How to download alv grid output(with field catalogs) into excel file format and same file has to download to application server.
Please help.
Regards,
Satya.Hi,
On list where alv is displayed, select export icon( green color -> ),select spread sheet.
This will display records in Excel sheet. -
Need to choose fields from alv grid output and send mail
Hi,
I need to choose few orders from alv grid output and send mail as PDF for chosen orders.
Suggest if possible and how.Moderator message - Please do not post your requirements and ask the forum to do your work for you - post locked
Rob -
Hi,
I have one issue on ALV Grid output.
Some times we will not have any values to display in ALV Grid output.
In such cases we usually have to display 'No Data found' in report output message(Below report header).
How to acheive this as all my ALV grid fields are of less length.
Note: Message should be displayed below ALV Header (Where we usually get 1st record to be displayed).
What is the solution for the same!
Thanks,
Deep.Hello Deep,
You can try with,
MESSATE 'Data not Found' TYPE 'I'.
Bye
Gabriel P.- -
How to append ALV grid output to LIST output
Hi,
I am working with Basis AUDIT MANUAL report for which i have to integrate around 50 standard transactions (SM37,SM35...etc) output and make it into one single report.
On execution of my report i have to get all the 50 transaction outputs sequentially.
Some standard transactions have ALV list display output and some have GRID display.I can able to append only list outputs by submit program and exporting list to memory.
Please suggest me how to get Alv grid output in midst of list output.
Regards
Kalpana.You should post your question to the ABAP forum:
ABAP Development -
Push Button in Every record in ALV grid output
Dear Experts,
I need to print a push button in first column of every record in ALV grid output. How ?
No OOPS concepts please.
Thanks,
Siva.For this requirement, you have to copy the standard PF status of the ALV output. Do as below :-
1) Go to SE41
2) Enter the program name as SAPLKKBL
3) In the field status enter STANDARD_FULLSCREEN
4) Click on STATUS button on the application toolbar.
5) Enter the name of your Program & a new status name.
6) Click on COPY.
This way the standard status will be copied to the custom status & call the same status in your program using SET PF STATUS statement. Then double click on the custom status name & you will be navigated to SE41, there you can add you new button on the application tool bar & assign a function code, which you can program by enabling the export parameter I_CALLBACK_USER_COMMAND of the Function module REUSE_ALV_GRID_DISPLAY.
Just a sample code snippet for your reference :-
FORM USER_COMMAND USING L_UCOMM LIKE SY-UCOMM
LS_SELFIELD TYPE SLIS_SELFIELD.
CASE L_UCOMM.
WHEN 'your function code goes here'.
Do further processing.
This way you will have the standard PF status alongwith your button as well.
Edited by: Kumar Manas Mishra on Jan 29, 2010 1:03 PM -
Displaying the selected rows in ALV Grid output
Hi Experts,
I am developing one interactive ALV Grid report where user can process the selected records/rows from the ALV Grid output.
for displaying the ALV Grid, I have used the class CL_GUI_ALV_GRID class. I am working on ECC 6.0 system.
when I select any records/rows from output and then press any Application Toolbar button, PAI and then PBO modules of the screen gets executed as per the normal flow.
however After PBO, when same ALV output comes, all the selected/highlighted rows appear as unselected, that means I want to retain the ALV
rows selection during the round trip.
please advise.
Regards,
JageshHi,
Feiyun Wu is correct.
Get_selected_rows and set_selected_rows are the methods to be used .
Some code:
Note the sequence of code:
FORM set_gui_alv_grid_1 .
DATA: wa_layout TYPE lvc_s_layo ,
wa_print TYPE lvc_s_prnt .
DATA: it_sort TYPE lvc_t_sort ,
wa_sort TYPE LINE OF lvc_t_sort .
DATA: it_fieldcatalog TYPE lvc_t_fcat.
IF gui_custom_container_1 IS INITIAL .
CREATE OBJECT gui_custom_container_1
EXPORTING
container_name = 'GUI_CUSTOM_CONTAINER_1'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6 .
IF sy-subrc <> 0.
ENDIF.
PERFORM get_field_catalog
USING gc_log_group_1
CHANGING it_fieldcatalog .
CREATE OBJECT gui_alv_grid_1
EXPORTING i_parent = gui_custom_container_1.
CREATE OBJECT ob_event_receiver_1
EXPORTING log_group = gc_log_group_1 .
* registers the event handlers
SET HANDLER ob_event_receiver_1->handle_toolbar FOR gui_alv_grid_1 .
SET HANDLER ob_event_receiver_1->handle_user_command FOR gui_alv_grid_1 .
SET HANDLER ob_event_receiver_1->print_top_of_page FOR gui_alv_grid_1 .
SET HANDLER ob_event_receiver_1->hotspot_click FOR gui_alv_grid_1 .
wa_layout-cwidth_opt = abap_true .
* wa_layout-excp_fname = gc_excp_fname .
* wa_layout-ctab_fname = gc_ctab_fname.
* wa_layout-excp_led = abap_true .
CALL METHOD gui_alv_grid_1->set_table_for_first_display
EXPORTING
is_layout = wa_layout
is_print = wa_print
i_save = 'A'
is_variant = gs_disvariant_1
CHANGING
it_sort = it_sort
it_fieldcatalog = it_fieldcatalog
it_outtab = it_alv_grid_1.
ELSE .
CALL METHOD gui_alv_grid_1->refresh_table_display.
* Restore selections
CALL METHOD gui_alv_grid_1->set_selected_rows
EXPORTING
it_index_rows = ob_event_receiver_1->it_rows.
* Restore position
CALL METHOD gui_alv_grid_1->set_scroll_info_via_id
EXPORTING
is_col_info = ob_event_receiver_1->wa_col
is_row_no = ob_event_receiver_1->wa_roid.
ENDIF.
ENDFORM . "set_gui_alv_grid_1
Regards. -
Hide a Column in ALV Grid Output
Hi,
I want to hide a column in ALV Grid Output through program.
I am using lwa_fieldcat-NO_OUT = 'X'. to hide the column in output but it is not working, column in not hided in the output.
Kindly suggest.It should work..
see the code :
d_fieldcat_wa-fieldname = 'MATNR'.
d_fieldcat_wa-seltext_l = 'material number'.
d_fieldcat_wa-no_out = 'X'. * hide particular field
append d_fieldcat_wa to d_fieldcat.
clear d_fieldcat_wa.
if not please paste your code here.
Thanks
Seshu -
Hi guys,
I generated a report which gives out put in ALV grid.
In the ALV grid output, I have some editable fields.
Lets suppose, there are some editable fields with no data in it.
I have userdefined pushbutton in Application toolbar, when I press the pushbutton the cursor should go to the empty field in the ALV grid output.
Can this be possible through SET CURSOR statement?
Thanks,
Shivaa......Hi,
You can set the cursor field on the output list that too for the output fields which are vissible on the screen only.
syntax
SET CURSOR 11 3. ---> 11Coloumn and 3 line
for dynamically setting cursor, first you have to search for the empty fields then set the cursor dynamically.
look at this help document it might be helpful
http://help.sap.com/saphelp_nw70/helpdata/EN/9f/dba47e35c111d1829f0000e829fbfe/content.htm
Regards
Bala KRishna -
Hi,
I want show few line item informations in bold in ALV grid output.
Please let me know your suggestions.You may check the below links.
some methods to achieve this is mentioned out there.
Re: BOLD cell in ALV.
Re: ALV Row should apper in BOLD when order type is "ZSTP1" in the cloumn
Regards,
Anil -
Color in ALV grid output based on condition
Hi,
I have generated a ALV Grid output.
I have a internal table ITAB1. It has 2 fields - field1 and field2.
Now, my requirement is if field1 is 'X', the row should be colored in RED, else if field1 is 'Y', the row should be colored in GREEN.
How can it be done?
Thanks,
Shivaa.........Hi,
add another field in the internal table with the type of char04.
use the code given below....
DATA : begin of itab occurs 0,
field1(10) type c,
field2(10) type c,
color(4) type c,
end of itab.
" fetch records in itab..
loop at itab.
if itab-field1 = 'X'.
itab-color = 'C700'. " Trial and error to get the color you want...
elseif itab-field1 = 'Y'.
itab-color = 'C300'. " Trial and error to get the color you want...
endif.
endloop.
fs_fcat-fieldname = 'FIELD1'.
fs_fcat-col_pos = 1.
fs_fcat-coltext = 'FIRST FIELD'.
APPEND fs_fcat TO t_fcat.
fs_fcat-fieldname = 'FIELD2'.
fs_fcat-col_pos = 2.
fs_fcat-coltext = 'SECOND FIELD'.
APPEND fs_fcat TO t_fcat.
fs_layo-sel_mode = 'A'.
fs_layo-INFO_FNAME = 'COLOR'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = sy_cprog
is_layout_lvc = fs_layo
it_fieldcat_lvc = t_fcat
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
This resolves you issue....
Cheers,
Siddarth -
Hi all,
Iam in need of a code that may help me out to get my cuztomized menu for my alv grid output.
Please give your suggestions,
Thanks,
Rajesh.Hello Rajesh,
First copy the standard ALV GUI Status STANDARD_FULLSCREEN to an ZSTANDARD_FULLSCREEN and make ur changes.
FOr this u have
DATA:g_callback_user_command TYPE slis_formname,
g_callback_pf_status_set TYPE slis_formname.
g_callback_pf_status_set = 'ZSTANDARD_FULLSCREEN'.
g_callback_user_command = 'ALV_USER_COMMAND'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = g_progname
i_callback_pf_status_set =
g_callback_pf_status_set
i_callback_user_command = g_callback_user_command I_STRUCTURE_NAME =
is_layout = g_r_layout
it_fieldcat = g_t_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
i_save = 'A'
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
is_print = g_r_print
IS_REPREP_ID =
i_screen_start_column = g_screen_start_column
i_screen_start_line = g_screen_start_line
i_screen_end_column = g_screen_end_column
i_screen_end_line = g_screen_end_line
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = p_t_liste
EXCEPTIONS
program_error = 1
OTHERS = 2
FORM alv_user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
*--- Hotspot selektion
CASE rs_selfield-sel_tab_field.
*------ Material
WHEN 'T_MAT-MATNR'.
READ TABLE t_mat INDEX rs_selfield-tabindex.
PERFORM call_mm02 USING t_mat-matnr.
WHEN 'G_T_LISTE-PSPID' OR 'G_T_HEADER-PSPID'.
*------ Projekt
Click auf Projekt -> Projekt anzeigen (CJ20)
SET PARAMETER ID 'PSP' FIELD rs_selfield-value.
SET PARAMETER ID 'PRO' FIELD space.
CALL TRANSACTION 'CJ20' AND SKIP FIRST SCREEN.
WHEN 'G_T_LISTE-POSID'.
*------ PSP-Element
Click auf PSP Element -> PSP Element anzeigen (CJ12)
SET PARAMETER ID 'PSP' FIELD space.
SET PARAMETER ID 'PRO' FIELD rs_selfield-value.
CALL TRANSACTION 'CJ12' AND SKIP FIRST SCREEN.
WHEN 'G_T_LISTE-STTXT_INT'.
*------ Systemstatus
g_sttxt_int = rs_selfield-value.
G_T_LEGENDE erfüllen
PERFORM f_fill_g_t_legende_int.
g_r_layout-window_titlebar = 'Systemstatus'(004).
PERFORM f_status_legende_popup.
WHEN 'G_T_LISTE-STTXT_EXT'.
*------ Anwenderstatus
g_sttxt_ext = rs_selfield-value.
G_T_LEGENDE erfüllen
PERFORM f_fill_g_t_legende_ext.
g_r_layout-window_titlebar = 'Anwenderstatus'(005).
PERFORM f_status_legende_popup.
WHEN 'G_T_LISTE-ICON'.
*------ Status Detail
PERFORM f_fill_g_t_status_detail USING rs_selfield-tabindex.
PERFORM f_status_detail_popup.
ENDCASE.
WHEN 'MTNR'.
READ TABLE t_mat INDEX rs_selfield-tabindex.
PERFORM call_mm02 USING t_mat-matnr.
WHEN 'INFO'.
READ TABLE t_mat INDEX rs_selfield-tabindex.
CALL SCREEN 900 STARTING AT 20 5
ENDING AT 100 20.
ENDCASE.
ENDFORM. "ALV_USER_COMMAND
Hope this will solve ur problem.
Reward if helps.
Vasanth
Message was edited by: Vasanth M
Maybe you are looking for
-
Key figure Explaination in SNP planning books 9ASNP94
Dear Experts , I am curious to know regarding SNP planning books key figures when i am exploring sap standard Planning book 9ASNP94 Data view : SNP94(1) I can able to see many KEY FIGURES Please refer below I AM NOT SURE how they are used in planni
-
I have done absalutely nothing to my 4g apple ipod touch, and it over heats, won't hold a charge, and the front camera will not work. I bought this brand new in december, and i've barely used it. I've tried restarting it and everything, I honestly th
-
Requirements to Make a Windows PC Use the iMac?
Hi. There are many that have great graphics, tweakable (mod and such) games on the PC now; until extreme gaming GPU grade thunderbolt external boxes come, If you want to assemble a very powerful Windows 7 64-bit but minimal (no case, no drive, it may
-
In IE the cursor can be changed to a block form, I can't find a way to do this with Firefox, the block form is an old carry back from the days of the old "green screens"
-
Can I backup and reinstall MacOS X to fixes problemes.
I want to reinstall Mac OS X to fix some of the problemes . Can I backup everything on external HD, reinstall OS (erase my HD) and restore all my systeme files, setting, and applications using time machine. If yes, do I have to be aware of something?