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
Similar Messages
-
How to add the double headings in Alv Report.
Hi All,
Plz suggest me how to add the double headings in ALv Report.
RamHi,
Try out this program....
REPORT ypm_historycard_rep.
TYPE-POOLS : slis.
DATA : it_cbm TYPE STANDARD TABLE OF mara.
DATA : it_layout TYPE STANDARD TABLE OF slis_layout_alv WITH HEADER LINE,
wa_fcat TYPE slis_fieldcat_alv,
it_fcat TYPE slis_t_fieldcat_alv.
START-OF-SELECTION.
SELECT *
FROM mara
INTO CORRESPONDING FIELDS OF TABLE it_cbm
where matnr = 'D80K7'.
END-OF-SELECTION.
it_layout-zebra = 'X'.
it_layout-colwidth_optimize = 'X'.
it_layout-f2code = '&ETA'.
APPEND it_layout.
DEFINE macro4fcat.
wa_fcat-col_pos = &1.
wa_fcat-fieldname = &2.
wa_fcat-tabname = &3.
wa_fcat-seltext_l = &4.
append wa_fcat to it_fcat.
clear wa_fcat.
END-OF-DEFINITION.
macro4fcat '1' 'MATNR' 'IT_CBM' 'MATERIAL NO' .
DESCRIBE TABLE it_cbm.
IF sy-ucomm = '&F03'.
MESSAGE 'hi hello good morning "press enter button" this is quiz' TYPE 'S'.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
is_layout = it_layout
it_fieldcat = it_fcat
i_save = 'A'
TABLES
t_outtab = it_cbm
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.
*& Form html_top_of_page
* text
* -->TOP text
FORM html_top_of_page USING top TYPE REF TO cl_dd_document.
DATA: l_text(255) TYPE c.
DATA: text1(255) TYPE c.
DATA: t_header TYPE REF TO cl_dd_table_element ,
wa_header TYPE REF TO cl_dd_table_area.
CALL METHOD top->add_gap
EXPORTING
width = 10.
CALL METHOD top->add_text
EXPORTING
text = 'hello'
sap_style = 'HEADING'
CALL METHOD top->add_gap
EXPORTING
width = 20.
CALL METHOD top->add_text
EXPORTING
text = 'HOW ARE YOU'
sap_style = 'HEADING'.
CALL METHOD TOP->new_line
* EXPORTING
* repeat =
CALL METHOD top->add_gap
EXPORTING
width = 50.
CALL METHOD top->add_text
EXPORTING
text = '____________________________________________________________'
sap_style = 'HEADING'.
CALL METHOD TOP->new_line
* EXPORTING
* repeat =
CALL METHOD top->add_gap
EXPORTING
width = 90.
CALL METHOD top->add_text
EXPORTING
text = 'YOU CAN TRY LIKE THIS'
sap_style = 'HEADING'.
ENDFORM. "html_top_of_page
Regards
Debarshi -
Hi,
How to display sub headings in alv grid
output format should be:
<COL_HEADING1> <COL_HEADING2>
<SUB_HEADING1> <SUB_HEADING2> <SUB_HEADING1><SUB_HEADING2>
and i want separate templet with side headings?
could you tell me grid supports this?
thanks in advance
cheers
sriniHi Srinivas,
Look ALV grid Multiple Header ... ? which has got a slightly more comprehensive information
Regards,
Anand Mandalika. -
FIeld headings in ALV Grid by label
Hi
I want disply the headings in alv grid display like this format.
I want write my own label in the output. (not in Normal LIST DISPLAY)
Sno | Sname | Marks
| | M1 | M2 | M3
How it is possible?
Edited by: Krishna Bommisetty on Sep 11, 2008 10:55 AMHi,
Check the below code.
WA_FCAT-SELTEXT_M = TEXT-073.
WA_FCAT-DDICTXT = 'M'.
We can define the name of the field label as mentioned above, where texto073 is nothing but the field label you want to give to the particular field.
DDICTXT you have to mention the length as small 'S', medium 'M' and large as 'L'. -
Hi Max,
If you remember in one of my last post I asked for changing the column headings in ALV display for example from 'Material' to 'Material used'.
I am using
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = repid
IT_FIELDCAT = field_body
I_SAVE = g_save
IS_VARIANT = g_variant
IT_EVENTS = events
TABLES
T_OUTTAB = itab.
And you suggested me the following way....
loop at field_body into field_wa.
case field_wa-fieldname.
when 'Material'.
field_wa-seltext_l = 'Material used'.
field_wa-seltext_m = 'Material used'.
field_wa-seltext_s = 'Material used'.
endcase.
modify field_body from field_wa.
endloop.
It is working well. In ALV display the column heading is changed to what I wanted. But the question is when I export the displayed ALV to Excel using ALV functionality, Export->Spreadsheet... I see that <b>I dont get the Column Heading into Excel as it was in the ALV display.</b>
I get in the Excel as 'Material u' or 'Mat. Used'. But when I add this line in the code.....
when 'Material'.
field_wa-seltext_l = 'Material used'.
field_wa-seltext_m = 'Material used'.
field_wa-seltext_s = 'Material used'.
<b> field_wa-outputlen = 20.</b>
Then I see that I get the complete heading in the Excel. But this way the columns with outputlen 20 are taking much space in ALV display.
Is there any fix for this. May be not mentioning the outputlen but still get the column headings into Excel as it was in ALV display.
Anyone with ideas please respond. Waiting for replies. ThanksHi
The labels have a fixed size:
seltext_l is long text: 20 char
seltext_m is medium text: 15 char
seltext_s is short text: 10 char
The text 'Material used' is long 13 char so you should write:
field_wa-seltext_l = 'Material used'.
field_wa-seltext_m = 'Material used'.
field_wa-seltext_s = 'Mat. used'.
You can try to set the field colwidth_optimize of parameter IT_LAYOUT.
This field should optimize the width of the colunm
So
data layout type SLIS_LAYOUT_ALV.
layout-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = repid
IT_LAYOUT = layout
IT_FIELDCAT = field_body
I_SAVE = g_save
IS_VARIANT = g_variant
IT_EVENTS = events
TABLES
T_OUTTAB = itab.
and you can decide which label has to be used:
field_wa-seltext_l = 'Material used'.
field_wa-seltext_m = 'Material used'.
field_wa-seltext_s = 'Mat. used'.
If you want to set the short text
field_wa-ddictxt = 'S'.
...medium
field_wa-ddictxt = 'M'.
...long
field_wa-ddictxt = 'L'.
Max -
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 -
Hello Experts,
I am preparing a ALV report in that i want to display fields in a such a way that
under a heading i need to have two sub headings ie, for example under a material heading
i need to display material no and code as separate coloumn but both should look like
single coloumn under heading Material.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 -
Hi there
Our development requires that we have a main heading with multiple subheadings on a report. Is it possible to display multiple headings on an ALV grid report?
Kind Regards
Gustav ColeskeHi Vijay
This example does not do what we need. I attach a better description of what we need:
Heading line 1 - Appointments
Heading line 2 (all under heading line 1) - ACI, WF, WM, Total, ACI %, WF %, WM%
Please let me know if you need more clarity.
Kind Regards
Gustav Coleske -
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 -
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. -
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 -
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 RegardsHi 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 -
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. -
Dear friends,
Can i present ALV output with Main Heading and within there r subheadings like the following ?
Main Heading 01 Main Heading 02
Sub Head1 Sub Head2 sub Head3 sub Head4 sub Head5
In addition, can i print ALV output which is more than 255 characters long in A3 paper size, when i try to print there is no format available with more than 255 characters and columns gets truncated.
Kindly suggest,
Regards,
Praveen LoboHi,
Using alv tree concept it is possible..
In sap standard layout allowed only 255 charters only.
Download your page in pdf format or same other format and take print out.
Regards,
Anki Reddy.
Maybe you are looking for
-
Can't sign in to iMessage and Facetime with my Apple ID, only one or the other
I have an iPhone 5 running iOS 6.1.2 on AT&T. I've noticed I am unable to use my Apple ID for both Facetime and iMessage; if I am signed in to one of them, I'm unable to sign in to the other. I get in a loop of the phone repeatedly popping up a pas
-
Using Multiple iPhoto Libraries
Hi, I just got a new macbook pro. I have photo libraries on two other machines that I transferred over. I would rather not spend money to merge the libraries but every time I switch from one library to the other it duplicates the pictures in the "all
-
Can I change the Default Position of a JColorChooser Dialog Box???
I am working on a drawing application where I am using a button that launches a JColorChooser dialog to allow a user to select a color which. I have tied this button to the JColorChooser using the source code below to reset the color based on the use
-
Safari is broken and no one will convince me other wise. Painfully slow page loads, most pages not completely loading, interminable delays and no domain forwarding. Since my 10.4.3 update, Safari ***** and my Powerbook *****. That's just the plain tr
-
Error in entering header level conditional value - toomany line items to PO
Hi experts I have an issue while processing a PO. While entering condition values like Freight, Customs duty etc in header level where the order contains more than 1000 line items, i am getting an error " too many line items, msg no.899". Can somebo