Alv header
hi all
there is a small doubt
we have a report developed in alv oops
haow can i add something on the top of report?
thanks in advance
Hi,
CHECK THIS PROGRAME
HI,
Test ALV Display With Header & Footer :-
*Program to Test ALV Display With Header & Footer.
*& Report ZRJR02 *
REPORT ZRJR02 .
*Table declaration.
TABLES:ZEMP_MST,ZDEPT_MST,ZDESG_MST,ZSL_TXN.
*Varriable declaration.
TYPE-POOLS SLIS.
DATA : POS TYPE I.
DATA REPID LIKE SY-REPID.
DATA : F1 TYPE SLIS_T_FIELDCAT_ALV,
F2 TYPE SLIS_FIELDCAT_ALV,
L_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA L_POS TYPE I VALUE 1. "position of the column
DATA GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
*DATA GT_SORT TYPE SLIS_T_SORTINFO_ALV.
data: GT_EVENTS TYPE SLIS_T_EVENT,
FS_EVENTCAT LIKE LINE OF GT_EVENTs.
*Internal table declaration.
*DATA BEGIN OF IT_SORT OCCURS 5.
INCLUDE TYPE SLIS_SORTINFO_ALV.
*DATA END OF IT_SORT.
DATA:BEGIN OF ITAB OCCURS 0,
ZEMPNO LIKE ZEMP_MST-ZEMPNO,
ZEMPNAME LIKE ZEMP_MST-ZEMPNAME,
ZDEPTCD LIKE ZEMP_MST-ZDEPTCD,
ZDEPTNAME LIKE ZDEPT_MST-ZDEPTNAME,
ZDESGCD LIKE ZEMP_MST-ZDESGCD,
ZDESGNAME LIKE ZDESG_MST-ZDESGNAME,
END OF ITAB.
REFRESH ITAB.CLEAR ITAB.
START-OF-SELECTION.
SELECT AZEMPNO AZEMPNAME AZDEPTCD BZDEPTNAME AZDESGCD CZDESGNAME
FROM ZEMP_MST AS A
INNER JOIN ZDEPT_MST AS B
ON AZDEPTCD EQ BZDEPTCD
INNER JOIN ZDESG_MST AS C
ON AZDESGCD EQ CZDESGCD
INTO CORRESPONDING FIELDS OF TABLE ITAB.
IF SY-SUBRC <> 0.
MESSAGE E899(M3) WITH 'No records'.
ENDIF.
perform f_build_eventcat.
PERFORM LAYOUT.
END-OF-SELECTION.
*& Form LAYOUT
FORM LAYOUT .
PERFORM FCAT USING 'ZEMPNO' 'ITAB' '' 'Emp.No.' 'ZEMPNO' 'ZEMP_MST' ''.
PERFORM FCAT USING 'ZEMPNAME' 'ITAB' '' 'Emp. Name' 'ZEMPNAME' 'ZEMP_MST' ''.
PERFORM FCAT USING 'ZDEPTCD' 'ITAB' '' 'Dept.Code' 'ZDEPTCD' 'ZEMP_MST' ''.
PERFORM FCAT USING 'ZDEPTNAME' 'ITAB' '' 'Dept.Name' 'ZDEPTNAME' 'ZDEPT_MST' ''.
PERFORM FCAT USING 'ZDESGCD' 'ITAB' '' 'Desg.Code' 'ZDESGCD' 'ZEMP_MST' ''.
PERFORM FCAT USING 'ZDESGNAME' 'ITAB' '' 'Desg.Name' 'ZDESGNAME' 'ZDESG_MST' ''.
PERFORM LSORT USING 'ZEMPNO' 'IDATA' ''.
PERFORM LSORT USING 'ZEMPNAME' 'IDATA' ''.
MOVE IT_SORT[] TO GT_SORT[].
REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = REPID
IT_FIELDCAT = F1
IT_SORT = GT_SORT
I_SAVE = 'X'
IT_EVENTS = GT_EVENTS[]
TABLES
T_OUTTAB = ITAB.
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. " LAYOUT
*& Form FCAT
FORM FCAT USING P_FIELD P_TABLE P_SUM P_TEXT P_RFIELD P_RTABLE P_DISP.
ADD 1 TO POS.
F2-COL_POS = POS.
F2-FIELDNAME = P_FIELD.
F2-TABNAME = P_TABLE.
F2-SELTEXT_L = P_TEXT.
F2-REF_FIELDNAME = P_RFIELD.
F2-REF_TABNAME = P_RTABLE.
F2-DO_SUM = P_SUM.
F2-NO_OUT = P_DISP.
APPEND F2 TO F1.
CLEAR F2.
ENDFORM. " FCAT
*& Form LSORT
*FORM LSORT USING P_FIELD P_TABLE P_UP.
ADD 1 TO L_POS.
IT_SORT-SPOS = L_POS.
IT_SORT-FIELDNAME = P_FIELD.
IT_SORT-TABNAME = P_TABLE.
IT_SORT-UP = P_UP.
APPEND IT_SORT.
*ENDFORM. " LSORT
FORM F_BUILD_EVENTCAT .
CLEAR: GT_EVENTS. REFRESH: GT_EVENTS.
CLEAR: FS_EVENTCAT.
FS_EVENTCAT-NAME = 'TOP_OF_PAGE'.
FS_EVENTCAT-FORM = 'F_REPORT_HEADER_ALV'.
APPEND FS_EVENTCAT TO GT_EVENTS.
CLEAR: FS_EVENTCAT.
FS_EVENTCAT-NAME = 'END_OF_LIST'.
FS_EVENTCAT-FORM = 'F_WRITE_SUMMARY'.
APPEND FS_EVENTCAT TO GT_EVENTS.
ENDFORM. " F_BUILD_EVENTCAT
FORM F_REPORT_HEADER_ALV.
CALL FUNCTION 'Z_YHEAD_PRINT'
EXPORTING
TITLE1 = 'XYZ Limited'
TITLE2 = 'Employee Master'
TITLE3 = 'Created on '
COLOR = 'X'
ENDFORM.
*& Form F_WRITE_SUMMARY
Write summary before exit
FORM F_WRITE_SUMMARY .
write:/ 'Welcome to XYZ Limited'.
write:/ 'This is a test program to display Report in ALV Format'.
ENDFORM.
http://www.sap-img.com/fu037.htm
Hope it helps you...
Ramesh.
Similar Messages
-
How to display total in ALV Header
How to display total in ALV Header?
Hi Venkey,
As far as your issue is concerned I would like to quote my perception.
Create a header internal table with title and number of records.
At the later part of your program you should have found the total number of records ,now assign it to the header internal table and print it.
For further clarification you can go check this link:
http://wiki.sdn.sap.com/wiki/display/ABAP/AddHeadertoALVreport
Thanks
P.Srikanth -
Hi friends,
I make one header alv ok I want and take one variable count in my program so I want to display its value in ALV HEADER
Total Target Qty:
Total EMP. Efficiency
Total Machine Effi.
I take may header like this and pass thre text here.ok Now I want to display value of this three.
Total Trget Qty: 2.23 like that.
CLEAR st_line.
st_line-typ = 'S'.
CONCATENATE 'Total Target Qty: ' count ' ' INTO st_line-info.
APPEND st_line TO t_list_top_of_page.
So I took like this in header count is my variable in which I take value.
So how can we pass the value in ALV Header please tell me.
its urgent so.
Thnaks in Advance.
Prashant.HI DHWANI,
*& Report ZPP_RE_EMP_DETAILS
*& This Report is used to check the Employee Performance And Used Machine Quantity
*& Rqueirement By Santhosh
*& Developed By Prashant On Date 01.02.2008
*& Created By: Prashant Brahmbhatt
*& Creation Date: 20080201
*& Module: PP (Production & Plannig)
*& Changed By Changed Date Reason
REPORT zpp_re_emp_details.
TABLES:zpplan.
TYPE-POOLS:slis.
DATA:BEGIN OF itab OCCURS 0,
zdate LIKE zpplan-zdate,
werks LIKE zpplan-werks,
mname LIKE zpplan-mname,
shftin LIKE zpplan-shftin,
iserh LIKE zpplan-iserh,
quaty LIKE zpplan-quaty,
plan_qty LIKE zpplan-plan_qty,
act_prod LIKE zpplan-act_prod,
temp TYPE c,
tar_qty(10) TYPE c,
ach_qty(10) TYPE c,
mch_eff(10) TYPE c,
a(10) TYPE c,
END OF itab.
DATA:BEGIN OF temp OCCURS 0,
zdate LIKE zpplan-zdate,
werks LIKE zpplan-werks,
mname LIKE zpplan-mname,
shftin LIKE zpplan-shftin,
iserh LIKE zpplan-iserh,
quaty LIKE zpplan-quaty,
plan_qty LIKE zpplan-plan_qty,
act_prod LIKE zpplan-act_prod,
temp TYPE c,
tar_qty(10) TYPE c,
ach_qty(10) TYPE c,
mch_eff(10) TYPE c,
a(10) TYPE c,
END OF temp.
DATA:BEGIN OF itab_t OCCURS 0,
zdate LIKE zpplan-zdate,
werks LIKE zpplan-werks,
mname LIKE zpplan-mname,
shftin LIKE zpplan-shftin,
iserh LIKE zpplan-iserh,
quaty LIKE zpplan-quaty,
plan_qty LIKE zpplan-plan_qty,
act_prod LIKE zpplan-act_prod,
temp TYPE c,
tar_qty(10) TYPE c,
ach_qty(10) TYPE c,
mch_eff(10) TYPE c,
a(10) TYPE c,
END OF itab_t.
DATA:BEGIN OF itab1 OCCURS 0,
zdate LIKE zpplan-zdate,
werks LIKE zpplan-werks,
mname LIKE zpplan-mname,
shftin LIKE zpplan-shftin,
act_prod LIKE zpplan-act_prod,
quaty LIKE zpplan-quaty,
planned LIKE zpplan-planned,
iserh LIKE zpplan-iserh,
temp TYPE c,
tar_qty TYPE p DECIMALS 2,
ach_qty TYPE p DECIMALS 2,
mch_eff TYPE p DECIMALS 2,
END OF itab1.
DATA: wa LIKE itab1.
DATA:BEGIN OF itab2 OCCURS 0,
zdate LIKE zpplan-zdate,
werks LIKE zpplan-werks,
mname LIKE zpplan-mname,
shftin LIKE zpplan-shftin,
act_prod LIKE zpplan-act_prod,
quaty LIKE zpplan-quaty,
planned LIKE zpplan-planned,
iserh LIKE zpplan-iserh,
temp TYPE c,
tar_qty(10) TYPE p DECIMALS 2,
ach_qty(10) TYPE p DECIMALS 2,
mch_eff(10) TYPE p DECIMALS 2,
count(10) TYPE c,
END OF itab2.
DATA: a(10) TYPE c,
b(10) TYPE c,
count(10) TYPE c,
count1(10) TYPE c.
c(2) TYPE p DECIMALS 2.
DATA:t_fcat TYPE slis_t_fieldcat_alv,
t_events TYPE slis_t_event,
t_list_top_of_page TYPE slis_t_listheader,
t_list_end_of_page TYPE slis_t_listheader.
CONSTANTS:c_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
CONSTANTS:c_formname_end_of_page TYPE slis_formname VALUE 'END_OF_PAGE'.
DATA: st_line TYPE slis_listheader.
SELECTION-SCREEN
SELECTION-SCREEN:BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
*PARAMETERS:shftin LIKE zpplan-shftin.
SELECT-OPTIONS:date FOR zpplan-zdate,
shftin FOR zpplan-shftin,
werks FOR zpplan-werks.
SELECTION-SCREEN:END OF BLOCK blk1.
ALV CALL
INITIALIZATION.
PERFORM build_fieldcatalog USING t_fcat .
PERFORM event_call.
PERFORM head_built USING t_events.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM display_alv.
*& Form build_fieldcatalog
text
-->P_T_FCAT text
FORM build_fieldcatalog USING temp_fcat TYPE slis_t_fieldcat_alv.
DATA:w_fcat TYPE slis_fieldcat_alv.
w_fcat-tabname = 'ITAB2'.
w_fcat-fieldname = 'MNAME'.
w_fcat-seltext_m = 'Machine Name'.
APPEND w_fcat TO temp_fcat.
CLEAR w_fcat.
w_fcat-tabname = 'ITAB2'.
w_fcat-fieldname = 'SHFTIN'.
w_fcat-seltext_m = 'Emp No'.
APPEND w_fcat TO temp_fcat.
CLEAR w_fcat.
w_fcat-tabname = 'ITAB2'.
w_fcat-fieldname = 'ZDATE'.
w_fcat-seltext_m = 'Pos Date'.
APPEND w_fcat TO temp_fcat.
CLEAR w_fcat.
w_fcat-tabname = 'ITAB2'.
w_fcat-fieldname = 'QUATY'.
w_fcat-seltext_m = 'Quantity'.
APPEND w_fcat TO temp_fcat.
CLEAR w_fcat.
w_fcat-tabname = 'ITAB2'.
w_fcat-fieldname = 'ACT_PROD'.
w_fcat-seltext_m = 'Actual Quantity'.
APPEND w_fcat TO temp_fcat.
CLEAR w_fcat.
w_fcat-tabname = 'ITAB2'.
w_fcat-fieldname = 'ISERH'.
w_fcat-seltext_m = 'Down Time'.
APPEND w_fcat TO temp_fcat.
CLEAR w_fcat.
w_fcat-tabname = 'ITAB2'.
w_fcat-fieldname = 'TAR_QTY'.
w_fcat-seltext_m = 'Target Qty.'.
APPEND w_fcat TO temp_fcat.
CLEAR w_fcat.
w_fcat-tabname = 'ITAB2'.
w_fcat-fieldname = 'ACH_QTY'.
w_fcat-seltext_m = 'EMP Effec.'.
APPEND w_fcat TO temp_fcat.
CLEAR w_fcat.
w_fcat-tabname = 'ITAB2'.
w_fcat-fieldname = 'MCH_EFF'.
w_fcat-seltext_m = 'Machine Effec.'.
APPEND w_fcat TO temp_fcat.
CLEAR w_fcat.
w_fcat-tabname = 'ITAB2'.
w_fcat-fieldname = 'COUNT'.
w_fcat-seltext_m = 'Machine Effec.'.
APPEND w_fcat TO temp_fcat.
CLEAR w_fcat.
ENDFORM. " build_fieldcatalog
*& Form event_call
text
--> p1 text
<-- p2 text
FORM event_call .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = t_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 data_retrieval
text
--> p1 text
<-- p2 text
FORM data_retrieval .
IF shftin <> ''.
SELECT zdate werks mname shftin INTO CORRESPONDING FIELDS OF TABLE
temp FROM zpplan
WHERE shftin IN shftin
AND zdate IN date
AND werks IN werks.
ELSE.
SELECT zdate werks mname INTO CORRESPONDING FIELDS OF TABLE
temp FROM zpplan
WHERE zdate IN date
AND werks IN werks.
ENDIF.
SORT temp BY mname zdate shftin.
DELETE ADJACENT DUPLICATES FROM temp.
SORT temp BY mname shftin zdate.
DELETE ADJACENT DUPLICATES FROM temp.
APPEND temp.
LOOP AT temp.
SELECT zdate werks mname shftin act_prod quaty iserh FROM zpplan INTO CORRESPONDING FIELDS OF TABLE itab_t
WHERE mname = temp-mname
AND zdate = temp-zdate
AND werks = temp-werks.
LOOP AT itab_t.
MOVE-CORRESPONDING itab_t TO itab.
APPEND itab.
ENDLOOP.
ENDLOOP.
*******************************************8
SELECT zdate werks mname shftin act_prod quaty iserh FROM zpplan INTO CORRESPONDING FIELDS OF TABLE itab
FOR ALL ENTRIES IN temp
WHERE zdate = temp-zdate AND
werks = temp-werks
AND mname = temp-mname.
SELECT zdate werks mname shftin act_prod quaty iserh FROM zpplan INTO CORRESPONDING FIELDS OF TABLE itab
WHERE zdate IN date AND
werks IN werks AND
shftin = shftin.
SORT itab BY mname zdate.
DELETE ADJACENT DUPLICATES FROM itab.
LOOP AT itab.
MOVE-CORRESPONDING itab TO itab1.
COLLECT itab1.
ENDLOOP.
LOOP AT itab1.
itab1-tar_qty = itab1-tar_qty + ( itab1-quaty / 3 ).
IF ( itab1-tar_qty NE 0 ).
itab1-ach_qty = ( itab1-ach_qty + itab1-act_prod / itab1-tar_qty ) * 100.
ELSE.
itab1-ach_qty = 0 * 100.
ENDIF.
itab1-mch_eff = ( ( 8 - itab1-iserh ) / 8 ) * 100.
MODIFY itab1 TRANSPORTING tar_qty ach_qty mch_eff.
ENDLOOP.
LOOP AT itab1.
READ TABLE itab1 INDEX 1 INTO wa.
IF itab1-mname = wa-mname.
itab1-zdate = wa-zdate.
itab2-shftin = itab1-shftin.
itab2-mname = itab1-mname.
itab2-zdate = itab1-zdate.
itab2-quaty = itab2-quaty + itab1-quaty.
itab2-act_prod = itab2-act_prod + itab1-act_prod.
itab2-iserh = itab2-iserh + itab1-iserh.
itab2-tar_qty = itab2-tar_qty + itab1-tar_qty.
itab2-ach_qty = itab2-ach_qty + itab1-ach_qty.
itab2-mch_eff = itab2-mch_eff + itab1-mch_eff.
ELSE.
APPEND itab2.
CLEAR itab2.
MOVE-CORRESPONDING itab1 TO wa.
itab2-shftin = itab1-shftin.
itab2-mname = itab1-mname.
itab2-zdate = itab1-zdate.
itab2-quaty = itab2-quaty + itab1-quaty.
itab2-act_prod = itab2-act_prod + itab1-act_prod.
itab2-iserh = itab2-iserh + itab1-iserh.
itab2-tar_qty = itab2-tar_qty + itab1-tar_qty.
itab2-ach_qty = itab2-ach_qty + itab1-ach_qty.
itab2-mch_eff = itab2-mch_eff + itab1-mch_eff.
ENDIF.
ENDLOOP.
APPEND itab2.
LOOP AT itab2.
IF ( itab2-tar_qty NE 0 ).
itab2-ach_qty = ( itab2-ach_qty + itab2-act_prod / itab2-tar_qty(10) ) * 100.
ELSE.
itab2-ach_qty = 0 * 100.
ENDIF.
itab2-mch_eff = ( ( 8 - itab2-iserh ) / 8 ) * 100.
MODIFY itab2 TRANSPORTING tar_qty ach_qty mch_eff.
ENDLOOP.
APPEND itab2.
LOOP AT itab2.
count = sy-tfill.
a = a + itab2-tar_qty.
b = b + itab2-ach_qty.
ENDLOOP.
CLEAR itab2.
itab2-tar_qty = a.
itab2-ach_qty = b.
APPEND itab2.
CLEAR itab2.
count = a / sy-tfill.
count1 = b / sy-tfill.
itab2-tar_qty = count.
itab2-ach_qty = count1.
itab2-tar_qty = count.
APPEND itab2.
ENDFORM. " data_retrieval
*& Form head_built
text
-->P_T_EVE text
FORM head_built USING p_t_eve TYPE slis_t_event.
count = a / sy-tfill.
DATA: ls_event TYPE slis_alv_event.
REFRESH t_list_top_of_page.
READ TABLE p_t_eve WITH KEY name = slis_ev_top_of_page INTO ls_event.
IF sy-subrc = 0.
MOVE c_formname_top_of_page TO ls_event-form.
MODIFY p_t_eve FROM ls_event INDEX sy-tabix.
ENDIF.
CLEAR st_line.
st_line-typ = 'S'.
st_line-key = 'Total Target Qty: '.
st_line-info = count.
APPEND st_line TO t_list_top_of_page.
CLEAR st_line.
st_line-typ = 'S'.
st_line-info = count.
CONCATENATE 'Avg Target Qty.' count ' ' INTO st_line-info.
APPEND st_line TO t_list_top_of_page.
CLEAR st_line.
st_line-typ = 'S'.
st_line-key = 'Avg.EMP Efficiency: '.
st_line-info = count1.
APPEND st_line TO t_list_top_of_page.
CLEAR st_line.
st_line-typ = 'S'.
st_line-key = 'Avg. Machine Efficincy: '.
st_line-info = count.
APPEND st_line TO t_list_top_of_page.
REFRESH t_list_end_of_page.
READ TABLE p_t_eve WITH KEY name = slis_ev_end_of_list INTO ls_event.
IF sy-subrc = 0.
MOVE c_formname_end_of_page TO ls_event-form.
MODIFY p_t_eve FROM ls_event INDEX sy-tabix.
ENDIF.
CLEAR st_line.
st_line-typ = 'S'.
CONCATENATE 'END OF PAGE' ' ' INTO st_line-info.
APPEND st_line TO t_list_end_of_page.
ENDFORM. " head_built
*& Form top-of-page
text
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_list_top_of_page
I_LOGO =
I_END_OF_LIST_GRID =
I_ALV_FORM =
ENDFORM. "top-of-page
*& Form display_alv
text
--> p1 text
<-- p2 text
FORM display_alv .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = 'ZPP_RE_EMP_DETAILS'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
i_background_id = 'ALV_BACKGROUND'
i_grid_title = 'EMP Information'
I_GRID_SETTINGS =
IS_LAYOUT =
it_fieldcat = t_fcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = t_events
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = itab2
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 -
Space in Top of page on alv header
Hi Experts,
I do have a query on ALV , Can you please help me in solving my problem.
Here goes my query...
I have to develop a ALV where on the top of page i have to display two fields as shown in below which was highlighted in the screen
http://img410.imageshack.us/my.php?image=op2sn9.jpg
But i'm getting output as shown below screen
http://img410.imageshack.us/my.php?image=op1ut4.jpg
I have tried with space and all other alternatives but i'm unable to get the desired output.
Can i have any sample code for the same
Regards
NandaHi,
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,
gt_events type slis_t_event,
gd_prntparams type slis_print_alv.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform build_events.
perform build_print_params.
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 No'.
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-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
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' "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_events
is_print = gd_prntparams
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.
* FORM USER_COMMAND *
* --> R_UCOMM *
* --> RS_SELFIELD *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
* Check function code
CASE r_ucomm.
WHEN '&IC1'.
* Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'EBELN'.
* Read data table, using index of row user clicked on
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
* Set parameter ID for transaction screen field
SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
* Sxecute transaction ME23N, and skip initial data entry screen
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM.
*& Form BUILD_EVENTS
* Build events table
form build_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_end_of_page
into ls_event.
if sy-subrc = 0.
move 'END_OF_PAGE' to ls_event-form.
append ls_event to gt_events.
endif.
read table gt_events with key name = slis_ev_end_of_list
into ls_event.
if sy-subrc = 0.
move 'END_OF_LIST' to ls_event-form.
append ls_event to gt_events.
endif.
endform. " BUILD_EVENTS
*& Form BUILD_PRINT_PARAMS
* Setup print parameters
form build_print_params.
gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
gd_prntparams-no_coverpage = 'X'.
endform. " BUILD_PRINT_PARAMS
*& Form END_OF_PAGE
form END_OF_PAGE.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
write: sy-uline(50).
skip.
write:/40 'Page:', sy-pagno .
endform.
*& Form END_OF_LIST
form END_OF_LIST.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
skip.
write:/40 'Page:', sy-pagno .
endform.
Try with this sample
Regards
Krishna -
Alv heading to display in excel
Hi
i have a problem ,
i want 2 take print of body of alv with ALV header.
while printing , only body is comin for print-out, not a header.
guide me.
points vil be rewardedwrite the header under the event top-fo-page and use listheader structure and also use FM ALV_commentary _write
see following code for example
http://sapprograms.blogspot.com/2008/04/alv-grid-display-report.html -
Rename alv header text in webdynpro abap
Hi ,
I have created two attribute PART_NUMBER and TERM_CODE in context level with type CHAR10.
AND in ALV header PART_NUMBER and TERM_CODE is displaying, which is coming from context level.
i want to rename the header of ALV to PARTNUMBER and TERMCODE.
could any one send me the sampls code or any solution?
Thanks
RaksharFirst get access to the ALV Model object for your ALV usage:
data: l_ref_cmp_usage type ref to if_wd_component_usage.
l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).
if l_ref_cmp_usage->has_active_component( ) is initial.
l_ref_cmp_usage->create_component( ).
endif.
data l_salv_wd_table type ref to iwci_salv_wd_table.
l_salv_wd_table = wd_this->wd_cpifc_alv( ).
data l_table type ref to cl_salv_wd_config_table.
l_table = l_salv_wd_table->get_model( ).
Then access the column you want to change the header on. In addition to setting the text of the header of the column, you must also force off the data dictionary binding for the field property text.
data l_column type ref to cl_salv_wd_column.
l_column = l_table->if_salv_wd_column_settings~get_column( 'POSTING_DATE' ).
data l_header type ref to cl_salv_wd_column_header.
l_header = l_column->get_header( ).
l_header->set_prop_ddic_binding_field(
property = if_salv_wd_c_ddic_binding=>bind_prop_text
value = if_salv_wd_c_ddic_binding=>ddic_bind_none ).
l_header->set_text( `Posting Date` ). -
How to Display Logo in ALV Header?
Hi
I want to display/ print my company logo image in ALV Header. Please help me how can I do this?
Thanks
Iftikhar Ali
Islamabad.Hi,
If you are already having a logo say ZLOGO .
You can use it this way .
Give TOP-OF-PAGE
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
And in top of page do this .
FORM top-of-page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRIT
EXPORTING
IT_LIST_COMMENTARY = IT_LISTHE
i_logo = 'ZLOGO'
I_END_OF_LIST_GRID =
endform.
Hope this will work .
Reward if found useful.
Regards
SureshP. -
Displaying blank line in ALV header
How do I display a blank line in ALV header
For eg i want if i want the ALV header to display as follows
Document Datewise Report as of 31/10/2009
<-- BLANK LINE
Run On : 01/12/2009Hi,
Are you using 'REUSE_ALV_COMMENTARY_WRITE' for displaying the header?
If yes, then I think it is not possible. Instead, use the events table to achieve it.
Use the 'REUSE_ALV_EVENTS_GET' FM to get all possible events and then modify
the events internal table to specify the form name to handle top-of-page event.
eg.
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.
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.
FORM TOP_OF_PAGE.
* Use write statements to display the header data.
ENDFORM.
In write statement use '/' to go to new line. So to insert an empty line you can use something like
write : 'some text' / / 'some text' .
Hope this helps.
Regards,
Bhavesh. -
Hi Friends,
In ALV GRID i need to display the output header like below.
SHIP
SOLD
|----
NUM
NAME
NUM
NAME
It's not dots and pipes. But like the box with above design.
Can any one please give me your valuable inputs regarding this.
I want to use it in ALV GRID . i.e: By using ALV FM or OOPS also.
Thanks
Srinivas.Hi
REPORT znnr_nnr LINE-SIZE 125.
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,
gt_events type slis_t_event,
gd_prntparams type slis_print_alv.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform build_events.
perform build_print_params.
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-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
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' "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_events
is_print = gd_prntparams
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.
FORM USER_COMMAND *
--> R_UCOMM *
--> RS_SELFIELD *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
Check function code
CASE r_ucomm.
WHEN '&IC1'.
Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'EBELN'.
Read data table, using index of row user clicked on
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
Set parameter ID for transaction screen field
SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
Sxecute transaction ME23N, and skip initial data entry screen
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM.
*& Form BUILD_EVENTS
Build events table
form build_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_end_of_page
into ls_event.
if sy-subrc = 0.
move 'END_OF_PAGE' to ls_event-form.
append ls_event to gt_events.
endif.
read table gt_events with key name = slis_ev_end_of_list
into ls_event.
if sy-subrc = 0.
move 'END_OF_LIST' to ls_event-form.
append ls_event to gt_events.
endif.
endform. " BUILD_EVENTS
*& Form BUILD_PRINT_PARAMS
Setup print parameters
form build_print_params.
gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
gd_prntparams-no_coverpage = 'X'.
endform. " BUILD_PRINT_PARAMS
*& Form END_OF_PAGE
form END_OF_PAGE.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
write: sy-uline(50).
skip.
write:/40 'Page:', sy-pagno .
endform.
*& Form END_OF_LIST
form END_OF_LIST.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
endform. -
Vertical text in ALV header (WD4A)
HI,
Can anybody tell me how I can display ALV header text in WD4A as vertical text ?
Cheers, JohnHi,
DATA:
lr_alv_header TYPE REF TO cl_salv_wd_column_header.
Get the column reference of the ALV column.
CALL METHOD lr_column->set_width
EXPORTING
value = '70'.
lr_alv_header = lr_column->get_header( ).
lr_alv_header->set_text( 'Header' ).
lr_column->set_resizable( abap_true ).
lr_alv_header->set_header_text_wrapping( abap_true ). -
Hi friends,
I want the heading of an ALV report in the format given as below ..... Is that possible ???
In the 1st line :-
123 ( Left corner ) ..... ABC (Center).... date (right corner)
In the second line also :- something like the first line .....
Is that possible ???
If yes ... How can i do this ???
Expecting your answers
thanks in advance
Cheers
R.Kriparefer the links:
http://www.sap-img.com/abap/test-alv-display-with-header-footer.htm
or
http://www.sap-img.com/abap/sample-alv-heading-in-alv.htm
or
ALV LIST Header
how to display header in alv list
The last two would address your question more precisely.
Regards,
Ravi -
Hi,
How to dispaly ALV Heading in each and every page while printing or in download file in (EXCEL).
Thanks & Regards
hruHi Manish,
Thank you for your reply
Iam using the ALV GRID using FM REUSE_ALV_GRID_DISPLAY
The event ( FROM = 'TOP_OF_PAGE') (NAME = 'SLIS_EV_TOP_OF_PAGE') and add this event to the function module REUSE_ALV_EVENTS_GET.
create a Form with the name 'TOP_OF_PAGE',in this form use the function module REUSE_ALV_LIST_COMMENTARY' to display heaer text.
Build the code like this and then i did download all the records to excel file, But in that i found Header information display only once.
But i want display heading each and every page.
Thanks & Regards
hru -
Regarding ALV Header to display at Right side of Header
Hi dudes..
How to handle ALV header to print content at right side of the report out-put.
If we use ALV_list dispaly line size ends to 80 and Other than
using OOP's is there any way to do this..
Could You please let me know.How to handle this issue??
Regards,
SgHi,
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZALV_PRDS'
i_callback_user_command = 'USER_COMMAND'
i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE' "for header alignment
it_fieldcat = t_fcat
i_save = 'A'
it_events = t_eve
TABLES
t_outtab = itab
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 USING document TYPE REF TO cl_dd_document.
DATA: text TYPE sdydo_text_element.
CALL METHOD document->add_gap
EXPORTING
width = 200.
text = 'Material Information'.
CALL METHOD document->add_text
EXPORTING
text = text
sap_style = 'HEADING'.
CALL METHOD document->new_line.
CALL METHOD document->new_line.
CALL METHOD document->new_line.
ENDFORM. "HTML_TOP_OF_PAGE
For more details, refer to the methods of the class cl_dd_document
Also check the below link.
https://www.sdn.sap.com/irj/sdn/wiki?path=/pages/viewpage.action&pageid=37566
Also this link
Report header using ALV Grid(oops)
Please reward points if it helps
Thanks
Vikranth -
Displaying selection screen data on alv header in multiple rows and columns
Hi
Presently in my requirement , whatever the data entered in selection screen should display on alv header and item details on alv grid display.
for eg...
on alv header
customer no : 1000 to 2000 sales order no: 111
name : gff to ff sales org:
city: country:
item details below this
plz guide me how to solve this issue.
Thanks & Regards,
PradeepHi,
Check this code this may help you.
<code>
TYPE-POOLS : SLIS.
TABLES VBRK.
TYPES : BEGIN OF TY_VBRK,
VBELN TYPE VBRK-VBELN,
VKORG TYPE VBRK-VKORG,
VTWEG TYPE VBRK-VTWEG,
SPART TYPE VBRK-SPART,
FKDAT TYPE VBRK-FKDAT,
END OF TY_VBRK,
BEGIN OF TY_VBRP,
VBELN TYPE VBRP-VBELN,
POSNR TYPE VBRP-POSNR,
MATNR TYPE VBRP-MATNR,
ARKTX TYPE VBRP-ARKTX,
FKIMG TYPE VBRP-FKIMG,
NETWR TYPE VBRP-NETWR,
END OF TY_VBRP,
BEGIN OF TY_TARGET,
VBELN TYPE VBRK-VBELN,
VKORG TYPE VBRK-VKORG,
VTWEG TYPE VBRK-VTWEG,
SPART TYPE VBRK-SPART,
FKDAT TYPE VBRK-FKDAT,
POSNR TYPE VBRP-POSNR,
MATNR TYPE VBRP-MATNR,
ARKTX TYPE VBRP-ARKTX,
FKIMG TYPE VBRP-FKIMG,
NETWR TYPE VBRP-NETWR,
END OF TY_TARGET.
DATA : T_VBRK TYPE TABLE OF TY_VBRK,
W_VBRK TYPE TY_VBRK,
T_VBRP TYPE TABLE OF TY_VBRP,
W_VBRP TYPE TY_VBRP,
T_TARGET TYPE TABLE OF TY_TARGET,
W_TARGET TYPE TY_TARGET,
FIELD CATALOG ******************
T_FCAT TYPE SLIS_T_FIELDCAT_ALV,
W_FCAT TYPE SLIS_FIELDCAT_ALV,
*************************************SUB TOTALS AND SORTING***********
T_SORT TYPE SLIS_T_SORTINFO_ALV,
W_SORT TYPE SLIS_SORTINFO_ALV,
*************************************FOR LIST HEADER******************
T_LIST_HEAD TYPE SLIS_T_LISTHEADER,
W_LIST_HEAD TYPE SLIS_LISTHEADER,
T_LIST_HEAD1 TYPE SLIS_T_LISTHEADER,
W_LIST_HEAD1 TYPE SLIS_LISTHEADER,
*************************************FOR LIST HEADER******************
W_LAYOUT TYPE SLIS_LAYOUT_ALV,
************************************FOR EVENTS************************
T_EVENT TYPE SLIS_T_EVENT,
W_EVENT TYPE SLIS_ALV_EVENT.
*********************************SELECT OPTIONS***********************
SELECT-OPTIONS : S_VBELN FOR VBRK-VBELN DEFAULT 90005316 TO 90005330.
**RETRIVING DATA************************
PERFORM DATA_RETRIVE.
**BUILDING THE FIELD CATALOG************
PERFORM BUILD_FCAT.
**BUILDING THE TABLE FOR LIST HEADER****
PERFORM BUILD_LIST_HEAD.
*******************************CALLING THE FUNCTION MODULE************
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_TOP_OF_PAGE = 'LIST_TOP_OF_PAGE'
IT_FIELDCAT = T_FCAT
IT_SORT = T_SORT
TABLES
T_OUTTAB = T_TARGET.
*& Form DATA_RETRIVE
FORM DATA_RETRIVE .
SELECT VBELN VKORG VTWEG SPART FKDAT FROM VBRK INTO CORRESPONDING FIELDS
OF TABLE T_VBRK WHERE VBELN IN S_VBELN.
IF SY-SUBRC EQ 0.
SORT T_VBRK BY VBELN.
SELECT VBELN POSNR MATNR ARKTX FKIMG NETWR FROM VBRP INTO TABLE
T_VBRP FOR ALL ENTRIES IN T_VBRK WHERE VBELN = T_VBRK-VBELN.
ENDIF.
LOOP AT T_VBRP INTO W_VBRP.
LOOP AT T_VBRK INTO W_VBRK WHERE VBELN = W_VBRP-VBELN.
W_TARGET-VBELN = W_VBRK-VBELN.
W_TARGET-VKORG = W_VBRK-VKORG.
W_TARGET-VTWEG = W_VBRK-VTWEG.
W_TARGET-SPART = W_VBRK-SPART.
W_TARGET-FKDAT = W_VBRK-FKDAT.
W_TARGET-POSNR = W_VBRP-POSNR.
W_TARGET-MATNR = W_VBRP-MATNR.
W_TARGET-ARKTX = W_VBRP-ARKTX.
W_TARGET-FKIMG = W_VBRP-FKIMG.
W_TARGET-NETWR = W_VBRP-NETWR.
APPEND W_TARGET TO T_TARGET.
ENDLOOP.
ENDLOOP.
SORT T_TARGET BY VBELN.
ENDFORM. " DATA_RETRIVE
*& Form BUILD_FCAT
FORM BUILD_FCAT .
W_FCAT-COL_POS = 1.
W_FCAT-FIELDNAME = 'VBELN'.
W_FCAT-SELTEXT_M = 'BILLING NO'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 2.
W_FCAT-FIELDNAME = 'VKORG'.
W_FCAT-SELTEXT_M = 'SALES ORGANIZATION'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 3.
W_FCAT-FIELDNAME = 'VTWEG'.
W_FCAT-SELTEXT_M = 'DISTRIBUTION CHANNEL'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 4.
W_FCAT-FIELDNAME = 'SPART'.
W_FCAT-SELTEXT_M = 'DIVISION'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 5.
W_FCAT-FIELDNAME = 'FKDAT'.
W_FCAT-SELTEXT_M = 'CREATION DATE'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 6.
W_FCAT-FIELDNAME = 'POSNR'.
W_FCAT-SELTEXT_M = 'BILLING ITEM'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 7.
W_FCAT-FIELDNAME = 'MATNR'.
W_FCAT-SELTEXT_M = 'MATERIAL NUM'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 8.
W_FCAT-FIELDNAME = 'ARKTX'.
W_FCAT-SELTEXT_M = 'DESCRIPTION'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 9.
W_FCAT-FIELDNAME = 'FKIMG'.
W_FCAT-SELTEXT_M = 'QUANTITY'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 10.
W_FCAT-FIELDNAME = 'NETWR'.
W_FCAT-SELTEXT_M = 'NET VALUE'.
W_FCAT-DO_SUM = 'X'.
APPEND W_FCAT TO T_FCAT.
ENDFORM. " BUILD_FCAT
*& Form BUILD_LIST_HEAD
FORM BUILD_LIST_HEAD .
DATA : L_DATE(10),
L_TIME(8).
W_LIST_HEAD-TYP = 'S'.
W_LIST_HEAD-KEY = 'Sales org :'.
W_LIST_HEAD-INFO = S_VBELN-LOW .
APPEND W_LIST_HEAD TO T_LIST_HEAD.
CLEAR W_LIST_HEAD.
W_LIST_HEAD-TYP = 'S'.
W_LIST_HEAD-KEY = 'TO '.
W_LIST_HEAD-INFO = S_VBELN-HIGH.
APPEND W_LIST_HEAD TO T_LIST_HEAD.
CLEAR W_LIST_HEAD.
ENDFORM. " BUILD_LIST_HEAD
*& Form LIST_TOP_OF_PAGE
FORM LIST_TOP_OF_PAGE .
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_LIST_HEAD.
ENDFORM. " LIST_TOP_OF_PAGE
<code>
Regards -
Blocked ALV Header and Item Displau
Hi Friends,
I`m new to ABAP and the forum.I`m in dire need of solution for a report.
Scenario
I have an internal table with fields ebeln vbeln adrnr.
For every change in ebeln i need to create a new page in ALV and display the item VBELN and some more fields.
Its like a header and item in a single page of alv report.
Is there a possibility to use ALV here or only classical report can be used in the scenario???Hi,
For Blocked alv header and item display you
declaration internal table fields ebeln vbeln adrn
TYPE-POOLS SLIS.
TYPES : BEGIN OF TY_EKKO,
EBELN TYPE EKKO-EBELN,
AEDAT TYPE EKKO-AEDAT,
vblen TYPE EKKO- vbeln,
END OF TY_EKKO.
DATA : IT_EKKO TYPE TABLE OF TY_EKKO,
WA_EKKO TYPE TY_EKKO.
DATA : WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA : WA_EVENTS TYPE SLIS_ALV_EVENT,
IT_EVENTS TYPE SLIS_T_ALV_EVENT,
IS_LAYOUT TYPE SLIS_LAYOUT_ALV.
For Build catalog
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-SELTEXT_M = 'PO NUMBER'.
WA_FIELDCAT-COL_POS = 1.
WA_FIELDCAT-KEY = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'AEDAT'.
WA_FIELDCAT-SELTEXT_M = 'DATE OF CREATION'.
WA_FIELDCAT-COL_POS = 2.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'LIFNR'.
WA_FIELDCAT-SELTEXT_M = 'VENDOR NO'.
WA_FIELDCAT-COL_POS = 3.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
read_data :
SELECT * INTO TABLE IT_EKKO FROM EKKO UP TO 20 ROWS.
print_header :
DATA : IT_LIST TYPE SLIS_T_LISTHEADER,
WA_LIST TYPE LINE OF SLIS_T_LISTHEADER.
CLEAR WA_LIST.
WA_LIST-TYP = 'H'.
WA_LIST-INFO = 'LIST OF PURCHASE ORDERS'.
APPEND WA_LIST TO IT_LIST.
Header along with write statement at top-of-page then use these function module
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LIST -
Problem with aligning values in ALV header???????
I am supposed to show some values in ALV header some thing like this
PGMID: xxxxx
Material: p_Matnr-low to p_Matnr high
Plant: p_werks-low to p_werks-high
ALV Reoport
For this i wrote code something like this.
Fieldcatalog-status='s'.
Fieldcatalog-key = 'PGMID:'.
FieldCatalog-info = 'xxxxxxxx'
append field catlalog.
Fieldcatalog-status='s'.
Fieldcatalog-key = 'Material:'.
Concatenate p_Matnr-low
'to'
p_Matnr-high into FieldCatalog-info.
append field catlalog.
etc................
Now output shown is like this
PGMID: xxxxx
Material: p_Matnr-low to p_Matnr high
Plant: p_werks-low to p_werks-high
I am not able to give a good gap in between the 'to' as shown initially. Any idea on this??
RakeshHi,
Please find attached below code :
IF NOT so_bukrs-low IS INITIAL AND NOT so_bukrs-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'Company Code'(015).
CONCATENATE so_bukrs-low 'to' so_bukrs-high INTO gs_line-info
SEPARATED BY space.
APPEND gs_line TO lt_top_of_page.
ELSEIF so_bukrs-low IS INITIAL AND so_bukrs-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'Company Code'(015).
gs_line-info = 'ALL Values'(012).
APPEND gs_line TO lt_top_of_page.
ELSEIF so_bukrs-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'Company Code'(015).
gs_line-info = so_bukrs-low.
APPEND gs_line TO lt_top_of_page.
ENDIF.
*Fiscal Year
CLEAR gs_line.
gs_line-typ = gc_s.
gs_line-key = 'Year'(014).
MOVE sp_gjahr TO gs_line-info.
APPEND gs_line TO lt_top_of_page.
*Period
CLEAR gs_line.
gs_line-typ = gc_s.
gs_line-key = 'Period'(013).
MOVE sp_monat TO gs_line-info.
APPEND gs_line TO lt_top_of_page.
*Currency Key
IF NOT so_waers-low IS INITIAL AND NOT so_waers-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'Currency'(011).
CONCATENATE so_waers-low 'to' so_waers-high INTO gs_line-info
SEPARATED BY space.
APPEND gs_line TO lt_top_of_page.
ELSEIF so_waers-low IS INITIAL AND so_waers-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'Currency'(011).
gs_line-info = 'ALL Values'(012).
APPEND gs_line TO lt_top_of_page.
ELSEIF so_waers-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'Currency'(011).
gs_line-info = so_waers-low.
APPEND gs_line TO lt_top_of_page.
ENDIF.
*Clearing Doc
IF NOT so_augbl-low IS INITIAL AND NOT so_augbl-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'Clearing Doc'(020).
CONCATENATE so_augbl-low 'to' so_augbl-high INTO gs_line-info
SEPARATED BY space.
APPEND gs_line TO lt_top_of_page.
ELSEIF so_augbl-low IS INITIAL AND so_augbl-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'Clearing Doc'(020).
gs_line-info = 'ALL Values'(012).
APPEND gs_line TO lt_top_of_page.
ELSEIF so_augbl-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'Clearing Doc'(020).
gs_line-info = so_augbl-low.
APPEND gs_line TO lt_top_of_page.
ENDIF.
*User ID
IF NOT so_usrid-low IS INITIAL AND NOT so_usrid-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'User ID'(021).
CONCATENATE so_usrid-low 'to' so_usrid-high INTO gs_line-info
SEPARATED BY space.
APPEND gs_line TO lt_top_of_page.
ELSEIF so_usrid-low IS INITIAL AND so_usrid-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'User ID'(021).
gs_line-info = 'ALL Values'(012).
APPEND gs_line TO lt_top_of_page.
ELSEIF so_usrid-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'User ID'(021).
gs_line-info = so_usrid-low.
APPEND gs_line TO lt_top_of_page.
ENDIF.
*GL Account
IF NOT so_hkont-low IS INITIAL AND NOT so_hkont-high IS INITIAL.
SHIFT so_hkont-low LEFT DELETING LEADING '0'.
SHIFT so_hkont-high LEFT DELETING LEADING '0'.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'GL Account'(004).
CONCATENATE so_hkont-low 'to' so_hkont-high INTO gs_line-info
SEPARATED BY space.
APPEND gs_line TO lt_top_of_page.
ELSEIF so_hkont-low IS INITIAL AND so_hkont-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'GL Account'(004).
gs_line-info = 'ALL Values'(012).
APPEND gs_line TO lt_top_of_page.
ELSEIF so_hkont-high IS INITIAL.
SHIFT so_hkont-low LEFT DELETING LEADING '0'.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'GL Account'(004).
gs_line-info = so_hkont-low.
APPEND gs_line TO lt_top_of_page.
ENDIF.
Thanks,
Sriram Ponna.
Maybe you are looking for
-
Is there a way to use a different slideshow on all iWeb Photo pages?
I am getting real tired of the iWeb slideshow. Hard to adjust the timing, scales automatically even when you don't want it to, etc... I did some searching on this site and a few people, such as Old Toad are mentioning SimpleViewer or Jalbum. But it s
-
Hi, I have just downloaded and installed SOA 11.1.1.4.0 and am trying to work through the basic labs. I would like to be able to use the Oracle Apps adapter, but am getting the below error when trying to update the apps adapter (to change the status
-
Subform -Hide depending on a Condition
Hi, How can we hide a subform depending on a condition? I mean if my internal table for that entry in initial.It should not display the subform. Also, I want to get rid of all outside boxes borders in output and have vertical lines which needs to be
-
Why is the iphone search function spotlight limited in time?
why is the iphone search function spotlight limited in time? I can only find entries that are less than a year old,but I would like to search older entries in my calender, which goes back to 2002. Anyone has a solution for this?
-
Registering db's with ODBC through Java code?
Hey, I have a project which uses an msacces database, I first have to register the database with odbc in windows, but I wonder if you can't do this with Java code instead of letting to user do some things he'd probably screw up while deploying the ap