Regarding disply in alv
have few queries on alv
1..i want to colout hte columns of my alv display say the first three columns with one colour and then the next three columns witth another colour and so on.
2.i have just displayed the output on alv and when i am double clicking on any record it is saying <b>Call (PERFORM) to a non-existent routine<b>.
now what i want i sthat is there any way by which i can avoid this thing means if user double clicks on any thing nothing should be done adn it should remain at the list.
3.now i n case i want to have that option where if the user double clicks on any record then it should dispaly the corresonding record like we have in report display at line-selection
is there some thing like that in alv also.
Thanks and Regards
Hi Ashish,
check the below code to solve u r proble...
Just create PF STATUS for the below code and execute it...
*******Declare Data Areas for List Viewer (Begin)***********
TYPE-POOLS: SLIS.
DATA: FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT_LN LIKE LINE OF FIELDCAT,
SORTCAT TYPE SLIS_T_SORTINFO_ALV,
LAYOUT TYPE SLIS_LAYOUT_ALV,
SORTCAT_LN LIKE LINE OF SORTCAT,
EVENTCAT TYPE SLIS_T_EVENT,
EVENTCAT_LN LIKE LINE OF EVENTCAT,
COUNT TYPE I,
COLCELL TYPE SLIS_FIELDNAME VALUE 'MATNR'.
DATA: COL_POS TYPE I,
W_FNAME TYPE DD03L-FIELDNAME.
******Declare Data Areas for List Viewer (End)**************
******Declare Internal Table to Store Selected Data (Begin)*
DATA LS_CELLCOLOR TYPE SLIS_T_SPECIALCOL_ALV WITH HEADER LINE.
DATA: BEGIN OF TSPFLI OCCURS 10 ,
CHECK TYPE SLIS_FIELDNAME,
COLOR(3),
COLCELLS TYPE SLIS_T_SPECIALCOL_ALV.
INCLUDE STRUCTURE SPFLI.
DATA : END OF TSPFLI.
*Declare Internal Table to Store Selected Data (Begin) For sflight*
DATA:
W_SPFLI LIKE LINE OF TSPFLI.
DATA : BEGIN OF FS_SFLIGHT,
CHECK TYPE SLIS_FIELDNAME,
COLOR(3).
INCLUDE STRUCTURE SFLIGHT.
DATA : END OF FS_SFLIGHT.
DATA
T_SFLIGHT LIKE
STANDARD TABLE
OF FS_SFLIGHT.
*Declare Internal Table to Store Selected Data (Begin) For sbook*
DATA:
W_SFLIGHT LIKE LINE OF T_SFLIGHT.
DATA : BEGIN OF FS_SBOOK,
CHECK TYPE SLIS_FIELDNAME.
INCLUDE STRUCTURE SBOOK.
DATA : END OF FS_SBOOK.
DATA
T_SBOOK LIKE
STANDARD TABLE
OF FS_SBOOK.
******Declare Internal Table to Store Selected Data (End)***
*******Select Data into Internal Table (Begin) ***************
SELECT *
INTO CORRESPONDING FIELDS OF TSPFLI
FROM SPFLI.
APPEND TSPFLI.
CLEAR TSPFLI.
ENDSELECT.
Select Data into Internal Table (End) ****************
PERFORM BUILD_FIELDCAT4.
PERFORM BUILD_FIELDCAT6.
PERFORM BUILD_FIELDCAT7.
PERFORM BUILD_LISTCAT.
PERFORM BUILD_EVENTCAT.
PERFORM START_LIST_VIEWER.
*& Form build_fieldcat4
text
FORM BUILD_FIELDCAT4.
FIELDCAT_LN-FIELDNAME = 'CHECK'.
APPEND FIELDCAT_LN TO FIELDCAT.
CLEAR FIELDCAT_LN.
ENDFORM. "BUILD_FIELDCAT4
*& Form build_fieldcat6
text
FORM BUILD_FIELDCAT6.
FIELDCAT_LN-FIELDNAME = 'COLOR'.
FIELDCAT_LN-OUTPUTLEN = 4.
APPEND FIELDCAT_LN TO FIELDCAT.
CLEAR FIELDCAT_LN.
ENDFORM. "build_fieldcat6
*& Form BUILD_FIELDCAT7
text
FORM BUILD_FIELDCAT7.
FIELDCAT_LN-FIELDNAME = 'COLCELLS'.
APPEND FIELDCAT_LN TO FIELDCAT.
CLEAR FIELDCAT_LN.
ENDFORM. "build_fieldcat6
*& Form build_listcat
text
FORM BUILD_LISTCAT.
LAYOUT-BOX_FIELDNAME = 'CHECK'.
LAYOUT-INFO_FIELDNAME = 'COLOR'.
LAYOUT-COLTAB_FIELDNAME = 'COLCELLS'.
ENDFORM. "build_listcat
*& Form BUILD_EVENTCAT
text
FORM BUILD_EVENTCAT.
EVENTCAT_LN-NAME = 'PF_STATUS_SET'.
EVENTCAT_LN-FORM = 'STATUSSET'.
APPEND EVENTCAT_LN TO EVENTCAT.
EVENTCAT_LN-NAME = 'USER_COMMAND'.
EVENTCAT_LN-FORM = 'USERCOMM'.
APPEND EVENTCAT_LN TO EVENTCAT.
ENDFORM. "BUILD_EVENTCAT
*& Form STATUSSET
text
-->RT_EXTAB text
FORM STATUSSET
USING RT_EXTAB TYPE SLIS_T_EXTAB.
DATA
W_EXTAB TYPE SLIS_EXTAB.
CLEAR RT_EXTAB[].
W_EXTAB-FCODE = 'SBOOK'.
APPEND W_EXTAB TO RT_EXTAB.
SET PF-STATUS 'STATUS' EXCLUDING RT_EXTAB.
ENDFORM. "STATUSSET
*& Form START_LIST_VIEWER
text
FORM START_LIST_VIEWER.
DATA: PGM LIKE SY-REPID.
PGM = SY-REPID.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = PGM
i_callback_pf_status_set = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_STRUCTURE_NAME = 'SPFLI'
IS_LAYOUT = LAYOUT
IS_VARIANT = ' '
IT_EVENTS = EVENTCAT
IT_EVENT_EXIT =
TABLES
T_OUTTAB = TSPFLI
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM. "START_LIST_VIEWER
*& Form USERCOMM
text
-->UCOMM text
-->SELFIELD text
FORM USERCOMM USING UCOMM LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
CLEAR FIELDCAT[].
CASE UCOMM.
WHEN 'SFLIGHT'.
CLEAR T_SFLIGHT[].
LOOP AT TSPFLI INTO W_SPFLI.
IF W_SPFLI-CHECK EQ 'X'.
SELECT *
FROM SFLIGHT
APPENDING CORRESPONDING FIELDS OF TABLE T_SFLIGHT
WHERE CARRID = W_SPFLI-CARRID
AND CONNID = W_SPFLI-CONNID.
W_SPFLI-CHECK = '1'.
W_SPFLI-COLOR = 'C21'.
MODIFY TSPFLI FROM W_SPFLI TRANSPORTING CHECK COLOR.
ENDIF.
ENDLOOP.
PERFORM BUILD_FIELDCAT9.
PERFORM BUILD_EVENTCAT1.
PERFORM START_LIST_VIEWER1.
ENDCASE.
SELFIELD-REFRESH = 'X'.
ENDFORM. "USERCOMM
*& Form START_LIST_VIEWER1
text
FORM START_LIST_VIEWER1.
DATA: PGM LIKE SY-REPID.
PGM = SY-REPID.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = PGM
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = 'SFLIGHT'
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FIELDCAT
IT_SORT =
IT_EVENTS = EVENTCAT
TABLES
T_OUTTAB = T_SFLIGHT
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. "START_LIST_VIEWER1
*& Form BUILD_EVENTCAT1
text
FORM BUILD_EVENTCAT1.
CLEAR EVENTCAT[].
EVENTCAT_LN-NAME = 'PF_STATUS_SET'.
EVENTCAT_LN-FORM = 'STATUSSET1'.
APPEND EVENTCAT_LN TO EVENTCAT.
CLEAR EVENTCAT_LN.
EVENTCAT_LN-NAME = 'USER_COMMAND'.
EVENTCAT_LN-FORM = 'USERCOMM1'.
APPEND EVENTCAT_LN TO EVENTCAT.
ENDFORM. "BUILD_EVENTCAT
*& Form STATUSSET1
text
-->RT_EXTAB text
FORM STATUSSET1
USING RT_EXTAB TYPE SLIS_T_EXTAB.
DATA
W_EXTAB TYPE SLIS_EXTAB.
CLEAR RT_EXTAB[].
W_EXTAB-FCODE = 'SFLIGHT'.
APPEND W_EXTAB TO RT_EXTAB.
SET PF-STATUS 'STATUS' EXCLUDING RT_EXTAB.
ENDFORM. "STATUSSET
*.................................USERCOMM1..................
FORM USERCOMM1 USING UCOMM LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
CLEAR FIELDCAT[].
CASE UCOMM.
WHEN 'SBOOK'.
CLEAR T_SBOOK[].
LOOP AT T_SFLIGHT INTO W_SFLIGHT.
IF W_SFLIGHT-CHECK EQ 'X'.
SELECT *
FROM SBOOK
APPENDING CORRESPONDING FIELDS OF TABLE T_SBOOK
WHERE CARRID = W_SFLIGHT-CARRID
AND CONNID = W_SFLIGHT-CONNID
AND FLDATE = W_SFLIGHT-FLDATE.
W_SFLIGHT-CHECK = '1'.
W_SFLIGHT-COLOR = 'C81'.
MODIFY T_SFLIGHT FROM W_SFLIGHT TRANSPORTING CHECK COLOR.
ENDIF.
ENDLOOP.
PERFORM BUILD_FIELDCAT9.
PERFORM BUILD_EVENTCAT2.
PERFORM START_LIST_VIEWER2.
ENDCASE.
SELFIELD-REFRESH = 'X'.
ENDFORM. " USERCOMM1
*& Form BUILD_FIELDCAT9
text
FORM BUILD_FIELDCAT9.
CLEAR FIELDCAT[].
FIELDCAT_LN-FIELDNAME = 'CHECK'.
APPEND FIELDCAT_LN TO FIELDCAT.
CLEAR FIELDCAT_LN.
LAYOUT-BOX_FIELDNAME = 'CHECK'.
ENDFORM. "BUILD_FIELDCAT8
*& Form START_LIST_VIEWER2
text
FORM START_LIST_VIEWER2.
DATA: PGM LIKE SY-REPID.
PGM = SY-REPID.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = PGM
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = 'SBOOK'
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FIELDCAT
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
IT_EVENTS = EVENTCAT
TABLES
T_OUTTAB = T_SBOOK
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. "START_LIST_VIEWER1
*& Form BUILD_EVENTCAT2
text
FORM BUILD_EVENTCAT2.
CLEAR EVENTCAT[].
EVENTCAT_LN-NAME = 'PF_STATUS_SET'.
EVENTCAT_LN-FORM = 'STATUSSET2'.
APPEND EVENTCAT_LN TO EVENTCAT.
ENDFORM. "BUILD_EVENTCAT
*& Form STATUSSET1
text
-->RT_EXTAB text
FORM STATUSSET2
USING RT_EXTAB TYPE SLIS_T_EXTAB.
DATA
W_EXTAB TYPE SLIS_EXTAB.
CLEAR RT_EXTAB[].
W_EXTAB-FCODE = 'SFLIGHT'.
APPEND W_EXTAB TO RT_EXTAB.
W_EXTAB-FCODE = 'SBOOK'.
APPEND W_EXTAB TO RT_EXTAB.
SET PF-STATUS 'STATUS' EXCLUDING RT_EXTAB.
ENDFORM. "STATUSSET
Reward points if it is helpful...
Regards,
Omkar.
Message was edited by:
Omkaram Yanamala
Similar Messages
-
Hi all,
I am using alv to display Currency fields in a tax return report.........I want to display the sum of a perticular column or all the columns when i press the total button from alv selecting the required columns. But its coming only for first two columns not for all. Please help.
Regards.Hi,
This ALV program have all the basic report requirements such as page heading, page no, sub-total and a grand total.
* This is a basic ALV with the followings:-
* - Page Heading
* - Page No
* - Sub-Total
* - Grand Total
REPORT ZALV.
TYPE-POOLS: SLIS.
DATA: G_REPID LIKE SY-REPID,
GS_PRINT TYPE SLIS_PRINT_ALV,
GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
GT_EVENTS TYPE SLIS_T_EVENT,
GT_SORT TYPE SLIS_T_SORTINFO_ALV,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT_LN LIKE LINE OF GT_FIELDCAT,
COL_POS TYPE I.
DATA: BEGIN OF ITAB,
FIELD1(5) TYPE C,
FIELD2(5) TYPE C,
FIELD3(5) TYPE P DECIMALS 2,
END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA: END OF ITAB1.
DATA: BEGIN OF ITAB_FIELDCAT OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA: END OF ITAB_FIELDCAT.
* Print Parameters
PARAMETERS:
P_PRINT AS CHECKBOX DEFAULT ' ', "PRINT IMMEDIATE
P_NOSINF AS CHECKBOX DEFAULT 'X', "NO SELECTION INFO
P_NOCOVE AS CHECKBOX DEFAULT ' ', "NO COVER PAGE
P_NONEWP AS CHECKBOX DEFAULT ' ', "NO NEW PAGE
P_NOLINF AS CHECKBOX DEFAULT 'X', "NO PRINT LIST INFO
P_RESERV TYPE I. "NO OF FOOTER LINE
INITIALIZATION.
G_REPID = SY-REPID.
PERFORM PRINT_BUILD USING GS_PRINT. "Print PARAMETERS
START-OF-SELECTION.
* TEST DATA
MOVE 'TEST1' TO ITAB1-FIELD1.
MOVE 'TEST1' TO ITAB1-FIELD2.
MOVE '10.00' TO ITAB1-FIELD3.
APPEND ITAB1.
MOVE 'TEST2' TO ITAB1-FIELD1.
MOVE 'TEST2' TO ITAB1-FIELD2.
MOVE '20.00' TO ITAB1-FIELD3.
APPEND ITAB1.
DO 50 TIMES.
APPEND ITAB1.
ENDDO.
END-OF-SELECTION.
PERFORM BUILD.
PERFORM EVENTTAB_BUILD CHANGING GT_EVENTS.
PERFORM COMMENT_BUILD CHANGING GT_LIST_TOP_OF_PAGE.
PERFORM CALL_ALV.
FORM BUILD.
* DATA FIELD CATALOG
* Explain Field Description to ALV
DATA: FIELDCAT_IN TYPE SLIS_FIELDCAT_ALV.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD1'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
*FIELDCAT_LN-NO_OUT = 'X'. "FIELD NOT DISPLAY, CHOOSE FROM LAYOUT
FIELDCAT_LN-KEY = ' '. "SUBTOTAL KEY
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'HEAD1'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD2'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
FIELDCAT_LN-NO_OUT = 'X'.
FIELDCAT_LN-SELTEXT_L = 'HEAD2'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD3'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
FIELDCAT_LN-REF_FIELDNAME = 'MENGE'. "<- REF FIELD IN THE DICTIONNARY
FIELDCAT_LN-REF_TABNAME = 'MSEG'. "<- REF TABLE IN THE DICTIONNARY
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-DO_SUM = 'X'. "SUM UPON DISPLAY
APPEND FIELDCAT_LN TO GT_FIELDCAT.
* DATA SORTING AND SUBTOTAL
DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD1'.
GS_SORT-SPOS = 1.
GS_SORT-UP = 'X'.
GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD2'.
GS_SORT-SPOS = 2.
GS_SORT-UP = 'X'.
*GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
ENDFORM.
FORM CALL_ALV.
* ABAP List Viewer
CALL FUNCTION 'REUSE_ALV_LIST_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 = ' '
I_STRUCTURE_NAME = 'ITAB1'
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = GT_FIELDCAT[]
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
IT_SORT = GT_SORT[]
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
IT_EVENTS = GT_EVENTS[]
* IT_EVENT_EXIT =
IS_PRINT = GS_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 = ITAB1
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM.
* HEADER FORM
FORM EVENTTAB_BUILD CHANGING LT_EVENTS TYPE SLIS_T_EVENT.
CONSTANTS:
GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
*GC_FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE'.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = LT_EVENTS.
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
* define END_OF_PAGE event
* READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_END_OF_PAGE
* INTO LS_EVENT.
* IF SY-SUBRC = 0.
* MOVE GC_FORMNAME_END_OF_PAGE TO LS_EVENT-FORM.
* APPEND LS_EVENT TO LT_EVENTS.
* ENDIF.
ENDFORM.
FORM COMMENT_BUILD CHANGING GT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
DATA: GS_LINE TYPE SLIS_LISTHEADER.
CLEAR GS_LINE.
GS_LINE-TYP = 'H'.
GS_LINE-INFO = 'HEADER 1'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
CLEAR GS_LINE.
GS_LINE-TYP = 'S'.
GS_LINE-KEY = 'STATUS 1'.
GS_LINE-INFO = 'INFO 1'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
GS_LINE-KEY = 'STATUS 2'.
GS_LINE-INFO = 'INFO 2'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
* CLEAR GS_LINE.
* GS_LINE-TYP = 'A'.
* GS_LINE-INFO = 'ACTION'.
* APPEND GS_LINE TO GT_TOP_OF_PAGE.
ENDFORM.
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
WRITE: SY-DATUM, 'Page No', SY-PAGNO LEFT-JUSTIFIED.
ENDFORM.
FORM END_OF_PAGE.
WRITE at (sy-linsz) sy-pagno CENTERED.
ENDFORM.
* PRINT SETTINGS
FORM PRINT_BUILD USING LS_PRINT TYPE SLIS_PRINT_ALV.
LS_PRINT-PRINT = P_PRINT. "PRINT IMMEDIATE
LS_PRINT-NO_PRINT_SELINFOS = P_NOSINF. "NO SELECTION INFO
LS_PRINT-NO_COVERPAGE = P_NOCOVE. "NO COVER PAGE
LS_PRINT-NO_NEW_PAGE = P_NONEWP.
LS_PRINT-NO_PRINT_LISTINFOS = P_NOLINF. "NO PRINT LIST INFO
LS_PRINT-RESERVE_LINES = P_RESERV.
ENDFORM.
*END OF ZALV PROGRAM
Regards
Sudheer -
Regarding the simple ALV report
Hi All,
I created the simple code for disply of the alv report the code is provided below,but the output is showing only the column heading not the data in the grid, i won't came to know where the problem is please find the problem in the code.
Regards
Sai
********sample code**********
type-pools : slis.
data : b_display type slis_t_fieldcat_alv,
w_display type slis_fieldcat_alv.
data : begin of itab_display occurs 0,
kunnr type kna1-kunnr,
name1 type kna1-name1,
end of itab_display.
data : gd_repid like sy-repid.
itab_display-name1 = 'ram'.
itab_display-kunnr = '10000033242'.
append itab_display.
clear itab_display.
itab_display-name1 = 'sai'.
itab_display-kunnr = '10000033243'.
append itab_display.
clear itab_display.
w_display-col_pos = 0.
w_display-fieldname = 'name1'.
w_display-seltext_m = 'name'.
append w_display to b_display.
clear w_display.
w_display-col_pos = 1.
w_display-fieldname = 'kunnr'.
w_display-seltext_m = 'cus.no'.
append w_display to b_display.
clear w_display.
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = gd_repid
IT_FIELDCAT = b_display[]
I_SAVE = 'X'
TABLES
t_outtab = itab_display.Hi,
Please use the following code.
type-pools : slis.
data : b_display type slis_t_fieldcat_alv,
w_display type slis_fieldcat_alv.
data : begin of itab_display occurs 0,
kunnr type kna1-kunnr,
name1 type kna1-name1,
end of itab_display.
data : gd_repid like sy-repid.
itab_display-name1 = 'ram'.
itab_display-kunnr = '10000033242'.
append itab_display.
clear itab_display.
itab_display-name1 = 'sai'.
itab_display-kunnr = '10000033243'.
append itab_display.
clear itab_display.
w_display-col_pos = 0.
w_display-fieldname = 'NAME1'.
w_display-tabname = ITAB_DISPLAY.
w_display-seltext_m = 'Name'.
w_display-ddictxt = 'M'.
append w_display to B_DISPLAY.
w_display-col_pos = 1.
w_display-fieldname = 'KUNNR'.
w_display-tabname = ITAB_DISPLAY.
w_display-seltext_m = 'cus.no'.
w_display-ddictxt = 'M'.
append w_display to B_DISPLAY.
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = gd_repid
IT_FIELDCAT = b_display[]
I_SAVE = 'X'
TABLES
t_outtab = itab_display[].
Regards,
Sankar. -
Regarding Vendor wise ALV Display
Dear All,
I am working on a report which has different fields like vendor , Doc No., Date, Amount. I am able to display all these fields for all the vendors in single alv grid. I want the report to display all these fields vendor wise in diffent Alv grid. Foe e.g.,
Vendor Code: 111111
Vendor Name : xyz ltd.
Doc no . Date Amount
11 01.05.2010 50000
12 02.05.2010 10000
Vendor Code: 222222
Vendor Name : pqr ltd.
Doc no . Date Amount
13 03.05.2010 5000
14 04.05.2010 1000
Pls, suggest any good Solutions.
Thanks & Regards,
Sandip SonarThank U sandeep,
But I want the list for all the vendors entered in selection-screen.
Thanks again,
Sandip Sonar -
Regarding downloading from alv report o/p to excel sheet
Hi gurus,
When i am trying to download the alv output to excel sheet it is downloading only titles, No data is getting displayed in it.No data is getting downloaded.
Thnaks in advance.Hi,
What are the steps you do to download ALV to excel? We need to replicate the case in order to find answer.
Regards,
Teddy Kurniawan -
Hi Everyone,
I want to print a logo in the alv grid display.
I have used the "reuse_alv_commentary_write" fm.
The logo is also displaying at the right top corner.
But I want to get it printed at the left top corner.
please give me a solution. this is urgent
With Thanks and Best Regards
V.RavishankarHi Ravi,
You can do that. Try like this,
Concatenate the Logo name with ASCII values of the Spaces following it(LOGO NAME) and put it in an Field which you are going to pass to that function Module <b>reuse_alv_commentary_write[\b]. ASCII Value for Space can be entered as ALT+255. place around five to 10 spaces and then try it must work i hope.
Thanks and Regards,
Prashanth -
Regarding Headings in AlV.
Hi,
I have a requirement where the headings for a ALV display have to be in 2 or 3 rows.For an e.g. Posting Date must be as Posting and Customer name as
Date
Customer
Name
Is it possible to do this in ALV?I tried using row value while building the fieldcatalog but it did not work.
Please suggest me some ways to do this.Its urgent.
Thanks,
Sandeep.Hi Dude,
For first header
wa_hader-type = 'H'.
wa_hader-info = 'Main Headding'.
append wa_heaer to it_header.
For Sub header
wa_hader-type = 'S'.
wa_hader-info = Sub Headding1.
append wa_heaer to it_header.
Finally call the function module
Reuse_Alv_commentray_write function module
then pass the parameter
exporting
it_list_commentary = it_header.
Try this
Hope it will work....
Thanks & Regards
Ramakrishna Pathi -
Regarding downloading the ALV tree to excel
I have prepared a report in which the ouput will be in ALV tree format. Now i want to download the tree to excel file. If anyone can help me out i'll be very thankful.
Regards,
RohitashHi
Use the FM - ALV_XXL_CALL. here is the sample -
REPORT ZSKC_ALV_XXL.
TYPE-POOLS : KKBLO.
DATA : ITAB LIKE T100 OCCURS 0,
T_FCAT_LVC TYPE LVC_S_FCAT OCCURS 0 WITH HEADER LINE,
T_FCAT_KKB TYPE KKBLO_T_FIELDCAT.
START-OF-SELECTION.
Get data.
SELECT * UP TO 20 ROWS
FROM T100
INTO TABLE ITAB
WHERE SPRSL = SY-LANGU.
CHECK SY-SUBRC EQ 0.
Create the field catalog.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = 'T100'
CHANGING
CT_FIELDCAT = T_FCAT_LVC[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
CHECK SY-SUBRC EQ 0.
make sure you pass the correct internal table name in the field catalog.
t_fcat_lvC-tabname = 'ITAB'.
MODIFY T_FCAT_LVC TRANSPORTING TABNAME WHERE TABNAME NE SPACE.
Transfer to KKBLO format.
CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO'
EXPORTING
IT_FIELDCAT_LVC = T_FCAT_LVC[]
IMPORTING
ET_FIELDCAT_KKBLO = T_FCAT_KKB
EXCEPTIONS
IT_DATA_MISSING = 1
IT_FIELDCAT_LVC_MISSING = 2
OTHERS = 3.
CHECK SY-SUBRC EQ 0.
Call XXL.
CALL FUNCTION 'ALV_XXL_CALL'
EXPORTING
I_TABNAME = 'ITAB'
IT_FIELDCAT = T_FCAT_KKB
TABLES
IT_OUTTAB = ITAB[]
EXCEPTIONS
FATAL_ERROR = 1
NO_DISPLAY_POSSIBLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
ENDIF. -
Regarding POP-UP ALV..
Hi..
How can display the data in POP-UP using ALV.
If I clicked on purchase order number , then I want to display Item data in POP-UP ALV.
Which function module I can use.
If any one is having sample code.
Please send me.
Regards
Sandeep.sandeep,
Step 1:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = ws_repid
i_callback_user_command = 'USER_COMMAND'
is_layout = gs_layout
it_fieldcat = i_fcat
TABLES
t_outtab = i_final.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
READ TABLE i_final INTO i_final INDEX rs_selfield-
tabindex.
Here you will get the seleted po number in internal table
i_final.
based on i_final-purchase order number
select item data into one more internal table
and again declare field catelog for your popup.
and use again below FM
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = ws_repid
i_callback_user_command = 'USER_COMMAND'
is_layout = gs_layout
it_fieldcat = i_fcat
TABLES
t_outtab = new_internal table item data.
Don't forget to reward if useful.....
ENDCASE.
ENDFORM. "user_command -
Hi all,
Please clarify this query of mine in alv.
I am displaying an output in ALV format which has 10 rows.
I want to add a eleventh row to the above output .
The eleventh row must contain the sum of the above 10 rows .
Please guide me how to achieve this.
Kindly reply as fast as possible.
Regards,
VijayHi,
see following code :
REPORT ZALVTEST1 .
TYPE-POOLS: SLIS.
Data: v_temp type p decimals 2.
Data: v_f1_sum type i,
v_f2_sum type i.
dATA: BEGIN OF struct_customer,
CUSTOMER LIKE KNA1-KUNNR,
FIELD1 TYPE I,
FIELD2 TYPE I,
field3 type i,
END OF struct_customer.
DATA: I_LAYOUT TYPE SLIS_LAYOUT_ALV,
I_FIELDTAB TYPE SLIS_T_FIELDCAT_ALV,
I_HEADING TYPE SLIS_T_LISTHEADER,
I_EVENTS TYPE SLIS_T_EVENT.
DATA: RS_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA: V_CUST TYPE KNA1-KUNNR.
DATA: BEGIN OF ITAB OCCURS 0,
CUSTOMER LIKE KNA1-KUNNR,
FIELD1 TYPE I,
FIELD2 TYPE I,
field3 type i,
END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 0,
CUSTOMER LIKE KNA1-KUNNR,
FIELD1 TYPE I,
FIELD2 TYPE I,
field3 type i,
END OF ITAB1.
DATA: FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
DATA: FORMNAME_SUBTOTAL_TEXT TYPE SLIS_FORMNAME VALUE 'SUBTOTAL_TEXT'.
DATA: FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE'.
DATA: FORMNAME_END_OF_LIST TYPE SLIS_FORMNAME VALUE 'END_OF_LIST'.
DATA: FORMNAME_AFTER_LINE_OUTPUT TYPE SLIS_FORMNAME VALUE 'LINE_OUTPUT'.
START-OF-SELECTION.
PERFORM FILL_ITAB.
PERFORM FILL_CAT.
PERFORM SET_SORT.
PERFORM FILL_EVENT.
PERFORM DISPLAY_DATA.
END-OF-SELECTION.
*& Form FILL_ITAB
text
--> p1 text
<-- p2 text
FORM FILL_ITAB .
DATA: L_CTR TYPE I.
ITAB-CUSTOMER = 1.ITAB-FIELD1 = 1.ITAB-FIELD2 = 2.APPEND ITAB.
CLEAR ITAB.
ITAB-CUSTOMER = 2.ITAB-FIELD1 = 3.ITAB-FIELD2 = 4.APPEND ITAB.
CLEAR ITAB.
ITAB-CUSTOMER = 3.ITAB-FIELD1 = 2.ITAB-FIELD2 = 5.APPEND ITAB.
CLEAR ITAB.
ITAB-CUSTOMER = 4.ITAB-FIELD1 = 1.ITAB-FIELD2 = 10.APPEND ITAB.
CLEAR ITAB.
LOOP AT ITAB.
v_temp = itab-field1 / itab-field2.
itab-field3 = v_temp * 100.
modify itab.
V_f1_sum = v_f1_sum + itab-field1.
V_f2_sum = v_f2_sum + itab-field2.
ENDLOOP.
ENDFORM. " FILL_ITAB
*& Form FILL_CAT
text
--> p1 text
<-- p2 text
FORM FILL_CAT .
DATA: L_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
CLEAR L_FIELDCAT.
L_FIELDCAT-COL_POS = 1.
L_FIELDCAT-TABNAME = 'ITAB'.
L_FIELDCAT-FIELDNAME = 'CUSTOMER'.
L_FIELDCAT-REF_TABNAME = 'KNA1'.
L_FIELDCAT-REF_FIELDNAME = 'KUNNR'.
L_FIELDCAT-KEY = 'X'.
APPEND L_FIELDCAT TO I_FIELDTAB.
CLEAR L_FIELDCAT.
CLEAR L_FIELDCAT.
L_FIELDCAT-COL_POS = 3.
L_FIELDCAT-TABNAME = 'ITAB'.
L_FIELDCAT-FIELDNAME = 'FIELD1'.
L_FIELDCAT-DO_SUM = 'X'.
L_FIELDCAT-No_zero = 'X'.
L_FIELDCAT-seltext_l ='VALUE1'.
L_FIELDCAT-seltext_M ='VALUE1'.
L_FIELDCAT-seltext_S ='VALUE1'.
L_FIELDCAT-KEY = 'X'.
APPEND L_FIELDCAT TO I_FIELDTAB.
CLEAR L_FIELDCAT.
L_FIELDCAT-COL_POS = 4.
L_FIELDCAT-TABNAME = 'ITAB'.
L_FIELDCAT-FIELDNAME = 'FIELD2'.
L_FIELDCAT-DO_SUM = 'X'.
L_FIELDCAT-No_zero = 'X'.
L_FIELDCAT-seltext_l ='VALUE2'.
L_FIELDCAT-seltext_M ='VALUE2'.
L_FIELDCAT-seltext_S ='VALUE2'.
L_FIELDCAT-KEY = 'X'.
APPEND L_FIELDCAT TO I_FIELDTAB.
CLEAR L_FIELDCAT.
L_FIELDCAT-COL_POS = 5.
L_FIELDCAT-TABNAME = 'ITAB'.
L_FIELDCAT-FIELDNAME = 'FIELD3'.
L_FIELDCAT-DO_SUM = 'X'.
L_FIELDCAT-No_zero = 'X'.
L_FIELDCAT-seltext_l ='VALUE3'.
L_FIELDCAT-seltext_M ='VALUE3'.
L_FIELDCAT-seltext_S ='VALUE3'.
APPEND L_FIELDCAT TO I_FIELDTAB.
ENDFORM. " FILL_CAT
*& Form DISPLAY_DATA
text
--> p1 text
<-- p2 text
FORM DISPLAY_DATA .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'ZALVTEST2'
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = I_FIELDTAB
I_DEFAULT = 'X'
I_SAVE = ' '
IT_EVENTS = I_EVENTS[]
TABLES
T_OUTTAB = 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. " DISPLAY_DATA
*& Form SET_SORT
text
--> p1 text
<-- p2 text
FORM SET_SORT .
I_LAYOUT-ZEBRA = 'X'.
DATA: LS_SORT TYPE SLIS_SORTINFO_ALV.
CLEAR LS_SORT.
LS_SORT-SPOS = 1.
LS_SORT-FIELDNAME = 'CUSTOMER'.
LS_SORT-TABNAME = 'ITAB'.
LS_SORT-UP = 'X'.
APPEND LS_SORT TO RS_SORT.
ENDFORM. " SET_SORT
*& Form FILL_EVENT
text
--> p1 text
<-- p2 text
FORM FILL_EVENT .
DATA: L_I_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = I_EVENTS.
READ TABLE I_EVENTS WITH KEY NAME = SLIS_EV_AFTER_LINE_OUTPUT
INTO L_I_EVENT.
IF SY-SUBRC = 0.
MOVE FORMNAME_AFTER_LINE_OUTPUT TO L_I_EVENT-FORM.
MODIFY I_EVENTS FROM L_I_EVENT INDEX SY-TABIX.
ENDIF.
ENDFORM. " FILL_EVENT
*& Form AFTER_LINE_OUTPUT
text
FORM LINE_OUTPUT using RS_LINEINFO TYPE SLIS_LINEINFO.
DATA: L_TABIX LIKE SY-TABIX.
DATA: L_TABIX1 LIKE SY-TABIX.
data: str_kunnr like struct_customer.
check RS_LINEINFO-tabindex ne 0.
L_TABIX = RS_LINEINFO-tabindex.
read table itab index l_tabix.
l_tabix1 = RS_LINEINFO-tabindex + 1.
struct_customer-customer = itab-customer.
read table itab into str_kunnr index l_tabix1 transporting customer.
if sy-subrc <> 0.
v_temp = ( v_f1_sum / v_f2_sum ) * 100.
uline at (45).
skip.
uline at (45).
write: / sy-vline , 'Total',
12 sy-vline , (9) v_f1_sum,
23 sy-vline , (9) v_f2_sum,
34 sy-vline , (9) v_temp decimals 0,
45 sy-vline.
*uline at (46).
endif.
ENDFORM. " AFTER_LINE_OUTPUT
Reward points if helpful.
Regards.
Srikanta Gope -
Regarding button on alv screen
IN the alv grid output i hav to fix the button if user click that button the file has to downloaded how? using function code &ZDL
Hello,
The Download Functionality is provided by SAP Itself .There is no need for u to handle it explicitly.
But for ur Functionality refer this
*& Report Z_82235_ALV_OOPS_PUSTBUTTON *
report z_82235_alv_oops_pustbutton .
tables: mara.
types: begin of t_mara,
matnr type matnr,
mtart type mtart,
matkl type matkl,
meins type meins,
end of t_mara.
data: gt_mara type standard table of t_mara,
gs_mara like line of gt_mara.
class lcl_event_receiver definition deferred.
*-- Global Data defenation for ALV
*---Alv Grid instance referance
data : gr_alvgrid type ref to cl_gui_alv_grid,
event_receiver type ref to lcl_event_receiver.
*---Name of the custom control added on the screen
data gc_custom_control_name type scrfname value 'CC_ALV'
*---Custom container instance referance
data: gr_ccontainer type ref to cl_gui_custom_container.
*---Field catalog table
data: gt_fieldcat type lvc_t_fcat,
gs_fieldcat type lvc_s_fcat.
*---Layout structure
data: gs_layout type lvc_s_layo.
data: g_repid like sy-repid.
select matnr
mtart
matkl
meins
from mara into table gt_mara
up to 25 rows.
g_repid = sy-repid.
include <icon>.
* Predefine a local class for event handling to allow the
* declaration of a reference variable before the class is defined.
* Set initial dynpro
set screen 100.
* LOCAL CLASSES: Definition
*===============================================================
* class lcl_event_receiver: local class to
* define and handle own functions.
* Definition:
* ~~~~~~~~~~~
class lcl_event_receiver definition.
public section.
methods:
handle_toolbar
for event toolbar of cl_gui_alv_grid
importing e_object e_interactive,
handle_user_command
for event user_command of cl_gui_alv_grid
importing e_ucomm.
private section.
endclass.
* lcl_event_receiver (Definition)
*===============================================================
* LOCAL CLASSES: Implementation
*===============================================================
* class lcl_event_receiver (Implementation)
class lcl_event_receiver implementation.
method handle_toolbar.
* § 2.In event handler method for event TOOLBAR: Append own functions
* by using event parameter E_OBJECT.
data: ls_toolbar type stb_button.
* E_OBJECT of event TOOLBAR is of type REF TO CL_ALV_EVENT_TOOLBAR_SET.
* This class has got one attribute, namly MT_TOOLBAR, which
* is a table of type TTB_BUTTON. One line of this table is
* defined by the Structure STB_BUTTON (see data deklaration above).
* A remark to the flag E_INTERACTIVE:
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* 'e_interactive' is set, if this event is raised due to
* the call of 'set_toolbar_interactive' by the user.
* You can distinguish this way if the event was raised
* by yourself or by ALV
* (e.g. in method 'refresh_table_display').
* An application of this feature is still unknown... :-)
* append a separator to normal toolbar
clear ls_toolbar.
move 3 to ls_toolbar-butn_type.
append ls_toolbar to e_object->mt_toolbar.
* append an icon to download
clear ls_toolbar.
ls_toolbar-function = 'DOWN'.
ls_toolbar-icon = 'icon_generate'.
ls_toolbar-quickinfo = 'DOWNLOAD FILE'.
ls_toolbar-text = 'DOWNLOAD FILE'.
* MOVE ' ' TO ls_toolbar-disabled.
append ls_toolbar to e_object->mt_toolbar.
endmethod.
method handle_user_command.
* § 3.In event handler method for event USER_COMMAND: Query your
* function codes defined in step 2 and react accordingly.
data: lt_rows type lvc_t_row.
case e_ucomm.
when 'DOWN'.
call function 'GUI_DOWNLOAD'
exporting
* BIN_FILESIZE =
filename = 'D:a.txt'
* FILETYPE = 'ASC'
* APPEND = ' '
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
tables
data_tab = gt_mara
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.
endcase.
endmethod. "handle_user_command
endclass.
* lcl_event_receiver (Implementation)
*===================================================================
* S T A R T - O F - S E L E C T I O N.
start-of-selection.
set screen '100'.
*& Module display_alv OUTPUT
* text
module display_alv output.
if gr_alvgrid is initial.
*---Creating custom container instance
create object gr_ccontainer
exporting
container_name = gc_custom_control_name
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.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
*---Creating ALV gris instance
create object gr_alvgrid
exporting
i_parent = gr_ccontainer
i_appl_events = 'X'
exceptions
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
*---Prepare field catalog
perform prepare_field_catalog tables gt_fieldcat.
*---Prepare layout
perform prepare_layout changing gs_layout.
*---Call ALV grid
call method gr_alvgrid->set_table_for_first_display
exporting
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
* I_STRUCTURE_NAME =
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
is_layout = gs_layout
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO =
changing
it_outtab = gt_mara[]
it_fieldcatalog = gt_fieldcat
* IT_SORT =
* IT_FILTER =
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
* ->Create Object to receive events and link them to handler methods.
* When the ALV Control raises the event for the specified instance
* the corresponding method is automatically called.
create object event_receiver.
set handler event_receiver->handle_user_command for gr_alvgrid.
set handler event_receiver->handle_toolbar for gr_alvgrid.
* § 4.Call method 'set_toolbar_interactive' to raise event TOOLBAR.
call method gr_alvgrid->set_toolbar_interactive.
* endif. "IF grid1 IS INITIAL
* call method cl_gui_control=>set_focus exporting control = gr_alvgrid.
*--- the instance is present
else .
call method gr_alvgrid->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
exceptions
finished = 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.
endif.
endmodule. " display_alv OUTPUT
*& Form prepare_field_catalog
* text
* <--P_GT_FIELDCAT text
form prepare_field_catalog tables gt_fieldcat.
clear : gs_fieldcat.
gs_fieldcat-fieldname = 'MATNR'.
gs_fieldcat-col_pos = 1.
gs_fieldcat-emphasize = 'X'.
gs_fieldcat-outputlen = 10.
gs_fieldcat-coltext = 'Material No'.
gs_fieldcat-edit = 'X'.
append gs_fieldcat to gt_fieldcat.
clear : gs_fieldcat.
gs_fieldcat-fieldname = 'MTART'.
gs_fieldcat-col_pos = 2.
gs_fieldcat-outputlen = 6.
gs_fieldcat-coltext = 'Material Type'.
append gs_fieldcat to gt_fieldcat.
clear : gs_fieldcat.
gs_fieldcat-fieldname = 'MATKL'.
gs_fieldcat-col_pos = 3.
gs_fieldcat-outputlen = 5.
gs_fieldcat-coltext = 'Material Grp'.
append gs_fieldcat to gt_fieldcat.
clear : gs_fieldcat.
gs_fieldcat-fieldname = 'MEINS'.
gs_fieldcat-col_pos = 4.
gs_fieldcat-outputlen = 4.
gs_fieldcat-coltext = 'Unit'.
append gs_fieldcat to gt_fieldcat.
endform. " prepare_field_catalog
*& Form prepare_layout
* text
* <--P_GS_LAYOUT text
form prepare_layout changing p_gs_layout type lvc_s_layo.
p_gs_layout-zebra = 'X'.
p_gs_layout-grid_title = 'Material'.
p_gs_layout-smalltitle = 'X'.
endform. " prepare_layout
*& Module STATUS_0100 OUTPUT
* text
module status_0100 output.
set pf-status 'STATUS1'.
* SET TITLEBAR 'xxx'.
endmodule. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
module user_command_0100 input.
case sy-ucomm.
when 'BACK' or 'UP' or 'CANCEL'.
leave program.
when '&DETAIL'.
leave program.
endcase.
endmodule. " USER_COMMAND_0100 INPUT
Regards,
Deepu.K -
Regarding CehckBox at ALV header
Hi,
know that we can have checkbox in column in ALV by using class CL_SALV_WD_UIE_CHECKBOX.
But want to have CheckBox at ALV header like we can have button by using class CL_SALV_WD_FE_BUTTON.
Is it possible to have CheckBox at ALV header.
If yes than how?
Thanks & Regards,
ArvindUnfortunately, I don't see any class for Checkbox
CL_SALV_WD_FE_A_BUTTON
CL_SALV_WD_FE_A_BUTTON_CHOICE
CL_SALV_WD_FE_A_CAPTION
CL_SALV_WD_FE_A_DRDN_BY_INDEX
CL_SALV_WD_FE_A_DRDN_BY_KEY
CL_SALV_WD_FE_A_DROPDOWN
CL_SALV_WD_FE_A_INPUT
CL_SALV_WD_FE_A_LINK
CL_SALV_WD_FE_A_TOGGLE
CL_SALV_WD_FE_A_TOGGLE_BUTTON
CL_SALV_WD_FE_BUTTON
CL_SALV_WD_FE_BUTTON_CHOICE
CL_SALV_WD_FE_DROPDOWN_BY_IDX
CL_SALV_WD_FE_DROPDOWN_BY_KEY
CL_SALV_WD_FE_INPUT_FIELD
CL_SALV_WD_FE_INTERACTIVE
CL_SALV_WD_FE_LINK_TO_ACTION
CL_SALV_WD_FE_LINK_TO_URL
CL_SALV_WD_FE_SEPARATOR
CL_SALV_WD_FE_TOGGLE_BUTTON -
Regarding output using alv grid display
Hi experts,
i have a program
FS_TAB1-A = P_T1.
IF P_T1 = 0.
TEMP1 = 1.
DO TEMP1 TIMES.
FS_TAB1-A = P_T1 * DUMMY1.
APPEND FS_TAB1 TO T_TAB1.
DUMMY1 = DUMMY1 + 1.
ENDDO.
now i have to diplay the p_t1*dummy1 using alv grid display like it goes into thew loop for ten times then i have to show it 10 times like
10 1 102 103 104 111 112 like that can u help mehi,
you have to get the result of the multiplication at each row and then concatenate the result and the factor to show the final result in multiples value and multiplication factor... -
Regarding Filter in ALV display
Hi Experts,
I have a problem wih the filter option of the ALV. if choose the date field for filtering it shows the message "Correct the distance (2) between "." and "." or "." and ","" when given for docu number it shows as "Entry is too long: Only 8 digits are allowed in the whole number part" can you help me????
please provide any solution for this issueHi,
Declare the date field as sy-datum in the internal table.
In field catalog give it is DATS.
This will solve your problem.
Reward if helpful. -
Regarding events in alv reports
Dear Friends,
Sorry for this post, Events not triggering in alv reports. There is no errors and no warnings.I am using interactive reports. Please tell me where could be i went wrong. It is displaying basic list information but with out events triggering.Hi,
go through the following piece of code..........
*& Form EVENT_CALL
we get all events - TOP OF PAGE or USER COMMAND in table v_events
FORM EVENT_CALL.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_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.
ENDFORM. "EVENT_CALL
*& Form POPULATE_EVENT
Events populated for TOP OF PAGE & USER COMAND
FORM POPULATE_EVENT.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-FORM.
ENDIF.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'USER_COMMAND'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-NAME.
ENDIF.
ENDFORM. "POPULATE_EVENT
FORM DISPLAY_ALV_REPORT.
V_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_GRID_TITLE = I_TITLE_EKKO
I_GRID_SETTINGS =
IS_LAYOUT = ALV_LAYOUT
IT_FIELDCAT = I_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
i_default = 'ZLAY1'
I_SAVE = 'A'
is_variant = i_variant
IT_EVENTS = V_EVENTS
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 TOP_OF_PAGE
text
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LISTHEADER
i_logo =
I_END_OF_LIST_GRID =
ENDFORM. "TOP_OF_PAGE
*& Form USER_COMMAND
text
-->R_UCOMM text
-->, text
-->RS_SLEFIELDtext
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
PERFORM BUILD_FIELDCATLOG_EKPO.
PERFORM EVENT_CALL_EKPO.
PERFORM POPULATE_EVENT_EKPO.
PERFORM DATA_RETRIEVAL_EKPO.
PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
PERFORM DISPLAY_ALV_EKPO.
ENDCASE.
ENDFORM. "user_command
*& Form event_call_ekpo
we get all events - TOP OF PAGE or USER COMMAND in table v_events
FORM EVENT_CALL_EKPO.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_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.
ENDFORM. "event_call_ekpo
*& Form POPULATE_EVENT
Events populated for TOP OF PAGE & USER COMAND
FORM POPULATE_EVENT_EKPO.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-FORM.
ENDIF.
ENDFORM. "POPULATE_EVENT
*& Form TOP_OF_PAGE
text
FORM F_TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LISTHEADER
i_logo =
I_END_OF_LIST_GRID =
ENDFORM. "TOP_OF_PAGE
Thanks
Ashu
Maybe you are looking for
-
Ipod suddenly in recovery mode, No Itunes
Hi guys I´m traveling throughout South America, Currently in Argentina. Today my Ipod touch´s battery drained, but unlike previous times, when i connected the charger, the itunes shows the Connect to Ites logo. I'm on the road, using Internet Cafe an
-
HT4847 can't open preferences because iCloud window won't close
hi , im new to macs , very new , and im trying to open my preferences but when i do , i get a window with icloud , that wont close , it just shows the orange light , no green , no red , just orange . and when i do press the orange option it just puts
-
I looked up MovieClipLoader tutorials and finally came up with the code: var myMCL:MovieClipLoader = new MovieClipLoader(); var loadListener:Object = new Object(); myMCL.addListener(loadListener); loadListener.onLoadProgress = function(target_mc:Movi
-
OS X 10.5.8 unexpectedly quits when computer is shut
I just updated my computer to 10.5.8 last night and since then whenever I close my macbook OS X decides to quit. I have a first generation macbook a 1.83 GHz intel core duo, 1 GB of RAM and a 60 gig hard drive. Any information on how to resolve the i
-
Is every Digital Camera RAW Compatibility Update necessary?
Knowledge base doc (http://support.apple.com/kb/HT3825) says "Mac OS X v10.6 Snow Leopard provides system-level support for digital camera RAW formats." so I assume a system update includes Digital Camera RAW Combatibility updates. Before I updated