Problem in ALV top of page event
Hi,
Have created a report in ALV and used top of page event to display the header details, where i am doing some calculations and the value is appearing in top of page, but when i take print out (or see print preview), the top of page contents are not visible, is there any way so that i can print the top of page also.
Thanks in Advance
Santosh
Hi this might help u.
*& Form BUILD_LAYOUT
Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
with regards,
Hema Sundara.
pls give points if u find it helpful.
Similar Messages
-
Hi All,
I am having a ALV report .Once i execute the report there will be ALV output once i click on the Material no((Hot spot)) in the output it ll take to the another ALV report.The problem is how to get the top of page in the second alv...The top of page in the second ALV should be different..
Is it possible to do this?Pls reply asap.
Thanks
Raj.Hi Arun,
It is not working in the way you have given.
Hi All,
Is there any way to do this ???
Thanks
Raj. -
ALV Top of Page Date format problem?
Dear All Abapper,
I have placed date(12.12.2007) format in ALV Top of Page, but it displayed
<u> <b> 20071212</b></u> in this format.
Pls, give me the suggestion to reclaim my problem.Hi,
Cjeck the following code:
V_DATE = 'Run Date:'.
CONCATENATE V_DATE SY-DATUM6(2) '.' SY-DATUM4(2) '.' SY-DATUM(4)
INTO V_DATE .
REFRESH ITHED.
CLEAR SHED.
SHED-TYP = 'A'.
SHED-INFO = V_DATE.
APPEND SHED TO ITHED.
CLEAR SHED.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = ITHED.
I_LOGO =
I_END_OF_LIST_GRID =
ENDFORM.
Hope this helps.
Reward if helpful.
Regards,
Sipra -
To display the typ, key field,info in the top-of -page event in OO ALV
Hi all,
I need to display the heading and the other select option details in the top-of-page event in ooalv.How can the key ,typ and the info of top of event in alv grid be passed in ooalv grid display.
Regards,
ArpitaCheck the blog.
TOP_OF_PAGE in ALV Using CL_GUI_ALV_GRID
Now you have to use the method ADD_TEXT to populate the Select options details.
I hope you know the Function to get the selection details
RS_REFRESH_FROM_SELECTOPTIONS,. it will give into a table. so use that table and populate the TOP_OF_PAGE uisng the class CL_DD_DOCUMENT. -
Top-of-page event is not triggered
Hi,
I have a problem with top-of-page event. I have a report that shows the results in ALV grid display. But I use "REUSE_ALV_GRID_DISPLAY" not OO alv and there is only one screen with number 1000. On the menu toolbar there is a button that prints the data of ALV in a list using "write" statement. While writing , "top of page" event is not triggered. I expect that it is triggered at the first "write" statement but isn't. Is there anyone who knows the cause of this problem?
The code is below.
Thanks.
Tables ...
TABLES : mara , makt , ekko , ekpo , zzith_yukh , lfa1 , t001w , lips ,
eket .
global variables
DATA : BEGIN OF list OCCURS 1,
zztahsk LIKE ekko-zztahsk ,
zterm LIKE ekko-zterm ,
txz01 LIKE ekpo-txz01 ,
name1 LIKE lfa1-name1 ,
menge LIKE ekpo-menge ,
meins LIKE ekpo-meins ,
fyukl LIKE zzith_yukh-zzdel_flag ,
" Yüklenmiş miktar var göstergesi ...
inco1 LIKE ekko-inco1 ,
netwr LIKE ekpo-netwr ,
waers LIKE ekko-waers ,
bedat LIKE ekko-bedat ,
zzontar LIKE ekko-zzontar ,
slfdt LIKE eket-slfdt ,
tname1 LIKE t001w-name1 ,
banfn LIKE ekpo-banfn ,
ebeln LIKE ekko-ebeln ,
ebelp LIKE ekpo-ebelp ,
lifnr LIKE ekko-lifnr ,
mtart LIKE mara-mtart ,
matkl LIKE mara-matkl ,
ekgrp LIKE ekko-ekgrp ,
matnr LIKE mara-matnr ,
eknam LIKE t024-eknam,
bukrs LIKE ekko-bukrs,
zzbltur LIKE ekko-zzbltur,
END OF list .
DATA temp LIKE list OCCURS 1 WITH HEADER LINE .
DATA total LIKE list OCCURS 1 WITH HEADER LINE .
ALV fields
TYPE-POOLS : slis.
DATA : gt_fields TYPE slis_fieldcat_alv OCCURS 1 WITH HEADER LINE .
DATA : gt_events TYPE slis_t_event.
DATA : gs_layout TYPE slis_layout_alv.
DATA : gv_title TYPE lvc_title VALUE 'Günlük Depo Sayım Miktarları'.
DATA : gt_top_of_page TYPE slis_t_listheader.
selection screen
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001 .
*Satınalma organizasyonu
*Satınalma grubu
*Satıcı
*Tarih
*SAS no
*Dosya no
SELECT-OPTIONS:
s_bukrs FOR ekko-bukrs .
SELECTION-SCREEN SKIP .
SELECT-OPTIONS:
s_ekorg FOR ekko-ekorg OBLIGATORY MEMORY ID eko ,
s_ekgrp FOR ekko-ekgrp ,
s_lifnr FOR ekko-lifnr ,
s_ebeln FOR ekko-ebeln .
SELECTION-SCREEN END OF BLOCK a .
Define Katalog
DEFINE fill_catalog .
gt_fields-fieldname = &1.
gt_fields-tabname = &2.
gt_fields-seltext_l = &3.
gt_fields-seltext_m = &3.
gt_fields-seltext_s = &3.
gt_fields-checkbox = &4.
gt_fields-cfieldname = &5.
gt_fields-ref_tabname = &6.
gt_fields-ref_fieldname = &7.
gt_fields-edit = &8.
append gt_fields .
clear gt_fields .
END-OF-DEFINITION.
Modify Catalog
DEFINE modify_catalog .
gt_fields-seltext_m = &1 .
modify gt_fields transporting seltext_m where fieldname = &2 .
END-OF-DEFINITION .
TOP-OF-PAGE.
write 'top of page'.
PERFORM top-of-page.
start-of-selection
START-OF-SELECTION .
PERFORM get_data.
PERFORM listele .
*& Form listele .
FORM listele .
PERFORM get_events .
PERFORM alv_list_header.
PERFORM get_field_catalog USING 'LIST' .
PERFORM display_alv .
ENDFORM. " listele.
*& Form getfield_Catalog
FORM get_field_catalog USING p_tabname .
fill_catalog :
'EBELN' 'LIST' '' '' '' 'EKPO' 'EBELN' '' ,
'ZZTAHSK' 'LIST' '' '' '' 'EKKO' 'ZZTAHSK' '' ,
'ZZBLTUR' 'LIST' '' '' '' 'EKKO' 'ZZBLTUR' '' ,
'MATNR' 'LIST' '' '' '' 'MARA' 'MATNR' '' ,
'MATKL' 'LIST' '' '' '' 'MARA' 'MATKL' '' ,
'TXZ01' 'LIST' '' '' '' 'EKPO' 'TXZ01' '' ,
'NAME1' 'LIST' '' '' '' 'LFA1' 'NAME1' '' ,
'MENGE' 'LIST' '' '' '' 'EKPO' 'MENGE' '' ,
'MEINS' 'LIST' '' '' '' 'EKPO' 'MENGE' '' ,
'FYUKL' 'LIST' '' '' '' 'ZZITH_YUKH' 'ZZDEL_FLAG' '' ,
'INCO1' 'LIST' '' '' '' 'EKKO' 'INCO1' '' ,
'NETWR' 'LIST' '' '' '' 'EKPO' 'NETWR' '' ,
'WAERS' 'LIST' '' '' '' 'EKKO' 'WAERS' '' ,
'BEDAT' 'LIST' '' '' '' 'EKKO' 'BEDAT' '' ,
'ZZONTAR' 'LIST' '' '' '' 'EKKO' 'ZZONTAR' '' ,
'SLFDT' 'LIST' '' '' '' 'EKET' 'SLFDT' '' ,
'TNAME1' 'LIST' '' '' '' 'T001W' 'NAME1' '' ,
'BANFN' 'LIST' '' '' '' 'EKPO' 'BANFN' '' ,
'EKNAM' 'LIST' '' '' '' 'T024' 'EKNAM' '' .
gt_fields-ddictxt = 'M' .
MODIFY gt_fields TRANSPORTING ddictxt WHERE fieldname NE space.
modify_catalog 'Yükleme No' 'VBELN' .
modify_catalog 'Malzeme Türü' 'ZZBLTUR' .
modify_catalog 'Malzeme Tanımı' 'TXZ01' .
modify_catalog 'Satıcı' 'NAME1' .
modify_catalog 'Teslim Şekli' 'INCO1' .
modify_catalog 'Döviz Tutarı' 'ZZTOPLAM'.
modify_catalog 'Döviz Kodu' 'WAERS' .
modify_catalog 'Siparişi Veren' 'TNAME1' .
modify_catalog 'Tahmini İthalat Trh.' 'SLFDT' .
modify_catalog 'İthalata İntikal Trh.' 'BEDAT' .
modify_catalog 'Dosya Onay Tarihi' 'ZZONTAR' .
modify_catalog 'Talep No' 'BANFN' .
modify_catalog 'Dosya Sorumlusu' 'EKNAM' .
modify_catalog 'Yük.Göstergesi' 'FYUKL' .
ENDFORM. " getfield_Catalog
*& Form display_alv
text
--> p1 text
<-- p2 text
FORM display_alv .
DATA lv_repid LIKE sy-repid .
lv_repid = sy-repid .
CLEAR gs_layout.
gs_layout-zebra = 'X'.
gs_layout-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = lv_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
is_layout = gs_layout
it_fieldcat = gt_fields[]
it_events = gt_events[]
TABLES
t_outtab = list[].
ENDFORM. " display_alv
FORM set_pf_status USING iv_nodisplay TYPE slis_t_extab.
SET PF-STATUS 'STANDARD' ."excluding iv_nodisplay.
ENDFORM. " SET_PF_STATUS
FORM user_command USING iv_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE iv_ucomm .
WHEN 'PRINT' . PERFORM print_data .
ENDCASE .
ENDFORM. "USER_COMMAND
FORM get_events .
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = gt_events.
READ TABLE gt_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE 'ALV_TOP_OF_PAGE' TO ls_event-form.
APPEND ls_event TO gt_events.
ENDIF.
ENDFORM. " getevents
FORM alv_list_header .
DATA: ls_line TYPE slis_listheader.
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-key = 'Satınalma Org.:'.
CONCATENATE s_ekorg-low s_ekorg-high
INTO ls_line-info SEPARATED BY '/'.
APPEND ls_line TO gt_top_of_page.
ls_line-key = 'Satınalma Grubu.:'.
CONCATENATE s_ekgrp-low s_ekgrp-high
INTO ls_line-info SEPARATED BY '/'.
APPEND ls_line TO gt_top_of_page.
ls_line-key = 'Satıcı.:'.
CONCATENATE s_lifnr-low s_lifnr-high
INTO ls_line-info SEPARATED BY '/'.
APPEND ls_line TO gt_top_of_page.
ls_line-key = 'SAS No.:'.
CONCATENATE s_ebeln-low s_ebeln-high
INTO ls_line-info SEPARATED BY '/'.
APPEND ls_line TO gt_top_of_page.
ENDFORM. " alv_list_header
FORM alv_top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_top_of_page.
ENDFORM. "TOP_OF_PAGE
FORM get_data .
DATA : BEGIN OF tr ,
menge LIKE eket-menge ,
dabmg LIKE eket-dabmg ,
END OF tr ,
zzfiilytar LIKE zzith_yukh-zzfiilytar .
*- Get data ...
SELECT *
INTO CORRESPONDING FIELDS OF TABLE list
FROM ekpo AS a
INNER JOIN ekko AS b ON bebeln = aebeln
WHERE b~ebeln IN s_ebeln AND
b~bukrs IN s_bukrs AND
b~loekz EQ space AND
b~lifnr IN s_lifnr AND
b~ekorg IN s_ekorg AND
b~ekgrp IN s_ekgrp AND
a~loekz EQ space AND
a~elikz EQ space .
LOOP AT list .
CLEAR tr .
SELECT menge dabmg
INTO tr
FROM eket
WHERE ebeln = list-ebeln AND
ebelp = list-ebelp.
tr-menge = tr-menge - tr-dabmg .
ENDSELECT.
IF tr-menge LE 0 .
DELETE list .
ELSE .
list-menge = tr-menge .
IF tr-dabmg GT 0 .
list-fyukl = '*' .
ENDIF .
SELECT SINGLE butxt INTO list-tname1 FROM t001
WHERE bukrs = list-bukrs .
SELECT SINGLE slfdt INTO list-slfdt FROM eket
WHERE ebeln = list-ebeln AND
ebelp = list-ebelp .
SELECT SINGLE name1 INTO list-name1 FROM lfa1 WHERE lifnr = list-lifnr.
SELECT SINGLE mtart matkl INTO (list-mtart,list-matkl)
FROM mara WHERE matnr = list-matnr .
SELECT SINGLE eknam INTO list-eknam FROM t024 WHERE ekgrp = list-ekgrp .
MODIFY list .
ENDIF .
ENDLOOP .
ENDFORM. " get_data
FORM print_data .
LEAVE TO LIST-PROCESSING .
NEW-PAGE NO-HEADING NO-TITLE LINE-SIZE 229 .
SET PF-STATUS SPACE .
PERFORM top-of-page .
malzeme türü 1005 ler yazdırılır
PERFORM yazdir_1005 .
malzeme türü 1005 olmayanlar yazdırılır
PERFORM yazdir_ne_1005 .
Satınalama grupları bilgisi yazdırılır
PERFORM yazdir_ekgrp .
ENDFORM. " print_data
FORM top-of-page .
WRITE : 'ÜLKER GRUBU KONSOLİDE' .
WRITE AT 40 'Sevkiyat Bekleyen Malzemeler' COLOR COL_HEADING .
WRITE : 180 sy-uname , sy-datum , sy-uzeit.
NEW-LINE .
ULINE 0(229) .
WRITE :/2 'Rapor Kodu..............:' , (10) sy-tcode .
WRITE :/2 'Satınalma Organizasyonu.:' , (10) s_ekorg-low, '/', (10) s_ekorg-high .
WRITE :/2 'Satınalma Grubu.........:' , (10) s_ekgrp-low, '/', (10) s_ekgrp-high .
WRITE :/2 'Satıcı..................:' , (10) s_lifnr-low, '/', (10) s_lifnr-high .
WRITE :/2 'Satınalma Sipariş No....:' , (10) s_ebeln-low, '/', (10) s_ebeln-high .
NEW-LINE .
ULINE 0(229) .
Başlıklar yazılır
FORMAT COLOR COL_HEADING .
WRITE :
/(10) 'SAS NO.' CENTERED,
(6) 'TAHSİS' CENTERED,
(5) 'ÖDEME' CENTERED,
(5) 'Bel.T' CENTERED,
(25) 'MALZEME' CENTERED,
(25) 'SATICI' CENTERED,
(12) 'MİKTAR' CENTERED,
(3) 'BRM' CENTERED,
(3) 'G' ,
(7) 'TES.ŞK.' CENTERED,
(16) 'DÖVİZ TUTARI' CENTERED,
(3) 'DB.' CENTERED,
(13) 'İTH.İNTK.TRH.' CENTERED,
(13) 'DOSYA ON.TRH.' CENTERED,
(10) 'TAHMİN.İTH.TRH.' CENTERED,
(20) 'SİPARİŞ VEREN' CENTERED,
(10) 'TALEP NO.' CENTERED,
(18) 'DOSYA SORUMLUSU' CENTERED.
ULINE 0(229) .
FORMAT RESET .
ENDFORM. " top-of-page
FORM yazdir_1005 .
DATA ebeln LIKE list-ebeln .
SORT list BY zzbltur matnr .
temp[] = list[] .
DELETE temp WHERE mtart <> '1005' .
LOOP AT list WHERE mtart = '1005' .
CLEAR list-netwr .
IF ebeln NE list-ebeln OR ebeln EQ space .
REFRESH total . CLEAR total .
ebeln = list-ebeln .
LOOP AT temp WHERE ebeln = list-ebeln .
list-netwr = list-netwr + temp-netwr .
CLEAR total .
total-txz01 = '*** TKNK.MLZ. TOPLAMI ****' .
total-meins = temp-meins .
total-menge = temp-menge .
COLLECT total .
ENDLOOP .
PERFORM write_list USING '1' .
LOOP AT total .
PERFORM write_list USING '2' .
ENDLOOP .
AT END OF zzbltur .
ULINE 0(229) .
ENDAT .
ENDIF .
ENDLOOP .
ENDFORM. " yazdir_1005
FORM write_list USING flag .
flag 1 1005 için yazdırma
flag 2 ise ara toplam
IF flag = '1' .
FORMAT COLOR COL_NORMAL .
WRITE :
/(10) list-ebeln ,
(6) list-zztahsk,
(5) list-zterm,
(5) list-zzbltur ,
(25) list-txz01,
(25) list-name1,
(12) list-menge,
(3) list-meins,
(3) list-fyukl,
(7) list-inco1,
(16) list-netwr,
(3) list-waers,
(13) list-bedat,
(13) list-zzontar,
(10) list-slfdt ,
(20) list-tname1,
(10) list-banfn ,
(18) list-eknam .
FORMAT RESET .
ELSEIF flag = '2' .
FORMAT COLOR COL_TOTAL .
WRITE :
/(10) '' ,
(6) '' ,
(5) '' ,
(5) '' ,
(25) total-txz01,
(25) '' ,
(12) total-menge,
(3) total-meins,
(3) '' ,
(7) '' ,
(16) '' ,
(3) '' ,
(13) '' ,
(13) '' ,
(10) '' ,
(20) '' ,
(10) '' ,
(18) '' .
FORMAT RESET .
ELSEIF flag = '3' .
FORMAT COLOR COL_TOTAL .
WRITE :
/(10) '' ,
(6) '' ,
(5) '' ,
(5) '' ,
(25) total-txz01,
(25) '' ,
(12) total-menge,
(3) '' ,
(3) '' ,
(7) '' ,
(16) total-netwr ,
(3) '' ,
(13) '' ,
(13) '' ,
(10) '' ,
(20) '' ,
(10) '' ,
(18) '' .
FORMAT RESET .
ENDIF .
ENDFORM. " write_list
FORM yazdir_ne_1005 .
DATA matnr LIKE list-matnr .
SORT list BY zzbltur matkl matnr .
temp[] = list[] .
DELETE temp WHERE mtart = '1005' .
LOOP AT list WHERE mtart <> '1005' .
Her yeni Malzeme için ara toplam yazılır
IF matnr NE list-matnr AND matnr NE space .
REFRESH total . CLEAR total .
Toplamlar alınır
LOOP AT temp WHERE matnr = matnr .
CLEAR total .
total-netwr = temp-netwr .
total-menge = temp-menge .
total-txz01 = '*** TOPLAM ****' .
COLLECT total .
ENDLOOP .
LOOP AT total . .
PERFORM write_list USING '3' .
ENDLOOP .
ULINE 0(229) .
ENDIF .
PERFORM write_list USING '1' .
matnr = list-matnr .
ENDLOOP .
Toplamlar alınır
LOOP AT temp WHERE matnr = matnr .
REFRESH total . CLEAR total .
total-netwr = temp-netwr .
total-menge = temp-menge .
total-txz01 = '*** TOPLAM ****' .
COLLECT total .
ENDLOOP .
LOOP AT total .
PERFORM write_list USING '3' .
ENDLOOP .
ULINE 0(229) .
ENDFORM. " yazdir_ne_1005
FORM yazdir_ekgrp .
DATA: BEGIN OF total OCCURS 1 ,
eknam LIKE list-eknam ,
zzbltur LIKE list-zzbltur ,
sayi TYPE i ,
END OF total .
DATA: BEGIN OF gtotal OCCURS 1 ,
eknam LIKE list-eknam ,
zzbltur LIKE list-zzbltur ,
sayi TYPE i ,
END OF gtotal .
DATA: bltur LIKE zzith_bltur OCCURS 1 WITH HEADER LINE .
DATA: len TYPE i .
DATA: wa LIKE total.
REFRESH temp .
SELECT * INTO TABLE bltur FROM zzith_bltur .
CLEAR bltur .
MOVE : 'ZZZZ' TO bltur-zzbltur , " Satır toplamı için ...
text-002 TO bltur-zztanim .
APPEND bltur .
CLEAR list .
SORT list BY eknam ebeln .
DELETE ADJACENT DUPLICATES FROM list COMPARING eknam ebeln .
LOOP AT list .
CLEAR : total, gtotal .
total-eknam = list-eknam .
total-zzbltur = list-zzbltur .
total-sayi = 1 .
COLLECT total .
total-eknam = list-eknam .
total-zzbltur = 'ZZZZ' .
total-sayi = 1 .
COLLECT total .
gtotal-eknam = text-001 .
gtotal-zzbltur = list-zzbltur .
gtotal-sayi = 1 .
COLLECT gtotal .
gtotal-eknam = text-001 .
gtotal-zzbltur = 'ZZZZ' .
gtotal-sayi = 1 .
COLLECT gtotal .
ENDLOOP .
FORMAT COLOR COL_HEADING.
ULINE AT /1(145).
WRITE :/
sy-vline , (15) 'Dosya Sorumlusu' , sy-vline .
LOOP AT bltur .
WRITE :(15) bltur-zztanim , sy-vline .
ENDLOOP .
ULINE AT /1(145).
FORMAT RESET .
total-zzbltur = '0001' .
MODIFY total TRANSPORTING zzbltur WHERE zzbltur = space .
gtotal-zzbltur = '0001' .
MODIFY gtotal TRANSPORTING zzbltur WHERE zzbltur = space .
SORT total BY eknam .
LOOP AT total .
AT NEW eknam .
WRITE :/
sy-vline , (15) total-eknam COLOR COL_HEADING ,
sy-vline .
LOOP AT bltur .
len = sy-tabix * 18 .
len = len + 3 .
CLEAR wa .
READ TABLE total INTO wa WITH KEY zzbltur = bltur-zzbltur
eknam = total-eknam .
WRITE AT len(15) wa-sayi NO-ZERO.
WRITE sy-vline .
ENDLOOP .
ENDAT .
ENDLOOP .
LOOP AT gtotal .
AT NEW eknam .
FORMAT COLOR COL_TOTAL .
WRITE :/
sy-vline , (15) gtotal-eknam ,
sy-vline .
LOOP AT bltur .
len = sy-tabix * 18 .
len = len + 3 .
CLEAR wa .
READ TABLE gtotal INTO wa WITH KEY zzbltur = bltur-zzbltur
eknam = text-001 .
WRITE AT len(15) wa-sayi NO-ZERO.
WRITE sy-vline .
ENDLOOP .
ENDAT .
ENDLOOP .
ULINE AT /1(145).
FORMAT RESET .
ENDFORM. " yazdir_ekgrpHi,
In the function use the top-of-page event as follows:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = 'ZRPMSLM'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
<b> I_CALLBACK_TOP_OF_PAGE = 'TOP'</b>
Define whatever to appear in top-of page in a subroutine named TOP.
Hope this helps.
Reward if helpful.
Regards,
Sipra -
Problem while displaying top of page in list display
Hi,
M facing problem in displaying top of page in list .
M using following methods:-
lr_outer_grid TYPE REF TO cl_salv_form_layout_grid,
lr_inner_grid TYPE REF TO cl_salv_form_layout_grid,
lr_label TYPE REF TO cl_salv_form_label,
lr_text TYPE REF TO cl_salv_form_text.
For displaying the top of page m using event TOP_OF_PAGE.
CREATE OBJECT lr_outer_grid.
*Outer grid
lr_inner_grid = lr_outer_grid->create_grid(
row = 1
column = 1 ).
*... create lable information in inner_grid
User ID
lr_label = lr_inner_grid->create_label(
row = 1
column = 1
text = text-h03 ).
*... create text information in inner_grid
lr_text = lr_inner_grid->create_text(
row = 1
column = 2
text = sy-uname ).
*... set label for text
lr_label->set_label_for( lr_text ).
But while m going to do same coding for second parameter its not intializing length so adding extra spaces while displaying second row.
e.g
USERID abcdefghjik
PLANT jhk to hjk
I want that output should look like
USERID abcdefghjik
PLANT jhk to hjk
Please tell me the solution what should i do for avoiding extra spaceHi Neelema,
You could try this sample code.
[http://sap-img.com/fu037.htm]
[http://sap-img.com/abap/sample-alv-heading-in-alv.htm]
Regards,
Amit. -
Hi All,
In my Report i am printing both interactive and alv grid display in same report.means i have one check box it is then report print as a alv format otherwise classical format.
But here i have small problem i am trying print in alv format its automatically trigger the top of page event thatsway a blank screen is generated so please tell how to skip the Top of page event.
Regards,
VenkateshEND-OF-SELECTION.
SORT tab1 BY ebeln ebelp.
DESCRIBE TABLE tab1 LINES tabln.
IF tabln = 0.
MESSAGE ID 'ME' TYPE 'I' NUMBER '260'.
EXIT.
ENDIF.
SORT tab1 BY sortkey knttp ebeln ebelp.
if P_ALV = 'X'.
LOOP AT tab1.
IF tab1-knttp = '1'.
gs_final-str = text-k01.
gs_final-kont1 = tab1-kont1.
gs_final-kont2 = tab1-kont2.
ELSEIF tab1-knttp = '2'.
gs_final-str = text-k02.
gs_final-kont1 = tab1-kont1.
gs_final-kont2 = tab1-kont2.
ELSEIF tab1-knttp = '3'.
gs_final-str = text-k03.
gs_final-kont1 = tab1-kont1.
gs_final-kont2 = tab1-kont2.
ELSEIF tab1-knttp = '4'.
gs_final-str = text-k04.
gs_final-kont1 = tab1-kont1.
gs_final-kont2 = tab1-kont2.
ELSEIF tab1-knttp = '5'.
gs_final-str = text-k05.
gs_final-kont1 = tab1-kont1.
gs_final-kont2 = tab1-kont2.
ELSEIF tab1-knttp = '6'.
gs_final-str = text-k04.
gs_final-kont1 = tab1-kont1.
ELSEIF tab1-knttp IS INITIAL.
gs_final-str = 'Stock without Account Assignment'.
ENDIF.
gs_final-ebeln = tab1-ebeln.
gs_final-lifnr = tab1-lifnr.
gs_final-name1 = tab1-name1.
gs_final-aedat = tab1-aedat.
gs_final-udate = tab1-udate.
gs_final-inco1 = tab1-inco1.
gs_final-inco2 = tab1-inco2.
gs_final-ebelp = tab1-ebelp.
gs_final-matnr = tab1-matnr.
gs_final-txz01 = tab1-txz01.
gs_final-paedt = tab1-paedt.
gs_final-eindt = tab1-eindt.
gs_final-eindt1 = tab1-eindt1.
gs_final-labnr = tab1-labnr. "NWC-29042005
gs_final-budat = tab1-budat.
gs_final-menge = tab1-menge.
gs_final-wemng = tab1-wemng.
gs_final-meins = tab1-meins.
gs_final-vbeln = tab1-vbeln.
gs_final-tddat = tab1-tddat.
IF NOT tab1-vbeln IS INITIAL.
FORMAT COLOR 4 INTENSIFIED OFF.
WRITE:/3 wa_tab1-vbeln.
READ TABLE lines INDEX 1.
MOVE lines-tdline TO l_text.
CLEAR lines.
READ TABLE lines INDEX 2.
CONCATENATE l_text lines-tdline INTO l_text SEPARATED BY ' '.
FORMAT COLOR 5 INTENSIFIED OFF.
gs_final-l_text = l_text.
SKIP. "NWC-16092003
ENDAT.
APPEND gs_final to gt_final.
ENDLOOP.
PERFORM maintain_fieldcatlog.
PERFORM Display_data.
ELSE.
LOOP AT tab1.
MOVE tab1 TO wa_tab1.
AT NEW kont1.
RESERVE 5 LINES.
FORMAT COLOR 3 INTENSIFIED.
IF tab1-knttp = '1'.
WRITE:/(20) text-k01, 20 ': ', 22(30) tab1-kont1 NO-ZERO,
60(74) tab1-kont2.
ELSEIF tab1-knttp = '2'.
WRITE:/(20) text-k02, 20 ': ', 22(30) tab1-kont1 NO-ZERO,
60(74) tab1-kont2.
ELSEIF tab1-knttp = '3'.
WRITE:/(20) text-k03, 20 ': ', 22(30) tab1-kont1 NO-ZERO,
60(74) tab1-kont2.
ELSEIF tab1-knttp = '4'.
WRITE:/(20) text-k04, 20 ': ', 22(30) tab1-kont1 NO-ZERO,
60(74) tab1-kont2.
ELSEIF tab1-knttp = '5'.
WRITE:/(20) text-k05, 20 ': ', 22(30) tab1-kont1 NO-ZERO,
60(74) tab1-kont2.
ELSEIF tab1-knttp = '6'.
WRITE:/(20) text-k04, 20 ': ', 22(30) wa_tab1-kont1 NO-ZERO,
60 text-k02, 75 ': ', 77(57) wa_tab1-kont2 NO-ZERO.
ELSEIF tab1-knttp IS INITIAL.
WRITE:/ 'Stock without Account Assignment'.
ENDIF.
WRITE 170 ' '.
FORMAT COLOR INTENSIFIED OFF.
ENDAT.
AT NEW ebeln.
RESERVE 4 LINES.
FORMAT COLOR 1 INTENSIFIED OFF.
WRITE:/ wa_tab1-ebeln,
11 ' ',
13 wa_tab1-lifnr,
23 wa_tab1-name1,
60 wa_tab1-aedat NO-ZERO,
73 wa_tab1-udate NO-ZERO,
86 wa_tab1-inco1,
91(37) wa_tab1-inco2,
170 ' '.
ENDAT.
AT NEW ebelp.
RESERVE 3 LINES.
FORMAT COLOR 2 INTENSIFIED OFF.
WRITE:/2 wa_tab1-ebelp,
9 wa_tab1-matnr,
30(40) wa_tab1-txz01,
73(10) wa_tab1-paedt,
84(10) wa_tab1-eindt,
95(10) wa_tab1-eindt1 NO-ZERO,
106(15) wa_tab1-labnr, "NWC-29042005
122(10) wa_tab1-budat NO-ZERO,
133(16) wa_tab1-menge NO-ZERO,
150(16) wa_tab1-wemng NO-ZERO,
167(3) wa_tab1-meins,
170 ' '.
ENDAT.
HIDE: tab1-ebeln, tab1-ebelp.
I
READ TABLE lines INDEX 1.
MOVE lines-tdline TO l_text.
CLEAR lines.
READ TABLE lines INDEX 2.
CONCATENATE l_text lines-tdline INTO l_text SEPARATED BY ' '.
FORMAT COLOR 5 INTENSIFIED OFF.
WRITE: /3(132) l_text,
170 ' '.
SKIP. "NWC-16092003
ENDAT.
ENDLOOP.
ENDIF.
AT LINE-SELECTION.
CHECK NOT tab1-ebeln IS INITIAL.
SET PARAMETER ID 'BES' FIELD tab1-ebeln.
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
CLEAR tab1.
TOP-OF-PAGE.
if P_ALV ne 'X'.
IF sy-pagno = 1.
DETAIL.
WRITE: /2 text-a01.
RESERVE 1 LINES.
SUMMARY.
IF lifnr IS INITIAL.
WRITE: /4 text-a02, 26 'All'.
ELSE.
LOOP AT lifnr WHERE sign = 'I'.
IF lifnr-option = 'EQ'.
WRITE : /4 text-a02, 26 lifnr-low.
ELSE.
WRITE: /4 text-a02, 26 'From', 32 lifnr-low,
44 'to', 48 lifnr-high.
ENDIF.
ENDLOOP.
ENDIF.
IF matnr IS INITIAL.
WRITE: /4 text-a14, 26 'All'.
ELSE.
LOOP AT matnr WHERE sign = 'I'.
IF matnr-option = 'EQ'.
WRITE : /4 text-a14, 26 matnr-low.
ELSE.
WRITE: /4 text-a14, 26 'From', 32 matnr-low,
44 'to', 48 matnr-high.
ENDIF.
ENDLOOP.
ENDIF.
IF ebeln IS INITIAL.
WRITE: /4 text-a03, 26 'All'.
ELSE.
LOOP AT ebeln WHERE sign = 'I'.
IF ebeln-option = 'EQ'.
WRITE : /4 text-a03, 26 ebeln-low.
ELSE.
WRITE: /4 text-a03, 26 'From', 32 ebeln-low,
44 'to', 48 ebeln-high.
ENDIF.
ENDLOOP.
ENDIF.
IF aedat IS INITIAL.
WRITE: /4 text-a04, 26 'All'.
ELSE.
LOOP AT aedat WHERE sign = 'I'.
IF aedat-option = 'EQ'.
WRITE : /4 text-a04, 26 aedat-low.
ELSE.
WRITE: /4 text-a04, 26 'From', 32 aedat-low,
44 'to', 48 aedat-high.
ENDIF.
ENDLOOP.
ENDIF.
IF eindt IS INITIAL.
WRITE: /4 text-a13, 26 'All'.
ELSE.
LOOP AT eindt WHERE sign = 'I'.
IF eindt-option = 'EQ'.
WRITE : /4 text-a13, 26 eindt-low.
ELSE.
WRITE: /4 text-a13, 26 'From', 32 eindt-low,
44 'to', 48 eindt-high.
ENDIF.
ENDLOOP.
ENDIF.
IF bednr IS INITIAL.
WRITE: /4 text-a15, 26 'All'.
ELSE.
LOOP AT bednr WHERE sign = 'I'.
IF bednr-option = 'EQ'.
WRITE : /4 text-a15, 26 bednr-low.
ELSE.
WRITE: /4 text-a15, 26 'From', 32 bednr-low,
44 'to', 48 bednr-high.
ENDIF.
ENDLOOP.
ENDIF.
linno = sy-linno + 1.
BACK.
IF ekorg IS INITIAL.
WRITE: /70 text-a11, 92 'All'.
ELSE.
LOOP AT ekorg WHERE sign = 'I'.
IF ekorg-option = 'EQ'.
WRITE : /70 text-a11, 92 ekorg-low.
ELSE.
WRITE: /70 text-a11, 92 'From', 98 ekorg-low,
104 'to', 108 ekorg-high.
ENDIF.
ENDLOOP.
ENDIF.
IF ekgrp IS INITIAL.
WRITE: /70 text-a12, 92 'All'.
ELSE.
LOOP AT ekgrp WHERE sign = 'I'.
IF ekgrp-option = 'EQ'.
WRITE : /70 text-a12, 92 ekgrp-low.
ELSE.
WRITE: /70 text-a12, 92 'From', 98 ekgrp-low,
104 'to', 108 ekgrp-high.
ENDIF.
ENDLOOP.
ENDIF.
IF werks IS INITIAL.
WRITE: /70 text-a05, 92 'All'.
ELSE.
LOOP AT werks WHERE sign = 'I'.
IF werks-option = 'EQ'.
WRITE : /70 text-a05, 92 werks-low.
ELSE.
WRITE: /70 text-a05, 92 'From', 98 werks-low,
104 'to', 108 werks-high.
ENDIF.
ENDLOOP.
ENDIF.
IF pspid IS INITIAL.
WRITE: /70 text-a06, 92 'All'.
ELSE.
LOOP AT pspid WHERE sign = 'I'.
WRITE:/70 text-a06, 92 pspid-low.
ENDLOOP.
ENDIF.
IF pspnr1 IS INITIAL.
WRITE: /70 text-a07, 92 'All'.
ELSE.
LOOP AT pspnr1 WHERE sign = 'I'.
WRITE:/70 text-a07, 92 pspnr1-low.
ENDLOOP.
ENDIF.
IF elikz EQ 'X'.
WRITE: /70 text-a08, 92 'Open PO only'.
ELSEIF elikz IS INITIAL.
WRITE: /70 text-a08, 92 'All PO'.
ENDIF.
IF stock EQ 'X'.
WRITE: ', Common Stock Items'.
ELSEIF pspnr IS INITIAL.
WRITE: ', All Stock'.
ENDIF.
IF sy-linno >= linno.
linno = sy-linno + 1.
ENDIF.
SKIP TO LINE linno.
ULINE.
ENDIF.
FORMAT COLOR 1 INTENSIFIED OFF.
WRITE:/ 'PO',
12 'Vendor no.',
25 'Company',
60 'PO Crt dt',
73 'Approved dt',
86 'Incoterm',
170 ' '.
FORMAT COLOR 2 INTENSIFIED OFF.
WRITE:/2 'Item',
9 'Material',
30 'Description',
73 'Chged date',
84 'Delv date',
95 'OA date',
106 'OA Number', "NWC-29042005
122 'GR date',
138 'Order Qty',
158 'GR Qty',
167 'UoM',
170 ' '.
FORMAT COLOR 4 INTENSIFIED OFF.
WRITE:/2 'Ship notf #',
15 'ETD.',
26 'ETA',
44 'Shipped Qty',
57 'UoM',
170 ' '.
FORMAT COLOR 5 INTENSIFIED OFF.
WRITE:/2 'Remarks',
170 ' '.
ULINE.
ENDIF.
form MAINTAIN_FIELDCATLOG .
REFRESH gt_fieldcat.
CLEAR gs_fieldcat.
PERFORM fill_fieldcatlog USING:
'01' '01' 'STR' 'GT_FINAL' 'Account Assignment',
'01' '02' 'KONT1' 'GT_FINAL' 'Kont1',
'01' '03' 'KONT2' 'GT_FINAL' 'Kont2',
'01' '04' 'EBELN' 'GT_FINAL' 'PO',
'01' '05' 'LIFNR' 'GT_FINAL' 'Vendor no',
'01' '06' 'NAME1' 'GT_FINAL' 'Company',
'01' '07' 'AEDAT' 'GT_FINAL' 'PO Crt dt',
'01' '08' 'UDATE' 'GT_FINAL' 'Approved dt' ,
'01' '09' 'INCO1' 'GT_FINAL' 'Incoterm Code',
'01' '10' 'INCO2' 'GT_FINAL' 'Incoterm Text',
'01' '11' 'EBELP' 'GT_FINAL' 'Item',
'01' '12' 'MATNR' 'GT_FINAL' 'Material',
'01' '13' 'TXZ01' 'GT_FINAL' 'Description',
'01' '14' 'PAEDT' 'GT_FINAL' 'Chged date',
'01' '15' 'EINDT' 'GT_FINAL' 'Delv date',
'01' '16' 'EINDT1' 'GT_FINAL' 'OA date',
'01' '17' 'LABNR' 'GT_FINAL' 'OA Number',
'01' '18' 'BUDAT' 'GT_FINAL' 'GR date',
'01' '19' 'MENGE' 'GT_FINAL' 'Order Qty',
'01' '20' 'WEMNG' 'GT_FINAL' 'GR Qty',
'01' '21' 'MEINS' 'GT_FINAL' 'UoM',
'01' '22' 'VBELN' 'GT_FINAL' 'Ship notf #',
'01' '23' 'TDDAT' 'GT_FINAL' 'ETD',
'01' '24' 'LFDAT' 'GT_FINAL' 'ETA',
'01' '25' 'LFIMG' 'GT_FINAL' 'Shipped Qty',
'01' '26' 'VRKME' 'GT_FINAL' 'UoM',
'01' '27' 'L_TEXT' 'GT_FINAL' 'Remarks'.
endform. " MAINTAIN_FIELDCATLOG
form FILL_FIELDCATLOG using lv_rowpos TYPE sycurow
lv_colpos TYPE sycucol
lv_fldnam TYPE fieldname
lv_tabnam TYPE tabname
lv_seltext TYPE dd03p-scrtext_l.
gs_fieldcat-row_pos = lv_rowpos.
gs_fieldcat-col_pos = lv_colpos.
gs_fieldcat-fieldname = lv_fldnam.
gs_fieldcat-tabname = lv_tabnam.
gs_fieldcat-seltext_l = lv_seltext.
APPEND gs_fieldcat TO gt_fieldcat.
CLEAR gs_fieldcat.
endform. " FILL_FIELDCATLOG
form DISPLAY_DATA .
DATA : lv_repid TYPE syrepid.
lv_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = lv_repid
it_fieldcat = gt_fieldcat
TABLES
t_outtab = gt_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0. "#EC NEEDED
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. " DISPLAY_DATA -
ALV top of page - heading depending upon list output
Hi All,
My alv grid report shows the report containing vendor account group and some other details.
My requirement is to get the page break for every new vendor account group and also print the vendor account group description at the top of the list (in header section).
I have achieved this by using * in sort table for page break and in top of page , I am reading the vendor acct grp desc table to print the header based on index sy-pagno.
But this solution is only working in print preview mode. If I print the output, actual page breaks are getting applied and I am not getting the desired output as logic using sy-pagno is giving wrong output.
My question is is there any way to get the current list in the top of page event? So that depending upon the displayed vendor acct grp per page, I will print its description?
OR is there any other way to achieve this functionality?Any suggestions?
-
Hi All,
I have the same issue as mentioned in the thread
ALV - Top of Page Error
Please let me know the solution
Thanks
Bala Duvvuri
Moderator message: please describe the problem in your own thread, do not have people clicking on links first.
Edited by: Thomas Zloch on Mar 22, 2011 9:59 AMSolved by self
-
The no of character in alv top of page
i have to display k:
Share\MM_SCUBCode_PDAtxt_Upload\OUT-1090000017-200903171823 - LY 2.txt
in the alv top of page but it is taking k:
Share\MM_SCUBCode_PDAtxt_Upload\OUT-1090000017-200903171823.
any idea how to do it
please check my code
form top_of_page .
DATA: wa_header TYPE slis_listheader.
IF p_file IS NOT INITIAL.
wa_header-typ = 'S'.
wa_header-key = 'File Path:'.
wa_header-info = p_file.
APPEND wa_header TO it_header.
CLEAR wa_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_header.
ENDIF.Hi,
To overcome this limitation we can use dynamic document, which can be implemented through the class CL_DD_DOCUMENT. As dynamic documents use HTML viewer control so instead of triggering the TOP_OF_PAGE event we should trigger event of HTML TOP_OF_PAGE.
First create a subroutine for top of page in HTML format and send that name in I_CALLBACK_HTML_TOP_OF_PAGE parameter of ALV function module. The input parameter for this subroutine will be a variable of class CL_DD_DOCUMENT.
* FORM html_top_of_page *
FORM html_top_of_page USING top TYPE REF TO cl_dd_document.
data: l_text(255) type c.
l_text = 'k:\\Share\MM_SCUBCode_PDAtxt_Upload\OUT-1090000017-200903171823 - LY 2.txt'.
CALL METHOD top->add_text EXPORTING text = 'Hello world '
sap_style = 'heading' .
CALL METHOD top->add_gap EXPORTING width = 200.
CALL METHOD top->add_picture EXPORTING picture_id = 'ENJOYSAP_LOGO'.
CALL METHOD top->NEW_LINE( ).
CALL METHOD top->add_text EXPORTING
text = l_text.
ENDFORM.
* Display ALV grid
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
i_callback_program = g_repid
i_structure_name = 'STRUCTURE'
TABLES
t_outtab = gt_outtab.
Regards
Bala Krishna -
How to write ICONS in ALV TOP of Page
Hai experts,
How to ICON in ALV Top of PAGE
i want to wrire
ICON_LED_RED for cancellation Invioce
ICON_LED_GREEN for Invioce
but i pass this values to wa_header-info it comes @5C@ @5B@
thanks
sitaramHi...
I think this code is help full for u....
*& Report ZFI_TEST *
REPORT ZFI_ICON_TEST MESSAGE-ID zz .
*& TABLES DECLARATION *
TABLES: vbak.
*& TYPE POOLS DECLARATION *
TYPE-POOLS: slis.
*& INTERNAL TABLE DECLARATION *
DATA: BEGIN OF itab OCCURS 0,
icon TYPE icon-id, "itab-icon = '@08@' -> Green ; '@09@' -> Yellow ; '@0A@' -> Red
vbeln LIKE vbak-vbeln,
audat LIKE vbak-audat,
vbtyp LIKE vbak-vbtyp,
auart LIKE vbak-auart,
augru LIKE vbak-augru,
netwr LIKE vbak-netwr,
waerk LIKE vbak-waerk,
END OF itab.
*INTERNAL TABLE FOR FIELD CATALOG
DATA: wa_fieldcat TYPE slis_fieldcat_alv,
it_fieldcat TYPE slis_t_fieldcat_alv.
IT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV
WITH HEADER LINE,
*INTERNAL TABLE FOR EVENTS
DATA: it_event TYPE slis_t_event,
wa_event TYPE slis_alv_event,
*INTERNAL TABLE FOR SORTING
it_sort TYPE slis_t_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv,
*INTERNAL TABLE FOR LAYOUT
wa_layout TYPE slis_layout_alv.
*& VARIABLE DECLARATION *
DATA : v_repid TYPE sy-repid,
v_pagno(4) TYPE n,
v_date(8) TYPE c.
*& CONSTANTS *
CONSTANTS: c_x TYPE c VALUE 'X'.
*& SELECTION SCREEN *
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln,
s_vbtyp FOR vbak-vbtyp DEFAULT 'C'.
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_list RADIOBUTTON GROUP rad1 DEFAULT 'X'.
SELECTION-SCREEN : END OF LINE.
SELECTION-SCREEN : BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(20) text-004.
PARAMETERS: p_grid RADIOBUTTON GROUP rad1.
SELECTION-SCREEN : END OF LINE.
SELECTION-SCREEN: END OF BLOCK b2.
AT SELECTION-SCREEN.
PERFORM validate_screen.
*& START OF SELECTION *
START-OF-SELECTION.
CLEAR: itab, itab[].
V_REPID = SY-REPID.
PERFORM get_data.
PERFORM display_data.
*& END OF SELECTION *
END-OF-SELECTION.
*--DO ALV Process
v_repid = sy-repid.
*--Sort the Output Fields
PERFORM sort_fields.
*--Build Field catalog for the Output fields
PERFORM BUILD_FIELDCAT.
*--Set the Layout for ALV
PERFORM set_layout.
*& Form GET_DATA
text
TO GET THE DATA FROM TABLES INTO ITAB
FORM get_data .
SELECT vbeln
audat
vbtyp
auart
augru
netwr
waerk
INTO CORRESPONDING FIELDS OF TABLE itab
FROM vbak
WHERE vbeln IN s_vbeln AND
audat > '04.04.2005'
AND netwr > 0.
LOOP AT itab.
IF itab-netwr < 10000.
itab-icon = '@08@'.
ELSEIF itab-netwr > 10000 AND itab-netwr < 100000.
itab-icon = '@09@'.
ELSEIF itab-netwr > 100000.
itab-icon = '@0A@'.
ENDIF.
MODIFY itab INDEX sy-tabix.
ENDLOOP.
ENDFORM. " GET_DATA
*& Form sort_fields
FORM sort_fields .
CLEAR wa_sort.
wa_sort-fieldname = 'VBTYP'.
wa_sort-spos = '1'.
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
wa_sort-fieldname = 'NETWR'.
wa_sort-spos = '2'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO it_sort.
ENDFORM. " sort_fields
*& Form set_layout
FORM set_layout .
IF p_list = c_x .
wa_layout-window_titlebar = 'LIST DISPLAY'(016).
wa_layout-zebra = 'X'.
+
+
ALV LIST DISPLAY
PERFORM list_display TABLES itab.
o
+
+ ALV GRID DISPLAY
ELSEIF p_grid = c_x.
wa_layout-window_titlebar = 'GRID DISPLAY'(017).
wa_layout-zebra = 'X'.
PERFORM grid_display TABLES itab.
ENDIF.
ENDFORM. " set_layout
*& Form list_display
FORM list_display TABLES p_itab .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = v_repid
is_layout = wa_layout
it_fieldcat = it_fieldcat[]
it_sort = it_sort[]
i_save = 'U'
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. " list_display
*& Form GRID_DISPLAY
FORM grid_display TABLES p_itab .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
is_layout = wa_layout
it_fieldcat = it_fieldcat[]
it_sort = it_sort[]
it_events = it_event
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. " GRID_DISPLAY
*& Form VALIDATE_SCREEN
text
--> p1 text
<-- p2 text
FORM validate_screen .
DATA: lv_vbeln LIKE vbak-vbeln.
IF NOT s_vbeln IS INITIAL.
SELECT vbeln
INTO lv_vbeln
UP TO 1 ROWS
FROM vbak
WHERE vbeln IN s_vbeln.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE e000 WITH 'INVALID SALES DOC'.
ENDIF.
ENDIF.
ENDFORM. " VALIDATE_SCREEN
*& Form display_data
text
--> p1 text
<-- p2 text
FORM display_data .
DEFINE m_fieldcat.
add 1 to wa_fieldcat-col_pos.
wa_fieldcat-fieldname = &1.
wa_fieldcat-ref_tabname = 'VBAK'.
wa_fieldcat-do_sum = &2.
wa_fieldcat-cfieldname = &3.
append wa_fieldcat to it_fieldcat.
END-OF-DEFINITION.
DATA:
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv.
m_fieldcat 'ICON' '' ''.
m_fieldcat 'VBELN' '' ''.
m_fieldcat 'AUDAT' '' ''.
m_fieldcat 'VBTYP' '' ''.
m_fieldcat 'AUART' '' ''.
m_fieldcat 'AUGRU' '' ''.
m_fieldcat 'NETWR' 'C' 'WAERK'.
m_fieldcat 'WAERK' '' ''.
ENDFORM. " display_data[/code]
Regards,
Rahul
Edited by: Rahul Reddy on Apr 14, 2008 12:33 PM -
AVL report - top of page event code ?
Hi,
I want to print TOP-OF_PAGE event code in ALV reprot.
START-OF-SELECTION.
Perform ALV_REPORT.
TOP-OF-PAGE.
PERFORM top_of_page.
in the ALV function module(form alv_report) I have given like this.
but its not printing any thing in top of ALV report, but its leaving blank space.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
Can any one tell me how to write the code?
thanks.
Kavitha.hi,
use like this..
*& Form get_event
text
-->P_IT_EVENT text
FORM get_event USING P_IT_EVENT TYPE slis_t_event.
DATA : wa_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = it_event.
READ TABLE it_event WITH KEY name = slis_ev_top_of_page INTO wa_event.
IF SY-SUBRC = 0.
MOVE 'TOP_OF_PAGE' to wa_event-form.
APPEND wa_event to it_event.
ENDIF.
ENDFORM. " get_event
*FORM FOR TOP_OF_PAGE(to assign form for the top-of-page event)
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_listheader.
ENDFORM. "top_of_page
*& Form fill_listheader
text
-->P_IT_LISTHEADER text
FORM fill_listheader USING P_IT_LISTHEADER TYPE slis_t_listheader.
DATA : wa_listheader TYPE slis_listheader.
CLEAR wa_listheader.
wa_listheader-typ = 'S'.
wa_listheader-info ='S.T.O REPORT '.
APPEND wa_listheader TO it_listheader.
ENDFORM. " fill_listheader
*& Form call_alv_function
text
--> p1 text
<-- p2 text
FORM call_alv_function .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'CALL_TCODE'
I_STRUCTURE_NAME =
IS_LAYOUT = st_layout
IT_FIELDCAT = it_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = lt_sort
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = it_event[]
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 = IT_EKBE
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. " call_alv_function
Regards, -
How to pass field in Alv Top-of-page
Edited by: Deepak Mathrani on Aug 12, 2008 12:40 PM
<THREAD LOCKED. Please read the [Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement] to discover why>
Edited by: Mike Pokraka on Aug 12, 2008 2:58 PMHi
sample program
*& Report ZNNR_ALVSAMPLE
REPORT znnr_alvsample NO STANDARD PAGE HEADING.
TABLES: ekko.
TYPE-POOLS: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid.
*Start-of-selection.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
There are a number of ways to create a fieldcat.
For the purpose of this example i will build the fieldcatalog manualy
by populating the internal table fields individually and then
appending the rows. This method can be the most time consuming but can
also allow you more control of the final product.
Beware though, you need to ensure that all fields required are
populated. When using some of functionality available via ALV, such as
total. You may need to provide more information than if you were
simply displaying the result
I.e. Field type may be required in-order for
the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'. "Display column total
fieldcatalog-datatype = 'CURR'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
fieldcatalog-EDIT = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
FORM build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
ENDFORM. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE'(001) "see FORM
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
IT_EVENTS = GT_XEVENTS
i_save = 'X'
is_variant = z_template
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into table it_ekko.
endform. " DATA_RETRIEVAL
Form TOP-OF-PAGE *
ALV Report Header *
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c.
Title
wa_header-typ = 'H'.
wa_header-info = 'EKKO Table Report'.
append wa_header to t_header.
clear wa_header.
Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
append wa_header to t_header.
clear: wa_header.
Total No. of Records Selected
describe table it_ekko lines ld_lines.
ld_linesc = ld_lines.
concatenate 'Total No. of Records Selected: ' ld_linesc
into t_line separated by space.
wa_header-typ = 'A'.
wa_header-info = t_line.
append wa_header to t_header.
clear: wa_header, t_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header.
i_logo = 'Z_LOGO'.
endform. -
Hi Experts,
In my Alv report top-of-page, i have a date . with name "Open Items As key Date" but i cant see
full text and if the date is 11.07.2008. its showing 11.07.20. so how to do this.
Correct answers will be fully rewarded.
Regards
Sunita.Hi,
data : lv_bldat(10) type c.
write p_bldat to lv_bldat.
pass lv_bldat inside of p_bldat.
What about this thread
ALV Top-Of -Page Display No respose for this.
If u got the solution close the THREAD.
Thanks,
Durai.V
Edited by: Durai V on Jul 11, 2008 12:04 PM -
ALV- top-of-page: print varaibale in right corner,...
Hi,
In ALV (REUSE_ALV_GRID_DISPALY), i've requirement to print shop name at the top right corner of the top-of-page and sy-datum at top left corner.
How can I print a varaible at top right corner in top-of-page of ALV? and
how to print page no in ALV top-of-page?
How can I set portrait format to print the ALV?
regards,
Ravipls ignore
pk
Edited by: kishan P on Mar 9, 2009 6:01 PM
Maybe you are looking for
-
Category Titles all ending in e.g. Windows 8?
Why do many of the category titles on this forum end in "e.g. Windows 8"? I'm looking under hardware, but Windows 8 is of course software, I don't get it. Is there some meaning here I'm missing? Or is it what seems more likely that the creator of the
-
Item category in Purchase Requisition
Hello experts, i am having a problem with PR. I made my own docs for RFQ, PR, and PO. and i allowed only standard item category for all these document and i linked them as well. when i tried to make a PR with my PR doc type i left blank for item cate
-
I have to write a select query
hi i have a select-options DATE , i want to make a select QUERY which select all data Staring Date(Initial Date) to 1 less to DATE-LOW. For that i define a variable i.g. ODDATE = DATE-LOW - 1. this contain date 1 less then LOW. But now ho
-
I need help starting the server
Hello! I am trying to do the HelloWorld rmi-example and I can't get the server started. Can anyone tell me if there's something wrong what I am trying to do. At command prompt I type: java -Djava.rmi.server.codebase="file:///C:/temp/Jaana/aa/examples
-
Hi, Can someone tell me if that document from Metalink is still valide : Note:337660.1 "Subject: Using XML Publisher Program To Automatically Run Shipping Report As Part Of Document Set." "The functionality to support the XML Publisher program to aut