Regarding putting trafic lights in alv report
Hi frnds,
I need to add Traffic lites to my program can any one help me how to do that.
Below i m providing my code.
<code>
*ztest_alv
*& Report ZSAMPLEALV3 *
REPORT ZSAMPLEALV3
MESSAGE-ID Z00.
TABLE DECLARATIONS
TABLES : EKKO. "Purchasing Document Header
CONSTANTS DECLARATIONS
CONSTANTS : C_EBELN(5) VALUE 'EBELN'.
DATA DECLARATIONS
DATA : V_FLAG, "For Select Status
V_DATA(50). "To Store Data
TYPE DECLARATIONS FOR ALV *
TYPE-POOLS : SLIS.
*Type Declarations for Field Catalog for Basic List
DATA : I_FLDCAT_HEAD TYPE SLIS_T_FIELDCAT_ALV,
WA_FLDCAT_HEAD TYPE SLIS_FIELDCAT_ALV.
*Type Declarations for Field Catalog for Secondary List
DATA : I_FLDCAT_ITEM TYPE SLIS_T_FIELDCAT_ALV,
WA_FLDCAT_ITEM TYPE SLIS_FIELDCAT_ALV.
*Type Declarations for Displaying Images on Basic Grid
DATA : I_COMMENT TYPE SLIS_T_LISTHEADER,
WA_COMMENT TYPE SLIS_LISTHEADER.
*Type Declarations for Displaying Images on Secondary Grid
DATA : I_COMMENT_SEC TYPE SLIS_T_LISTHEADER,
WA_COMMENT_SEC TYPE SLIS_LISTHEADER.
*Type Declarations for ALV Events for Basic Grid
DATA : I_EVENTS TYPE SLIS_T_EVENT,
WA_EVENT LIKE LINE OF I_EVENTS.
*Type Declarations for ALV Events for Secondary Grid
DATA : I_EVENTS_SEC TYPE SLIS_T_EVENT,
WA_EVENT_SEC LIKE LINE OF I_EVENTS.
*Type Declarations for Layout Design
DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
*Type Declarations for Linking the fields
DATA : WA_KEYINFO TYPE SLIS_KEYINFO_ALV.
Type declarations for coloring field
DATA : wa_color type LVC_S_SCOL.
DATA: IT_COLOR TYPE TABLE OF LVC_S_SCOL.
INTERNAL TABLE DECLARATIONS
*--Internal Table for Basic List
DATA : BEGIN OF IT_FINAL_BAS OCCURS 0,
EBELN LIKE EKKO-EBELN, "Purchasing Document Number
BUKRS LIKE EKKO-BUKRS, "Company Code
AEDAT LIKE EKKO-AEDAT, "Date on which the record was created
EKORG LIKE EKKO-EKORG, "Purchasing Organization
EKGRP LIKE EKKO-EKGRP, "Purchasing group
COLOR(3) , "For applying color
END OF IT_FINAL_BAS.
*--Internal Table for Secondary List
DATA : BEGIN OF IT_FINAL_SEC OCCURS 0,
EBELN LIKE EKPO-EBELN, "Purchasing Document Number
MATNR LIKE EKPO-MATNR, "Material Number
TXZ01 LIKE EKPO-TXZ01, "Material Desc
WERKS LIKE EKPO-WERKS, "Plant
LGORT LIKE EKPO-LGORT, "Location
MATKL LIKE EKPO-MATKL, "Material Group
MENGE LIKE EKPO-MENGE, "Purchase order quantity
MEINS LIKE EKPO-MEINS, "Order unit
NETPR LIKE EKPO-NETPR, "Net price in purchasing document (in document currency)
NETWR LIKE EKPO-NETWR, "Net order value in PO currency
DUMMY LIKE ICON-ID, "For placing Icon
COLOR(3) , "For applying color
END OF IT_FINAL_SEC.
*--Internal Table for Secondary List with selected records
DATA : BEGIN OF I_ITEM_DISPLAY OCCURS 0,
EBELN LIKE EKPO-EBELN, "Purchasing Document Number
MATNR LIKE EKPO-MATNR, "Material Number
TXZ01 LIKE EKPO-TXZ01, "Material Desc
WERKS LIKE EKPO-WERKS, "Plant
LGORT LIKE EKPO-LGORT, "Location
MATKL LIKE EKPO-MATKL, "Material Group
MENGE LIKE EKPO-MENGE, "Purchase order quantity
MEINS LIKE EKPO-MEINS, "Order unit
NETPR LIKE EKPO-NETPR, "Net price in purchasing document (in document currency)
NETWR LIKE EKPO-NETWR, "Net order value in PO currency
DUMMY LIKE ICON-ID, "For placing Icon
COLOR(3) , "For applying color
END OF I_ITEM_DISPLAY.
SELECTION SCREEN
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-H01.
SELECT-OPTIONS: S_EBELN FOR EKKO-EBELN.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
SELECTION-SCREEN : BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(20) TEXT-003.
PARAMETERS: P_DISP RADIOBUTTON GROUP RAD1 DEFAULT 'X'.
SELECTION-SCREEN : END OF LINE.
SELECTION-SCREEN : BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(20) TEXT-005.
PARAMETERS: P_UPD RADIOBUTTON GROUP RAD1.
SELECTION-SCREEN : END OF LINE.
SELECTION-SCREEN END OF BLOCK B2.
Event : INITIALIZATION
INITIALIZATION.
MOVE 'Developed by'(001) TO V_DATA.
Event : AT SELECTION SCREEN
AT SELECTION-SCREEN.
PERFORM VALIDATE_EBELN.
Event : START-OF-SELECTION
START-OF-SELECTION.
*--Getting the Data
PERFORM GET_DATA.
*--Generating the Field catalog for basic and secondary grid
PERFORM GET_FLDCAT.
*--Generating the Layout for basic and secondary grid
PERFORM GET_LAYOUT.
*--Generating the key infor to link Basic grid to Secondary grid
PERFORM GET_KEYINFO.
*--Generating the Events for Basic and Secondary Grid
PERFORM GET_EVENTS.
*--Displaying data only
IF P_DISP = 'X'.
PERFORM DISPLAY_DATA.
ELSE .
PERFORM UPDATE_DATA.
ENDIF.
Event : END-OF-SELECTION
END-OF-SELECTION.
*& Form DISPLAY_DATA
text
--> p1 text
<-- p2 text
FORM DISPLAY_DATA .
IF V_FLAG EQ 'X'.
*--Generating Basic List
PERFORM DISP_BASIC_LIST.
ELSE.
IF SY-SUBRC NE 0.
MESSAGE I010 WITH 'No Data Found To Display'(002).
ENDIF.
ENDFORM. " DISPLAY_DATA
SUB-ROUTINES
*& Form VALIDATE_EBELN
Validating the PO No
FORM VALIDATE_EBELN .
SELECT EBELN
UP TO 1 ROWS
INTO (EKKO-EBELN)
FROM EKKO
WHERE EBELN IN S_EBELN.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE I010 WITH 'Invalid PO No'(003) S_EBELN-LOW 'To'(004) S_EBELN-HIGH.
ENDIF.
ENDFORM. " VALIDATE_EBELN
*& Form GET_DATA
Getting Basic List and Secondary List Data
FORM GET_DATA .
*--Getting Basic List Data
SELECT EBELN "PO No
BUKRS "Company Code
AEDAT "Creation Date
EKORG "Purch Org
EKGRP "Purch Group
INTO TABLE IT_FINAL_BAS
FROM EKKO
WHERE EBELN IN S_EBELN.
*--Getting Secondary List Data
IF SY-SUBRC EQ 0.
SELECT EBELN "PO No
MATNR "Material No
TXZ01 "Material Desc
WERKS "Plant
LGORT "Location
MATKL "Material Group
MENGE "PO Qty
MEINS "Unit
NETPR "Net Price
NETWR "Net Value
INTO TABLE IT_FINAL_SEC
FROM EKPO
WHERE EBELN IN S_EBELN.
ENDIF.
IF SY-SUBRC EQ 0.
V_FLAG = 'X'.
ELSE.
V_FLAG = SPACE.
ENDIF.
ENDFORM. " GET_DATA
*& Form GET_FLDCAT
Generating the Field Catalog
FORM GET_FLDCAT .
*--Generating the Field Catalog for Basic List
WA_FLDCAT_HEAD-REPTEXT_DDIC = 'Status'.
WA_FLDCAT_HEAD-FIELDNAME = 'LIGHT'.
WA_FLDCAT_HEAD-COL_POS = '1'.
WA_FLDCAT_HEAD-JUST = 'C'.
WA_FLDCAT_HEAD-OUTPUTLEN = '4'.
WA_FLDCAT_HEAD-ICON = 'X'.
APPEND WA_FLDCAT_HEAD TO I_FLDCAT_HEAD.
CLEAR WA_FLDCAT_HEAD .
WA_FLDCAT_HEAD-FIELDNAME = 'EBELN'.
WA_FLDCAT_HEAD-COL_POS = '2'.
WA_FLDCAT_HEAD-JUST = 'C'.
WA_FLDCAT_HEAD-OUTPUTLEN = '12'.
WA_FLDCAT_HEAD-SELTEXT_M = 'PO Number'(006).
WA_FLDCAT_HEAD-DDICTXT = 'M'.
WA_FLDCAT_HEAD-REF_TABNAME = ' '.
WA_FLDCAT_HEAD-HOTSPOT = 'X'.
APPEND WA_FLDCAT_HEAD TO I_FLDCAT_HEAD.
CLEAR WA_FLDCAT_HEAD .
WA_FLDCAT_HEAD-FIELDNAME = 'BUKRS'(007).
WA_FLDCAT_HEAD-COL_POS = '3'.
WA_FLDCAT_HEAD-OUTPUTLEN = '12'.
WA_FLDCAT_HEAD-SELTEXT_M = 'Company Code'(008).
WA_FLDCAT_HEAD-DDICTXT = 'M'.
APPEND WA_FLDCAT_HEAD TO I_FLDCAT_HEAD.
WA_FLDCAT_HEAD-FIELDNAME = 'AEDAT'(009).
WA_FLDCAT_HEAD-COL_POS = '4'.
WA_FLDCAT_HEAD-OUTPUTLEN = '10'.
WA_FLDCAT_HEAD-SELTEXT_M = 'PO Date'(010).
WA_FLDCAT_HEAD-DDICTXT = 'M'.
APPEND WA_FLDCAT_HEAD TO I_FLDCAT_HEAD.
WA_FLDCAT_HEAD-FIELDNAME = 'EKORG'(011).
WA_FLDCAT_HEAD-COL_POS = '5'.
WA_FLDCAT_HEAD-OUTPUTLEN = '6'.
WA_FLDCAT_HEAD-SELTEXT_M = 'PO Org'(012).
WA_FLDCAT_HEAD-DDICTXT = 'M'.
WA_FLDCAT_HEAD-EDIT = 'X'.
APPEND WA_FLDCAT_HEAD TO I_FLDCAT_HEAD.
WA_FLDCAT_HEAD-FIELDNAME = 'EKGRP'(013).
WA_FLDCAT_HEAD-COL_POS = '6'.
WA_FLDCAT_HEAD-OUTPUTLEN = '8'.
WA_FLDCAT_HEAD-SELTEXT_M = 'PO Group'(014).
WA_FLDCAT_HEAD-DDICTXT = 'M'.
WA_FLDCAT_HEAD-DO_SUM = 'X'.
APPEND WA_FLDCAT_HEAD TO I_FLDCAT_HEAD.
*--Generating the Field Catalog for secondary List
WA_FLDCAT_ITEM-FIELDNAME = 'EBELN'.
WA_FLDCAT_ITEM-COL_POS = '1'.
WA_FLDCAT_ITEM-JUST = 'C'.
WA_FLDCAT_ITEM-OUTPUTLEN = '12'.
WA_FLDCAT_ITEM-SELTEXT_M = 'PO Number'(006).
WA_FLDCAT_ITEM-DDICTXT = 'M'.
WA_FLDCAT_ITEM-REF_TABNAME = ' '.
APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.
WA_FLDCAT_ITEM-FIELDNAME = 'MATNR'(015).
WA_FLDCAT_ITEM-COL_POS = '2'.
WA_FLDCAT_ITEM-JUST = 'C'.
WA_FLDCAT_ITEM-OUTPUTLEN = '18'.
WA_FLDCAT_ITEM-SELTEXT_M = 'Item Number'(016).
WA_FLDCAT_ITEM-DDICTXT = 'M'.
WA_FLDCAT_ITEM-REF_TABNAME = ' '.
APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.
WA_FLDCAT_ITEM-FIELDNAME = 'TXZ01'(017).
WA_FLDCAT_ITEM-COL_POS = '3'.
WA_FLDCAT_ITEM-JUST = 'C'.
WA_FLDCAT_ITEM-OUTPUTLEN = '40'.
WA_FLDCAT_ITEM-SELTEXT_M = 'Item Desc'(018).
WA_FLDCAT_ITEM-DDICTXT = 'M'.
APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.
WA_FLDCAT_ITEM-FIELDNAME = 'WERKS'(019).
WA_FLDCAT_ITEM-COL_POS = '4'.
WA_FLDCAT_ITEM-JUST = 'C'.
WA_FLDCAT_ITEM-OUTPUTLEN = '6'.
WA_FLDCAT_ITEM-SELTEXT_M = 'Plant'(020).
WA_FLDCAT_ITEM-DDICTXT = 'M'.
APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.
WA_FLDCAT_ITEM-FIELDNAME = 'LGORT'(021).
WA_FLDCAT_ITEM-COL_POS = '5'.
WA_FLDCAT_ITEM-JUST = 'C'.
WA_FLDCAT_ITEM-OUTPUTLEN = '9'.
WA_FLDCAT_ITEM-SELTEXT_M = 'Location'(022).
WA_FLDCAT_ITEM-DDICTXT = 'M'.
APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.
WA_FLDCAT_ITEM-FIELDNAME = 'MATKL'(023).
WA_FLDCAT_ITEM-COL_POS = '6'.
WA_FLDCAT_ITEM-JUST = 'C'.
WA_FLDCAT_ITEM-OUTPUTLEN = '10'.
WA_FLDCAT_ITEM-SELTEXT_M = 'Mat Group'(024).
WA_FLDCAT_ITEM-DDICTXT = 'M'.
APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.
WA_FLDCAT_ITEM-FIELDNAME = 'MENGE'(025).
WA_FLDCAT_ITEM-COL_POS = '7'.
WA_FLDCAT_ITEM-JUST = 'C'.
WA_FLDCAT_ITEM-OUTPUTLEN = '17'.
WA_FLDCAT_ITEM-SELTEXT_M = 'PO Qty'(026).
WA_FLDCAT_ITEM-DDICTXT = 'M'.
APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.
WA_FLDCAT_ITEM-FIELDNAME = 'MEINS'(027).
WA_FLDCAT_ITEM-COL_POS = '8'.
WA_FLDCAT_ITEM-JUST = 'C'.
WA_FLDCAT_ITEM-OUTPUTLEN = '3'.
WA_FLDCAT_ITEM-SELTEXT_M = 'Unit'(028).
WA_FLDCAT_ITEM-DDICTXT = 'M'.
APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.
WA_FLDCAT_ITEM-FIELDNAME = 'NETPR'(029).
WA_FLDCAT_ITEM-COL_POS = '9'.
WA_FLDCAT_ITEM-JUST = 'C'.
WA_FLDCAT_ITEM-OUTPUTLEN = '14'.
WA_FLDCAT_ITEM-SELTEXT_M = 'Net Price'(037).
WA_FLDCAT_ITEM-DDICTXT = 'M'.
APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.
WA_FLDCAT_ITEM-FIELDNAME = 'NETWR'(030).
WA_FLDCAT_ITEM-COL_POS = '10'.
WA_FLDCAT_ITEM-JUST = 'C'.
WA_FLDCAT_ITEM-OUTPUTLEN = '16'.
WA_FLDCAT_ITEM-SELTEXT_M = 'Net Value'(031).
WA_FLDCAT_ITEM-DDICTXT = 'M'.
APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.
WA_FLDCAT_ITEM-FIELDNAME = 'DUMMY'(038).
WA_FLDCAT_ITEM-COL_POS = '11'.
WA_FLDCAT_ITEM-JUST = 'C'.
WA_FLDCAT_ITEM-OUTPUTLEN = '3'.
WA_FLDCAT_ITEM-SELTEXT_M = 'Status'(039).
WA_FLDCAT_ITEM-DDICTXT = 'M'.
WA_FLDCAT_ITEM-ICON = 'X'.
APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.
ENDFORM. " GET_FLDCAT
*& Form DISP_BASIC_LIST
Generating the Basic List
FORM DISP_BASIC_LIST .
**--Applying the color to record in Basic List
SORT IT_FINAL_BAS BY BUKRS.
LOOP AT IT_FINAL_BAS.
IF IT_FINAL_BAS-BUKRS LE '1000'.
IT_FINAL_BAS-COLOR = 'C21'.
ELSEIF IT_FINAL_BAS-BUKRS GT '1000' AND IT_FINAL_BAS-BUKRS LE '2000'.
IT_FINAL_BAS-COLOR = 'C41'.
ELSEIF IT_FINAL_BAS-BUKRS GT '2000' AND IT_FINAL_BAS-BUKRS LE '3000'.
IT_FINAL_BAS-COLOR = 'C71'.
ELSEIF IT_FINAL_BAS-BUKRS GT '3000'.
IT_FINAL_BAS-COLOR = 'C51'.
ELSE.
IT_FINAL_BAS-COLOR = 'C61'.
ENDIF.
MODIFY IT_FINAL_BAS INDEX SY-TABIX.
ENDLOOP.
*--Generating the Grid output
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'ZTEST_ALV'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = 'PLAIN_BACKGROUND'
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = I_FLDCAT_HEAD
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = I_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
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_FINAL_BAS
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. " DISP_BASIC_LIST
*& Form GET_EVENTS
Getting the ALV Events
FORM GET_EVENTS .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = I_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*--Calling the User Defined sub-routines for ALV Events
IF NOT I_EVENTS[] IS INITIAL.
READ TABLE I_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
WA_EVENT-FORM = 'GENERATE_USERCOMMAND_HEADER'.
MODIFY I_EVENTS FROM WA_EVENT INDEX SY-TABIX.
READ TABLE I_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
WA_EVENT-FORM = 'FRM_TOP_OF_PAGE'.
MODIFY I_EVENTS FROM WA_EVENT INDEX SY-TABIX.
READ TABLE I_EVENTS INTO WA_EVENT WITH KEY NAME = 'END_OF_LIST'.
WA_EVENT-FORM = 'GENERATE_USERCOMMAND_FOOTER'.
MODIFY I_EVENTS FROM WA_EVENT INDEX SY-TABIX.
READ TABLE I_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
WA_EVENT-FORM = 'GENERATE_USERCOMMAND3'.
MODIFY I_EVENTS FROM WA_EVENT INDEX SY-TABIX.
ENDIF.
ENDFORM. " GET_EVENTS
*& Form GENERATE_USERCOMMAND_HEADER
Displaying Header-Text and Logo on Grid
FORM GENERATE_USERCOMMAND_HEADER.
CLEAR I_COMMENT[].
WA_COMMENT-TYP = 'H'.
WA_COMMENT-INFO = 'General Purchase Order Info'(032).
APPEND WA_COMMENT TO I_COMMENT.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_COMMENT
I_LOGO = 'ENJOYSAP_LOGO'.
I_END_OF_LIST_GRID = 'X'.
ENDFORM. " GENERATE_USERCOMMAND
*FORM FRM_TOP_OF_PAGE.
write :/ text-005 intensified on.
write :/ text-006 , sy-sysid,14 sy-mandt.
write :/ text-007 , sy-uname.
write :/ text-008 , sy-datum.
write :/ text-009 , sy-uzeit.
skip.
*ENDFORM.
*& Form GENERATE_USERCOMMAND_FOOTER
Displaying Footer-Text
FORM GENERATE_USERCOMMAND_FOOTER .
CLEAR I_COMMENT[].
WA_COMMENT-TYP = 'S'.
WA_COMMENT-KEY = V_DATA.
WA_COMMENT-INFO = 'kaka'(033).
APPEND WA_COMMENT TO I_COMMENT.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_COMMENT
I_LOGO = ''
I_END_OF_LIST_GRID = 'X'.
ENDFORM. " GENERATE_USERCOMMAND_FOOTER
*& Form GENERATE_USERCOMMAND3
Getting the F-Code and Calling Secondary List
--> P_UCOMM LIKE SY-UCOMM
--> P_SELFIELD TYPE SLIS_SELFIELD
FORM GENERATE_USERCOMMAND3 USING P_UCOMM LIKE SY-UCOMM
P_SELFIELD TYPE SLIS_SELFIELD.
CASE P_UCOMM.
WHEN '&IC1'. "DOUBLE CLICK Func-Code
READ TABLE IT_FINAL_BAS INDEX P_SELFIELD-TABINDEX.
REFRESH I_ITEM_DISPLAY.
*--Applying the color to record in Secondary List
LOOP AT IT_FINAL_SEC WHERE EBELN = IT_FINAL_BAS-EBELN.
IF IT_FINAL_SEC-NETPR EQ 0.
IT_FINAL_SEC-DUMMY = '@0A@'.
IT_FINAL_SEC-COLOR = 'C61'.
ELSEIF IT_FINAL_SEC-NETPR GT 0 AND IT_FINAL_SEC-NETPR LE 200.
IT_FINAL_SEC-DUMMY = '@09@'.
IT_FINAL_SEC-COLOR = 'C41'.
ELSEIF IT_FINAL_SEC-NETPR GT 200 AND IT_FINAL_SEC-NETPR LE 1000.
IT_FINAL_SEC-DUMMY = '@08@'.
IT_FINAL_SEC-COLOR = 'C71'.
ELSEIF IT_FINAL_SEC-NETPR GT 1000.
IT_FINAL_SEC-DUMMY = '@6P@'.
IT_FINAL_SEC-COLOR = 'C51'.
ENDIF.
MODIFY IT_FINAL_SEC INDEX SY-TABIX.
MOVE-CORRESPONDING IT_FINAL_SEC TO I_ITEM_DISPLAY.
APPEND I_ITEM_DISPLAY.
CLEAR I_ITEM_DISPLAY.
ENDLOOP.
*--Getting the ALV Events of Secondary List
PERFORM GET_EVENTS_SEC.
*--Generating the ALV Secondary Grid output
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'ZTEST'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = 'PLAIN_BACKGROUND'
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = I_FLDCAT_ITEM
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = I_EVENTS_SEC
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
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = I_ITEM_DISPLAY
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.
ENDCASE.
ENDFORM. " GENERATE_USERCOMMAND3
*& Form GET_LAYOUT
Generating the Layout
FORM GET_LAYOUT .
WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'. "OPTIMIZING FIELD WIDTH
WA_LAYOUT-ZEBRA = 'X'. "PUTTING ZEBRA COLORS
WA_LAYOUT-INFO_FIELDNAME = 'COLOR'(034). "APPLYING COLORS TO ROWS
ENDFORM. " GET_LAYOUT
*& Form GET_KEYINFO
Getting Key info
FORM GET_KEYINFO .
*--Linking the Basic List to Secondary List
WA_KEYINFO-HEADER01 = C_EBELN.
WA_KEYINFO-ITEM01 = C_EBELN.
ENDFORM. " GET_KEYINFO
*& Form GET_EVENTS_SEC
Getting Secondary List Events
FORM GET_EVENTS_SEC .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = I_EVENTS_SEC
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*--Calling user-defined sub-routines for Secondary List
IF NOT I_EVENTS_SEC[] IS INITIAL.
READ TABLE I_EVENTS_SEC INTO WA_EVENT_SEC WITH KEY NAME = 'TOP_OF_PAGE'.
WA_EVENT_SEC-FORM = 'GENERATE_USERCOMMAND_H_SEC'.
MODIFY I_EVENTS_SEC FROM WA_EVENT_SEC INDEX SY-TABIX.
READ TABLE I_EVENTS_SEC INTO WA_EVENT_SEC WITH KEY NAME = 'END_OF_LIST'.
WA_EVENT_SEC-FORM = 'GENERATE_USERCOMMAND_F_SEC'.
MODIFY I_EVENTS_SEC FROM WA_EVENT_SEC INDEX SY-TABIX.
ENDIF.
ENDFORM. " GET_EVENTS_SEC
*& Form GENERATE_USERCOMMAND_H_SEC
Displaying Header-Text and Logo on Grid For Secondary List
FORM GENERATE_USERCOMMAND_H_SEC.
CLEAR I_COMMENT_SEC[].
WA_COMMENT_SEC-TYP = 'H'.
WA_COMMENT_SEC-INFO = 'Purchase Order Info'(035).
APPEND WA_COMMENT_SEC TO I_COMMENT_SEC.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_COMMENT_SEC
I_LOGO = 'ENJOYSAP_LOGO'.
I_END_OF_LIST_GRID = 'X'.
ENDFORM. " GENERATE_USERCOMMAND_H_SEC
*& Form GENERATE_USERCOMMAND_F_SEC
Displaying Footer-Text for Secondary List
FORM GENERATE_USERCOMMAND_F_SEC.
CLEAR I_COMMENT_SEC[].
WA_COMMENT_SEC-TYP = 'S'.
WA_COMMENT_SEC-KEY = V_DATA.
WA_COMMENT_SEC-INFO = 'kak1'(036).
APPEND WA_COMMENT_SEC TO I_COMMENT_SEC.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_COMMENT_SEC
I_LOGO = ''
I_END_OF_LIST_GRID = 'X'.
ENDFORM. " GENERATE_USERCOMMAND_F_SEC
*& Form UPDATE_DATA
text
--> p1 text
<-- p2 text
*form UPDATE_DATA .
*CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME = I_STRUCTURE_NAME
I_BACKGROUND_ID = ' '
I_GRID_TITLE = I_GRID_TITLE
I_GRID_SETTINGS = I_GRID_SETTINGS
IS_LAYOUT = IS_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_EXCLUDING = IT_EXCLUDING
IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS
IT_SORT = IT_SORT
IT_FILTER = IT_FILTER
IS_SEL_HIDE = IS_SEL_HIDE
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT = IS_VARIANT
IT_EVENTS = IT_EVENTS
IT_EVENT_EXIT = IT_EVENT_EXIT
IS_PRINT = IS_PRINT
IS_REPREP_ID = 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_ALV_GRAPHICS
IT_HYPERLINK = IT_HYPERLINK
IT_ADD_FIELDCAT = IT_ADD_FIELDCAT
IT_EXCEPT_QINFO = IT_EXCEPT_QINFO
IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER
IMPORTING
E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER
ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER
TABLES
t_outtab = t_outtab
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. " UPDATE_DATA
</code>
regards,
sanjay
Hi,
Please refer to the code below:
REPORT ALV_LIGHTS.* Published at SAPTechnical.COMTYPES: BEGIN OF ty_alv,
lights(1) TYPE c, "Exception, Holding the value of the lights
text(20) TYPE c, "some text
END OF ty_alv.DATA: gs_alv TYPE ty_alv,
gt_alv TYPE TABLE OF ty_alv,
gr_alv TYPE REF TO cl_salv_table,
gr_columns TYPE REF TO cl_salv_columns_table.START-OF-SELECTION.
gs_alv-lights = '1'. "Color red
gs_alv-text = 'RED SIGNAL'.
APPEND gs_alv TO gt_alv. gs_alv-lights = '2'. "Color yellow
gs_alv-text = 'YELLOW SIGNAL'.
APPEND gs_alv TO gt_alv. gs_alv-lights = '3'. "Color green
gs_alv-text = 'GREEN SIGNAL'.
APPEND gs_alv TO gt_alv. CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = gr_alv
CHANGING
t_table = gt_alv. gr_columns = gr_alv->get_columns( ). gr_columns->set_exception_column( value = 'LIGHTS' ). CALL METHOD gr_alv->display.
Thanks,
Sriram Ponna.
Similar Messages
-
Hi Masters,
i have tried my best to Impliment the TRAFIC LIGHTS in my alv report but i could not succeed.
can i have some input as to how we impliment the TRAFIC LIGHTS CODE in alv report.
your valuble info is highly appriciated.
thank you,
pasala.the previous post is the sample code if you want to use ALV via cl_salv_table, but if you want to build ALV using function module REUSE_ALV_GRID_DISPLAY, please try following sample code. It works in my computer. Hope it helps.
types: begin of gs_outtab.
types: lights type char1,
color type i,
tabcol type lvc_t_scol,
id type char25, " Already exist in ICON, Flat Structure
name type icon-name,
symbol type icon-id,
end of gs_outtab.
data: gt_outtab type standard table of gs_outtab.
data: gr_grid type ref to cl_gui_alv_grid.
data: gr_container type ref to cl_gui_custom_container,
gs_layout type lvc_s_layo,
gt_fieldcat type lvc_t_fcat.
data: ls_vari type disvariant.
data: g_okcode type syucomm.
data: gt_exc type table of ALV_S_QINF.
data: text type string.
selection-screen begin of block gen with frame.
parameters:
p_amount type i default 20.
selection-screen end of block gen.
selection-screen begin of block dsp with frame.
parameters:
p_full radiobutton group dsp,
p_grid radiobutton group dsp.
selection-screen end of block dsp.
START-OF-SELECTION.
END-OF-SELECTION.
perform select_data.
IF p_full = 'X'.
perform display_fullscreen.
ELSE.
perform display_grid.
ENDIF.
STEP 1: load data *******************************************
form select_data.
select * from icon into corresponding fields of table gt_outtab
up to p_amount rows.
endform.
STEP2: build full screen **************************************
form display_fullscreen .
data: ls_layout type slis_layout_alv,
lt_fcat type slis_t_fieldcat_alv,
ls_fcat type slis_fieldcat_alv.
ls_layout-lights_tabname = '1'.
ls_layout-lights_fieldname = 'LIGHTS'.
ls_layout-coltab_fieldname = 'TABCOL'.
clear ls_fcat.
ls_fcat-fieldname = 'LIGHTS'.
ls_fcat-inttype = 'C'.
ls_fcat-seltext_l = ls_fcat-seltext_m = ls_fcat-seltext_s = 'Lights'.
append ls_fcat to lt_fcat.
clear ls_fcat.
ls_fcat-fieldname = 'COLOR'.
ls_fcat-inttype = 'I'.
ls_fcat-seltext_l = ls_fcat-seltext_m = ls_fcat-seltext_s = 'Color'.
append ls_fcat to lt_fcat.
clear ls_fcat.
ls_fcat-fieldname = 'ID'.
ls_fcat-inttype = 'C'.
ls_fcat-seltext_l = ls_fcat-seltext_m = ls_fcat-seltext_s = 'Icon'.
ls_fcat-icon = abap_true.
append ls_fcat to lt_fcat.
clear ls_fcat.
ls_fcat-fieldname = 'SYMBOL'.
ls_fcat-inttype = 'C'.
ls_fcat-seltext_l = ls_fcat-seltext_m = ls_fcat-seltext_s = 'Symbol'.
ls_fcat-symbol = abap_true.
append ls_fcat to lt_fcat.
clear ls_fcat.
ls_fcat-fieldname = 'NAME'.
ls_fcat-tech = abap_true.
append ls_fcat to lt_fcat.
perform select_data.
perform set_tooltips.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IS_LAYOUT = ls_layout
IT_FIELDCAT = lt_fcat
IT_EXCEPT_QINFO = gt_exc
TABLES
T_OUTTAB = gt_outtab
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
ASSERT sy-subrc = 0.
endform.
STEP3: display grid ******************************************
form display_grid.
call screen 100.
endform.
STEP4: PBO ***************************************************
module d0100_pbo output.
perform d0100_pbo.
endmodule.
STEP5: PAI ***************************************************
module d0100_pai input.
perform d0100_pai.
endmodule.
STEP6: PBO form ***********************************************
form d0100_pbo .
set pf-status 'D0100'.
if gr_container is not bound.
create object gr_container
exporting
container_name = 'CONTAINER'.
create object gr_grid
exporting i_parent = gr_container.
data: ls_layout type lvc_s_layo,
lt_fcat type lvc_t_fcat,
ls_fcat type lvc_s_fcat.
ls_layout-excp_fname = 'LIGHTS'.
ls_layout-ctab_fname = 'TABCOL'.
clear ls_fcat.
ls_fcat-fieldname = 'LIGHTS'.
ls_fcat-inttype = 'C'.
ls_fcat-scrtext_l = ls_fcat-scrtext_m = ls_fcat-scrtext_s = 'Lights'.
append ls_fcat to lt_fcat.
clear ls_fcat.
ls_fcat-fieldname = 'COLOR'.
ls_fcat-inttype = 'I'.
ls_fcat-scrtext_l = ls_fcat-scrtext_m = ls_fcat-scrtext_s = 'Color'.
append ls_fcat to lt_fcat.
clear ls_fcat.
ls_fcat-fieldname = 'ID'.
ls_fcat-inttype = 'C'.
ls_fcat-scrtext_l = ls_fcat-scrtext_m = ls_fcat-scrtext_s = 'Icon'.
ls_fcat-icon = abap_true.
append ls_fcat to lt_fcat.
clear ls_fcat.
ls_fcat-fieldname = 'SYMBOL'.
ls_fcat-inttype = 'C'.
ls_fcat-scrtext_l = ls_fcat-scrtext_m = ls_fcat-scrtext_s = 'Symbol'.
ls_fcat-symbol = abap_true.
append ls_fcat to lt_fcat.
clear ls_fcat.
ls_fcat-fieldname = 'NAME'.
ls_fcat-tech = abap_true.
append ls_fcat to lt_fcat.
perform select_data.
perform set_tooltips.
data: lt_tooltips type lvc_t_qinf,
lt_toolb type ui_functions,
ls_toolb type UI_FUNC.
ls_toolb = CL_GUI_ALV_GRID=>mc_fc_call_crbatch.
append ls_toolb to lt_toolb.
lt_tooltips = gt_exc.
call method gr_grid->set_table_for_first_display
exporting is_layout = ls_layout
it_except_qinfo = lt_tooltips
it_toolbar_excluding = lt_toolb
changing
it_fieldcatalog = lt_fcat
it_outtab = gt_outtab.
endif.
endform.
STEP7: PAI form ******************************************************
form d0100_pai .
case g_okcode.
when 'BACK' or 'EXIT' or 'CANC'.
set screen 0.
leave screen.
endcase.
endform.
STEP8: Set Tooltip *************************************************
FORM set_tooltips .
field-symbols: <outtab> type gs_outtab.
data: tooltips type ref to cl_salv_tooltips,
settings type ref to cl_salv_functional_settings,
ls_styl type lvc_s_styl,
value type char128,
text type char40,
ls_symbol type icon,
lt_symbol type standard table of icon,
ls_exc type ALV_S_QINF,
tabix type sy-tabix,
col type lvc_s_scol.
loop at gt_outtab assigning <outtab>.
tabix = sy-tabix.
read table lt_symbol index sy-tabix into ls_symbol.
<outtab>-symbol = ls_symbol-id.
value = <outtab>-id(3).
text = <outtab>-name.
concatenate value '\Q' text '@' into value.
<outtab>-id = value.
value = ls_symbol-id.
text = ls_symbol-name.
ls_exc-type = cl_salv_tooltip=>c_type_symbol.
ls_exc-value = value.
ls_exc-text = text.
append ls_exc to gt_exc.
<outtab>-color = tabix mod 7 + 1.
<outtab>-lights = tabix mod 3 + 1.
col-fname = 'COLOR'.
col-color-col = tabix mod 7 + 1.
if tabix ge 7.
col-color-inv = 1.
endif.
if tabix ge 14.
col-color-int = 1.
endif.
append col to <outtab>-tabcol.
endloop.
ENDFORM. -
How we can drill-down, sorting, traffic lights, in ALV report
hi gurus ,
how we can drill-down, sorting, traffic lights, in ALV report .
please any one suggest that...
regards,
praveenCheck the sample code for drill-down, sorting, traffic lights, in ALV report.
REPORT YMS_COLOURALV NO STANDARD PAGE HEADING.
TYPE-POOLS: SLIS, ICON.
DATA: FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: BEGIN OF IMARA OCCURS 0,
LIGHT(4) TYPE C,
MATNR TYPE MARA-MATNR,
MTART TYPE MARA-MTART,
MAKTX TYPE MAKT-MAKTX,
COLOR_LINE(4) TYPE C,
TCOLOR TYPE SLIS_T_SPECIALCOL_ALV, "cell
END OF IMARA.
DATA: XCOLOR TYPE SLIS_SPECIALCOL_ALV.
START-OF-SELECTION.
PERFORM GET_DATA.
PERFORM WRITE_REPORT.
FORM GET_DATA.
WRITE ICON_GREEN_LIGHT AS ICON TO IMARA-LIGHT.
IMARA-MATNR = 'ABC'.
IMARA-MTART = 'ZCFG'.
IMARA-MAKTX = 'This is description for ABC'.
APPEND IMARA.
WRITE ICON_YELLOW_LIGHT AS ICON TO IMARA-LIGHT.
IMARA-MATNR = 'DEF'.
IMARA-MTART = 'ZCFG'.
IMARA-MAKTX = 'This is description for DEF'.
APPEND IMARA.
WRITE ICON_RED_LIGHT AS ICON TO IMARA-LIGHT.
IMARA-MATNR = 'GHI'.
IMARA-MTART = 'ZCFG'.
IMARA-MAKTX = 'This is description for GHI'.
APPEND IMARA.
LOOP AT IMARA.
IF SY-TABIX = 1.
IMARA-COLOR_LINE = 'C410'. " color line
ENDIF.
IF SY-TABIX = 2. " color CELL
CLEAR XCOLOR.
XCOLOR-FIELDNAME = 'MTART'.
XCOLOR-COLOR-COL = '3'.
XCOLOR-COLOR-INT = '1'. " Intensified on/off
XCOLOR-COLOR-INV = '0'.
APPEND XCOLOR TO IMARA-TCOLOR.
ENDIF.
MODIFY IMARA.
ENDLOOP.
ENDFORM. "get_data
FORM WRITE_REPORT.
DATA: LAYOUT TYPE SLIS_LAYOUT_ALV.
LAYOUT-COLTAB_FIELDNAME = 'TCOLOR'.
LAYOUT-INFO_FIELDNAME = 'COLOR_LINE'.
PERFORM BUILD_FIELD_CATALOG.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FIELDCAT
TABLES
T_OUTTAB = IMARA.
ENDFORM. "write_report
FORM BUILD_FIELD_CATALOG.
DATA: FC_TMP TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
CLEAR: FIELDCAT. REFRESH: FIELDCAT.
CLEAR: FC_TMP.
FC_TMP-REPTEXT_DDIC = 'Status'.
FC_TMP-FIELDNAME = 'LIGHT'.
FC_TMP-TABNAME = 'IMARA'.
FC_TMP-OUTPUTLEN = '4'.
FC_TMP-ICON = 'X'.
APPEND FC_TMP TO FIELDCAT.
CLEAR: FC_TMP.
FC_TMP-REPTEXT_DDIC = 'Material Number'.
FC_TMP-FIELDNAME = 'MATNR'.
FC_TMP-TABNAME = 'IMARA'.
FC_TMP-OUTPUTLEN = '18'.
APPEND FC_TMP TO FIELDCAT.
CLEAR: FC_TMP.
FC_TMP-REPTEXT_DDIC = 'Material Type'.
FC_TMP-FIELDNAME = 'MTART'.
FC_TMP-TABNAME = 'IMARA'.
FC_TMP-OUTPUTLEN = '10'.
APPEND FC_TMP TO FIELDCAT.
CLEAR: FC_TMP.
FC_TMP-REPTEXT_DDIC = 'Material'.
FC_TMP-FIELDNAME = 'MAKTX'.
FC_TMP-TABNAME = 'IMARA'.
FC_TMP-OUTPUTLEN = '40'.
APPEND FC_TMP TO FIELDCAT.
ENDFORM. "build_field_catalog -
Regarding displaying Trafic light on one column of ALV
Hi
I want to display trafic light(red or yellow) on the first column of the ALV report.Is it possible by any alv field catalog field ?use this demo code - in this code the form fill_itab is related to ur requirement,see loop at itab ,in tht form..u wil find the way to use traffic lights..
*& Report ZGILL_ALV *
REPORT ZGILL_ALV message-id rp .
type-pools slis.
tables: zgill_main,zgill_details.
data z_fieldcat type slis_t_fieldcat_alv.
data begin of itab occurs 0.
DATA ICON TYPE ICON-ID.
include structure zgill_main.
data salary like zgill_details-salary.
data end of itab.
*data itab1 like table of itab with header line.
data : WA_SORT TYPE SLIS_SORTINFO_ALV,
IT_SORT TYPE SLIS_T_SORTINFO_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
IT_FIELDTAB TYPE SLIS_T_FIELDCAT_ALV,
WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
PARAMETERS: p_list radiobutton group A1,
P_GRID RADIOBUTTON GROUP A1.
SELECT-OPTIONS: S_PERNR FOR ZGILL_MAIN-PERNR.
start-of-selection.
perform fill_itab.
perform sort_list.
**************Start of scenario without container******************************************
*********Method 1***********
perform fill_fieldcat. " Manuallly Preparing Fiedl Catalog
*********Method 2***********
*perform fill_fieldcat1 changing z_fieldcat. "Preparing field catalog with merge function
perform display_alv.
*****************end of scenario without container*****************************************
*& Form fill_itab
text
--> p1 text
<-- p2 text
form fill_itab .
*select * from zgill_main up to 20 rows INTO CORRESPONDING FIELDS OF TABLE itab.
*ITAB1[] = ITAB[].
select apernr aname aorg adob b~salary INTO CORRESPONDING FIELDS OF TABLE itab
from zgill_main as a join zgill_details as b on apernr = bpernr
WHERE A~PERNR IN S_PERNR.
LOOP AT ITAB.
IF ITAB-PERNR < 1111.
ITAB-ICON = '@08@'.
ELSEIF ITAB-PERNR > 1111 AND ITAB-PERNR < 11111111.
ITAB-ICON = '@09@'.
ELSEIF ITAB-PERNR GE 11111111.
ITAB-ICON = '@0A@'.
ENDIF.
MODIFY ITAB INDEX SY-TABIX.
ENDLOOP.
endform. " fill_itab
*& Form display_alv
text
--> p1 text
<-- p2 text
form display_alv .
data repid like sy-repid.
REPID = SY-REPID.
WA_LAYOUT-ZEBRA = 'X'.
WA_LAYOUT-WINDOW_TITLEBAR = 'GRID DISPLAY'.
WA_LAYOUT-SUBTOTALS_TEXT = 'SUBTOTAL'.
WA_LAYOUT-TOTALS_TEXT = 'TOTAL'.
IF P_GRID = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = repid
IT_FIELDCAT = IT_FIELDTAB
IT_SORT = IT_SORT
IS_LAYOUT = WA_LAYOUT
TABLES
t_outtab = itab[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF sy-subrc <> 0.
message e016 with 'Error in Display'.
ENDIF.
ELSEIF P_LIST = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = repid
IT_FIELDCAT = IT_FIELDTAB
IT_SORT = IT_SORT
IS_LAYOUT = WA_LAYOUT
TABLES
t_outtab = itab[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF sy-subrc <> 0.
message e016 with 'Error in Display'.
ENDIF.
ENDIF.
endform. " display_alv
*& Form fill_fieldcat1
text
--> p1 text
<-- p2 text
form fill_fieldcat1 changing d_fcat type slis_t_fieldcat_alv.
data repid like sy-repid.
data d_fcat1 type slis_t_fieldcat_alv with header line.
REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = repid
I_INTERNAL_TABNAME = 'ITAB'
I_STRUCTURE_NAME = 'ZGILL_MAIN'
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = d_fcat[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF sy-subrc <> 0.
message e016 with 'Error in preparing fiedl catalog'.
ENDIF.
loop at d_fcat into d_fcat1.
case d_fcat1-fieldname.
when 'NAME'.
d_fcat1-reptext_ddic = 'Emp Name'.
MODIFY D_FCAT FROM D_FCAT1.
WHEN 'PERNR'.
d_fcat1-reptext_ddic = 'Emp Num'.
MODIFY D_FCAT FROM D_FCAT1.
WHEN 'ORG'.
d_fcat1-reptext_ddic = 'Org Unit'.
MODIFY D_FCAT FROM D_FCAT1.
endcase.
clear d_fcat1.
endloop.
endform. " fill_fieldcat1
*& Form sort_list
text
--> p1 text
<-- p2 text
form sort_list .
CLEAR WA_SORT.
WA_SORT-FIELDNAME = 'DOB'.
WA_SORT-SPOS = '1'.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
CLEAR WA_SORT.
WA_SORT-FIELDNAME = 'NAME'.
WA_SORT-SPOS = '1'.
WA_SORT-UP = 'X'.
APPEND WA_SORT TO IT_SORT.
CLEAR WA_SORT.
endform. " sort_list
*& Form fill_fieldcat
text
--> p1 text
<-- p2 text
form fill_fieldcat .
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'ITAB'.
WA_FIELDCAT-FIELDNAME = 'ICON'.
WA_FIELDCAT-SELTEXT_L = 'TRAFFIC'.
WA_FIELDCAT-ICON = 'X'.
WA_FIELDCAT-ddictxt = 'l'.
WA_FIELDCAT-COL_POS = 1.
WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO IT_FIELDTAB.
CLEAR WA_FIELDCAT .
WA_FIELDCAT-TABNAME = 'ITAB'.
WA_FIELDCAT-FIELDNAME = 'PERNR'.
WA_FIELDCAT-SELTEXT_L = 'EMP NUMBER'.
WA_FIELDCAT-ddictxt = 'l'.
WA_FIELDCAT-COL_POS = 2.
WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO IT_FIELDTAB.
CLEAR WA_FIELDCAT .
when 'maktx'.
WA_FIELDCAT-TABNAME = 'ITAB'.
WA_FIELDCAT-FIELDNAME = 'NAME'.
WA_FIELDCAT-SELTEXT_L = 'EMP NAME'.
WA_FIELDCAT-ddictxt = 'l'.
WA_FIELDCAT-COL_POS = 3.
WA_FIELDCAT-OUTPUTLEN = 15.
APPEND WA_FIELDCAT TO IT_FIELDTAB.
CLEAR WA_FIELDCAT .
WA_FIELDCAT-TABNAME = 'ITAB'.
WA_FIELDCAT-FIELDNAME = 'ORG'.
WA_FIELDCAT-SELTEXT_L = 'ORG UNIT'.
WA_FIELDCAT-COL_POS = 4.
WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO IT_FIELDTAB.
CLEAR WA_FIELDCAT .
WA_FIELDCAT-TABNAME = 'ITAB'.
WA_FIELDCAT-FIELDNAME = 'DOB'.
WA_FIELDCAT-SELTEXT_L = 'BIRTH DATE'.
WA_FIELDCAT-COL_POS = 5.
WA_FIELDCAT-OUTPUTLEN = 12.
APPEND WA_FIELDCAT TO IT_FIELDTAB.
CLEAR WA_FIELDCAT .
WA_FIELDCAT-TABNAME = 'ITAB'.
WA_FIELDCAT-FIELDNAME = 'SALARY'.
WA_FIELDCAT-SELTEXT_L = 'SALARY'.
WA_FIELDCAT-COL_POS = 6.
WA_FIELDCAT-OUTPUTLEN = 25.
WA_FIELDCAT-do_sum = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDTAB.
endform. " fill_fieldcat -
How to print traffic lights in ALV reports
hi how to print traffic lights on selection screen in alv reports
HI,
check below code
TYPE-POOLS : icon.
types: BEGIN OF ty_display,
status TYPE icon-id,
bukrs TYPE bseg-bukrs,
gjahr TYPE bseg-gjahr,
monat TYPE monat,
work_order TYPE z_work_order,
glaccount TYPE saknr,
message TYPE string,
END OF ty_display.
data : it_display TYPE TABLE OF ty_display,
wa_display TYPE ty_display.
WRITE icon_led_green AS ICON TO wa_display-status.
wa_display-gjahr = p_year.
wa_display-bukrs = p_cc.
wa_display-monat = p_period.
wa_display-work_order = v_aufnr.
wa_display-glaccount = wa_bseg-hkont.
APPEND wa_display TO it_display.
WRITE icon_led_red AS ICON TO wa_display-status.
wa_display-gjahr = p_year.
wa_display-bukrs = p_cc.
wa_display-monat = p_period.
wa_display-work_order = v_aufnr.
wa_display-glaccount = wa_bseg-hkont.
wa_display-message = text-010.
APPEND wa_display TO it_display.
change the icon color based on your requirement and append it to the internal table which you have to display in ALV.
reward points if it is helpful.
Regards,
Srilatha -
Urgent: regarding sub total button in alv report
hi,
i had made dis report and it is is fine till now,but now i want add the sub total field in it ,by making double click on the field sub-total should be displayed in it.
here is d code as i had tried the sub - total but when i execute it is giving some diferrent result.
*& Report ZTET2
REPORT ZTET2.
TABLES: ISEG,MARA.
TYPE-POOLS : SLIS.
DATA : DATE1(15) TYPE C,
DATE2(15) TYPE C,
TITLE(65) TYPE C,
DT(25) TYPE C.
DATA : ITEVENT TYPE SLIS_T_EVENT.
DATA: lv_sort TYPE slis_sortinfo_alv,
t_sort type slis_t_sortinfo_alv.
DATA : repid LIKE sy-repid.
INTERNAL TABLE FOR INVENTORY STOCK *****************
DATA: BEGIN OF ITS1 OCCURS 0,
MATNR LIKE ISEG-MATNR,
ITEMID(6) TYPE C,
MEINS LIKE ISEG-MEINS,
MENGE LIKE ISEG-MENGE,
WRTZL LIKE ISEG-WRTZL,
BUCHM LIKE ISEG-BUCHM,
WRTBM LIKE ISEG-WRTBM,
WERKS LIKE ISEG-WERKS,
BUDAT LIKE ISEG-BUDAT,
ZLDAT LIKE ISEG-ZLDAT,
MTART LIKE MARA-MTART,
ITEMDESC LIKE MAKT-MAKTX,
DIFFQTY LIKE ISEG-BUCHM,
DIFFVALUE LIKE ISEG-WRTBM,
GRUND LIKE ISEG-GRUND,
GRTXT LIKE T157E-GRTXT,
BWART LIKE T157E-BWART,
REAS TYPE C LENGTH 15,
END OF ITS1.
data: t_heading type slis_t_listheader.
SELECTION-SCREEN BEGIN OF BLOCK PAR1 WITH FRAME TITLE TEXT-001.
*SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
*********PARAMETERS*********
PARAMETERS : PLANT LIKE ISEG-WERKS OBLIGATORY.
*********SELECTION SCREEN OPTIONS*********
SELECT-OPTIONS : R_DATE FOR ISEG-BUDAT OBLIGATORY NO-EXTENSION,
M_TYPE FOR MARA-MTART,
IT_M FOR MARA-MATNR.
*********DEFINING VARIABLES*********
SELECTION-SCREEN END OF BLOCK par1.
CONCATENATE R_DATE-LOW6(2) '.' R_DATE-LOW4(2) '.' R_DATE-LOW+0(4) INTO DATE1.
CONCATENATE R_DATE-HIGH6(2) '.' R_DATE-HIGH4(2) '.' R_DATE-HIGH+0(4) INTO DATE2.
TOP-OF-PAGE.
PERFORM PG_HEADER.
START-OF-SELECTION.
SELECT AMATNR AMEINS AMENGE AWRTZL ABUCHM AWRTBM AWERKS ABUDAT AZLDAT BMTART AGRUND CBWART
FROM ISEG AS A INNER JOIN MARA AS B ON BMATNR = AMATNR
INNER JOIN MSEG AS C ON AMBLNR = CMBLNR
INTO CORRESPONDING FIELDS OF TABLE ITS1 WHERE BMATNR = AMATNR AND BMEINS = AMEINS AND AWERKS = PLANT AND ABUDAT IN R_DATE AND BMTART IN M_TYPE AND BMATNR IN IT_M.
LOOP AT ITS1.
ITS1-ITEMID = ITS1-MATNR+12(6).
ITS1-DIFFQTY = ITS1-MENGE - ITS1-BUCHM.
ITS1-DIFFVALUE = ITS1-WRTZL - ITS1-WRTBM.
SELECT SINGLE MAKTX FROM MAKT INTO ITS1-ITEMDESC WHERE MATNR = ITS1-MATNR.
SELECT SINGLE GRTXT INTO ITS1-GRTXT FROM T157E WHERE GRUND = ITS1-GRUND AND SPRAS = 'E' AND BWART = ITS1-BWART.
MODIFY ITS1.
ENDLOOP.
PERFORM PRN_SMSTOCK_ALV.
WRITING DATA FROM D TABLES**********
FORM PG_HEADER.
WRITE : 'PHYSICAL INVENTORY AUDIT REPORT PLANT : ', PLANT.
ENDFORM.
*& Form PRN_SMSTOCK_ALV
text
--> p1 text
<-- p2 text
form PRN_SMSTOCK_ALV .
data: w_title type lvc_title,
w_repid type syrepid,
w_comm type slis_formname,
w_status type slis_formname,
x_layout type slis_layout_alv,
t_event type slis_t_event,
t_fieldcat type slis_t_fieldcat_alv,
t_subtot TYPE slis_t_sortinfo_alv,
subtot LIKE LINE OF t_subtot.
refresh t_fieldcat.
refresh t_event.
refresh t_sort.
clear x_layout.
clear w_title.
perform set_fieldcat2 using:
1 'MTART' 'MTART' 'MARA' '15' space 'MATERIAL TYPE' space space space space space space space space SPACE t_fieldcat 'L' 'L',
2 'ITEMID' 'ITEMID' 'MARA' '7' space 'ITEM ID' space space space space space space space space SPACE t_fieldcat 'R' 'C',
3 'ITEMDESC' 'MAKTX' 'MAKT' '25' space 'MATERIAL DESCRIPTION' space space space space space space space space SPACE t_fieldcat 'L' 'C',
4 'MEINS' 'MEINS' 'MARA' '5' space 'UOM' space space space space space space space space SPACE t_fieldcat 'C' 'C',
5 'MENGE' 'MENGE' 'ISEG' '13' space 'ORG.INV.QTY' space space space space space space space space SPACE t_fieldcat 'R' 'C',
6 'WRTZL' 'WRTZL' 'ISEG' '13' space 'ORG.INV.VALUE' space space space space space space space space SPACE t_fieldcat 'R' 'C',
7 'BUCHM' 'BUCHM' 'ISEG' '13' space 'PHY.INV.QTY' space space space space space space space space SPACE t_fieldcat 'R' 'C',
8 'WRTBM' 'WRTBM' 'ISEG' '13' space 'PHY.INV.VALUE' space space space space space space space space SPACE t_fieldcat 'R' 'C',
9 'DIFFQTY' 'MENGE' 'ISEG' '13' space 'DIFF.INV.QTY' space space space space space space space space SPACE t_fieldcat 'R' 'C',
10 'DIFFVALUE' 'WRTZL' 'ISEG' '13' space 'DIFF.INV.VALUE' space space space space space space space space SPACE t_fieldcat SPACE 'P',
11 'BUDAT' 'BUDAT' 'ISEG' '18' space 'CORRECTED DATE' space space space space space space space space SPACE t_fieldcat 'C' 'C',
12 'GRTXT' 'GRTXT' 'ISEG' '18' space 'REASON' space space space space space space space space SPACE t_fieldcat 'L' 'L',
13 'REAS' 'REAS' 'ISEG' '18' space 'AUTH.BY' space space space space space space space space SPACE t_fieldcat 'C' 'C'.
x_layout-zebra = 'X'.
perform set_top_page_heading using t_heading t_event.
perform set_events using t_event.
perform get_subtotals.
w_status = ''.
w_repid = sy-repid.
w_comm = 'USER_COMMAND'.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = w_repid
it_fieldcat = t_fieldcat
i_Callback_top_of_page = 'Top-of-page'
is_layout = x_layout
it_sort = t_sort
i_callback_pf_status_set = w_status
i_callback_user_command = w_comm
i_save = 'X'
it_events = t_event
i_grid_title = w_title
tables
t_outtab = ITS1
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 set_fieldcat2 USING
p_colpos p_fieldname p_ref_fieldname p_ref_tabname
p_outputlen p_noout
p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt
p_hotspot p_showasicon p_checkbox p_edit
p_dosum
p_subtot
t_fieldcat TYPE slis_t_fieldcat_alv
P_JUST
P_FTYPE.
DATA: wa_fieldcat TYPE slis_fieldcat_alv.
CLEAR wa_fieldcat.
General settings
wa_fieldcat-fieldname = p_fieldname.
wa_fieldcat-col_pos = p_colpos.
wa_fieldcat-no_out = p_noout.
wa_fieldcat-hotspot = p_hotspot.
wa_fieldcat-checkbox = p_checkbox.
wa_fieldcat-icon = p_showasicon.
wa_fieldcat-do_sum = p_dosum.
wa_fieldcat-t_subtot = p_subtot.
Set output length.
IF NOT p_outputlen IS INITIAL.
wa_fieldcat-outputlen = p_outputlen.
ENDIF.
Set text headers.
IF NOT p_seltext_m IS INITIAL.
wa_fieldcat-seltext_m = p_seltext_m.
ENDIF.
IF NOT p_seltext_l IS INITIAL.
wa_fieldcat-seltext_l = p_seltext_l.
ENDIF.
IF NOT p_seltext_s IS INITIAL.
wa_fieldcat-seltext_s = p_seltext_s.
ENDIF.
IF NOT p_reptext_ddic IS INITIAL.
wa_fieldcat-reptext_ddic = p_reptext_ddic.
ENDIF.
IF NOT p_ddictxt IS INITIAL.
wa_fieldcat-ddictxt = p_ddictxt.
ENDIF.
IF NOT P_JUST IS INITIAL.
WA_FIELDCAT-JUST = P_JUST.
ENDIF.
IF NOT p_edit IS INITIAL.
wa_fieldcat-Input = 'X'.
wa_fieldcat-edit = 'X'.
wa_fieldcat-do_sum = 'x'.
wa_fieldcat-p_subtot = 'x'.
ENDIF.
APPEND wa_fieldcat TO t_fieldcat.
ENDFORM. "set_fieldcat2
======================== Subroutines called by ALV ================
*& Form top_of_page
Called on top_of_page ALV event.
Prints the heading.
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_heading.
ENDFORM.
form set_top_page_heading using t_heading type slis_t_listheader
t_events type slis_t_event.
data: x_heading type slis_listheader,
x_event type line of slis_t_event.
Report title
clear t_heading[].
clear x_heading.
x_heading-typ = 'H'.
x_heading-info = 'PHYSICAL INVENTORY AUDIT REPORT'.
append x_heading to t_heading.
Plant Name
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'PLANT : '.
x_heading-info = PLANT.
append x_heading to t_heading.
IF DATE2 = '00.00.0000'.
CONCATENATE DATE1 'to' DATE1 INTO DT SEPARATED BY SPACE.
ELSE.
CONCATENATE DATE1 'to' DATE2 INTO DT SEPARATED BY SPACE.
ENDIF.
X_heading-TYP = 'S'.
X_heading-key = 'PERIOD :'.
X_heading-INFO = DT.
APPEND x_heading TO t_heading.
Control Date
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'CONTROL NO. :'.
x_heading-info = ' ASDFADDFAAS DATE : 11.04.2007'.
append x_heading to t_heading.
Control date
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'CONTROL DATE : '.
x_heading-info = ''.
append x_heading to t_heading.
Time of execution
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'DATE : '.
write sy-DATUM to x_heading-info.
append x_heading to t_heading.
Top of page event
x_event-name = slis_ev_top_of_page.
x_event-form = 'TOP_OF_PAGE'.
append x_event to t_events.
endform.
FORM get_subtotals.
CLEAR lv_sort.
lv_sort-fieldname = 'MENGE'.
lv_sort-up = 'X'.
lv_sort-subtot = 'X'.
APPEND lv_sort TO t_sort.
clear lv_sort.
*lv_sort-fieldname = 'MENGE'.
*lv_sort-tabname = 'ITS1'.
*lv_sort-subtot = 'X'.
*APPEND lv_sort TO t_sort.
lv_sort-fieldname = 'WRTZL'.
lv_sort-tabname = 'ITS1'.
lv_sort-subtot = 'X'.
APPEND lv_sort TO t_sort.
clear lv_sort.
lv_sort-fieldname = 'BUCHM'.
lv_sort-tabname = 'ITS1'.
lv_sort-subtot = 'X'.
APPEND lv_sort TO t_sort.
clear lv_sort.
lv_sort-fieldname = 'WRTBM'.
lv_sort-tabname = 'ITS1'.
lv_sort-subtot = 'X'.
APPEND lv_sort TO t_sort.
clear lv_sort.
lv_sort-fieldname = 'DIFFQTY'.
lv_sort-tabname = 'ITS1'.
lv_sort-subtot = 'X'.
APPEND lv_sort TO t_sort.
clear lv_sort.
lv_sort-fieldname = 'DIFFVALUE'.
lv_sort-tabname = 'ITS1'.
lv_sort-subtot = 'X'.
APPEND lv_sort TO t_sort.
clear lv_sort.
ENDFORM.
form set_events using t_events type slis_t_event.
data: x_event type line of slis_t_event.
endform.
PLZ HELP ME and definately get rewarded.hi,
how did u declared ur internal table?
Declare a dummy field in your internal table to trigger subtotal text event.
TYPES: BEGIN OF ty_ekpo,
lifnr TYPE ekko-lifnr, "vendor number
ebeln TYPE ekko-ebeln, "purchase document number
ebelp TYPE ekpo-ebelp, "Item Number of Purchasing Document
matnr TYPE ekpo-matnr, "Material Number
bukrs TYPE ekpo-bukrs, "Company Code
werks TYPE ekpo-werks, "Plant
d, "Dummy field to fire the Subtotal text event
END OF ty_ekpo.
Prepare field catalog for that dummyfield also and set attributes like below
wa_fcat-col_pos = 7.
wa_fcat-fieldname = 'D'.
wa_fcat-tabname = 'IT_EKPO'.
wa_fcat-ref_fieldname = 'NETPR'.
wa_fcat-ref_tabname = 'EKPO'.
wa_fcat-no_out = 'X'.
APPEND wa_fcat TO it_fcat.
Fill sortinfo table as follows
wa_sort-spos = 1.
wa_sort-fieldname = 'LIFNR'.
wa_sort-tabname = 'IT_EKPO'.
wa_sort-up = 'X'.
wa_sort-group = 'UL'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
wa_sort-spos = 2.
wa_sort-fieldname = 'D'.
wa_sort-tabname = 'IT_EKPO'.
wa_sort-up = 'X'.
wa_sort-group = 'UL'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO it_sort.
fill the event table
wa_event-name = 'SUBTOTAL_TEXT'. "--> this event is used to trigger subtotal text
wa_event-form = 'SUBTOTAL'.
APPEND wa_event TO it_event.
*& Form subtotal
FORM subtotal USING i_listhead STRUCTURE wa_ekpo i_subtotal TYPE slis_subtot_text.
READ TABLE it_sort INTO wa_sort WITH KEY fieldname = 'D'.
IF sy-subrc = 0.
IF i_subtotal-criteria = 'D'.
i_subtotal-display_text_for_subtotal = 'Sub total'.
ENDIF.
ENDIF.
ENDFORM. "subtotal
Thanks & REgards -
ALV Report output as per selection screen
Hi,
I got a requirement. In selection screen there is field where i can entered 1 to 12 numbers. When i entered a number, so that in output of an alv report should display that many fields
for eg.
if i entered 5 in selection screen
in out put 5 fields of alv report should display.
Thanks....
Moderator message : Spec dumping / Outsourcing is not allowed. Thread locked.
Edited by: Vinod Kumar on Jul 15, 2011 11:34 AMhi,
u sort the internal table by the materials in our variant.
like sort itab by jtab
itab consists of all materials
jtab cosists of materials in variant.
hope it may helpful,
regards,
chandu -
Choose for Selection option in ALV report
Hi SAP experts,
There is a requirement of using the functionality of Settings->Field for selection functionality in our ALV report.
Please suggest some way to implement it. I am attaching the screenshot. This functionality i need to use in alv report. Thanks in advance
Thanks & regards
Pratham kapoorHello,
in an ALV-Report you could just use get_selinfos = 'X' in the layout-workarea.
Check the docu on parameter IS_LAYOUT in REUSE_ALV_LIST_DISPLAY.
Or you could use the fuction you wrote about and print these information at the TOP_OF_PAGE event.
Regards Wolfgang -
Download ALV report to PDF with Lights
Hi,
I have a requirement wherein, when i download ALV report to PDF which has Lights in the first column. My problem is these lights are not displayed instead i get the following in the PDF
PDF o/p:
XOO RED SIGNAL
OXO YELLOW SIGNAL
OOX GREEN SIGNAL
Please let me know how to get the lights in the PDF o/p
Thanks & Regards,
SandhyaHi Sandhya,
U can convert any type of display(SF,ALV) to PDF.....
User Program rstxpdft4 to convert it first the O/P need to be converted into spool.
cheers,
Naveen. -
i have designed a alv list report this list output should be converted to .pdf format.
Hi,
Create a spool request by printing alv list and put spool request number to report RSTXPDF4 and you will get pdf output of ALV list .
Hope that helps.
Regards
Mr Kapadia
***Assigning points is the way to say thanks in SDN.*** -
I want to see out put of data 'plant wise' as vertical left in ALV report
I want to see out put of data 'plant wise' as vertical left in ALV report.
Can anybody suggest me with coding.
thanks
nareshHiiii
Sorry ...however could u be rather specific ..what u want ... unable to under stand ur requirement ...
earlier also u asked some thing similiar query..i think that didnt solve ur issue ...
is that u want a tree structure report ??????or what type of o/p do u want to have .....le tthat be more explanatory ....
regards
chandu reddy -
Hi all,
I've created an ALV report which is having a editable checkbox box field and some more fields that are not editable.
My requirement is that when i check any checkbox, some of the fields in that particular row should become editable.
In table control it can be done easily but can it be done in ALV.
Note: I have created the ALV through container as it was required.
Thanks in Advance.
Regards
DheerajHi,
Basically you will have to first register the data change event after you display the grid as follows:-
CALL METHOD y_lobj_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>MC_EVT_MODIFIED
EXCEPTIONS
error = 1
OTHERS = 2.
Here Y_LOBJ_GRID is my grid object of type CL_GUI_ALV_GRID.
Then you will have to set a handler method for this.
SET HANDLER y_obj_evt_handler->y_m_handle_cell_modified
FOR Y_LOBJ_GRID.
Here y_obj_evt_handler is a local class in your program and y_m_handle_cell_modified is the method of that class.
In this method you can change the fields to make then editable or non editable.
Regards,
Ankur Parab -
Hi experts 1 query regarding alv report running in background
when i run my alv report with 40 columns in background in spool when i get output disturbed 20 lines of first row is moving to second row so when i download to excel the o/p is completely disturbed and no use for me is there any way to solve this problem.please reply
hi ,
this will solve your problem
http://www.****************/Tutorials/ALV/Spool/width.htm
Increasing the width of the spool when using ALV List
By Aafaque Husain, YASH Technologies
Whenever an ALV report (with more number of columns) is scheduled in background, the output will be displayed in a zigzag fashion as shown below:
If we try to download the output from the spool or try to view the output, then we observe that the output is not in an appropriate fashion.
To get the right format of output in the spool we generally increase the u201Cno. of columns fieldu201D in the Format typesu201D. Have a look at the following screenshot:
Sometimes even when we change this field, we get the output truncated at the end, like last few columns are not displayed. There is certain limitation for this field, so that even if increase this value again, we find no change in the output display in spool.
This value is effective only when we check the check box u201CNumber of columns from list display formatu201D in the SPAD transaction.
Ø GO to SPAD Transaction code
Ø In the menu Settings -> Spool System as shown belowu2026
Ø In the others tab check the first check box in the Output Controller block, SAVE and exit.
Now Schedule the ALV report again by providing the output device and format, and then we get the full output in the spool as shown below:
Regards,
Madhavi -
On ALV report in1 column I want to put Icon on every row of that column.
On ALV report there is 1 column I want to put Icon on every row of that column.That ALV program uses object oriented concept all class and methods.
I want to use that icon on that row. That icon name is ICON_OKAY
In my program when I assign values to internal table at that time I am assigning that ICON_OKAY value to that row as follow.
Itab-
Itab-icon = ICON_OKAY.
Append itab.please follow below procedure to display icon in ALV
1) In corresponding fieldcatelog entry do
fieldcatalog-icon = 'X'
2) While filling the internal table fill the corresponding key value of icon , for example ICON_OKAY value is '@0V@' so statement would be
Itab-icon = '@0V@'
to get list of corresponding key for icon open include <ICON> in se38 -
Regarding Conversion of the Charecter field Into Lowercase in an ALV REPORT
HI ALL,
I have created an editable alv Report. In which i have a coloumn with charecter field where i can enter 64 charecters. when ever i have enter and moved to another Tab its converting into Capital Letters. I need to stop it conversion. Can any one suggest me Regarding It. I am Using the Docking Container and method set_table_for_first_display for displaying the Grid.
Please give some suggestion in order to control conversion of charecters.
Thanks in Advance.
NareshWhat Kind of Dataelement/Domain you are using? CHAR60? Then try TEXT60 f.e.
Maybe you check this out
http://help.sap.com/saphelp_erp2005/helpdata/DE/bf/3bd1369f2d280ee10000009b38f889/frameset.htm
and there the FC option lowercase..
Edited by: Mathias Maerker on Apr 23, 2009 2:14 PM
Maybe you are looking for
-
How can I upgrade my Mac OS 9.0.4 to Mac OS 9.1?
I recently needed to run an old program on my G4 tower which is running 10.4.11. But whenever I try to run it, the computer (which I call Titania -- from Midsummer Night's Dream) tells me that I need 9.1. I thought I had upgraded to 9.1 before I star
-
I am at a loss .... I can't get my printer to do anything
Here is the scoop: I have a HP OfficeJet Pro 8600. I purchased and installed it in February 2012. It worked fine (printer, scanner, copier) until about a week ago. I did all of the troubleshooting I can think of, plus sent data to HP website reque
-
How to install WEBm Plug-in Manually (unable to figure this out)
I need to export a WEBm file. (A prior thread is still unanswered) There is a 3rd party plug-in that allows this, but I don't seem to be able to figure out how to manually install it. fnordware/AdobeWebM · GitHub (this is a thread posted by Adobe l
-
Does the channel used by Airport Supreme cause problems?
I have problems with my wireless system using the Airport Supreme on my Mac Pro. Streaming movies and internet use on my iPad cut off and often I find that my internet service is down. I need to contact the cable company which resets the modem. The
-
Wired Keyboard gives low powered notice even on powered hub
I purchased my MBP in february and with it one of the new wired keyboards. Since purchasing the keyboard, I have been unable to use it unless it is plugged directly into the MBP. I've tried using a powered Belkin 4-port USB hub (FSU021) with no luck.