TOP_OF_LIST
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = WS_LAYOUT1
it_fieldcat = INT_FIELDCAT[]
i_tabname = 'INT_FINAL'
it_events = int_event1
TABLES
t_outtab = INT_FINAL[]
Now int_event1- name = TOP_OF_LIST
And int_event1-form = form1
Now form 1 = 'REUSE_ALV_COMMENTARY_W
is CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = INT_TOP_OF_LIST[].
and int_top_of_list contains the selection riteria.
The issue is that the selection criteria does not appear on top of list - but it appears when I press F3 or back button, what could be going wrong.
.
Similar Messages
-
ALV Top_of page and Top_of_list
hi friends..
in alv, what are the events available, where can i see that..
in Alv, what is diff bt top_of_page and top_of_list and end_of_page and end_of_list..
can you explain and send me sample prg
thanks in advanceThese are all the ALV Events.
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_events.htm
Check the following links for detailed in ALV:
http://www.sapbrain.com/TUTORIALS/TECHNICAL/ALV_tutorial.html
http://www.sap-img.com/abap-function.htm
Check the following links for detailed in ALV:
http://www.sapbrain.com/TUTORIALS/TECHNICAL/ALV_tutorial.html
http://www.sap-img.com/abap-function.htm
Below link may explain about top-of-page,top-of-list
http://www.sap-img.com/abap/what-are-the-events-in-alv.htm
Thanks
Seshu -
Reg: Top_Of_List Events in ALV GRID Display
Hi ,
How can i use the the the Top_of_list Event Alv grid Disply.
I have passed Events table with event name and form name to GRID FM it_events.
Form details:-
T_LISTHEADER header deatils table with data. .
FORM TOP_OF_LIST.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_LISTHEADER.
ENDFORM.
But still its not calling the form and also end_of list is working with same coding but top_of_list is not working can u give solution for this.
Regards,
rajHi Rajviji,
Please change the coding to below :-
*& Report ZR2K9_ALV008
REPORT alv_top_of_list
TABLES : t001.
TYPE-POOLS: slis.
DATA : w_repid LIKE sy-repid.
TYPES : BEGIN OF ty_comp.
INCLUDE STRUCTURE t001.
TYPES : END OF ty_comp.
DATA: T_EVENTS TYPE slis_t_event.
DATA: WA_EVENTS TYPE slis_alv_event .
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
DATA : it_comp TYPE TABLE OF ty_comp.
INITIALIZATION.
w_repid = sy-repid.
*Need to change here
wa_events-name = 'TOP_OF_PAGE'. "Instead of TOP_OF_LIST
wa_events-form = 'TOP_OF_PAGE'.
APPEND wa_events TO t_events.
START-OF-SELECTION.
SELECT * FROM t001 INTO TABLE it_comp up to 20 rows.
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = w_repid
i_internal_tabname = 'IT_COMP'
I_STRUCTURE_NAME = 't001'
i_inclname = w_repid
CHANGING
ct_fieldcat = it_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
it_fieldcat = it_fieldcat[]
IT_EVENTS = T_EVENTS
TABLES
t_outtab = it_comp
EXCEPTIONS
program_error = 1
OTHERS = 2.
FORM TOP_OF_PAGE. "Form Name Changed
DATA: T_LISTHEADER TYPE SLIS_T_LISTHEADER.
DATA: LS_LISTHEADER TYPE SLIS_LISTHEADER.
CLEAR LS_LISTHEADER.
LS_LISTHEADER-TYP = 'S'.
LS_LISTHEADER-KEY = 'Po Heder Details :-'.
APPEND LS_LISTHEADER TO T_LISTHEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_LISTHEADER.
ENDFORM.
Regards
Sandipan -
hi,
How to use PF STATUS IN ALV REPORT?HI,
see this code.
TABLES:MARA.
SELECT-OPTIONS: MATNR FOR MARA-MATNR.
DATA:BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR,
ERSDA LIKE MARA-ERSDA,
MTART LIKE MARA-MTART,
MBRSH LIKE MARA-MBRSH,
END OF ITAB.
SELECT * FROM MARA INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE MATNR
IN MATNR.
TYPE-POOLS SLIS.
DATA:FCAT TYPE slis_t_fieldcat_alv.
DATA:LAYOUT TYPE slis_layout_alv.
DATA:EVE TYPE slis_t_event WITH HEADER LINE.
DATA:HEAD TYPE slis_t_listheader WITH HEADER LINE.
DATA:SORT TYPE slis_t_sortinfo_alv WITH HEADER LINE.
SORT-UP = 'X'.
SORT-SPOS = 1.
SORT-FIELDNAME = 'ERSDA'.
SORT-tabname = 'MARA'.
APPEND SORT.
SORT-SPOS = 2.
SORT-FIELDNAME = 'MTART'.
SORT-tabname = 'MARA'.
APPEND SORT.
EVE-NAME = 'TOP_OF_PAGE'.
EVE-FORM = 'TOPOFPAGE'.
APPEND EVE.
EVE-NAME = 'TOP_OF_LIST'.
EVE-FORM = 'TOPOFLIST'.
APPEND EVE.
EVE-NAME = 'END_OF_LIST'.
EVE-FORM = 'ENDOFLIST'.
APPEND EVE.
LAYOUT-ZEBRA = 'X'.
LAYOUT-no_hline = 'X'.
LAYOUT-NO_VLINE = 'X'.
LAYOUT-window_titlebar = 'MATERIAL DETAILS'.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'ITAB'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = SY-REPID
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = FCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
<b> I_CALLBACK_PF_STATUS_SET = 'STATUS'
I_CALLBACK_USER_COMMAND = 'UCOMM'</b>
I_STRUCTURE_NAME =
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = SORT[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = EVE[]
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 5
I_SCREEN_START_LINE = 5
I_SCREEN_END_COLUMN = 120
I_SCREEN_END_LINE = 25
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
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.
FORM TOPOFPAGE.
REFRESH HEAD.
HEAD-TYP = 'H'.
HEAD-INFO = 'MATERIALS'.
APPEND HEAD.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = HEAD[]
I_LOGO =
I_END_OF_LIST_GRID =
ENDFORM.
FORM TOPOFLIST.
REFRESH HEAD.
HEAD-TYP = 'H'.
HEAD-INFO = 'MATERIALS-LISTTOP'.
APPEND HEAD.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = HEAD[]
I_LOGO =
I_END_OF_LIST_GRID =
ENDFORM.
FORM ENDOFLIST.
REFRESH HEAD.
HEAD-TYP = 'H'.
HEAD-INFO = 'MATERIALS-LISTEND'.
APPEND HEAD.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = HEAD[]
I_LOGO =
I_END_OF_LIST_GRID =
ENDFORM.
<b>FORM STATUS USING MYMENU.
SET PF-STATUS 'MENU' excluding MYMENU.
ENDFORM.
FORM UCOMM USING CODE STEXT.
CASE CODE.
WHEN 'ABC'.
WRITE:/ 'YOU HAVE CLICKED ON ABC'.
WHEN 'XYZ'.
WRITE:/ 'YOU HAVE CLICKED ON XYZ'.
ENDCASE.
ENDFORM.</b>
rgds,
bharat. -
HI CAN WE display a table in footer of ALV ,
i need table like structure dispaly data in footer ,
how can any one pls help me
THXHi,
yes we can,
normmall alv for header and 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'
for table at footer...... use this code
Reuse_alv_events_get
Parameters:
I_list_type type(slis_list_type)
Et_event type slis_t_event
You can capture
slis_ev_item_data_expand type slis_formname value 'ITEM_DATA_EXPAND',
slis_ev_reprep_sel_modify type slis_formname value 'REPREP_SEL_MODIFY',
slis_ev_caller_exit_at_start type slis_formname value 'CALLER_EXIT',
slis_ev_user_command type slis_formname value 'USER_COMMAND',
slis_ev_top_of_page type slis_formname value 'TOP_OF_PAGE',
slis_ev_data_changed type slis_formname value 'DATA_CHANGED',
slis_ev_top_of_coverpage type slis_formname value 'TOP_OF_COVERPAGE',
slis_ev_end_of_coverpage type slis_formname value 'END_OF_COVERPAGE',
slis_ev_foreign_top_of_page type slis_formname
value 'FOREIGN_TOP_OF_PAGE',
slis_ev_foreign_end_of_page type slis_formname
value 'FOREIGN_END_OF_PAGE',
slis_ev_pf_status_set type slis_formname value 'PF_STATUS_SET',
slis_ev_list_modify type slis_formname value 'LIST_MODIFY',
slis_ev_top_of_list type slis_formname value 'TOP_OF_LIST',
slis_ev_end_of_page type slis_formname value 'END_OF_PAGE',
slis_ev_end_of_list type slis_formname value 'END_OF_LIST',
slis_ev_after_line_output type slis_formname value 'AFTER_LINE_OUTPUT',
slis_ev_before_line_output type slis_formname value
'BEFORE_LINE_OUTPUT',
slis_ev_subtotal_text type slis_formname value
'SUBTOTAL_TEXT',
slis_ev_context_menu type slis_formname value 'CONTEXT_MENU'.
thanks
shankar
reward me if usefull -
Problem :ALV:Deletion Flags not showing in output
hi all !
I have a alv program which displays customer data.there are three deletion flags columns in the output.
First deletion flag will be: KNA1-LOEVM
Second deletion flag will be: KNB1-LOEVM
Third deletion flag will be: KNVV-LOEVM
earlier all three were showing.but now no one is showing.i'm pasting my code here if any expert can have a look and find out the BUG.
CODE STARTS----
report zqsdcap_cust.
INCLUDE DECLARATIONS
include:
ziabapcapph_macros. "Holcim Useful Macros
TABLE DECLARATIONS
tables:
tvko, "Org. Unit: Sales Organizations
t001, "Company codes
kna1, "Customer Master
knvv, "Customer master sales
knvi, "Customer tax classificat'n
knb1, "Customer master company code
<<CR003-DEVK949538 start ins
adr6. "SMTP numbers
<<CR003-DEVK949538 end ins
TYPE DECLARATIONS
type-pools:
slis.
STRUCTURE DECLARATIONS
Define structure for keep data in ALV list
data: begin of gs_output_list,
vkorg like knvv-vkorg, "Sales organization
ktokd like kna1-ktokd, "Customer A/C grp
kunnr like kna1-kunnr, "Customer number
vtweg like knvv-vtweg, "Distribution channel
name1 like kna1-name1, "Name1
name3 like kna1-name3, "Name3
name4 like kna1-name4, "Name4
stras like kna1-stras, "Street
cityc like kna1-cityc, "City
bezei1 like t005h-bezei, "Sales office
land1 like kna1-land1, "Country
regio like kna1-regio, "Region
bezei2 like t005u-bezei, "Region decription
kdgrp like knvv-kdgrp, "Customer group
ktext like t151t-ktext, "Cust grp name
bzirk like knvv-bzirk, "Sales district
bztxt like t171t-bztxt, "Description
zterm like knvv-zterm, "Payment term
lzone like kna1-lzone, "Transport zone
vtext like tzont-vtext, "Description
erdat like kna1-erdat, "Creation date
end of gs_output_list.
Internal table for customer tax data
data: begin of gs_output_tax,
vkorg like knvv-vkorg, "Sales organization
kunnr like kna1-kunnr, "Customer number
vtweg like knvv-vtweg, "Distribution channel
name1 like kna1-name1, "Name1
name3 like kna1-name3, "Name3
name4 like kna1-name4, "Name4
ort01 like kna1-ort01, "City
stcd1 like kna1-stcd1, "STD code
spart like knvv-spart, "Division
taxkd like knvi-taxkd, "Tax classific'n
tatyp like knvi-tatyp, "Tax category
vtext like tskdt-vtext, "Tax description
end of gs_output_tax.
Internal table for HVL customer master
data: begin of gs_output_hvl,
kunnr like kna1-kunnr, "Customer number
stceg like kna1-stceg, "VAT registration no
telfx like kna1-telfx, "Fax number
telf1 like kna1-telf1, "First telephone number
stras like kna1-stras, "House number and stret
ort02 like kna1-ort02, "District
cityc like kna1-cityc, "City code
bezei like t005h-bezei, "City description
regio like kna1-regio, "Region
ort01 like kna1-ort01, "City
name2 like kna1-name2, "Name2
name1 like kna1-name1, "Name1
bzirk like knvv-bzirk, "Sales district
spart like knvv-spart, "Division
vtweg like knvv-vtweg, "Distribution channel
vkorg like knvv-vkorg, "Sales organization
end of gs_output_hvl.
Internal table for customer database CRM
data: begin of gs_output_crm,
vkorg like knvv-vkorg, "Sales organization
vtweg like knvv-vtweg, "Distribution channel
bzirk like knvv-bzirk, "Sales district
kunnr like kna1-kunnr, "Customer number
name1 like kna1-name1, "Name1
name2 like kna1-name2, "Name2
stras like kna1-stras, "House number street
ort01 like kna1-ort01, "City
ort02 like kna1-ort02, "District
pstlz like kna1-pstlz, "Postal code
cityc like kna1-cityc, "City code
telf1 like kna1-telf1, "First telephone number
telfx like kna1-telfx, "Fax number
vkbur like knvv-vkbur, "Sales office
regio like kna1-regio, "Region
vkgrp like knvv-vkgrp, "Sales group
kdgrp like knvv-kdgrp, "Customer group
kvgr3 like knvv-kvgr3, "Customer group 3
altkn like knb1-altkn, "Previous record number
erdat like knvv-erdat, "Creation date
found_dat like zcrm_bp_ext-found_dat, "Found date
<<CR000-DEVK943142 start del
versg like knvv-versg, "Customer statistic grp
bukrs like knb1-bukrs, "Company code
<<CR000-DEVK943142 end del
end of gs_output_crm.
Internal table for customer information
data: begin of gs_output_info,
kunnr like kna1-kunnr, "Customer number
vkorg like knvv-vkorg, "Sales organization
vtweg like knvv-vtweg, "Distribution channel
stcd2 like kna1-stcd2, "Tax code
name1 like kna1-name1, "Name1
name2 like kna1-name2, "Name2
<<CR002-DEVK944835 start ins
name3 like kna1-name3, "Name3
<<CR002-DEVK944835 end ins
stras like kna1-stras, "House number street
ort01 like kna1-ort01, "City
ort02 like kna1-ort02, "District
pstlz like kna1-pstlz, "Postal code
regio like kna1-regio, "Region
land1 like kna1-land1, "Country code
cityc like kna1-cityc, "City code
telf1 like kna1-telf1, "First telephone number
telfx like kna1-telfx, "Fax number
<<CR001-DEVK944239 start ins
bzirk like knvv-bzirk, "Sales District
vkbur like knvv-vkbur, "Sales Office
kdgrp like knvv-kdgrp, "Customer group
<<CR001-DEVK944239 end ins
vkgrp like knvv-vkgrp, "Sales group
kvgr3 like knvv-kvgr3, "Customer group 3
versg like knvv-versg, "Customer stat grp
kdkg2 like kna1-kdkg2, "Customer condition gp2
kdkg1 like kna1-kdkg1, "Customer condition gp1
<<CR001-DEVK944239 start del
kdgrp like knvv-kdgrp, "Customer group
<<CR001-DEVK944239 end del
altkn like knb1-altkn, "Previous record#
erdat like knvv-erdat, "Creation date
note_text(200) type c, "<<CR003-DEVK949538 ins
smtp_addr like adr6-smtp_addr, "<<CR003-DEVK949538 ins
loevm1 like kna1-loevm, "Deletion flag all
loevm2 like knb1-loevm, "Deletion flag Cd
loevm3 like knvv-loevm, "Deletion flag sal
end of gs_output_info.
ALV Grid Declaration
data:
gs_fieldcat type slis_fieldcat_alv,
gs_layout type slis_layout_alv,
gs_event type slis_t_event,
gs_variant like disvariant,
gs_sort_info type slis_sortinfo_alv,
gs_exit_caused_by_user type slis_exit_by_user,
gs_tabname type slis_tabname,
gs_header type slis_entry.
INTERNAL TABLE DECLARATIONS
Define internal table for keep data in ALV list
data:
gt_output_list like table of gs_output_list,
gt_output_tax like table of gs_output_tax,
gt_output_hvl like table of gs_output_hvl,
gt_output_crm like table of gs_output_crm,
gt_output_info like table of gs_output_info,
<<CR003-DEVK949538 start ins
gv_text like tline occurs 0 with header line,
<<CR003-DEVK949538 start ins
ALV Grid Declaration
gt_fieldcat type slis_t_fieldcat_alv,
gt_list_top_of_page type slis_t_listheader,
gt_list_top_of_page2 type slis_t_listheader,
gt_sort_info type slis_t_sortinfo_alv.
VARIABLE DECLARATIONS
data:
ALV Grid Declaration
gv_save,
gv_exit_caused_by_caller,
gv_repid type sy-repid,
gv_user_command type slis_formname value 'USER_COMMAND',
gv_top_of_page type slis_formname value 'TOP_OF_PAGE',
gv_top_of_list type slis_formname value 'TOP_OF_LIST',
gv_end_of_list type slis_formname value 'END_OF_LIST',
lv_store like thead-tdname, "<<CR003-DEVK949538 ins
lv_id like thead-tdid, "<<CR003-DEVK949538 ins
lv_lines type i. "<<CR003-DEVK949538 ins
SELECTION SCREEN DECLARATIONS
Define selection-screen of query
selection-screen: begin of block blk with frame title text-001.
select-options: s_vkorg for knvv-vkorg "Sales org
obligatory
memory id vko,
s_bzirk for knvv-bzirk, "Sales district
s_vtweg for knvv-vtweg, "Dist channel
s_spart for knvv-spart "Division
default 'CM',
s_taxkd for knvi-taxkd, "Tax classific'n
s_kunnr for kna1-kunnr, "Customer number
s_regio for kna1-regio, "Region
s_kdgrp for knvv-kdgrp, "Customer group
s_vkgrp for knvv-vkgrp, "Sales group
s_vkbur for knvv-vkbur, "Sales office
s_lzone for kna1-lzone, "Zone
s_erdat for kna1-erdat, "Creation date
s_zuawa for knb1-zuawa, "Key for sorting
s_ktokd for kna1-ktokd, "Customer A/C grp
s_altkn for knb1-altkn, "Previous rec no
s_bukrs for knb1-bukrs "Company code
obligatory
memory id buk,
s_loevm1 for kna1-loevm, "Deletion flag all
s_loevm2 for knb1-loevm, "Deletion flag Cd
s_loevm3 for knvv-loevm. "Deletion flag sal
selection-screen: end of block blk.
selection-screen: begin of block b2 with frame title text-002.
parameters: pr_cust1 radiobutton group a1
default 'X'
user-command bkg,
pr_cust2 radiobutton group a1,
pr_cust3 radiobutton group a1,
pr_cust4 radiobutton group a1,
pr_cust5 radiobutton group a1.
selection-screen: end of block b2.
AT SELECTION-SCREEN ON S_VKORG
at selection-screen on s_vkorg.
select vkorg
into tvko-vkorg
from tvko
where vkorg in s_vkorg.
authorization check for sales org.
authority-check object 'V_VBRK_VKO'
id 'VKORG' field tvko-vkorg
id 'ACTVT' field '03'.
check sy-subrc ne 0.
message e002(zgen) with 'No authorization for sales org.'
tvko-vkorg.
endselect.
AT SELECTION-SCREEN ON S_BUKRS
at selection-screen on s_bukrs.
if pr_cust4 eq 'X' or
pr_cust5 eq 'X'.
select bukrs
into t001-bukrs
from t001
where bukrs in s_bukrs.
authorization check for plant and company code
authority-check object 'A_S_WERK'
id 'BUKRS' field t001-bukrs
id 'WERKS' dummy.
check sy-subrc ne 0.
message e002(zgen) with 'No authorization for this company code.'
t001-bukrs.
endselect.
endif.
AT SELECTION-SCREEN OUTPUT
at selection-screen output.
loop at screen .
if pr_cust1 eq 'X'.
if screen-name = 'S_VTWEG-LOW' or
screen-name = 'S_VTWEG-HIGH' or
screen-name = 'S_SPART-LOW' or
screen-name = 'S_SPART-HIGH' or
screen-name = 'S_TAXKD-LOW' or
screen-name = 'S_TAXKD-HIGH' or
screen-name = 'S_BUKRS-LOW' or
screen-name = 'S_BUKRS-HIGH' or
screen-name = 'S_ERDAT-LOW' or
screen-name = 'S_ERDAT-HIGH' or
screen-name = 'S_ALTKN-LOW' or
screen-name = 'S_ALTKN-HIGH' or
screen-name = 'S_VKBUR-LOW' or
screen-name = 'S_VKBUR-HIGH' or
screen-name = 'S_LOEVM1-LOW' or
screen-name = 'S_LOEVM1-HIGH' or
screen-name = 'S_LOEVM2-LOW' or
screen-name = 'S_LOEVM2-HIGH' or
screen-name = 'S_LOEVM3-LOW' or
screen-name = 'S_LOEVM3-HIGH'.
screen-input = 0.
endif.
elseif pr_cust2 eq 'X'.
if screen-name = 'S_BZIRK-LOW' or
screen-name = 'S_BZIRK-HIGH' or
screen-name = 'S_KDGRP-LOW' or
screen-name = 'S_KDGRP-HIGH' or
screen-name = 'S_LZONE-LOW' or
screen-name = 'S_LZONE-HIGH' or
screen-name = 'S_KTOKD-LOW' or
screen-name = 'S_KTOKD-HIGH' or
screen-name = 'S_ERDAT-LOW' or
screen-name = 'S_ERDAT-HIGH' or
screen-name = 'S_KTOKD-LOW' or
screen-name = 'S_KTOKD-HIGH' or
screen-name = 'S_ALTKN-LOW' or
screen-name = 'S_ALTKN-HIGH' or
screen-name = 'S_VKBUR-LOW' or
screen-name = 'S_VKBUR-HIGH' or
screen-name = 'S_LOEVM1-LOW' or
screen-name = 'S_LOEVM1-HIGH' or
screen-name = 'S_LOEVM2-LOW' or
screen-name = 'S_LOEVM2-HIGH' or
screen-name = 'S_LOEVM3-LOW' or
screen-name = 'S_LOEVM3-HIGH' or
screen-name = 'S_BUKRS-LOW' or
screen-name = 'S_BUKRS-HIGH' or
screen-name = 'S_VKGRP-LOW' or
screen-name = 'S_VKGRP-HIGH'.
screen-input = 0.
endif.
elseif pr_cust3 eq 'X'.
if screen-name = 'S_BZIRK-LOW' or
screen-name = 'S_BZIRK-HIGH' or
screen-name = 'S_KDGRP-LOW' or
screen-name = 'S_KDGRP-HIGH' or
screen-name = 'S_LZONE-LOW' or
screen-name = 'S_LZONE-HIGH' or
screen-name = 'S_ERDAT-LOW' or
screen-name = 'S_ERDAT-HIGH' or
screen-name = 'S_KTOKD-LOW' or
screen-name = 'S_KTOKD-HIGH' or
screen-name = 'S_SPART-LOW' or
screen-name = 'S_SPART-HIGH' or
screen-name = 'S_TAXKD-LOW' or
screen-name = 'S_TAXKD-HIGH' or
screen-name = 'S_REGIO-LOW' or
screen-name = 'S_REGIO-HIGH' or
screen-name = 'S_ALTKN-LOW' or
screen-name = 'S_ALTKN-HIGH' or
screen-name = 'S_VKBUR-LOW' or
screen-name = 'S_VKBUR-HIGH' or
screen-name = 'S_LOEVM1-LOW' or
screen-name = 'S_LOEVM1-HIGH' or
screen-name = 'S_LOEVM2-LOW' or
screen-name = 'S_LOEVM2-HIGH' or
screen-name = 'S_LOEVM3-LOW' or
screen-name = 'S_LOEVM3-HIGH' or
screen-name = 'S_BUKRS-LOW' or
screen-name = 'S_BUKRS-HIGH' or
screen-name = 'S_VKGRP-LOW' or
screen-name = 'S_VKGRP-HIGH' or
screen-name = 'S_VTWEG-LOW' or
screen-name = 'S_VTWEG-HIGH'.
screen-input = 0.
endif.
elseif pr_cust4 eq 'X'.
if screen-name = 'S_LZONE-LOW' or
screen-name = 'S_LZONE-HIGH' or
screen-name = 'S_TAXKD-LOW' or
screen-name = 'S_TAXKD-HIGH' or
screen-name = 'S_REGIO-LOW' or
screen-name = 'S_REGIO-HIGH' or
screen-name = 'S_ZUAWA-LOW' or
screen-name = 'S_ZUAWA-HIGH'.
screen-input = 0.
endif.
else.
if screen-name = 'S_LZONE-LOW' or
screen-name = 'S_LZONE-HIGH' or
screen-name = 'S_TAXKD-LOW' or
screen-name = 'S_TAXKD-HIGH'.
screen-input = 0.
endif.
endif.
modify screen.
endloop.
INITIALIZATION
initialization.
perform deactivate_program using sy-cprog.
START OF SELECTION
start-of-selection.
Customized function to get data from database table
perform get_data.
<<CR003-DEVK949538 start ins
perform get_internal_note_text tables gt_output_info.
<<CR003-DEVK949538 end ins
Create sort of ALV list
perform build_sort.
Send data to ALV list to display
if pr_cust1 eq 'X'.
gs_tabname = text-003.
gs_header = text-004.
perform write_alv_report tables gt_output_list
gt_sort_info.
elseif pr_cust2 eq 'X'.
gs_tabname = text-005.
gs_header = text-006.
perform write_alv_report tables gt_output_tax
gt_sort_info.
elseif pr_cust3 eq 'X'.
gs_tabname = text-007.
gs_header = text-008.
perform write_alv_report tables gt_output_hvl
gt_sort_info.
elseif pr_cust4 eq 'X'.
gs_tabname = text-009.
gs_header = text-010.
perform write_alv_report tables gt_output_crm
gt_sort_info.
else.
gs_tabname = text-011.
gs_header = text-012.
perform write_alv_report tables gt_output_info
gt_sort_info .
endif.
FORM EVENTTAB_FIELD
Fill Event tab, for ALV Grid Display
form eventtab_field using gs_events type slis_t_event.
data:
ls_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = gs_events.
read table gs_events with key name = slis_ev_top_of_page
into ls_event.
if sy-subrc = 0.
move gv_top_of_page to ls_event-form.
append ls_event to gs_events.
endif.
endform. " eventtab_field
FORM TOP_OF_PAGE
Write at Top of Page of ALV grid
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = gt_list_top_of_page.
endform. "top_of_page
FORM COMMENT_BUILD
Write header of ALV grid
form comment_build using lt_top_of_page type slis_t_listheader
gs_header.
data:
lv_tdate(10),
lv_fdate(10),
ls_line type slis_listheader.
clear: ls_line.
ls_line-typ = 'H'.
ls_line-info = gs_header.
append ls_line to lt_top_of_page.
endform. "comment_build
FORM INIT_FIELDCAT
Fill Field Catalog for ALV Grid
form init_fieldcat using gs_tabname.
refresh: gt_fieldcat.
use this function to get the all fields in the structure.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = gv_repid
i_internal_tabname = gs_tabname
i_inclname = gv_repid
changing
ct_fieldcat = gt_fieldcat.
if sy-subrc eq 0.
clear mark for key field to set color of key column
gs_fieldcat-key = ''.
modify gt_fieldcat from gs_fieldcat transporting key
where fieldname ne space.
read table gt_fieldcat with key fieldname = 'FOUND_DAT'
into gs_fieldcat.
gs_fieldcat-seltext_l = text-013.
modify gt_fieldcat from gs_fieldcat
transporting seltext_l
where fieldname = 'FOUND_DAT'.
<<CR003-DEVK949538 start ins
read table gt_fieldcat with key fieldname = 'NOTE_TEXT'
into gs_fieldcat.
gs_fieldcat-seltext_l = text-014.
modify gt_fieldcat from gs_fieldcat
transporting seltext_l
where fieldname = 'NOTE_TEXT'.
<<CR003-DEVK949538 start ins
endif.
endform. "init_fieldcat
FORM INIT_LAYOUT
Layout initial
form init_layout using gs_layout type slis_layout_alv.
gs_layout-info_fieldname = 'LINECOLOR'.
gs_layout-colwidth_optimize = 'X'.
gs_layout-zebra = 'X'.
endform. " init_layout
FORM WRITE_ALV_REPORT
form write_alv_report tables gt_output
gt_sort_info.
ALV Grid display
clear: gv_repid,
gv_save.
gv_repid = sy-repid.
gs_variant-report = gv_repid.
gv_save = 'A'.
Build fieldcatalog
perform init_fieldcat using gs_tabname.
Build list events
perform eventtab_field using gs_event.
Show in ALV Grid form
perform init_layout using gs_layout.
Build comments
perform comment_build using gt_list_top_of_page[]
gs_header.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_buffer_active = ' '
i_callback_program = gv_repid
is_layout = gs_layout
i_save = gv_save
is_variant = gs_variant
it_events = gs_event[]
it_sort = gt_sort_info[]
it_fieldcat = gt_fieldcat[]
importing
e_exit_caused_by_caller = gv_exit_caused_by_caller
es_exit_caused_by_user = gs_exit_caused_by_user
tables
t_outtab = gt_output
exceptions
program_error = 1
others = 2.
endform. "write_alv_report
FORM GET_DATA
form get_data.
Get customer list
if pr_cust1 eq 'X'.
select knvv~vkorg
kna1~ktokd
kna1~kunnr
knvv~vtweg
kna1~name1
kna1~name3
kna1~name4
kna1~stras
kna1~cityc
kna1~regio
kna1~land1
knvv~kdgrp
knvv~bzirk
knvv~zterm
kna1~lzone
kna1~erdat
from kna1 join knvv
on kna1kunnr = knvvkunnr
into corresponding fields of table gt_output_list
where kna1~kunnr in s_kunnr
and knvv~vkorg in s_vkorg
and knvv~bzirk in s_bzirk
and kna1~regio in s_regio
and knvv~kdgrp in s_kdgrp
and kna1~lzone in s_lzone
and kna1~erdat in s_erdat
and kna1~ktokd in s_ktokd.
loop at gt_output_list into gs_output_list.
Get City decsription
perform get_city_description using gs_output_list-cityc
changing gs_output_list-bezei1.
Get Region description
select single bezei
from t005u
into gs_output_list-bezei2
where bland = gs_output_list-regio
and land1 = gs_output_list-land1"<<CR000-DEVK942345 ins
and spras = sy-langu.
Get customer group description
select single ktext
from t151t
into gs_output_list-ktext
where kdgrp = gs_output_list-kdgrp
and spras = sy-langu.
Get sales district description
select single bztxt
from t171t
into gs_output_list-bztxt
where bzirk = gs_output_list-bzirk
and spras = sy-langu.
Get zone decription
select single vtext
from tzont
into gs_output_list-vtext
where zone1 = gs_output_list-lzone
and spras = sy-langu.
modify gt_output_list from gs_output_list index sy-tabix
transporting bezei1
bezei2
ktext
bztxt
vtext.
clear gs_output_list.
endloop.
Get customer tax data
elseif pr_cust2 eq 'X'.
select kna1~kunnr
kna1~name1
kna1~name3
kna1~name4
kna1~ort01
kna1~stcd1
knvv~vkorg
knvv~spart
knvv~vtweg
knvi~taxkd
knvi~tatyp
from kna1 join knvv
on kna1kunnr = knvvkunnr
join knvi
on kna1kunnr = knvikunnr
into corresponding fields of table gt_output_tax
where kna1~kunnr in s_kunnr
and knvv~vkorg in s_vkorg
and knvv~vtweg in s_vtweg
and knvv~spart in s_spart
and kna1~regio in s_regio
and knvi~taxkd in s_taxkd.
Get customer tax description
loop at gt_output_tax into gs_output_tax.
select single vtext
from tskdt
into gs_output_tax-vtext
where tatyp = gs_output_tax-tatyp
and taxkd = gs_output_tax-taxkd
and spras = sy-langu.
if sy-subrc eq 0.
modify gt_output_tax from gs_output_tax index sy-tabix
transporting vtext.
clear gs_output_tax.
endif.
endloop.
Get customer HVL data
elseif pr_cust3 eq 'X'.
select kna1~kunnr
kna1~stceg
kna1~telfx
kna1~telf1
kna1~stras
kna1~ort02
kna1~cityc
kna1~regio
kna1~ort01
kna1~name2
kna1~name1
knvv~bzirk
knvv~spart
knvv~vtweg
knvv~vkorg
from kna1 join knvv
on kna1kunnr = knvvkunnr
into corresponding fields of table gt_output_hvl
where kna1~kunnr in s_kunnr
and knvv~vkorg in s_vkorg.
loop at gt_output_hvl into gs_output_hvl.
Get city description.
perform get_city_description using gs_output_hvl-cityc
changing gs_output_hvl-bezei.
if sy-subrc eq 0.
modify gt_output_hvl from gs_output_hvl index sy-tabix
transporting bezei.
clear gs_output_hvl.
endif.
endloop.
Get cust CRM data
elseif pr_cust4 eq 'X'.
select kna1~kunnr
knvv~versg "<<CR000-DEVK943142 del
knvv~vkorg
knvv~vtweg
knvv~bzirk
knvv~vkgrp
knvv~kdgrp
knvv~vkbur
kna1~name1
kna1~name2
kna1~ort01
kna1~pstlz
kna1~regio
kna1~stras
kna1~telf1
kna1~telfx
kna1~ort02
kna1~cityc
knvv~kvgr3
knb1~altkn
knb1~bukrs "<<CR000-DEVK943142 del
knvv~erdat
zcrm_bp_ext~found_dat
from kna1 join knvv
on kna1kunnr = knvvkunnr
join knb1
on knvvkunnr = knb1kunnr
join zcrm_bp_ext
on knb1kunnr = zcrm_bp_extkunnr
into corresponding fields of table gt_output_crm
where kna1~kunnr in s_kunnr
and knvv~vkorg in s_vkorg
and knvv~vtweg in s_vtweg
and knvv~spart in s_spart
and knvv~bzirk in s_bzirk
and knvv~kdgrp in s_kdgrp
and knvv~vkgrp in s_vkgrp
and knvv~vkbur in s_vkbur
and knvv~erdat in s_erdat
and kna1~ktokd in s_ktokd
and kna1~loevm in s_loevm1
and knb1~loevm in s_loevm2
and knvv~loevm in s_loevm3
and knb1~bukrs in s_bukrs
and knb1~altkn in s_altkn.
else.
Get customer information
<<CR001-DEVK944342 start del
select kna1~kunnr
knvv~vkorg
knvv~vtweg
kna1~stcd2
kna1~name1
kna1~name2
kna1~ort01
kna1~land1
kna1~pstlz
kna1~regio
kna1~stras
kna1~telf1
kna1~telfx
knvv~bzirk "<<CR001-DEVK944239 ins
knvv~vkbur "<<CR001-DEVK944239 ins
kna1~ort02
kna1~cityc
knvv~vkgrp
knvv~kvgr3
knvv~versg
kna1~kdkg2
kna1~kdkg1
knvv~kdgrp
knb1~altkn
knvv~erdat
kna1~loevm
knb1~loevm
knvv~loevm
<<CR001-DEVK944342 end del
<<CR001-DEVK944342 start ins
select kna1~kunnr
knvv~vkorg
knvv~vtweg
kna1~stcd2
kna1~name1
kna1~name2
kna1~name3 "<<CR002-DEVK944835 ins
kna1~stras
kna1~ort01
kna1~ort02
kna1~pstlz
kna1~regio
kna1~land1
kna1~cityc
kna1~telf1
kna1~telfx
knvv~bzirk
knvv~vkbur
knvv~kdgrp
knvv~vkgrp
knvv~kvgr3
knvv~versg
kna1~kdkg2
kna1~kdkg1
knb1~altkn
knvv~erdat
kna1~loevm
knb1~loevm
knvv~loevm
<<CR001-DEVK944342 end ins
from kna1 join knvv
on kna1kunnr = knvvkunnr
join knb1
on kna1kunnr = knb1kunnr
<<CR001-DEVK944252 start del
into corresponding fields of table gt_output_info
<<CR001-DEVK944252 end del
<<CR003-DEVK949538 start del
into table gt_output_info "<<CR001-DEVK944342 ins
<<CR003-DEVK949538 end del
<<CR003-DEVK949538 start ins
into corresponding fields of table gt_output_info
<<CR003-DEVK949538 end ins
where kna1~kunnr in s_kunnr
and knvv~vkorg in s_vkorg
and knvv~vtweg in s_vtweg
and knvv~spart in s_spart
and knvv~bzirk in s_bzirk
and knvv~kdgrp in s_kdgrp
and knvv~vkgrp in s_vkgrp
and knvv~vkbur in s_vkbur
and knvv~erdat in s_erdat
and kna1~ktokd in s_ktokd
and kna1~regio in s_regio
<<CR001-DEVK944252 start del
and kna1~loevm in s_loevm1
and knb1~loevm in s_loevm2
and knvv~loevm in s_loevm3
<<CR001-DEVK944252 end del
<<CR001-DEVK944252 start ins
and ( kna1~loevm in s_loevm1
or knb1~loevm in s_loevm2
or knvv~loevm in s_loevm3 )
<<CR001-DEVK944252 end ins
and knb1~zuawa in s_zuawa
and knb1~bukrs in s_bukrs
and knb1~altkn in s_altkn.
<<CR003-DEVK949538 start ins
loop at gt_output_info into gs_output_info.
select single adrnr
into kna1-adrnr
from kna1
where kunnr = gs_output_info-kunnr.
check sy-subrc eq 0.
select single smtp_addr
into adr6-smtp_addr
from adr6
where addrnumber = kna1-adrnr.
check sy-subrc eq 0.
gs_output_info-smtp_addr = adr6-smtp_addr.
modify gt_output_info from gs_output_info.
endloop.
<<CR003-DEVK949538 end ins
endif.
<<CR003-DEVK949538 start ins
loop at gt_output_info into gs_output_info.
lv_store = gs_output_info-loevm1.
endloop.
<<CR003-DEVK949538 end ins
endform.
FORM BUILD_SORT
form build_sort.
if pr_cust1 eq 'X' or
pr_cust2 eq 'X'.
clear gs_sort_info.
gs_sort_info-fieldname = 'VKORG'.
gs_sort_info-spos = 1.
gs_sort_info-up = 'X'.
append gs_sort_info to gt_sort_info.
endif.
clear gs_sort_info.
gs_sort_info-fieldname = 'KUNNR'.
gs_sorhi shivaji!
thx for the reply.
can u chk whether there is any problem with the queries or not.
regards
sachin -
Alv : drill down not working.
Hi All,
Could you please tell me whats wrong with this code ? its not drilling down to show 'ebeln' with me22n. Am I missing something ?
Please help.
Hrishi
code is :-
REPORT Z_VENDOR_BACKORDER_REPORT_ALV .
TABLES: EKKO, LFA1, MAKT, EKET, EKPO, AFPO, MARC.
*Data Declaration
DATA: BEGIN OF ITAB OCCURS 0 ,
ebeln LIKE ekko-ebeln , " PO number
aedat LIKE ekko-aedat , " creation date
ebelp LIKE ekpo-ebelp , " item no
lifnr LIKE ekko-lifnr , " vendor number
name1 LIKE lfa1-name1 , " vendor name
RESWK LIKE EKKO-RESWK , " PLANT NO
MEMORY LIKE EKKO-MEMORY , " ORDER INCOMPLETE
matnr LIKE ekpo-matnr , " material number
werks like ekpo-werks , " plant
txz01 LIKE ekpo-txz01 , " material description
eindt LIKE eket-eindt , " Promised date
menge LIKE eket-menge , " quantity
wemng LIKE eket-wemng , " delivered quantity
netpr like ekpo-netpr , " value in AUD
peinh like ekpo-peinh , " price unit
banfn like ekpo-banfn , " PR no
aufnr like ebkn-aufnr , " Production order no
MAABC LIKE MARC-MAABC , " MATERIAL ABC Indicator
maktx like makt-maktx , " material long description
open_quant type p decimals 2, " quantity - delivered
VALUE TYPE p decimals 2, " $ VALUE * OPEN QUANTITY
end of ITAB.
data: wa like itab.
DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
DATA: TEMP TYPE EKKO-LIFNR.
data: opt like CTU_PARAMS.
*DATA: WA TYPE FINAL.
all ALV declarations
type-pools: slis. "ALV Declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv with header line,
G_REPID TYPE SY-REPID,
GS_PRINT TYPE SLIS_PRINT_ALV,
GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
GT_EVENTS TYPE SLIS_T_EVENT,
GT_SORT TYPE SLIS_T_SORTINFO_ALV,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
COL_POS TYPE I.
-----------------SELECTION SCREEN----------------------
selection-screen begin of block b1 with frame title text-001.
select-options VENDORNO for ekko-lifnr.
select-options MATERIAL for ekpo-matnr.
SELECT-OPTIONS PLANT FOR EKKO-RESWK.
select-options REQDAT for eket-eindt.
selection-screen end of block b1.
*................... GET DATA..................
START-OF-SELECTION.
PERFORM GATHER_DATA.
END-OF-SELECTION.
FORM USER_COMMAND USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
CASE rs_selfield-sel_tab_field.
WHEN 'ITAB-EBELN'.
CHECK NOT rs_selfield-value IS INITIAL.
SET PARAMETER ID 'BUS' FIELD rs_selfield-value.
CALL TRANSACTION 'ME22N' AND SKIP FIRST SCREEN.
Do something at 'Sales document type' field selection
when 'ITAB-MATNR'.
SET PARAMETER ID 'BUS' FIELD rs_selfield-value.
CALL TRANSACTION 'MD04' AND SKIP FIRST SCREEN.
ENDCASE.
ENDCASE.
ENDFORM.
form gather_data.
SELECT EKKO~EBELN
EKKO~AEDAT
EKKO~LIFNR
EKKO~MEMORY
EKKO~RESWK
EKPO~EBELP
EKPO~MATNR
ekpo~werks
ekpo~netpr
ekpo~peinh
ekpo~banfn
ekpo~txz01
makt~maktx
EKET~EINDT
EKET~MENGE
EKET~WEMNG
LFA1~NAME1
INTO corresponding fields of ITAB
FROM (
EKKO inner JOIN EKPO
ON EKKOEBELN = EKPOEBELN
inner JOIN EKET
ON EKPOEBELN = EKETEBELN
AND EKPOEBELP = EKETEBELP
inner JOIN LFA1
ON EKKOLIFNR = LFA1LIFNR
*left outer join makt
*on ekpomatnr = maktmatnr
WHERE EKKO~LIFNR IN VENDORNO
AND EKKO~RESWK IN PLANT
and EKPO~MATNR IN MATERIAL
and ekpo~elikz eq ' '
and ekpo~loekz ne 'L'
and eket~eindt in REQDAT.
append itab.
CLEAR ITAB.
endselect.
clear temp.
sort itab by lifnr.
loop at itab .
ITAB-OPEN_QUANT = ITAB-MENGE - ITAB-WEMNG.
if itab-matnr eq ''.
select single aufnr from ebkn into itab-aufnr where banfn = itab-banfn.
select single matnr from afpo into itab-matnr where aufnr = itab-aufnr.
endif.
select single maktx from makt into itab-maktx where matnr = itab-matnr.
select single maabc from MARC INTO ITAB-MAABC WHERE MATNR = ITAB-MATNR.
ITAB-VALUE = ITAB-NETPR * ITAB-OPEN_QUANT / itab-peinh.
modify itab.
endloop.
SKIP.
fieldcatalog-tabname = 'ITAB'.
fieldcatalog-fieldname = 'LIFNR'.
fieldcatalog-seltext_m = 'vendor no'.
fieldcatalog-col_pos = 1.
fieldcatalog-outputlen = 15.
fieldcatalog-inttype = 'C'.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-tabname = 'ITAB'.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'po Number'.
fieldcatalog-col_pos = 2.
fieldcatalog-inttype = 'C'.
fieldcatalog-emphasize = 'C401'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-tabname = 'ITAB'.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'po date'.
fieldcatalog-col_pos = 3.
fieldcatalog-inttype = 'C'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-tabname = 'ITAB'.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'item number'.
fieldcatalog-col_pos = 4.
fieldcatalog-inttype = 'C'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-tabname = 'ITAB'.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-no_zero = 'X'.
fieldcatalog-seltext_m = 'material number'.
fieldcatalog-col_pos = 5.
fieldcatalog-inttype = 'C'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-tabname = 'ITAB'.
fieldcatalog-fieldname = 'MAABC'.
fieldcatalog-seltext_m = 'material type'.
fieldcatalog-col_pos = 6.
fieldcatalog-inttype = 'C'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-tabname = 'ITAB'.
fieldcatalog-fieldname = 'TXZ01'.
fieldcatalog-seltext_m = 'short text'.
fieldcatalog-col_pos = 7.
fieldcatalog-inttype = 'C'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-tabname = 'ITAB'.
fieldcatalog-fieldname = 'MAKTX'.
fieldcatalog-seltext_m = 'long text'.
fieldcatalog-col_pos = 8.
fieldcatalog-inttype = 'C'.
fieldcatalog-outputlen = 15.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-tabname = 'ITAB'.
fieldcatalog-fieldname = 'EINDT'.
fieldcatalog-seltext_m = 'date promised'.
fieldcatalog-col_pos = 9.
fieldcatalog-inttype = 'C'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-tabname = 'ITAB'.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'Quantity'.
fieldcatalog-col_pos = 10.
fieldcatalog-inttype = 'C'.
fieldcatalog-outputlen = 15.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-tabname = 'ITAB'.
fieldcatalog-fieldname = 'WEMNG'.
fieldcatalog-seltext_m = 'Delivered'.
fieldcatalog-col_pos = 11.
fieldcatalog-inttype = 'C'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-tabname = 'ITAB'.
fieldcatalog-fieldname = 'OPEN_QUANT'.
fieldcatalog-seltext_m = 'Open quantity'.
fieldcatalog-col_pos = 12.
fieldcatalog-inttype = 'C'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-tabname = 'ITAB'.
fieldcatalog-fieldname = 'VALUE'.
fieldcatalog-seltext_m = '$ value'.
fieldcatalog-col_pos = 13.
fieldcatalog-inttype = 'C'.
fieldcatalog-do_sum = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = g_repid
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
it_fieldcat = fieldcatalog[]
is_layout = GS_layout
IT_SORT = gt_sort
I_DEFAULT = 'X'
I_SAVE = 'X'
is_variant = z_template
tables
t_outtab = ITAB
exceptions
program_error = 1
others = 2.
endform.hi,
please run the code below.
REPORT yfi7g_ing_mic_001 .
*PROGRAM YFI7G_ING_MIC_001.
TABLES: vbak .
TABLES: mara .
TYPES: BEGIN OF tp_vbak ,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
erzet TYPE vbak-erzet,
ernam TYPE vbak-ernam,
vbtyp TYPE vbak-vbtyp,
trvog TYPE vbak-trvog,
auart TYPE vbak-auart,
lifsk TYPE vbak-lifsk,
faksk TYPE vbak-faksk,
waerk TYPE vbak-waerk,
vkorg TYPE vbak-vkorg,
kunnr TYPE vbak-kunnr,
vgbel TYPE vbak-vgbel,
vgtyp TYPE vbak-vgtyp,
END OF tp_vbak .
TYPES: BEGIN OF tp_mara ,
matnr TYPE mara-matnr,
END OF tp_mara .
TYPES: BEGIN OF tp_alv1_data.
INCLUDE TYPE tp_vbak .
TYPES: END OF tp_alv1_data.
TYPES: BEGIN OF tp_alv2_data.
INCLUDE TYPE tp_mara .
TYPES: END OF tp_alv2_data.
TYPE-POOLS: slis.
DATA: gt_vbak TYPE STANDARD TABLE OF tp_vbak WITH HEADER LINE.
DATA: gt_mara TYPE STANDARD TABLE OF tp_mara WITH HEADER LINE.
DATA: gs_variant LIKE disvariant.
DATA: gt_alv1_data TYPE STANDARD TABLE OF tp_alv1_data WITH HEADER LINE.
DATA: gt_alv2_data TYPE STANDARD TABLE OF tp_alv2_data WITH HEADER LINE.
SELECTION-SCREEN *
BLOCK b0 *
SELECTION-SCREEN BEGIN OF BLOCK b0 WITH FRAME.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln. "<field not defined?>
PARAMETERS: p_matnr LIKE mara-matnr. "<field not defined?>
SELECTION-SCREEN END OF BLOCK b0.
BLOCK bvar *
SELECTION-SCREEN BEGIN OF BLOCK bvar WITH FRAME.
PARAMETERS: p_vari LIKE disvariant-variant.
SELECTION-SCREEN END OF BLOCK bvar.
BLOCK bbox *
SELECTION-SCREEN BEGIN OF BLOCK bbox WITH FRAME.
PARAMETERS: p_box_up RADIOBUTTON GROUP b1,
p_box_do RADIOBUTTON GROUP b1 DEFAULT 'X',
p_box_no RADIOBUTTON GROUP b1.
SELECTION-SCREEN END OF BLOCK bbox.
AT SELECTION-SCREEN ON P_VARI *
AT SELECTION-SCREEN ON p_vari.
PERFORM alv_variant_existence USING p_vari
CHANGING gs_variant.
AT SELECTION-SCREEN ON VALUE REQUEST FOR P_VARI *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
PERFORM alv_variant_f4 CHANGING p_vari
gs_variant.
INITIALIZATION *
INITIALIZATION.
START-OF-SELECTION *
START-OF-SELECTION.
PERFORM authority_check.
PERFORM get_control_data.
PERFORM get_transaction_data.
PERFORM process_transaction_data.
END-OF-SELECTION *
END-OF-SELECTION.
PERFORM output_data.
F O R M S *
FORM AUTHORITY_CHECK *
Perform authority checks for the report *
FORM authority_check.
!!! Note: authorisation checks are application-dependent.
!!! Some common cases are listed below - please select one of them
!!! or add new authorisation checks.
!!! If the report is creating batch input session or using LDB
!!! it may be sufficient to use automatic SAP auth.checks.
Authorisation for displaying documents in a single company code
authority-check object 'F_BKPF_BUK'
id 'BUKRS' field p_bukrs
id 'ACTVT' field '03'.
if sy-subrc <> 0.
message e001(z9) with 'No authorisation to display documents'
'in company code' p_bukrs.
endif.
Displaying documents from a list of company codes (select-options)
call function 'Y_BUKRS_AUTHORITY_CHECK'
EXPORTING
ACTVT = '03'
NOMESSAGE = ' '
tables
s_bukrs = s_bukrs.
ENDFORM. " AUTHORITY_CHECK
FORM GET_CONTROL_DATA *
Read configuration etc. *
FORM get_control_data.
ENDFORM. " GET_CONTROL_DATA
FORM GET_TRANSACTION_DATA *
Read documents etc. *
FORM get_transaction_data.
!!! Data selection statement below has been generated automatically.
!!! Please check if it is correct and complete.
!!! Use table joins or 'SELECT FOR ALL ENTRIES' when selecting data
!!! from related tables.
SELECT
vbeln
erdat
erzet
ernam
FROM vbak
INTO CORRESPONDING FIELDS OF TABLE gt_vbak
CHECK NOT gt_vbak[] IS INITIAL.
SELECT
matnr
FROM mara
INTO CORRESPONDING FIELDS OF TABLE gt_mara
FOR ALL ENTRIES IN gt_vbak
WHERE ernam = gt_vbak-ernam
ENDFORM. " GET_TRANSACTION_DATA
FORM PROCESS_TRANSACTION_DATA *
FORM process_transaction_data.
LOOP AT gt_vbak .
MOVE-CORRESPONDING gt_vbak TO gt_alv1_data .
APPEND gt_alv1_data .
ENDLOOP.
FREE gt_vbak .
LOOP AT gt_mara .
MOVE-CORRESPONDING gt_mara TO gt_alv2_data .
APPEND gt_alv2_data .
ENDLOOP.
FREE gt_mara .
ENDFORM. " PROCESS_TRANSACTION_DATA
FORM OUTPUT_DATA *
FORM output_data.
PERFORM alv_list_display.
ENDFORM. " OUTPUT_DATA
FORM DISPLAY_RECORD *
Display object associated with the current ALV line *
FORM display_record USING is_selfield TYPE slis_selfield.
READ TABLE gt_alv1_data INDEX is_selfield-tabindex.
CHECK sy-subrc = 0.
!!! SAMPLE IMPLEMENTATION FOR DISPLAYING FI DOCUMENTS:
SET PARAMETER ID 'BUK' FIELD gt_alv1_data-vbeln.
set parameter id 'BLN' field gt_alv1_data-belnr.
set parameter id 'GJR' field gt_alv1_data-gjahr.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
ENDFORM. " DISPLAY_RECORD
FORM ALV_LIST_DISPLAY *
Invoke main ALV function to format and show the report *
FORM alv_list_display.
DATA: ls_layout TYPE slis_layout_alv,
ls_print TYPE slis_print_alv,
ls_keyinfo TYPE slis_keyinfo_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_exctab TYPE slis_t_extab,
lt_sorttab TYPE slis_t_sortinfo_alv,
lt_events TYPE slis_t_event.
PERFORM alv_init_report_events TABLES lt_events.
PERFORM alv_init_report_layout TABLES lt_fieldcat
lt_exctab
lt_sorttab
CHANGING ls_layout
ls_print
ls_keyinfo.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_interface_check = ' '
i_callback_program = sy-cprog
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_excluding = lt_exctab
IT_SPECIAL_GROUPS =
it_sort = lt_sorttab
IT_FILTER =
IS_SEL_HIDE =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_DEFAULT = 'X'
i_save = 'A'
is_variant = gs_variant
it_events = lt_events
IT_EVENT_EXIT =
i_tabname_header = 'GT_ALV1_DATA'
i_tabname_item = 'GT_ALV2_DATA'
I_STRUCTURE_NAME_HEADER =
I_STRUCTURE_NAME_ITEM =
is_keyinfo = ls_keyinfo
is_print = ls_print
IS_REPREP_ID =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab_header = gt_alv1_data
t_outtab_item = gt_alv2_data.
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
ENDFORM. " ALV_LIST_DISPLAY
FORM ALV_INIT_REPORT_LAYOUT *
Set up report layout definition for ALV_LIST_DISPLAY *
<-- OT_FIELDCAT list of fields *
<-- OT_EXCTAB excluded menu options *
<-- OT_SORTTAB sorting/grouping definition *
<-- OS_LAYOUT global report layout settings *
<-- OS_PRINT global report printout settings *
<-- OS_KEYINFO itab key fields (required only for hier.lists) *
FORM alv_init_report_layout TABLES ot_fieldcat TYPE slis_t_fieldcat_alv
ot_exctab TYPE slis_t_extab
ot_sorttab TYPE slis_t_sortinfo_alv
CHANGING cs_layout TYPE slis_layout_alv
cs_print TYPE slis_print_alv
cs_keyinfo TYPE slis_keyinfo_alv.
add menu items to be excluded to ot_exctab.
REFRESH ot_exctab.
REFRESH ot_fieldcat.
REFRESH ot_sorttab.
!!! List all ALV data fields for display here:
DD-struct = data dictionary structure name
DD-field = field of data dictionary structure
itab = internal table for output data
itab-field = internal table field name
key = set to 'X' if key field
sum = set to 'X' for totals
hid = set to 'X' if field is initially hidden
row = list row number (multi-line list if >1)
DD-struct DD-field itab itab-field key sum hid row
PERFORM alv_build_fieldcat TABLES ot_fieldcat USING:
'VBAK' 'VBELN' 'GT_ALV1_DATA' 'VBELN' ' ' ' ' ' ' 1 ,
'VBAK' 'ERDAT' 'GT_ALV1_DATA' 'ERDAT' ' ' ' ' ' ' 1 ,
'VBAK' 'ERZET' 'GT_ALV1_DATA' 'ERZET' ' ' ' ' ' ' 1 ,
'VBAK' 'ERNAM' 'GT_ALV1_DATA' 'ERNAM' ' ' ' ' ' ' 1.
PERFORM alv_build_fieldcat TABLES ot_fieldcat USING:
'MARA' 'MATNR' 'GT_ALV2_DATA' 'MATNR' ' ' ' ' ' ' 1 .
!!! List all ALV data fields for sorting/grouping here
itab = internal table for output data
itab-field = internal table field name
up = sort ascending
down = sort descending
grp = group by
comp = group initially compressed
pos = field position in sort sequence
itab field up down grp comp pos
PERFORM alv_build_sorttab TABLES ot_sorttab USING:
'GT_ALV1_DATA' 'VBELN' 'X' ' ' ' ' ' ' 1.
PERFORM alv_build_sorttab TABLES ot_sorttab USING:
'GT_ALV2_DATA' 'MATNR' 'X' ' ' ' ' ' ' 1.
!!! key definition - required only for hierarchical display (2 itabs)
cs_keyinfo-header01 = 'VBELN' .
cs_keyinfo-item01 = 'MATNR' .
!!! See the declaration of type SLIS_LAYOUT_ALV and set the fields
!!! of OS_LAYOUT record to change list-level attributes
os_layout-no_colhead = 'X'. " no headings
cs_layout-zebra = 'X'. " stripped pattern
os_layout-no_vline = 'X'. " columns separated by space
os_layout-totals_only = 'X'. " show only totals
os_layout-totals_text = 'Total'. " totals line label
os_layout-subtotals_text = 'Subtotal'. " subtotals line label
os_layout-subtotals_text = 'Subtotal'. " subtotals line label
os_layout-key_hotspot = 'X'. " keys as hotspot
os_layout-expand_all = 'X'. " Expand all positions
os_layout...
cs_print-no_print_selinfos = 'X'. " Skip selection statistics
cs_print-no_print_listinfos = 'X'. " Skip list statistics
os_print-...
ENDFORM. " INIT_REPORT_LAYOUT
FORM ALV_BUILD_FIELDCAT *
Format a single line for ALV_INIT_REPORT_LAYOUT *
FORM alv_build_fieldcat TABLES ot_fieldcat
USING iv_ref_tabname "ref to a table/field
iv_ref_fieldname
iv_tabname "actual table/field name
iv_fieldname
iv_key
iv_do_sum
iv_no_out
iv_row_pos.
status variables for auto-numbering of field column position
(column number reset when a new table or row begins)
STATICS: sv_last_tabname TYPE slis_tabname,
sv_last_row_pos TYPE i,
sv_current_col TYPE i.
IF sv_last_tabname <> iv_tabname OR sv_last_row_pos <> iv_row_pos.
sv_current_col = 1.
ELSE.
ADD 1 TO sv_current_col.
ENDIF.
sv_last_tabname = iv_tabname.
sv_last_row_pos = iv_row_pos.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
DATA: lv_fieldname TYPE slis_fieldname.
lv_fieldname = iv_fieldname.
!!! List all the special formatting requirements in cases below
case lv_fieldname.
when 'WRBTR'. "<-- link with currency required
ls_fieldcat-cfieldname = 'WAERS'.
ls_fieldcat-ctabname = iv_tabname.
when 'HKONT'. "<-- change default column header
ls_fieldcat-seltext_s = 'GL Acc.'.
ls_fieldcat-ddictxt = 'S'. " (S)hort (M)iddle (L)ong
when 'SOME_NUMBER' "<-- change number formatting
ls_fieldcat-nosign = 'X'.
ls_fieldcat-nozero = 'X'.
ls_fieldcat-just = 'L'. " (L)eft (R)ight (C)enter
endcase.
ls_fieldcat-ref_tabname = iv_ref_tabname.
ls_fieldcat-ref_fieldname = iv_ref_fieldname.
ls_fieldcat-tabname = iv_tabname.
ls_fieldcat-fieldname = iv_fieldname.
ls_fieldcat-key = iv_key.
ls_fieldcat-do_sum = iv_do_sum.
ls_fieldcat-no_out = iv_no_out.
ls_fieldcat-row_pos = iv_row_pos.
ls_fieldcat-col_pos = sv_current_col.
APPEND ls_fieldcat TO ot_fieldcat.
ENDFORM. " ALV_BUILD_FIELDCAT
FORM ALV_BUILD_SORTTAB *
Set up sorting information for ALV_INIT_REPORT_LAYOUT *
FORM alv_build_sorttab TABLES ot_sorttab TYPE slis_t_sortinfo_alv
USING iv_tabname TYPE slis_fieldname
iv_fieldname TYPE slis_fieldname
iv_up TYPE c
iv_down TYPE c
iv_subtot TYPE c
iv_comp TYPE c
iv_spos TYPE n.
ot_sorttab-spos = iv_spos.
ot_sorttab-fieldname = iv_fieldname.
ot_sorttab-tabname = iv_tabname.
ot_sorttab-up = iv_up.
ot_sorttab-down = iv_down.
ot_sorttab-subtot = iv_subtot.
ot_sorttab-comp = iv_comp.
APPEND ot_sorttab.
ENDFORM. " ALV_BUILD_SORTTAB
FORM ALV_INIT_REPORT_EVENTS *
Set up program events for ALV_LIST_DISPLAY *
<-- OT_EVENTS list of events and associated report subroutines *
FORM alv_init_report_events TABLES ot_events TYPE slis_t_event.
CLEAR ot_events.
REFRESH ot_events.
ot_events-name = slis_ev_user_command.
ot_events-form = 'USER_COMMAND'.
APPEND ot_events.
ot_events-name = slis_ev_pf_status_set.
ot_events-form = ''. "'PF_STATUS_SET'.
APPEND ot_events.
ot_events-name = slis_ev_top_of_list.
ot_events-form = 'TOP_OF_LIST'.
APPEND ot_events.
ot_events-name = slis_ev_end_of_list.
ot_events-form = 'END_OF_LIST'.
APPEND ot_events.
ot_events-name = slis_ev_top_of_page.
ot_events-form = 'TOP_OF_PAGE'.
APPEND ot_events.
ot_events-name = slis_ev_end_of_page.
ot_events-form = 'END_OF_PAGE'.
APPEND ot_events.
ot_events-name = slis_ev_foreign_top_of_page.
ot_events-form = ''.
APPEND ot_events.
ot_events-name = slis_ev_foreign_end_of_page.
ot_events-form = ''.
APPEND ot_events.
ot_events-name = slis_ev_top_of_coverpage.
ot_events-form = ''.
APPEND ot_events.
ot_events-name = slis_ev_end_of_coverpage.
ot_events-form = ''.
APPEND ot_events.
ot_events-name = slis_ev_before_line_output.
ot_events-form = ''.
APPEND ot_events.
ot_events-name = slis_ev_after_line_output.
ot_events-form = ''.
APPEND ot_events.
ot_events-name = slis_ev_caller_exit_at_start.
ot_events-form = ''.
APPEND ot_events.
ot_events-name = slis_ev_list_modify.
ot_events-form = ''.
APPEND ot_events.
ot_events-name = slis_ev_subtotal_text.
ot_events-form = ''.
APPEND ot_events.
ENDFORM. " ALV_INIT_REPORT_EVENTS
FORM USER_COMMAND *
Subroutine attached as callback form to ABAP List Viewer *
--> UCOMM - user command code passed from ALV *
--> SELFIELD - information record describing current line/field *
FORM user_command USING value(iv_ucomm) LIKE sy-ucomm
is_selfield TYPE slis_selfield.
CASE iv_ucomm.
WHEN '&IC1'. "ALV record selection
PERFORM display_record USING is_selfield.
when ...
ENDCASE.
ENDFORM. " USER_COMMAND
FORM PF_STATUS_SET *
Subroutine attached as callback form to ABAP List Viewer, *
allows setting alternative menu. If necessary: *
1. Copy 'STANDARD' menu from SAPLKKBL and modify as required, *
2. Activate callback *
FORM pf_status_set USING it_exctab TYPE slis_t_extab.
set pf-status 'STANDARD' excluding it_exctab.
ENDFORM. " PF_STATUS_SET
FORM TOP_OF_LIST *
Subroutine attached as callback form to ABAP List Viewer, *
executed once at the start of list output. *
FORM top_of_list.
DATA: lt_seltab TYPE STANDARD TABLE OF rsparams WITH HEADER LINE.
DATA: lv_report LIKE sy-repid.
lv_report = sy-repid. "do not pass sy-repid to function!
IF p_box_up = 'X'. "display select options at report start
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = lv_report
TABLES
selection_table = lt_seltab.
remove 'technical' parameters with 'DELETE LT_SELTAB WHERE...'
before display, if necessary
CALL FUNCTION 'RS_LIST_SELECTION_TABLE'
EXPORTING
report = lv_report
seltext = 'X'
dyn_range =
newpage = ' '
screennr = 1000
TABLES
sel_tab = lt_seltab
EXCEPTIONS
sel_tab_empty = 1.
ENDIF. "p_box_up = 'X'
ENDFORM. " TOP_OF_LIST
FORM END_OF_LIST *
Subroutine attached as callback form to ABAP List Viewer *
executed once at the end of list output. *
FORM end_of_list.
DATA: lt_seltab TYPE STANDARD TABLE OF rsparams WITH HEADER LINE.
DATA: lv_report LIKE sy-repid.
lv_report = sy-repid. "do not pass sy-repid to function!
IF p_box_do = 'X'. "display select options at report end
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = lv_report
TABLES
selection_table = lt_seltab.
remove 'technical' parameters with 'DELETE LT_SELTAB WHERE...'
before display, if necessary
CALL FUNCTION 'RS_LIST_SELECTION_TABLE'
EXPORTING
report = lv_report
seltext = 'X'
dyn_range =
newpage = ' '
screennr = 1000
TABLES
sel_tab = lt_seltab
EXCEPTIONS
sel_tab_empty = 1.
ENDIF. "p_box_do = 'X'
ENDFORM. " END_OF_LIST
FORM TOP_OF_PAGE *
Subroutine attached as callback form to ABAP List Viewer *
FORM top_of_page.
standard Ingram Micro report page heading
DATA: lv_coco_pos TYPE i, "CurPos of 'Company confidential'
lv_title_pos TYPE i, "CurPos of report title
lv_title(70) TYPE c, "Truncated report title
lv_page_pos TYPE i, "CurPos of page number
lv_date_pos TYPE i, "CurPos of date and time
lv_page_no(10) TYPE c,
lv_date(25) TYPE c,
lv_time(20) TYPE c,
lv_page(10) TYPE c.
We may need to truncate title if the line size is < 81.
IF sy-linsz < 81.
lv_title = sy-title+0(50).
ELSE.
lv_title = sy-title.
ENDIF.
Decide on positioning of text depending on width of page
lv_title_pos = ( sy-linsz / 2 ) - ( STRLEN( lv_title ) / 2 ).
lv_coco_pos = sy-linsz - 20.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE: / 'Ingram Micro',
AT lv_title_pos lv_title,
AT lv_coco_pos 'Company Confidential'.
Setup data correctly in the correct format for the display fields.
lv_page = sy-pagno.
SHIFT lv_page LEFT DELETING LEADING ' '.
CONCATENATE sy-datum6(2) sy-datum4(2) sy-datum+0(4)
INTO lv_date SEPARATED BY '.'.
CONCATENATE sy-uzeit0(2) ':' sy-uzeit2(2) INTO lv_time.
CONCATENATE lv_date lv_time INTO lv_date SEPARATED BY ' '.
CONCATENATE 'Page' lv_page INTO lv_page_no SEPARATED BY ' '.
Decide on positioning of text depending on width of page.
lv_page_pos = sy-linsz - ( STRLEN( lv_page_no ) ).
WRITE: / lv_date,
AT lv_page_pos lv_page_no.
ULINE.
ENDFORM. " TOP_OF_PAGE
FORM END_OF_PAGE *
Subroutine attached as callback form to ABAP List Viewer *
FORM end_of_page.
ENDFORM. " END_OF_PAGE
Form ALV_VARIANT_EXISTENCE
Reads ALV variant definition
FORM alv_variant_existence USING iv_variant LIKE disvariant-variant
CHANGING os_variant LIKE disvariant.
CHECK NOT iv_variant IS INITIAL.
os_variant-report = sy-repid.
os_variant-variant = iv_variant.
IF iv_variant CP '/*'. "user-specific variants begin with slash
os_variant-username = sy-uname.
ENDIF.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = 'A'
CHANGING
cs_variant = os_variant
EXCEPTIONS
wrong_input = 1
not_found = 2
program_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE e001(z9) WITH 'Please select a valid display variant.'.
ENDIF.
ENDFORM. " ALV_VARIANT_EXISTENCE
FORM ALV_VARIANT_F4 *
Display list of layout variants on report selection screen *
FORM alv_variant_f4 CHANGING cv_varname LIKE disvariant-variant
cs_variant LIKE disvariant.
DATA: lv_exit(1) TYPE c.
cs_variant-report = sy-repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = cs_variant
i_save = 'A'
it_default_fieldcat =
IMPORTING
e_exit = lv_exit
es_variant = cs_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 2.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
IF lv_exit = space.
cv_varname = cs_variant-variant.
ENDIF.
ENDIF.
hope this will help.
see form user_command.
regards,
Ruchika -
Hi Experts,
i have issue were in i need to show sum of the amount. like example...
for Custmer 100 there are vendor number 10,20,30,40,50. so for all this vendor numbers..
vendor----- amount
10 -
100
20----
200
30----
300
40----
400
50-------500
so in the output i want it to be..
customer--vendornumber--
amount
1000--10--
1500
20---
30---
40---
50---
.hope u experts have undestood. so how can i add the it and show it in the output....
am forwarding my code also..
Corrects answers will be fully rewarded..
REPORT zrfi007 NO STANDARD PAGE HEADING LINE-SIZE 255 MESSAGE-ID z01.
TYPE-POOLS: slis, abap.
* TYPES Declaration
TYPES: BEGIN OF ty_lfa1,
lifnr TYPE lfa1-lifnr,
name1 TYPE lfa1-name1,
END OF ty_lfa1.
TYPES: BEGIN OF ty_bsik,
bukrs TYPE bsik-bukrs,
lifnr TYPE bsik-lifnr,
belnr TYPE bsik-belnr,
bldat TYPE bsik-bldat,
waers TYPE bsik-waers,
dmbtr TYPE bsik-dmbtr,
wrbtr TYPE bsik-wrbtr,
zfbdt TYPE bsik-zfbdt,
zbd1t TYPE bsik-zbd1t,
zbd2t TYPE bsik-zbd2t,
zbd3t TYPE bsik-zbd3t,
END OF ty_bsik.
TYPES: BEGIN OF ty_lfb1,
lifnr TYPE lfb1-lifnr,
bukrs TYPE lfb1-bukrs,
END OF ty_lfb1.
TYPES: BEGIN OF ty_final,
bukrs TYPE bsik-bukrs,
lifnr TYPE bsik-lifnr,
belnr TYPE bsik-belnr,
bldat TYPE bsik-bldat,
days TYPE sy-datum,
waers TYPE bsik-waers,
dmbtr TYPE bsik-dmbtr,
* waers type bsik-waers,
wrbtr TYPE bsik-wrbtr,
zfbdt TYPE bsik-zfbdt,
zbd1t TYPE bsik-zbd1t,
zbd2t TYPE bsik-zbd2t,
zbd3t TYPE bsik-zbd3t,
name1 TYPE lfa1-name1,
current TYPE bsik-dmbtr,
d30 TYPE bsik-dmbtr,
d60 TYPE bsik-dmbtr,
d90 TYPE bsik-dmbtr,
d120 TYPE bsik-dmbtr,
d180 TYPE bsik-dmbtr,
d240 TYPE bsik-dmbtr,
d360 TYPE bsik-dmbtr,
da365 TYPE bsik-dmbtr,
* ct_date TYPE sy-datum,
* date TYPE datum,
* days TYPE char8,
END OF ty_final.
* Data Declaration.
DATA: gt_lfa1 TYPE STANDARD TABLE OF ty_lfa1,
wa_lfa1 TYPE ty_lfa1.
DATA: gt_final TYPE STANDARD TABLE OF ty_final,
wa_final TYPE ty_final.
DATA: gt_bsik TYPE STANDARD TABLE OF ty_bsik,
wa_bsik TYPE ty_bsik.
DATA: gt_lfb1 TYPE STANDARD TABLE OF ty_lfb1,
wa_lfb1 TYPE ty_lfb1.
DATA: days TYPE sy-datum.
* ALV Components
**** ALV Internal Table
DATA : i_layout TYPE slis_layout_alv OCCURS 0 WITH HEADER LINE,
i_events TYPE slis_t_event,
i_fieldcat TYPE slis_t_fieldcat_alv,
i_print TYPE slis_print_alv,
i_list_top TYPE slis_t_listheader,
i_list_end TYPE slis_t_listheader,
i_sort TYPE slis_t_sortinfo_alv.
DATA: wa_fieldcat LIKE LINE OF i_fieldcat.
* ALV Variable.
DATA: v_top TYPE slis_formname VALUE 'TOP_OF_PAGE',
v_eop TYPE slis_formname VALUE 'END_OF_PAGE',
v_eol TYPE slis_formname VALUE 'END_OF_LIST',
v_tol TYPE slis_formname VALUE 'TOP_OF_LIST'.
**** ALV Variants
DATA: i_variant LIKE disvariant.
* Selection screen
DATA: v_bukrs TYPE bukrs,
v_lifnr TYPE kunnr,
pa_bldat TYPE bldat.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_bukrs FOR v_bukrs NO INTERVALS NO-EXTENSION OBLIGATORY,
s_lifnr FOR v_lifnr.
* bldat FOR v_bldat no-extension.
PARAMETERS: p_bldat TYPE bsik-bldat.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS: p_detail RADIOBUTTON GROUP r1 DEFAULT 'X',
p_sumry RADIOBUTTON GROUP r1.
SELECTION-SCREEN END OF BLOCK b2.
* Top-Of-Page Declaration Header
DATA: lwa_list_top LIKE LINE OF i_list_top.
DATA: lv_header(70),
lv_text(50),
lv_text1(60),
lv_text2(50),
lv_text3(50) ,
lv_text4(50),
lv_date TYPE char10,
lv_time TYPE char10.
DATA: lv_butxt LIKE t001-butxt,
lv_butxt1 LIKE lfa1-name1,
lv_butxt2 LIKE lfb1-lifnr.
INITIALIZATION.
*TOP-OF-PAGE.
* Validations for Selection screen
AT SELECTION-SCREEN ON s_bukrs.
IF NOT s_bukrs[] IS INITIAL.
SELECT SINGLE bukrs FROM lfb1
INTO s_bukrs
WHERE bukrs IN s_bukrs.
ENDIF.
IF sy-subrc NE 0.
MESSAGE e003.
ENDIF.
AT SELECTION-SCREEN ON s_lifnr.
IF NOT s_lifnr[] IS INITIAL.
SELECT SINGLE lifnr FROM lfa1
INTO s_lifnr
WHERE lifnr IN s_lifnr.
IF sy-subrc NE 0.
MESSAGE e005.
ENDIF.
ENDIF.
AT SELECTION-SCREEN ON p_bldat.
IF NOT p_bldat IS INITIAL.
SELECT SINGLE bldat FROM bsid
INTO p_bldat
WHERE bldat = p_bldat.
IF sy-subrc NE 0 .
MESSAGE e004.
ENDIF.
ENDIF.
* Selection For Top-of-page.
** Get company code description
SELECT SINGLE butxt
FROM t001 INTO lv_butxt
WHERE bukrs IN s_bukrs.
* SELECT SINGLE lifnr FROM lfb1
* INTO lv_butxt2 WHERE bukrs IN s_bukrs.
* SELECT SINGLE name1 FROM lfa1
* INTO lv_butxt1 WHERE lifnr = lv_butxt2.
START-OF-SELECTION.
PERFORM data_retrival.
PERFORM f_layout_init.
PERFORM f_eventtab_build.
i_variant-report = sy-repid.
PERFORM f_print_control.
* PERFORM f_build_header_list.
* perform f_build_header_list1.
* PERFORM f_build_fieldcat.
IF p_detail = 'X'.
PERFORM f_build_sort.
PERFORM fill_fieldcat.
PERFORM f_build_header_list.
ELSE.
PERFORM f_build_sort1.
PERFORM fill_fieldcat_sum.
PERFORM f_build_header_list1.
ENDIF.
PERFORM f_list_display TABLES gt_final[].
END-OF-SELECTION.
*& Form data_retrival
* text
* --> p1 text
* <-- p2 text
FORM data_retrival .
SELECT bukrs
lifnr
belnr
bldat
waers
dmbtr
wrbtr
zfbdt
zbd1t
zbd2t
zbd3t
FROM bsik INTO TABLE gt_bsik
WHERE bukrs IN s_bukrs
AND lifnr IN s_lifnr.
SELECT lifnr
name1
FROM lfa1 INTO TABLE gt_lfa1
FOR ALL ENTRIES IN gt_bsik
WHERE lifnr = gt_bsik-lifnr.
LOOP AT gt_bsik INTO wa_bsik.
READ TABLE gt_lfa1 INTO wa_lfa1 WITH KEY lifnr = wa_bsik-lifnr.
MOVE-CORRESPONDING wa_bsik TO wa_final.
MOVE-CORRESPONDING wa_lfa1 TO wa_final.
DATA: days TYPE char2,
c4 TYPE char2.
DATA: days1 TYPE sy-datum.
DATA:duedate TYPE rfpos-faedt.
CALL FUNCTION 'NET_DUE_DATE_GET'
EXPORTING
i_zfbdt = wa_final-zfbdt
i_zbd1t = wa_final-zbd1t
i_zbd2t = wa_final-zbd2t
i_zbd3t = wa_final-zbd3t
i_shkzg = ' '
i_rebzg = ' '
* I_KOART = 'D'
IMPORTING
e_faedt = duedate.
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_bis = duedate
i_datum_von = wa_final-bldat
* I_KZ_EXCL_VON = '0'
* I_KZ_INCL_BIS = '0'
* I_KZ_ULT_BIS = ' '
* I_KZ_ULT_VON = ' '
* I_STGMETH = '0'
* I_SZBMETH = '1'
IMPORTING
e_tage = days
EXCEPTIONS
days_method_not_defined = 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.
wa_final-days = duedate.
DATA : wf_char TYPE char10.
wf_char = days.
IF wf_char+0(1) EQ '*' .
SKIP.
ELSE.
IF days EQ 0.
wa_final-current = wa_bsik-wrbtr.
ELSEIF days LE 30 AND days GT 0.
wa_final-d30 = wa_bsik-wrbtr.
ELSEIF days LE 60 AND days GT 30 .
wa_final-d60 = wa_bsik-wrbtr.
ELSEIF days LE 90 AND days GT 60.
wa_final-d90 = wa_bsik-wrbtr.
ELSEIF days LE 120 AND days GT 90.
wa_final-d120 = wa_bsik-wrbtr.
ELSEIF days LE 180 AND days GT 120.
wa_final-d180 = wa_bsik-wrbtr.
ELSEIF days LE 240 AND days GT 180.
wa_final-d240 = wa_bsik-wrbtr.
ELSEIF days LE 360 AND days GT 240.
wa_final-d360 = wa_bsik-wrbtr.
ELSEIF days GT 365 .
wa_final-da365 = wa_bsik-wrbtr.
ENDIF.
ENDIF.
APPEND wa_final TO gt_final.
CLEAR: wa_final,
days,
duedate,days1.
ENDLOOP.
ENDFORM. " data_retrival
*& Form fill_fieldcat
* text
FORM fill_fieldcat.
PERFORM fill_fields USING: 'Vendor Number' 'LIFNR',
'Vendor Name' 'NAME1',
'Document Number' 'BELNR',
'Document Date' 'BLDAT',
'Due Date' 'DAYS',
'Total In Document Currency' 'WRBTR',
'Currency' 'WAERS',
'Total In Reporting Currency' 'DMBTR',
'Current' 'CURRENT',
'1-30 days' 'D30',
'31-60 days' 'D60',
'61-90 days' 'D90',
'91-120 days' 'D120',
'121-180 days' 'D180',
'181-240 days' 'D240',
'241-360 days' 'D360',
* '181-365 days' 'D365',
'Above 365 days' 'DA365'.
ENDFORM. "fill_fieldcat
*& Form fill_fieldcat_sum
* text
FORM fill_fieldcat_sum.
PERFORM fill_fields USING: 'Vendor Number' 'LIFNR',
'Vendor Name' 'NAME1',
'Total In Reporting Currency' 'DMBTR',
'Current' 'CURRENT',
'1-30 days' 'D30',
'31-60 days' 'D60',
'61-90 days' 'D90',
'91-120 days' 'D120',
'121-180 days' 'D180',
'181-240 days' 'D240',
'241-360 days' 'D360',
'Above 365 days' 'DA365'.
ENDFORM. "fill_fieldcat_sum
*& Form fill_fields
* text
* -->&01 text
* -->&02 text
FORM fill_fields USING &01 &02 .
wa_fieldcat-tabname = 'T_OUTPUT'. "t_output_provgr
wa_fieldcat-fieldname = &02.
wa_fieldcat-seltext_m = &01.
* wa_fieldcat-ref_fieldname = fieldname.
* wa_fieldcat-ref_tabname = 'SFLIGHT'.
* w_fieldcat-do_sum = &03.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. "fill_fields
*& Form f_layout_init
* Set the layout
FORM f_layout_init.
* P_layout-min_linesize = 170.
* p_layout-max_linesize = 170.
* P_layout-no_colhead = abap_true.
* p_layout-detail_popup = abap_true.
i_layout-colwidth_optimize = abap_true.
i_layout-zebra = abap_true.
* i_layout-subtotals_text = 'SubTotal'.
* i_layout-totals_text = 'Total'.
ENDFORM. " f_layout_init
*& Form f_eventtab_build
* Set the events
FORM f_eventtab_build.
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = i_events.
READ TABLE i_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE v_top TO: ls_event-form,
ls_event-name.
APPEND ls_event TO i_events.
ENDIF.
READ TABLE i_events WITH KEY name = slis_ev_end_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE v_eop TO: ls_event-form,
ls_event-name.
APPEND ls_event TO i_events.
ENDIF.
READ TABLE i_events WITH KEY name = slis_ev_end_of_list
INTO ls_event.
IF sy-subrc = 0.
MOVE v_eol TO: ls_event-form,
ls_event-name.
APPEND ls_event TO i_events.
ENDIF.
READ TABLE i_events WITH KEY name = slis_ev_top_of_list
INTO ls_event.
IF sy-subrc = 0.
MOVE v_tol TO: ls_event-form,
ls_event-name.
APPEND ls_event TO i_events.
ENDIF.
ENDFORM. " f_eventtab_build
*& Form f_print_control
* Set the print control
FORM f_print_control .
* i_print-no_print_listinfos = abap_true.
* i_print-no_print_selinfos = abap_true.
* i_print-reserve_lines = 2.
* i_print-no_change_print_params = abap_true.
ENDFORM. " f_print_control
*& Form f_build_header_list
* Build the header list (top of page)
FORM f_build_header_list .
lv_header = 'Vendor Open Item Analysis By Balance Of Overdue Items'(h01).
lv_text = 'Company Name:'(s01).
lv_text1 = 'Open Item As Key Date:'(s02).
lv_text2 = 'Company Code:'(s03).
lv_text3 = 'Vendor Number:'(s04).
lv_text4 = 'Vendor Name:'(s05).
* Header
CLEAR lwa_list_top.
lwa_list_top-typ = 'H'.
lwa_list_top-info = lv_header.
APPEND lwa_list_top TO i_list_top.
* Run date Display
lwa_list_top-typ = 'S'. " Item
WRITE: sy-datum TO lv_date MM/DD/YYYY.
lwa_list_top-key = 'Date :'(025).
lwa_list_top-info = lv_date.
APPEND lwa_list_top TO i_list_top.
CLEAR: lwa_list_top,
lv_date.
* Run time Display
lwa_list_top-typ = 'S'. " Item
WRITE: sy-uzeit TO lv_time USING EDIT MASK '__:__:__'.
lwa_list_top-key = 'Time :'(026).
lwa_list_top-info = lv_time.
APPEND lwa_list_top TO i_list_top.
CLEAR: lwa_list_top,
lv_time.
CLEAR lwa_list_top.
* Company Name
lwa_list_top-typ = 'S'.
lwa_list_top-key = lv_text.
lwa_list_top-info = lv_butxt.
APPEND lwa_list_top TO i_list_top.
CLEAR lwa_list_top.
*Open Item As Key Date
lwa_list_top-typ = 'S'.
lwa_list_top-key = lv_text1.
lwa_list_top-info = p_bldat.
APPEND lwa_list_top TO i_list_top.
CLEAR lwa_list_top.
* Company Code
lwa_list_top-typ = 'S'.
lwa_list_top-key = lv_text2.
lwa_list_top-info = s_bukrs-low.
APPEND lwa_list_top TO i_list_top.
CLEAR lwa_list_top.
** Vendor Number
* lwa_list_top-typ = 'S'.
* lwa_list_top-key = lv_text3.
* lwa_list_top-info = lv_butxt2.
* APPEND lwa_list_top TO i_list_top.
* CLEAR lwa_list_top.
**Vendor Name
* lwa_list_top-typ = 'S'.
* lwa_list_top-key = lv_text4.
* lwa_list_top-info = lv_butxt1.
* APPEND lwa_list_top TO i_list_top.
ENDFORM. " f_build_header_list
*& Form f_build_header_list1
* text
* --> p1 text
* <-- p2 text
FORM f_build_header_list1 .
lv_header = 'Vendor Open Item Analysis By Balance Of Overdue Items'(h01).
lv_text = 'Company Name:'(s01).
lv_text1 = 'Open Item As Key Date:'(s02).
lv_text2 = 'Company Code:'(s03).
lv_text3 = 'Vendor Number:'(s04).
lv_text4 = 'Vendor Name:'(s05).
lwa_list_top-typ = 'H'.
lwa_list_top-info = lv_header.
APPEND lwa_list_top TO i_list_top.
* Run date Display
lwa_list_top-typ = 'S'. " Item
WRITE: sy-datum TO lv_date MM/DD/YYYY.
lwa_list_top-key = 'Date :'(025).
lwa_list_top-info = lv_date.
APPEND lwa_list_top TO i_list_top.
CLEAR: lwa_list_top,
lv_date.
* Run time Display
lwa_list_top-typ = 'S'. " Item
WRITE: sy-uzeit TO lv_time USING EDIT MASK '__:__:__'.
lwa_list_top-key = 'Time :'(026).
lwa_list_top-info = lv_time.
APPEND lwa_list_top TO i_list_top.
CLEAR: lwa_list_top,
lv_time.
CLEAR lwa_list_top.
* Company Name
lwa_list_top-typ = 'S'.
lwa_list_top-key = lv_text.
lwa_list_top-info = lv_butxt.
APPEND lwa_list_top TO i_list_top.
CLEAR lwa_list_top.
*Open Item As Key Date
lwa_list_top-typ = 'S'.
lwa_list_top-key = lv_text1.
lwa_list_top-info = p_bldat.
APPEND lwa_list_top TO i_list_top.
CLEAR lwa_list_top.
ENDFORM. " f_build_header_list1
*& Form f_build_sort
* Set the sorting sequence
FORM f_build_sort .
DATA: l_sort TYPE slis_sortinfo_alv.
l_sort-spos = '1'.
l_sort-fieldname = 'LIFNR'.
l_sort-up = abap_true.
l_sort-group = '*'.
* l_sort-subtot = 'X'.
APPEND l_sort TO i_sort.
* l_sort-spos = '2'.
* l_sort-fieldname = 'NAME1'.
* l_sort-up = abap_true.
* l_sort-group = '*'.
** l_sort-subtot = 'X'.
* APPEND l_sort TO i_sort.
* l_sort-spos = '2'.
* l_sort-fieldname = 'LIFNR'.
* l_sort-up = abap_true.
* l_sort-subtot = abap_true.
* APPEND l_sort TO i_sort.
* l_sort-spos = '1'.
* l_sort-fieldname = 'VBELN'.
* l_sort-up = abap_true.
* l_sort-subtot = abap_true.
* APPEND l_sort TO i_sort.
* l_sort-spos = '2'.
* l_sort-fieldname = 'POSNR'.
* l_sort-up = abap_true.
* l_sort-subtot = abap_true.
* APPEND l_sort TO i_sort.
ENDFORM. " f_build_sort
*& Form f_list_display
* Display the ALV list report
* -->PT_DATA Internal table containing the data
FORM f_list_display TABLES pt_data.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = i_variant-report
is_layout = i_layout
it_fieldcat = i_fieldcat[]
it_sort = i_sort
i_default = 'X'
i_save = 'A'
is_variant = i_variant
it_events = i_events[]
is_print = i_print
TABLES
t_outtab = pt_data.
ENDFORM. "f_list_display
*& Form TOP_OF_PAGE
* TOP_OF_PAGE Event
FORM top_of_page. "#EC CALLED
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
* i_logo = 'ZLOGO_BAB'
it_list_commentary = i_list_top
i_alv_form = 'X'.
* PERFORM f_print_header USING SPACE SPACE SPACE.
ENDFORM. "TOP_OF_PAGE
*& Form END_OF_PAGE
* END_OF_PAGE Event
FORM end_of_page. "#EC CALLED
* DATA: l_pos(3) TYPE n VALUE 0,
* l_foot(30) VALUE '*** END OF PAGE ***'.
* l_pos = ( sy-linsz / 2 ) - ( STRLEN( l_foot ) / 2 ).
* ULINE.
* WRITE: /, AT l_pos l_foot.
ENDFORM. "END_OF_PAGE
*& Form END_OF_LIST
* END_OF_LIST Event
FORM end_of_list. "#EC CALLED
* DATA: l_pos(3) TYPE n VALUE 0,
* l_foot(30) VALUE '*** END OF REPORT ***'.
* l_pos = ( sy-linsz / 2 ) - ( STRLEN( l_foot ) / 2 ).
* ULINE.
* WRITE: /, AT l_pos l_foot.
ENDFORM. "END_OF_LIST
*& Form f_print_header
* Print the header (Top-Of-Page)
* -->P_P_TITLE1 Title text 1
* -->P_P_TITLE2 Title text 2
* -->P_P_TITLE3 Title text 3
FORM f_print_header USING p_title1 LIKE sy-title
p_title2 LIKE sy-title
p_title3 LIKE sy-title.
DATA: l_post1 TYPE i,
l_post2 TYPE i,
l_post3 TYPE i,
l_posin TYPE i.
l_post1 = ( sy-linsz / 2 ) - ( STRLEN( p_title1 ) / 2 ).
l_post2 = ( sy-linsz / 2 ) - ( STRLEN( p_title2 ) / 2 ).
l_post3 = ( sy-linsz / 2 ) - ( STRLEN( p_title3 ) / 2 ).
l_posin = sy-linsz - 17.
WRITE: / 'Report :', sy-cprog.
WRITE AT l_post1 p_title1.
WRITE AT l_posin 'Date :'.
WRITE sy-datum.
WRITE: / 'Cli/Sys :', sy-mandt, '/', sy-sysid.
WRITE AT l_post2 p_title2.
WRITE AT: l_posin 'Time :'.
WRITE sy-uzeit.
WRITE: / 'UserID :', sy-uname.
WRITE AT l_post3 p_title3.
WRITE AT l_posin 'Page :'.
WRITE sy-pagno NO-ZERO.
ENDFORM. " f_print_header
*& Form f_build_sort1
* text
* --> p1 text
* <-- p2 text
form f_build_sort1 .
DATA: l_sort TYPE slis_sortinfo_alv.
l_sort-spos = '1'.
l_sort-fieldname = 'LIFNR'.
l_sort-up = abap_true.
l_sort-group = '*'.
* l_sort-subtot = 'X'.
APPEND l_sort TO i_sort.
l_sort-spos = '2'.
l_sort-fieldname = 'NAME1'.
l_sort-up = abap_true.
l_sort-group = '*'.
* l_sort-subtot = 'X'.
APPEND l_sort TO i_sort.
* l_sort-spos = '3'.
* l_sort-fieldname = 'DMBTR'.
* l_sort-up = abap_true.
* l_sort-group = '*'.
* l_sort-subtot = 'X'.
* APPEND l_sort TO i_sort.
endform. " f_build_sort1
Regards
Sunita.Hey,
U can try out "SORTING THE VENDORS AND DO THE SUM in the NETWR"... try it out....see u sort the customers...rit?...keep it as usual and little mentoned above...
hope dis help u out...
Thanks. -
Open items for purchase order its very urgent
hi
my requirement is to write extract program for purchase order(me21) to extract only open items.
please provide sample code its very urgent.
thanks in advance.
points will be rewarded.
thanks
hari prasad reddycheck the below report :
REPORT ZMM_OPEN_PO_REPORT no standard page heading
line-size 255
message-id zwave.
======================================================================
Program Name : ZMM_OPEN_PO_REPORT *
Description : This report displays all Open PO Items and output *
would be PO Number,Material number and so on *
Author : Seshu *
Date : 01/24/2007 *
MODIFICATION HISTORY *
DATE | AUTHOR | CHANGE # | DESCRIPTION OF MODIFICATION *
--|||--
01/24/07| Seshu | DEVK921979 | Initial *
D A T A D E C L A R A T I O N P A R T ***
type-pools
type-pools : slis.
Tables
tables : ekko, " Purchase order Header
ekpo, " Purchase order Item
marc. " Material with Plant data
Internal table for output.
data : begin of i_output occurs 0,
ebeln like ekko-ebeln,
matnr like ekpo-matnr,
end of i_output.
ALV Data declaration.
data : v_repid like sy-repid.
ALV Function Module Variables
DATA: gs_layout type slis_layout_alv,
g_exit_caused_by_caller,
gs_exit_caused_by_user type slis_exit_by_user.
DATA: gt_fieldcat type slis_t_fieldcat_alv,
gs_print type slis_print_alv,
gt_events type slis_t_event,
gt_list_top_of_page type slis_t_listheader,
g_status_set type slis_formname value 'PF_STATUS_SET',
g_user_command type slis_formname value 'USER_COMMAND',
g_top_of_page type slis_formname value 'TOP_OF_PAGE',
g_top_of_list type slis_formname value 'TOP_OF_LIST',
g_end_of_list type slis_formname value 'END_OF_LIST',
g_variant LIKE disvariant,
g_save(1) TYPE c,
g_tabname_header TYPE slis_tabname,
g_tabname_item TYPE slis_tabname,
g_exit(1) TYPE c,
gx_variant LIKE disvariant.
data : gr_layout_bck type slis_layout_alv.
Ranges
ranges r_eindt for eket-eindt.
initialization.
v_repid = sy-repid.
start-of-selection.
Get the data from EKKO ,EKPO and MARC Table
perform get_data_tables.
end-of-selection.
display the data in the form of ALV
perform display_data.
*& Form get_data_tables
Get the data from EKKO,EKPO and MARC Table
FORM get_data_tables.
clear : i_output.
refresh : i_output.
fill the dates in ranges
r_eindt-low = sy-datum - 7.
r_eindt-high = sy-datum + 14.
r_eindt-option = 'BT'.
r_eindt-sign = 'I'.
append r_eindt.
Get the data from EKKO,EKPO and EKET Tables
select aebeln bmatnr into table i_output
from ekko as a inner join
ekpo as b on aebeln = bebeln
inner join marc as c on cmatnr = bmatnr
inner join mara as d on dmatnr = bmatnr
inner join eket as e on eebeln = aebeln
and eebelp = bebelp
where c~beskz = 'E'
and c~werks = '1000'
and d~mtart = 'FERT'
and b~loekz = space
and b~elikz = space
and e~eindt in r_eindt.
if sy-subrc ne 0.
message e000(zwave) with 'No open purchase order found'.
endif.
ENDFORM. " get_data_tables
*& Form display_data
text
FORM display_data.
Fill the Fiedlcat
PERFORM fieldcat_init using gt_fieldcat[].
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = v_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = g_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 = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = gr_layout_bck
IT_FIELDCAT = gt_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = g_save
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IT_EXCEPT_QINFO =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = i_output
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " display_data
*& Form fieldcat_init
text
-->P_GT_FIELDCAT[] text
FORM fieldcat_init USING e01_lt_fieldcat type slis_t_fieldcat_alv.
DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
Purchase order number
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'EBELN'.
LS_FIELDCAT-ref_fieldname = 'EBELN'.
LS_FIELDCAT-ref_tabname = 'EKKO'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
ls_fieldcat-seltext_L = 'Purchase Order'.
ls_fieldcat-seltext_M = 'Purchase Order'.
ls_fieldcat-seltext_S = 'Purchase Order'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
Material #
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'MATNR'.
LS_FIELDCAT-ref_fieldname = 'MATNR'.
LS_FIELDCAT-ref_tabname = 'EKPO'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
ls_fieldcat-seltext_L = 'Material'.
ls_fieldcat-seltext_M = 'Material'.
ls_fieldcat-seltext_S = 'Material'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
ENDFORM. " fieldcat_init -
REUSE_ALV_GRID_DISPLAY_LVC and checkboxes
Hi all,
please forgive the HUGE post, the code snip is quite significant. My task is to provide a search option for contract numbers then, after selection's done, show a grid with all the results from the search option where every row represents a contract. Addictionally, I want a checkbox for selection for every row, in order to provide a second, decisional step before processing these contracts.
In order to do so, I used the REUSE_ALV_GRID_DISPLAY but cannot manage to make the checkboxes visible. Note that the solution is working, because clicking in the first field of a row implies adding the row (so, the contract) to a table that will then processed after a particular event's raised (in this case, clicking a specified button).
Can anybody help me understanding why there are no checkboxes in the first columns? A very similar solution worked for me on another project... can't understand what's wrong with this.
Here's the code:
REPORT z_myproject .
* PARAMETERS
TYPES: BEGIN OF t_ztab_alv,
sel,
* cancellato TYPE c,
object_id TYPE crmt_object_id,
description TYPE crmt_process_description,
logical_system TYPE crmt_logsys,
END OF t_ztab_alv.
TYPES: ty_tt_crmd_orderadm_h TYPE TABLE OF crmd_orderadm_h.
DATA: it_contract TYPE TABLE OF t_ztab_alv,
wa_contract TYPE t_ztab_alv,
l_index TYPE i,
conditions TYPE string.
INITIALIZATION.
* Selection Screens and Parameters
SELECTION-SCREEN BEGIN OF BLOCK main_sel WITH FRAME TITLE text-001.
SKIP.
SELECT-OPTIONS s_ctrid FOR wa_contract-object_id.
SKIP.
SELECTION-SCREEN END OF BLOCK main_sel.
PARAMETERS: flag TYPE xfeld.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_ctrid-low.
DATA: it_help_item TYPE TABLE OF t_ztab_alv,
it_return TYPE TABLE OF ddshretval.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE it_help_item
FROM crmd_orderadm_h
WHERE object_type = 'BUS2000113'.
IF sy-subrc = 0.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'OBJECT_ID'
dynprofield = 'OBJECT_ID'
dynpprog = sy-cprog
dynpnr = sy-dynnr
value_org = 'S'
TABLES
value_tab = it_help_item
return_tab = it_return.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_ctrid-high.
DATA: it_help_item TYPE TABLE OF t_ztab_alv,
it_return TYPE TABLE OF ddshretval.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE it_help_item
FROM crmd_orderadm_h
WHERE object_type = 'BUS2000113'.
IF sy-subrc = 0.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'OBJECT_ID'
dynprofield = 'OBJECT_ID'
dynpprog = sy-cprog
dynpnr = sy-dynnr
value_org = 'S'
TABLES
value_tab = it_help_item
return_tab = it_return.
ENDIF.
START-OF-SELECTION.
* Retrieve values from the sel_opt.
SELECT * FROM crmd_orderadm_h
INTO CORRESPONDING FIELDS OF TABLE it_contract
WHERE object_id IN s_ctrid.
* Now let's kick our ALV out!
* General Data
TYPE-POOLS: slis.
DATA: gs_layout TYPE lvc_s_layo,
g_exit_caused_by_caller,
gs_exit_caused_by_user TYPE slis_exit_by_user,
g_repid LIKE sy-repid.
DATA:
gt_events TYPE slis_t_event,
gt_list_top_of_page TYPE slis_t_listheader,
g_status_set TYPE slis_formname VALUE 'PF_STATUS_SET',
g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
g_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE',
g_top_of_list TYPE slis_formname VALUE 'TOP_OF_LIST',
g_end_of_list TYPE slis_formname VALUE 'END_OF_LIST',
it_fieldcat TYPE lvc_t_fcat,
wa_fieldcat TYPE lvc_s_fcat.
*"Variants
DATA: gs_variant LIKE disvariant,
g_save.
g_repid = sy-repid.
g_save = 'A'.
* This is the main flow. Initialize the layout and manage events.
PERFORM layout_init USING gs_layout.
PERFORM eventtab_build USING gt_events[].
gs_variant-report = g_repid.
g_save = 'A'.
END-OF-SELECTION.
*"List Header for Top-Of-Page
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
* I_BACKGROUND_ID = 'ALV_BACKGROUND'
i_buffer_active = 'X'
i_callback_program = g_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = g_user_command
i_structure_name = 'ZCTR_TAB_ALV'
is_layout_lvc = gs_layout
it_fieldcat_lvc = it_fieldcat
i_save = g_save
is_variant = gs_variant
it_events = gt_events[]
* I_SCREEN_START_COLUMN = 0 "Use coordinates for
* I_SCREEN_START_LINE = 0 "display as dialog box
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
IMPORTING
e_exit_caused_by_caller = g_exit_caused_by_caller
es_exit_caused_by_user = gs_exit_caused_by_user
TABLES
t_outtab = it_contract
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc = 0.
IF g_exit_caused_by_caller = 'X'.
*" Forced Exit by calling program
*" <do_something>.
ELSE.
*" User left list via F3, F12 or F15
IF gs_exit_caused_by_user-back = 'X'. "F3
*" <do_something>.
ELSE.
IF gs_exit_caused_by_user-exit = 'X'. "F15
*" <do_something>.
ELSE.
IF gs_exit_caused_by_user-cancel = 'X'. "F12
*" <do_something>.
ELSE.
*" should not occur!
*" <do_Abnormal_End>.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
*"Fatal error callin ALV
* MESSAGE AXXX(XY) WITH ...
ENDIF.
*"Form routines
*& Form LAYOUT_INIT
* text
* -->RS_LAYOUT text
FORM layout_init USING rs_layout TYPE lvc_s_layo.
*"Build layout for list display
rs_layout-cwidth_opt = 'X'.
rs_layout-zebra = 'X'.
rs_layout-box_fname = 'SEL'.
ENDFORM. "LAYOUT_INIT
*& Form EVENTTAB_BUILD
* text
* -->RT_EVENTS text
FORM eventtab_build USING rt_events TYPE slis_t_event.
*"Registration of events to happen during list display
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = rt_events.
READ TABLE rt_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE g_top_of_page TO ls_event-form.
APPEND ls_event TO rt_events.
ENDIF.
ENDFORM. "EVENTTAB_BUILD
*& Form TOP_OF_PAGE
* text
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
* I_LOGO = 'ENJOYSAP_LOGO'
it_list_commentary = gt_list_top_of_page.
ENDFORM. "TOP_OF_PAGE
* FORM SET_PF_STATUS *
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'STANDARD'.
"Copy of 'STANDARD' pf_status from fgroup SALV
ENDFORM. "set_pf_status
* FORM USER_COMMAND *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA : it_sel_lines TYPE TABLE OF t_ztab_alv,
l_lines TYPE i,
l_mult_lines TYPE flag,
l_obj_id TYPE char35,
t_contratti TYPE ty_tt_crmd_orderadm_h,
wa_contratti TYPE crmd_orderadm_h.
* Calculate sel_lines.
REFRESH it_sel_lines.
CASE r_ucomm.
WHEN 'ZCANCELLA'. "set attribute button
REFRESH t_contratti.
LOOP AT it_contract INTO wa_contract WHERE sel = 'X'.
SELECT SINGLE *
FROM crmd_orderadm_h
INTO wa_contratti
WHERE object_id = wa_contract-object_id.
IF sy-subrc = 0.
APPEND wa_contratti TO t_contratti.
ENDIF.
ENDLOOP.
MOVE 'X' TO rs_selfield-refresh.
* do something with the selected entries.
PERFORM do something USING t_contratti.
ENDCASE.
COMMIT WORK AND WAIT.
CLEAR r_ucomm.
MOVE 'X' TO rs_selfield-refresh.
ENDFORM. "USER_COMMANDHello Byju, hello all...
...first of all, sorry for the BIG delay in answering but I had to leave a bit this task for other priorities... now I'm back on it to work. Oh, and obviously, happy new year mates
I tried by myself to follow what you called "option(2)"... a popup screen (simpliest possible).
In order to do so, I tried the following code, but I don't know how to manage the "no" answer.... I mean, the popup works but if I press "No", I don't want the code to follow to be executed (sounds like I have to translate into code "do nothing of what follows, simply return to the alv screen").
The code:
WHEN 'ZCANCELLA'. "set attribute button
REFRESH t_contratti.
LOOP AT it_contract INTO wa_contract WHERE sel = 'X'.
IF wa_contract-object_id BETWEEN 8400000000 AND 8499999999.
popupneeded = 'X'.
ENDIF.
ENDLOOP.
IF popupneeded EQ 'X'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
* TITLEBAR = 'ATTENZIONE'
* DIAGNOSE_OBJECT = ' '
text_question = '84* contracts in the selection. Continue? '
* TEXT_BUTTON_1 = 'Yes'(001)
* ICON_BUTTON_1 = ' '
* TEXT_BUTTON_2 = 'No'(002)
* ICON_BUTTON_2 = ' '
* DEFAULT_BUTTON = '1'
DISPLAY_CANCEL_BUTTON = SPACE
* USERDEFINED_F1_HELP = ' '
* START_COLUMN = 25
* START_ROW = 6
* POPUP_TYPE =
* IV_QUICKINFO_BUTTON_1 = ' '
* IV_QUICKINFO_BUTTON_2 = ' '
IMPORTING
ANSWER = w_answer.
* TABLES
* PARAMETER =
* EXCEPTIONS
* TEXT_NOT_FOUND = 1
* OTHERS = 2
IF w_answer ne '1'.
* to manage -> refresh the alv of selection and do nothing.
endif.
ENDIF.
LOOP AT it_contract INTO wa_contract WHERE sel = 'X'.
SELECT SINGLE *
FROM crmd_orderadm_h INTO wa_contratti
WHERE object_id = wa_contract-object_id.
IF sy-subrc = 0.
APPEND wa_contratti TO t_contratti.
ENDIF.
ENDLOOP.
MOVE 'X' TO rs_selfield-refresh.
* delete selected contracts.
PERFORM cancella_ctr USING t_contratti.
Also...I added a new field in the ALV mask, called "deleted"... it's a checkbox I'd like to check after the deletion phase to show that a selected contract's been deleted. The behaviour in my mind should be as follows:
- ALV screen that shows contracts;
- selection of some of these contracts;
- click on the button "delete";
- eventually, popup of the warning screen;
- after the deletion, return to the previous ALV in which the previously selected lines have the "deleted" field marked (it's not significant to verify that these entries have really been deleted... if something goes wrong, an exception is raised and managed).
Guess it's a simple "come back to the alv screen and refresh" issue, so maybe you can help me with a clarifying example
Thanks in advance!
Edited by: Matteo Montalto on Jan 7, 2009 10:15 AM -
Header prob. in ALV report
Hi All,
Hope you all are doing fine!!!
In the below program am trying to print the top-of-page/header in alv report,,but am unable to do it..
Am working on 4.6c version,,,,,its working fine in ECC 6.0 but i really dont understand why its not working in 4.6c...AM JUST PASTING THE ALV PART...!!!
Pls. do the needful
REPORT yjack LINE-SIZE 132
LINE-COUNT 65
NO STANDARD PAGE HEADING.
DATA: /sie/swe_ag0_rdo TYPE /sie/swe_ag0_rdo,
wa_tvko TYPE tvko,
/sie/swe_ag0_raa TYPE /sie/swe_ag0_raa,
wa_kna1 TYPE kna1,
wa_t001 TYPE t001,
wa_tvkot TYPE tvkot,
/sie/swe_ag0_con TYPE /sie/swe_ag0_con,
/sie/swe_ag0_r02 TYPE /sie/swe_ag0_r02.
TYPES: BEGIN OF ty_itab,
bukrs TYPE /sie/swe_ag0_rdo-bukrs,
vkorg TYPE /sie/swe_ag0_rdo-vkorg,
zclpr TYPE /sie/swe_ag0_rdo-zclpr,
zcdaz TYPE /sie/swe_ag0_rdo-zcdaz,
vbeln TYPE /sie/swe_ag0_rdo-vbeln,
posnr TYPE /sie/swe_ag0_rdo-posnr,
vbtyp TYPE /sie/swe_ag0_rdo-vbtyp,
zidag TYPE /sie/swe_ag0_rdo-zidag,
zimpp TYPE /sie/swe_ag0_rdo-zimpp,
zimco TYPE /sie/swe_ag0_rdo-zimco,
zimmg TYPE /sie/swe_ag0_rdo-zimmg,
fkdat TYPE /sie/swe_ag0_rdo-fkdat,
zstre TYPE /sie/swe_ag0_rdo-zstre,
vtweg TYPE /sie/swe_ag0_rdo-vtweg,
kunrg TYPE /sie/swe_ag0_rdo-kunrg,
END OF ty_itab.
TYPES: BEGIN OF ty_itab2,
bukrs TYPE /sie/swe_ag0_rdo-bukrs,
vkorg TYPE /sie/swe_ag0_rdo-vkorg,
zcdaz TYPE /sie/swe_ag0_rdo-zcdaz,
fkdat TYPE /sie/swe_ag0_rdo-fkdat,
vbeln TYPE /sie/swe_ag0_rdo-vbeln,
zimpp TYPE /sie/swe_ag0_rdo-zimpp,
zimco(5) TYPE p DECIMALS 2,
zimmg(5) TYPE p DECIMALS 2,
resid(6) TYPE p DECIMALS 2,
kunrg TYPE /sie/swe_ag0_rdo-kunrg,
name1 TYPE kna1-name1,
END OF ty_itab2.
type-pools: slis.
types: begin of ty_final,
bukrs type char29,
vkorg type char24,
mese type char17,
gjahr type gjahr,
agent type char45,
vbeln type vbeln,
fkdat type fkdat,
zimpp type /SIE/SWE_AG0_ZIMPP,
zimco type /SIE/SWE_AG0_ZIMCO,
zimmg type /SIE/SWE_AG0_ZIMMG,
resid(5) TYPE p DECIMALS 2,
kunrg type kunrg,
name1 type NAME1_GP,
end of ty_final.
data: it_final type table of ty_final,
wa_final type ty_final,
g_bukrs(29) type c,
g_vkorg(24) type c.
data: it_fieldcat type slis_t_fieldcat_alv,
it_layout type slis_layout_alv,
it_list_top_of_page type slis_t_listheader,
it_events type slis_t_event,
wa_events type slis_alv_event,
it_headings type slis_t_listheader,
wa_headings type slis_listheader.
constants: c_h type c value 'H',
c_s type c value 'S'.
field-symbols: <fs_final> type ty_final.
DATA: it_itab TYPE TABLE OF ty_itab,
it_itab2 TYPE TABLE OF ty_itab2,
wa_itab TYPE ty_itab,
wa_itab2 TYPE ty_itab2.
DATA: wa_app TYPE ty_itab.
DATA: w_var TYPE c VALUE '1',
w_com_mese(9) TYPE c,
w_flag_st TYPE c.
$$ Selection-screen
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK parametri WITH FRAME TITLE text-001.
BEG MOD ESX00596 IMS:100276414 TR:SWIK9A04W7 11.04.2007
*PARAMETERS: p_bukrs LIKE /sie/swe_ag0_rdo-bukrs OBLIGATORY.
*PARAMETERS: p_vkorg LIKE /sie/swe_ag0_rdo-vkorg OBLIGATORY.
PARAMETERS: p_bukrs TYPE /sie/swe_ag0_rdo-bukrs OBLIGATORY.
PARAMETERS: p_vkorg TYPE /sie/swe_ag0_rdo-vkorg OBLIGATORY.
SELECT-OPTIONS: s_zcdaz FOR /sie/swe_ag0_rdo-zcdaz OBLIGATORY
MATCHCODE OBJECT /sie/swe_ag0_zaa.
PARAMETERS: mese(2) TYPE n OBLIGATORY,
anno TYPE /sie/swe_ag0_rdo-gjahr OBLIGATORY.
SELECTION-SCREEN END OF BLOCK parametri.
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: c1 AS CHECKBOX.
SELECTION-SCREEN COMMENT 8(31) text-006 FOR FIELD c1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN: END OF BLOCK b1.
DATA: w_cd_a TYPE /sie/swe_ag0_rdo-vtweg,
w_cd_gen TYPE /sie/swe_ag0_rdo-vtweg,
w_cd_di TYPE /sie/swe_ag0_rdo-vtweg,
w_cd_re TYPE /sie/swe_ag0_rdo-vtweg,
w_cd_te TYPE /sie/swe_ag0_rdo-vtweg,
w_cd_ca TYPE /sie/swe_ag0_rdo-vtweg.
INITIALIZATION.
PERFORM selezione_hard_coding.
$$ At selection-screen
AT SELECTION-SCREEN.
PERFORM controlli.
$$ Top-of-page
TOP-OF-PAGE.
PERFORM top_of_page.
$$ Start-of-selection
START-OF-SELECTION.
perform build_events.
PERFORM carica_itab.
PERFORM carica_itab2.
PERFORM stampa.
END-OF-SELECTION.
IF C1 EQ 'X'.
perform fill-fieldcatalog.
perform display_alv.
ENDIF.
*& Form fill-fieldcatalog
text
--> p1 text
<-- p2 text
form fill-fieldcatalog.
data: l_fieldcat TYPE slis_fieldcat_alv.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'BUKRS'.
l_fieldcat-col_pos = 1.
l_fieldcat-seltext_l = 'Company'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'VKORG'.
l_fieldcat-col_pos = 2.
l_fieldcat-seltext_l = 'Comm. Organization'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'MESE'.
l_fieldcat-col_pos = 3.
l_fieldcat-seltext_l = 'Month'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'GJAHR'.
l_fieldcat-col_pos = 4.
l_fieldcat-seltext_l = 'Year'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'AGENT'.
l_fieldcat-col_pos = 5.
l_fieldcat-seltext_l = 'AGENT'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'VBELN'.
l_fieldcat-col_pos = 6.
l_fieldcat-seltext_l = 'Invoice'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'FKDAT'.
l_fieldcat-col_pos = 7.
l_fieldcat-seltext_l = 'Date'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'ZIMPP'.
l_fieldcat-col_pos = 8.
l_fieldcat-seltext_l = 'Taxable'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'ZIMCO'.
l_fieldcat-col_pos = 9.
l_fieldcat-seltext_l = 'Tot.Comm.'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'ZIMMG'.
l_fieldcat-col_pos = 10.
l_fieldcat-seltext_l = 'Settle'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'RESID'.
l_fieldcat-col_pos = 11.
l_fieldcat-seltext_l = 'Accruing'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'KUNRG'.
l_fieldcat-col_pos = 12.
l_fieldcat-seltext_l = 'Cust.Code'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'NAME1'.
l_fieldcat-col_pos = 13.
l_fieldcat-seltext_l = 'Company Name'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
endform. " fill-fieldcatalog
*& Form display_alv
text
--> p1 text
<-- p2 text
form display_alv.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_TOP_OF_PAGE = 'PRINT_HEADING'
IS_LAYOUT = it_layout
IT_FIELDCAT = it_fieldcat
IT_EVENTS = it_events
TABLES
t_outtab = it_final
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
*& Form build_events
text
-->P_IT_EVENTS[] text
form build_events.
clear wa_events.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = it_events.
read table it_events into wa_events with key name = 'TOP_OF_PAGE'.
if sy-subrc eq 0.
wa_events-form = 'PRINT_HEADING'.
modify it_events from wa_events transporting form
where name = 'TOP_OF_PAGE'.
endif.
endform. " build_events
form PRINT_HEADING.
clear wa_headings.
wa_headings-typ = 'H'.
wa_headings-info = 'DEMO FOR ALV!!!'.
append wa_headings to it_headings.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_headings.
endform.
Thanks n Regards
JackHi friend,
I think u have to remove below lines in your program because FM 'REUSE_ALV_GRID_DISPLAY' will call directly Form 'PRINT_HEADING' for TOP-OF-PAGE event through table 'it_events' :
Remove lines:
TOP-OF-PAGE.
PERFORM top_of_page.
Also remove the parameter
I_CALLBACK_TOP_OF_PAGE = 'PRINT_HEADING' in FM 'REUSE_ALV_GRID_DISPLAY'
Also put a breakpoint in your program in the line,
START-OF-SELECTION.
perform build_events.
See whether 'form' 'name' gets populated in table 'it_events' or not.
See sample report and compare.
REPORT zawi_assign3 NO STANDARD PAGE HEADING.
TYPE-POOLS: slis.
DATA: BEGIN OF gt_outtab OCCURS 0.
INCLUDE STRUCTURE ekpo.
DATA: END OF gt_outtab,
gs_layout TYPE slis_layout_alv,
g_exit_caused_by_caller,
gs_exit_caused_by_user TYPE slis_exit_by_user,
g_repid LIKE sy-repid.
DATA:
gt_events TYPE slis_t_event,
gt_list_top_of_page TYPE slis_t_listheader,
g_status_set TYPE slis_formname VALUE 'PF_STATUS_SET',
g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
g_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE',
g_top_of_list TYPE slis_formname VALUE 'TOP_OF_LIST',
g_end_of_list TYPE slis_formname VALUE 'END_OF_LIST'.
DATA: gs_variant LIKE disvariant,
g_save.
INITIALIZATION.
g_repid = sy-repid.
PERFORM layout_init USING gs_layout.
PERFORM eventtab_build USING gt_events[].
gs_variant-report = g_repid.
g_save = 'X'.
START-OF-SELECTION.
PERFORM select_data TABLES gt_outtab.
END-OF-SELECTION.
PERFORM comment_build USING gt_list_top_of_page[].
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_background_id = 'ALV_BACKGROUND'
i_buffer_active = 'X'
i_callback_program = g_repid
i_structure_name = 'ekpo'
is_layout = gs_layout
i_save = g_save
is_variant = gs_variant
it_events = gt_events[]
IMPORTING
e_exit_caused_by_caller = g_exit_caused_by_caller
es_exit_caused_by_user = gs_exit_caused_by_user
TABLES
t_outtab = gt_outtab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc = 0.
IF g_exit_caused_by_caller = 'X'.
ELSE.
IF gs_exit_caused_by_user-back = 'X'.
ELSE.
IF gs_exit_caused_by_user-exit = 'X'.
ELSE.
IF gs_exit_caused_by_user-cancel = 'X'.
ELSE.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
ENDIF.
FORM select_data TABLES rt_outtab LIKE gt_outtab[].
SELECT * FROM ekpo INTO CORRESPONDING FIELDS
OF TABLE rt_outtab
UP TO 00030 ROWS.
ENDFORM. "SELECT_DATA
FORM layout_init USING rs_layout TYPE slis_layout_alv.
rs_layout-detail_popup = 'X'.
rs_layout-edit = 'X'.
ENDFORM. "LAYOUT_INIT
FORM eventtab_build USING rt_events TYPE slis_t_event.
*"Registration of events to happen during list display
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = rt_events.
READ TABLE rt_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE g_top_of_page TO ls_event-form.
APPEND ls_event TO rt_events.
ENDIF.
ENDFORM. "EVENTTAB_BUILD
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'ENJOYSAP_LOGO'
it_list_commentary = gt_list_top_of_page.
ENDFORM. "TOP_OF_PAGE
FORM comment_build USING lt_top_of_page TYPE
slis_t_listheader.
DATA: ls_line TYPE slis_listheader.
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = text-100.
APPEND ls_line TO lt_top_of_page.
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-key = 'Program'.
ls_line-info = sy-repid.
APPEND ls_line TO lt_top_of_page.
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-key = 'User'.
ls_line-info = sy-uname.
APPEND ls_line TO lt_top_of_page.
ENDFORM. "COMMENT_BUILD
Might solve your problem.
Thanks.
Edited by: Sap Fan on Feb 20, 2009 9:50 AM
Edited by: Sap Fan on Feb 20, 2009 9:52 AM
Edited by: Sap Fan on Feb 20, 2009 9:54 AM -
Hi Friends,
Please help me out, I am new to ABAP.
Please anybody explain me the functionality of Field catalogs in ALVs?
How many methods are there to pass data to ALVs, i.e., in how many ways?
Hope u will help me.hi,
this will be very helpful for ALV REPORTING.....
Sap provides a set of ALV (ABAP LIST VIEWER) function modules which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length. In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output. The report output can contain upto 90 columns in the display with the wide array of display options.
The commonly used ALV functions used for this purpose are;
1. REUSE_ALV_VARIANT_DEFAULT_GET
2. REUSE_ALV_VARIANT_F4
3. REUSE_ALV_VARIANT_EXISTENCE
4. REUSE_ALV_EVENTS_GET
5. REUSE_ALV_COMMENTARY_WRITE
6. REUSE_ALV_FIELDCATALOG_MERGE
7. REUSE_ALV_LIST_DISPLAY
8. REUSE_ALV_GRID_DISPLAY
9. REUSE_ALV_POPUP_TO_SELECT
The different steps used for getting the above function modules into use are:
Step 1
DATA DECLARATION
Sap standard type pools: SLIS , KKBLO .
Sap standard tables types taken from the type pools are: SLIS_LAYOUT_ALV ,
SLIS_T_FIELDCAT_ALV,
SLIS_T_LISTHEADER,
SLIS_T_EVENT,
SLIS_SELFIELD.
Internal tables to used in the program declared based on the above table types
DATA: I_LAYOUT TYPE SLIS_LAYOUT_ALV,
I_FIELDTAB TYPE SLIS_T_FIELDCAT_ALV,
I_HEADING TYPE SLIS_T_LISTHEADER,
I_EVENTS TYPE SLIS_T_EVENT.
TYPES: KKBLO_SELFIELD TYPE SLIS_SELFIELD.
Step 2 (Optional)
SELECTING THE VARIANTS FOR INITIAL LIST DISPLAY (DEFAULT VARIANT)
The variants in the list display can be both user-specific and general. The user can programmatically set the initial (default) variant for list display.
The default variant can be found using the function module 'REUSE_ALV_VARIANT_DEFAULT_GET'.
Sample code:
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = variant save condition ( A=all, U = user-specific )
CHANGING
cs_variant = internal table containing the program name (and the default variant---optional )
EXCEPTIONS
not_found = 2.
The user can also choose from the list of existing variants using the function module REUSE_ALV_VARIANT_F4.
Step 3
DEFININING OUTPUT CHARACTERISTICS: PREPARING DISPLAY FIELDS CATALOG
A field catalog is prepared using the internal table (I_FIELDCAT) of type SLIS_T_FIELDCAT_ALV. Field catalog containing descriptions of the list output fields (usually a subset of the internal output table fields).
A field catalog is required for every ALV list output to add desired functionality (i.e. Key, Hotspot, Specific headings, Justify, Col. position etc) to certain fields of the output. If not mentioned specifically, then the defaults are taken. The possible values and defaults are listed below.
The field catalog for the output table is built-up in the caller's coding. The build-up can be completely or partially automated by calling the REUSE_ALV_FIELDCATALOG_MERGE module.
The minimal field catalog is documented below. This can be done in a routine using a local variable. The user can use the other optional parameters to assign output attributes to different fields in the output, which differ from the default.
A field catalog need not be built-up and passed explicitly only under the following conditions:
1. The internal table to be output has the same structure as a Data Dictionary structure which is referred to in the internal table declaration using LIKE or INCLUDE STRUCTURE. In this case the attributes of the different fields is taken directly from the table and the attributes (key fields, length, texts etc) need to state explicitly.
2. all fields in this structure are to be output
3. The structure name is passed to ALV in the parameter I_STRUCTURE_NAME of the function module REUSE_ALV_LIST_DISPLAY.
All the values entered in the catalog is specific to the particular field whose name is entered in the fieldname FIELDNAME of the fieldcat structure. The name of the table is also entered in the corr. Fieldname TABNAME of the structure.
The different possible attributes are:
Row_pos (row position): Only relevant if the list output is to be multi-line (two or three lines) by default. So, this attribute can be used maintain certain level of alignment in the output.
Value set: 0, 1 3
Col_pos (column position): This parameter is relevant when the fields in the output are to be different from the sequence of the fields in the internal table used for display. The parameter specifies the relative column position of the field in the list output. The column order can be changed interactively by the user. If this parameter is initial for all field catalog entries, columns appear in the internal table field sequence.
Value set: 0, 1 60
Fieldname (field name): This is the name of the internal table field for which the parameters are passed in the catalog.
Value set: internal output table field name (required parameter)
Tabname (internal output table): Name of the internal output table that contains the field FIELDCAT-FIELDNAME above.
Value set: SPACE, internal output table name.
Ref_fieldname (reference field name): Name of the Data Dictionary field referred to. This parameter is only used when the internal output table field described by the current field catalog entry has a reference to the Data Dictionary (not a program field), and the field name in the internal output table is different from the name of the field in the Data Dictionary. If the field names are identical, naming the Data Dictionary structure or table in the FIELDCAT-REF_TABNAME parameter is sufficient.
Value set: SPACE, Data Dictionary field name.
Ref_tabname (reference table/structure field name): Structure or table name of the referred Data Dictionary field. This parameter is only used when the internal output table field described by the current field catalog entry has a Data Dictionary reference (not a program field).
Value set: SPACE, name of a Data Dictionary structure or table
Link to currency unit
Cfieldname (currency unit field name): This is used for currency fields that have a reference to any unit field. This is only relevant for amount columns with associated unit. This parameter contains the Name of the internal output table field containing the currency unit associated with the amount field FIELDCAT-FIELDNAME. The field in FIELDCAT-CFIELDNAME must have its own field catalog entry.
Value set: SPACE, output table field name
Ctabname (internal currency unit field output table): Name of the internal output table containing the FIELDCAT-CFIELDNAME field.
Value set: SPACE, output table field name.
Link to measurement unit
Qfieldname (measurement unit field name): Only relevant for quantity columns with unit link. Name of the internal output table field containing the measurement unit associated with the quantity field FIELDCAT-FIELDNAME. The field in FIELDCAT-QFIELDNAME must have its own field catalog entry.
Value set: SPACE, output table field name.
Qtabname (internal measurement unit field output table): Name of the internal output table containing the FIELDCAT-QFIELDNAME field.
Value set: SPACE, output table field name.
Outputlen (column width): This parameter is used if the desired output length for a field is desired to be different from the internal output table field. For fields with a Data Dictionary link this parameter can be left initial. For fields without a Data Dictionary link (program field) the parameter must be given the value of the desired field list output length (column width).
Initial = column width is the output length of the referred Data Dictionary field (domain).
N = column width is n characters.
Value set: 0 (initial), n.
Key (key column): By default, the system makes some fields in the output as key fields, provided the fields are key fields in their referencing table. Using this parameter, fields other than key fields of the referencing table can be made key field. This parameter is most important if the output needs to contain some field which are not scrollable or cannot be hidden.
If the internal output table contains fields that are key fields from different tables, then all those fields in the report output becomes unscrollable and cannot be hidden. So, the fields in the output internal table should not be referenced from tables in which they are key fields. Instead, they should be referenced to the tables in which they are not key fields, incase they are not desired as key field in the output.
'X' = key field (key field output in color) and Key fields can not be interactively hidden. Parameter FIELDCAT-NO_OUT must be left initial.
Value set: SPACE, 'X'.
Key_sel (hideable key column): This parameter is only relevant for the fields which are made key fields using FIELDCAT-KEY = 'X'. Using this parameter the Key field can be hidden interactively.
The key column sequence cannot be changed interactively by the user. The output is controlled by the FIELDCAT-NO_OUT parameter analogously to non-key fields.
Value set: SPACE, 'X'.
No_out (field in field list): This parameter is used to remove certain fields from the output during initial display. The user can however interactively choose the field for output from the field list in the display variant.
'X' = field is not displayed in the current list.
Value set: SPACE, 'X'.
Tech (technical field): This parameter is used to make certain field display only in the field catalog. The fields with this parameter set cannot be output in the list nor can they be displayed interactively from the catalog.
'X' = technical field.
Value set: SPACE, 'X'.
Emphasize (highlight columns in color): As name suggests, this field parameter is used to highlight certain field with chosen colors.
Value set: SPACE, 'X' or 'Cxyz' (x:'1'-'9'; y,z: '0'=off ,'1'=on).
'X' = column is colored with the default column highlight color.
'Cxyz' = column is colored with a coded color:
- C: Color (coding must begin with C)
- X: color number
- Y: bold
- Z: inverse
Hotspot (column as hotspot): This parameter is used to make certain field appear as hotspot i.e. a hand is displayed if the cursor is positioned on the field value. Single click on such fields cause the PICK OR F2 events to happen.
Value set: SPACE, 'X'.
'X' = column cells are output as hotspots.
Fix_column (fix column): This parameter is used to fix certain columns in the output. All columns to be fixed must have this flag, starting from the left. If a column without this flag is output, only the columns to the left of this column are fixed. The user can change the column fixing interactively.
Value set: SPACE, 'X'.
'X' = column fixed (does not scroll horizontally).
Do_sum (sum over column): the user can also call this function interactively.
Value set: SPACE, 'X'.
'X' = a sum is calculated over this internal output table field.
No_sum (sums forbidden): No sum can be calculated over this field, although the data type of the field would allow summing.
Value set: SPACE, 'X'.
Icon: The parameter displays certain column contents as icons. The internal output table column contents must be valid icon strings.
Value set: SPACE, 'X'.
'X' = column contents to be output as an icon.
Symbol: The internal output table column must be a valid symbol character.
Value set: SPACE, 'X'
'X' = column contents are to be output as a symbol.
Just (justification): This parameter is used for alignment of the contents of the output table. This is only relevant for CHAR or NUMC fields in the output internal table. The justification of the column header always follows the justification of the columns. Independent justification of the column header is not possible.
Value set: SPACE, 'R', 'L', and C.
' ' = Default justification for this data type
'R' = right-justified output
'L' = left-justified output
'C' = centered output.
Lzero (leading zeros): By default ALV outputs NUMC fields right-justified without leading zeros. Using this parameter only the NUMC fields can be displayed with leading zeroes.
Value set: SPACE, 'X'.
'X' = output with leading zeros.
No_sign (no +/- sign): This parameter is used to suppress the signs of the output fields. It is only relevant for the value fields.
Value set: SPACE, 'X'.
'X' = value output without +/ sign.
No_zero (suppress zeros): Only relevant for value fields.
Value set: SPACE, 'X'.
'X' = suppress zeros.
Edit_mask (field formatting): To apply the report output formatting options same as in the WRITE statement in report writing.
Value set: SPACE, template.
The following parameters are used for customizing the texts in the heading of the output of the columns. The texts are taken from the Data Dictionary for fields with a Data Dictionary reference. If this is not desired, the text parameters can also be specified. The Data Dictionary texts are then ignored.
If the user changes the column width interactively, the column header text with the appropriate length is always used.
The interactive function 'Optimize column width' takes account of both the field contents and the column headers: if all field contents are shorter than the shortest column header, the column width depends on the column header.
The 'long field label' is also used in display variant definition,
Sort, etc. Popup.
seltext_l (long field label)
seltext_m (medium field label)
seltext_s (short field label)
reptext_ddic(header) Analogous to the Data element main header
Ddictxt (specify text) : You can specify with values 'L', 'M', and 'S', the keyword that should always be used as column header. If the column width changes, no attempt is made in this case to find an appropriate header for the new output width.
Value set: SPACE, 'L', 'M', and S.
Sample code:
Suppose I_PO_DETAILS is an internal table containing two fields EBELN (PO number) and EBELP (PO item no).
DATA: L_FIELDCAT TYPE SLIS_FIELDCAT_ALV. Local variable to hold the parameters
for a particular field of the field catalog
CLEAR L_FIELDCAT.
L_FIELDCAT-TABNAME = 'I_PO_DETAILS'.
L_FIELDCAT-FIELDNAME = 'EBELN'.
L_FIELDCAT-KEY = 'X'. The PO no is made the key field,
Colored and non scrollable
L_FIELDCAT-HOTSPOT = 'X'. The po no becomes a hotspot
L_FIELDCAT-SELTEXT_S = P.O No.
L_FIELDCAT-SELTEXT_M = 'P order No'.
L_FIELDCAT-SELTEXT_L = 'Purchase order No'.
APPEND L_FIELDCAT TO I_FIELDTAB.
CLEAR L_FIELDCAT
L_FIELDCAT-TABNAME = 'I_PO_DETAILS'.
L_FIELDCAT-FIELDNAME = 'EBELN'.
L_FIELDCAT-KEY = 'X'. The po item no is made the key field,
Colored and non scrollable
L_FIELDCAT-SELTEXT_S = 'Item No'.
L_FIELDCAT-SELTEXT_M = 'Item No`.
L_FIELDCAT-SELTEXT_L = 'PO Item No'.
APPEND L_FIELDCAT TO I_FIELDTAB.
CLEAR L_FIELDCAT
Thus the catalog for the report output is prepared.
Step 4
The next step is to build an event table, which are used for firing both user commands and the system dependent events i.e. top of page, end of page etc.
A list of possible events is populated into an event table (I_EVENTS) when this table is passed to the function module REUSE_ALV_EVENT_NAMES_GET. The return table from this function module contains all the possible events.
The function module contains following import and export parameters.
IMPORTING PARAMETERS: I_LIST_TYPE
This parameter has possible values from 0-4.
The parameter I_LIST_TYPE is of TYPE SLIS_LIST_TYPE and is DEFAULT 0 .
EXPORTING PARAMETERS: I_EVENTS table.
This table is of TYPE SLIS_T_EVENT and returns to the program the name of all the possible events.
The table structure contains the fields:
I_EVENTS-NAME: Name of the Callback event.
I_EVENTS-FORM: Name of the form routine that should be called in the calling program at the event.
Only events with a form routine name are processed.
The I_EVENTS table returns with the following possible constants:
1. Slis_ev_item_data_expand TYPE slis_formname VALUE 'ITEM_DATA_EXPAND'.
Only relevant for hierarchical-sequential lists using the layout parameter IS_LAYOUT-EXPAND_FIELDNAME of the structure IS_LAYOUT. Exit for passing item entries (ITEM table) for a header record that was expanded interactively by the user.
2. Slis_ev_reprep_sel_modify TYPE slis_formname VALUE 'REPREP_SEL_MODIFY'.
RS_SELFIELD-TABINDEX contains the header table index for which the item entries are to be put in the global item output table (T_OUTTAB_SLAVE). The Callback is only called if ALV has no items for a header that is to be expanded.
RFLG_ALL is passed with 'X' if the user shows all items. The application must ensure that entries are not repeated in the item table.
RS_SELFIELD is initial in this case.
3. Slis_ev_caller_exit_at_start TYPE slis_formname VALUE 'CALLER_EXIT'.
Is called at the beginning of the function module to make special settings. It is not usually used.
4. Slis_ev_user_command TYPE slis_formname VALUE 'USER_COMMAND'.
As this is a frequently-used Callback event, the form routine can also be passed directly in the interface by passing the user command in the IMPORTING parameter I_CALLBACK_USER_COMMAND.
5. Slis_ev_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
Equivalent to the list processing TOP-OF-PAGE event.
6. Slis_ev_top_of_coverpage TYPE slis_formname VALUE 'TOP_OF_COVERPAGE'.
The selection information and list status are output together (if they exist) on a separate page by default
7. Slis_ev_end_of_coverpage TYPE slis_formname VALUE 'END_OF_COVERPAGE'.
Analogously to TOP_OF_COVERPAGE the user can add other information
to the information output by ALV (selection information, list status) at this event.
8. Slis_ev_foreign_top_of_page TYPE slis_formname VALUE FOREIGN_TOP_OF_PAGE'.
The Top-of-page event is always processed in ALV and is only passed to the caller via the Callback mechanism. This is still the case if the caller, e.g. by a user action, processes a branch list which was not formatted by ALV (e.g. a popup with additional information about the list record selected and displayed by ALV).
In this case, top-of-page cannot be formatted by ALV analogously to the basic list, it must be handled completely by the caller. The event top-of-page still occurs in ALV. When ALV notices a top-of-page which was not caused by an ALV output, the form routine in FOREIGN_TOP_OF_PAGE is called.
9. Slis_ev_foreign_end_of_page TYPE slis_formname VALUE 'FOREIGN_END_OF_PAGE'.
The event end-of-page is always processed in ALV and only passed to the caller via callback. This is still the case, e.g. when the caller processes a details list which was not formatted by ALV (e.g. a popup with further information about selected list records which were displayed by ALV).
In this case, end-of-page cannot be formatted by ALV analogously to the basic list, it must be handled completely by the caller. The event end-of-page still occurs in ALV. When ALV notices an end-of-page that was not caused by an ALV output, the form routine in FOREIGN_END_OF_PAGE is called.
10. Slis_ev_pf_status_set TYPE slis_formname VALUE 'PF_STATUS_SET'.
If a user list status is to be set, it must be done in the form routine assigned to this event. The ALV function codes, which must not be active, are in the Parameter RT_EXTAB. This table must be passed with the SET PF-STATUS command (with inactive user function codes as well, if necessary).
The STANDARD status of the function group SALV should be used as a template for a user-specific status. As this is a frequently used Callback event, its form routine can also be passed directly in the interface in the IMPORTING parameter I_CALLBACK_PF_STATUS_SET.
11. Slis_ev_list_modify TYPE slis_formname VALUE 'LIST_MODIFY'.
LIST_MODIFY USING R_TABNAME TYPE SLIS_TABNAME
R_INDEX LIKE SY-TABIX
R_INDEX_ITEM LIKE SY-TABIX
R_INDEX_SUM LIKE SY-TABIX.
12. Slis_ev_top_of_list TYPE slis_formname VALUE 'TOP_OF_LIST'.
Information output at the start of the list
13. Slis_ev_end_of_page TYPE slis_formname VALUE 'END_OF_PAGE'.
Information output at the end of a page. This is only called for printing.
14. Slis_ev_end_of_list TYPE slis_formname VALUE 'END_OF_LIST'.
Information output at the end of the list
15. Slis_ev_after_line_output TYPE slis_formname VALUE 'AFTER_LINE_OUTPUT'.
Output information after each output line. Should only be used in justified cases because it costs a lot of performance.
16. Slis_ev_before_line_output TYPE slis_formname VALUE 'BEFORE_LINE_OUTPUT'.
Output information before each output line. Should only be used in justified cases because it costs a lot of performance.
17. Slis_ev_subtotal_text TYPE slis_formname VALUE 'SUBTOTAL_TEXT'.
This event table (I_EVENTS) is now checked with the desired constants. If the desired constant is found, then the corresponding field for the FORM NAME is populated with the name of the routine containing the corresponding event.
Sample code :
FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE', FORMNAME_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.
DATA: L_I_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = I_EVENTS.
READ TABLE I_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO L_I_EVENT.
IF SY-SUBRC = 0.
MOVE FORMNAME_TOP_OF_PAGE TO L_I_EVENT-FORM.
APPEND L_I_EVENT TO I_EVENTS.
ENDIF.
READ TABLE I_EVENTS WITH KEY NAME = SLIS_EV_END_OF_PAGE
INTO L_I_EVENT.
IF SY-SUBRC = 0.
MOVE FORMNAME_END_OF_PAGE TO L_I_EVENT-FORM.
APPEND L_I_EVENT TO I_EVENTS.
ENDIF.
CLEAR L_I_EVENT.
READ TABLE I_EVENTS WITH KEY NAME = SLIS_EV_USER_COMMAND
INTO L_I_EVENT.
IF SY-SUBRC = 0.
MOVE FORMNAME_USER_COMMAND TO L_I_EVENT-FORM.
APPEND L_I_EVENT TO I_EVENTS.
ENDIF.
This will prepare the events table for the report.
The report will contain three forms for the above events:
1. FORM TOP_OF_PAGE : This form will contain the top of page event for the report i.e header etc
Using the function module REUSE_ALV_COMMENTARY_WRITE, the internal table containing the headings for top of page event can be passed to the list output. Also, any logo specific to the report can be passed to the function module.
2. FORM END_OF_PAGE : This form will contain the end of page event for the report i.e footer etc
3. FORM USER_COMMAND : This form will contain the desired user command i.e pick/line selection
Step 5
A layout is build for the report output list description USING the internal table declared above (I_LAYOUT).
Output list description structure.
The parameters are described under the following heads:
Display options
Exceptions
Totals
Interaction
Detail screen
Display variants (only for hierarchical-sequential lists)
Color
Other
The layout table is of type slis_layout_alv_spec and has the following fields:
Display options
1. Colwidth_optimize (1) TYPE c: This parameter optimizes the length of the different columns in the output. The width of the different col. now depends on the max. Length of the data in the column.
Value set: SPACE, 'X'
'X' = optimizes the column width so that all contents are displayed completely.
2. No_colhead(1) TYPE c : This parameter suppresses the column headings
Value set: SPACE, 'X'.
'X' = column headers are not output
3. No_hotspot(1) TYPE c : The heading of the report output are not output as hotspot.
Value set: SPACE, 'X'.
'X' = column headers are not output as hotspot
4. Zebra(1) TYPE c : The report is output in the striped pattern.
Value set: SPACE, 'X'.
'X' = striped pattern (e.g. for wide lists)
5. No_vline(1) TYPE c : The report output contains columns only separated by space and no lines. It is not relevant for: hierarchical-sequential lists and multiple-line lists.
Value set: SPACE, 'X'.
'X' = columns separated by SPACE
6. No_min_linesize(1) TYPE c : The report line size is equal to the width of the list. It is not relevant for block lists.
Value set: SPACE, 'X.
'X' = line size depends on list width
' ' = Line size is set to 80 or MIN_LINESIZE (if > 0) .
7. Min_linesize LIKE sy-linsz: The report output contains a minimum possible length of line. If initial min_linesize is set to 80 by default, then this parameter is used to customize it. The prerequisite for this is that the parameter no_min_linesize should be ' '.
Value set: 0, 10 - 250
If the list is wider, the format uses the list width (maximum 250 or MAX_LINESIZE (if > 0)).
8. Max_linesize LIKE sy-linsz: The default max. Linesize is 250. To change this default value, this parameter can interactively-define the maximum list width setting.
Value set: 0, 80 - 1020
9. Window_titlebar LIKE rsmpe-tittext: To set the titlebar on the report output.
10. No_uline_hs(1) TYPE c.
Exceptions
11. Lights_fieldname TYPE slis_fieldname: Internal output table field containing the codes of exceptions to be output.
Output table field code: '1' = red traffic light
'2' = yellow traffic light
'3' = green traffic light Fieldname for exception
Value set: SPACE, internal output table field name.
12. Lights_tabname TYPE slis_tabname: Name of the internal output table that contains the field in the parameter LIGHTS_FIELDNAME. If LIGHTS_FIELDNAME is not empty, this field must also be filled for hierarchical-sequential lists. Only relevant for hierarchical-sequential lists.
. Value set: SPACE, internal output table name.
13. Lights_rollname LIKE dfies-rollname: The documentation of this data element is displayed when you call F1 help for an exception column.
Value set: SPACE, data element name.
14. Lights_condense(1) TYPE c : If a list record is output with 'red traffic light', each
Subtotal that includes this record is also output with 'red traffic light'.
Value set: SPACE, 'X'
'X' = the 'maximum' exception of the items in the subtotal is output at subtotal level.
Sums
15. No_sumchoice(1) TYPE c : This parameter allows the choice for summing up
Only by fieldcatalog.
Value set: SPACE, 'X'
'X' = fields which are to be summed, passed by the calling program (FIELDCAT-DO_SUM = 'X'). The user should not be able to change this value interactively.
16. No_totalline(1) TYPE c : Removes the option of having totals after sub-totals.
Value set: SPACE, 'X'
'X' = no total record is to be output. Subtotals can still be calculated and output. The fields in the subtotals are flagged DO_SUM = 'X' in the field list.
17. No_subchoice(1) TYPE c : Does not allow the user to interactively change the field chosen for subtotals.
Value set: SPACE, 'X'
'X' = value whose change triggers subtotals, provided by the calling program. The user should not be able to change this value interactively.
18. No_subtotals(1) TYPE c : No subtotals possible
Value set: SPACE, 'X'
'X' = no subtotals.
19. Numc_sum(1) TYPE c : Totals only possible for NUMC-Fields.
20. No_unit_splitting TYPE c: No separate total lines by inh.units
21.totals_before_items TYPE c: Display totals before the items
22. Totals_only(1) TYPE c : Show only totals
Value set: SPACE, 'X'
'X' = only total records are output.
23. Totals_text(60) TYPE c : Text for 1st col. in totals
Value set: SPACE, string (max.60)
' ' = The first column in the total record contains an appropriate number of '*'s to indicate the total by default. If the first column is wide enough, the string 'Total' is output after the asterisks.
'String = The string passed is output after the total indicated by '*', if the column is wide enough.
24. Subtotals_text(60) TYPE c : Texts for subtotals
Value set: SPACE, string (max.60)
' ' = In the first column of subtotal records, the subtotal is indicated by an appropriate number of '*' by default. If the first column is not a subtotal criterion, the string 'Total' is output after the asterisks, if the column is wide enough.
'String = the string passed is output after the subtotal indicated by '*', if the column is wide enough and the first column is not a subtotal criterion. If it is a subtotal criterion, its value is repeated after the total, if the column is wide enough.
Interaction
25. Box_fieldname TYPE slis_fieldname: Fieldname for checkbox in the report output. If the list has checkboxes at the start of records (for selecting several records), this parameter contains the internal output table field name indicated by the checkbox selection column. The field is a checkbox at the start of list records without a list header.
Value set: SPACE, internal output table field name
26. Box_tabname TYPE slis_tabname: Name of the internal output table that contains the field in the parameter BOX_FIELDNAME. If BOX_FIELDNAME is not empty, this field must also be filled for hierarchical-sequential lists.
Value set: SPACE, internal output table name.
27. Box_rollname LIKE dd03p-rollname: rollname for checkbox
28. Expand_fieldname TYPE slis_fieldname: fieldname flag expand. The user can show or hide the items by clicking on the folder symbol (hotspot). If the items for a header entry are only to be read by the calling program and passed to ALV when a header has been expanded interactively, this can be controlled via the CALLBACK event 'ITEM_DATA_EXPAND'.
29. Hotspot_fieldname TYPE slis_fieldname: Used to make the fieldname flag hotspot.
30. No_input(1) TYPE c : The fields are only display fields.
Value set: SPACE, 'X'
'X' = all ready-for-input fields in a list are displayed as not ready-for-input. (Record selection checkboxes and fields which can be made ready-for-input via the field list parameter FIELDCAT-INPUT = 'X')
31. F2code LIKE sy-ucomm: To assign an ALV standard function code to double-click (F2), assign the function code to this parameter. Ex.: to assign the ALV standard function 'Detail' ('&ETA') to F2.
=> LAYOUT-F2CODE = '&ETA'.
Value set: SPACE, function code
32. Confirmation_prompt: confirm. Prompt when leaving
Value set: SPACE, 'X'
'X' = if one of the functions Back (F03)', Exit (F15)' or Cancel (F12)' occurs, a confirmation prompt appears.
33. Key_hotspot(1) TYPE c : The key fields are displayed as hotspot. The columns defined in the field catalog as key fields (FIELDCAT-KEY = 'X') are output as hotspots, i.e. clicking on a key column (highlighted in color in the list) calls the function under F2.
Value set: SPACE, 'X'.
34. Reprep(1) TYPE c : report report interface active.
35. Group_buttons(1) TYPE c : group-buttons for COL1 - COL5 . Group output fields via FIELDCAT-SP_GROUP in the field list, and pass the group name to the list module in the interface parameter IT_SPECIAL_GROUPS.
Value set: SPACE, 'X'.
36. No_keyfix(1) TYPE c : Used to make the key fields scrollable.
Value set: SPACE, 'X'.
' ' = The key columns defined in the field catalog by FIELDCAT-KEY = 'X' are fixed in the list output. These columns do not scroll horizontally. The item table key columns are fixed in hierarchical-sequential lists. The header table key fields are not considered here.
'X' = key columns not fixed
37. Get_selinfos(1) TYPE c : To read selection screen.
Value set: SPACE, 'X'.
If the calling program is a report with an ABAP/4 selection screen, setting this parameter makes ALV read the selection screen again. If the selections are read successfully, a pushbutton, via which the user can call a popup which lists the report selections in a simple form, becomes active on the results list output by ALV.
38. group_change_edit(1) TYPE c : Settings by user for new group
Value set: SPACE, 'X'
'X' = the user can enter a format option for each sort criterion in the sort/subtotal popup, for the list format when this value changes (e.g. new page or underline).
39. No_scrolling(1) TYPE c : Does not allow scrolling of the list to the right.
Value set: SPACE, 'X'.
40. Expand_all(1) TYPE c : Expand all positions
Detailed screen
40. Detail_popup(1) TYPE c : show detail in popup.
Value set: SPACE, 'X'
' ' = List record detail display in full-screen mode, with top-of-page.
'X' = list record detail display in popup (without top-of-page).
41. Detail_initial_lines(1) TYPE c : show also initial lines
Value set: SPACE, 'X'
' ' = Only fields whose contents are not initial are output in the detail view.
'X' = initial field contents are also output in detail.
41. detail_titlebar(30) type c : Titlebar for detail screen
Value set: SPACE, string (max.30)
` ' = ' Detail: Display' is output as the title of the detail window.
'String = the string passed is output as the title of the detail window.
Display variants
42. Header_text (20) TYPE c: Text for header button. Only relevant for hierarchical-sequential lists. You can toggle between display field and field list views via pushbuttons in the display variant definition popup for hierarchical-sequential lists. The views refer to the hierarchy level of the fields. This is technically a toggle between the header table and item table fields.
Value set: SPACE, CHAR (20)
' ' = The header table field pushbutton text is 'Header' by default.
CHAR (20) = header table field pushbutton text.
43.item_text(20) TYPE c : Text for item button. Only relevant for hierarchical-sequential lists. You can toggle the view between the display fields and the field list via pushbuttons in the display variant definition popup for hierarchical-sequential lists. The views refer to the hierarchy level of the fields. This is technically a toggle between the header table and item table fields.
Value set: SPACE, CHAR (20)
' ' = The pushbutton text for the item table fields is 'Item' by default.
CHAR (20) = item table field pushbutton text.
44.default_ item(1) TYPE c : Items as default. Only relevant for hierarchical-sequential lists.
Value set: SPACE, 'X'
' ' = The header table fields are displayed by default in the display variant definition popup. The user can switch to the item table fields interactively.
'X' = the item table fields are displayed by default in the display variant Definition Popup. The user can switch to the header table fields interactively.
Colour
45. Info_fieldname TYPE slis_fieldname: infofield for listoutput. A whole list record can be colored individually using a color code in a column of the internal output table for the record. Assign the name of the field containing the color code to this parameter.
Value set: SPACE, internal output table field name
The internal output table field must be of type CHAR(3).
The code must have the following syntax: 'Cxy':
C = color (all codes must start with 'C')
X = color number ('1'-'9')
Y = bold ('0' = off, '1' = on)
46. Coltab_fieldname TYPE slis_fieldname: Cells can be colored individually using a color code which is contained in a column of the internal output table for the record containing the cell. Assign the name of the field to this parameter.
Others
47. List_append(1) TYPE c : no call screen. It is only useful to output block-lists without specifying the above modules if the number of list blocks exceeds, or may exceed, the maximum number specified in the block module documentation. These operations are not possible for user-defined block lists.
Example code :
I_LAYOUT-f2code = ws_fcode.
I_LAYOUT-zebra = 'X'.
I_LAYOUT-colwidth_optimize = 'X'.
I_LAYOUT-no_keyfix = 'X'.
I_LAYOUT-get_selinfos = 'X'.
I_LAYOUT-no_hotspot = 'X'.
I_LAYOUT-no_input = 'X'.
I_LAYOUT-hotspot_fieldname = FIELDNAME.
I_LAYOUT-no_input = X.
I_LAYOUT-no_vline = `X.
I_LAYOUT-no_colhead = .
I_LAYOUT-lights_condense = ` `.
I_LAYOUT-totals_text = ` `.
I_LAYOUT-subtotals_text = ` `.
I_LAYOUT-totals_only = ` `.
I_LAYOUT-key_hotspot = X.
I_LAYOUT-detail_popup = X.
I_LAYOUT-group_change_edit = X.
I_LAYOUT-GROUP_BUTTONS = X.
Step 6
This step is required to get the selection screen information in the report output.
The prerequisite for this is to set the parameter LAYOUT-GET_SELINFOS of the IMPORTING structure.
The parameters to be passed in the IS_SEL_HIDE table are:
o mode: 'R' = only the entries passed in the internal table IS_SEL_HIDE-T_ENTRIES
Are output in the pop up. Selection info, which the list tool read in the selection screen (when called by a report with a selection screen), is replaced by the values passed.
'S' = the selection info which the list tool read in the selection screen of the calling report are modified by the entries in the table IS_SEL_HIDE-T_ENTRIES.
o t_entries: Selection info table
o t_entries-mode: 'A' = output the selection info for the current table record in the info popup.
'D' = do not output select option or SELNAME parameter selection info in the popup.
o t_entries-selname: (only used in t_entries-mode = 'D') : Name of the select option or parameter.
The following table fields are only used in t_entries-mode = 'A'. They contain the selection information to be added.
t_entries-field: DDIC field name of the field for which selection information is to be output.
t_entries-table: DDIC table names of t_entries-field.
t_entries-stext: Field name in info popup.
If t_entries-field and t_entries-table have been entered, this text is taken from DDIC.
t_entries-valuf: Selection condition 'from' value (external format)
t_entries-valut: Selection condition 'to' value (external format)
t_entries-sign0: (I)nclusive (E)xclusive
t_entries-option: All values of the select options Option field allowed.
Step 6
The Table IT_SORT is populated with the sort criteria for the different fields.
The caller specifies the sorting and/or subtotaling of the basic list in the internal table IT_SORT.
This internal table has the following fields:
o spos : Sort sequence
o fieldname : Internal output table field name
o tabname : Only relevant for hierarchical-sequential lists. Name of the internal output table.
o up : 'X' = sort in ascending order
o down : 'X' = sort in descending order
o subtot : 'X' = subtotal at group value change
o group : '* ' = new page at group value change ,'UL' = underline at group value change
Step 7
The final step in the output of the report is the use of two ALV functions modules.
1. REUSE_ALV_FIELDCATALOG_MERGE
2. REUSE_ALV_LIST_DISPLAY
The first function module is used to pass the field catalog to the report output and merge it with the internal output table.
FUNCTION reuse_alv_fieldcatalog_merge.
""Lokale Schnittstelle:
* IMPORTING
*" VALUE(I_PROGRAM_NAME) LIKE SY-REPID OPTIONAL
*" VALUE(I_INTERNAL_TABNAME) TYPE SLIS_TABNAME OPTIONAL
*" VALUE(I_STRUCTURE_NAME) LIKE DD02L-TABNAME OPTIONAL
*" VALUE(I_CLIENT_NEVER_DISPLAY) TYPE SLIS_CHAR_1
*" DEFAULT 'X'
*" VALUE(I_INCLNAME) LIKE TRDIR-NAME OPTIONAL
*" CHANGING
*" VALUE(CT_FIELDCAT) TYPE SLIS_T_FIELDCAT_ALV
*" EXCEPTIONS
*" INCONSISTENT_INTERFACE
*" PROGRAM_ERROR
Import parameters
I_PROGRAM_NAME: Program in which the internal output table is declared and populated
I_INTERNAL_TABNAME: Internal output table name
I_STRUCTURE_NAME: Structure name (structure, table, and view)
I_CLIENT_NEVER_DISPL: Hide client fields default X
I_INCLNAME: Data declarations include name
CHANGING parameter
CT_FIELDCAT: Field catalog with field descriptions
The variant based on a program-internal table should only be used for rapid prototyping since the following restrictions apply:
1. Performance is affected since the code of the table definition must always be read and interpreted at runtime.
2. Dictionary reference are only considered if the keywords LIKE or INCLUDE STRUCTURE (not TYPE) are used.
Step 8
The other function module is used to display the internal output table with the contents
FUNCTION reuse_alv_list_display.
""Lokale Schnittstelle:
* IMPORTING
*" VALUE(I_INTERFACE_CHECK) DEFAULT SPACE
*" VALUE(I_CALLBACK_PROGRAM) LIKE SY-REPID DEFAULT SPACE
*" VALUE(I_CALLBACK_PF_STATUS_SET) TYPE SLIS_FORMNAME
*" DEFAULT SPACE
*" VALUE(I_CALLBACK_USER_COMMAND) TYPE SLIS_FORMNAME
*" DEFAULT SPACE
*" VALUE(I_STRUCTURE_NAME) LIKE DD02L-TABNAME OPTIONAL
*" VALUE(IS_LAYOUT) TYPE SLIS_LAYOUT_ALV OPTIONAL
*" VALUE(IT_FIELDCAT) TYPE SLIS_T_FIELDCAT_ALV OPTIONAL
*" VALUE(IT_EXCLUDING) TYPE SLIS_T_EXTAB OPTIONAL
*" VALUE(IT_SPECIAL_GROUPS) TYPE SLIS_T_SP_GROUP_ALV
*" OPTIONAL
*" VALUE(IT_SORT) TYPE SLIS_T_SORTINFO_ALV OPTIONAL
*" VALUE(IT_FILTER) TYPE SLIS_T_FILTER_ALV OPTIONAL
*" VALUE(IS_SEL_HIDE) TYPE SLIS_SEL_HIDE_ALV OPTIONAL
*" VALUE(I_DEFAULT) DEFAULT 'X'
" VALUE(I_SAVE) DEFAULT SPACE
" VALUE(IS_VARIANT) LIKE DISVARIANT
" STRUCTURE DISVARIANT DEFAULT SPACE
" VALUE(IT_EVENTS) TYPE SLIS_T_EVENT OPTIONAL
" VALUE(IT_EVENT_EXIT) TYPE SLIS_T_EVENT_EXIT OPTIONAL
" VALUE(IS_PRINT) TYPE SLIS_PRINT_ALV OPTIONAL
" VALUE(IS_REPREP_ID) TYPE SLIS_REPREP_ID OPTIONAL
" VALUE(I_SCREEN_START_COLUMN) DEFAULT 0
" VALUE(I_SCREEN_START_LINE) DEFAULT 0
" VALUE(I_SCREEN_END_COLUMN) DEFAULT 0
" VALUE(I_SCREEN_END_LINE) DEFAULT 0
" EXPORTING
" VALUE(E_EXIT_CAUSED_BY_CALLER)
" VALUE(ES_EXIT_CAUSED_BY_USER) TYPE SLIS_EXIT_BY_USER
" TABLES
" T_OUTTAB
" EXCEPTIONS
" PROGRAM_ERROR
Import parameters
I_INTERFACE_CHECK: Interface consistency check log output.
I_CALLBACK_PROGRAM: Name of the calling program
I_CALLBACK_PF_STATUS_SET: Set EXIT routine to status.
I_CALLBACK_USER_COMMAND: EXIT routine for command handling
I_STRUCTURE_NAME: Internal output table structure name
IS_LAYOUT: List layout specifications
IT_FIELDCAT: Field catalog with field descriptions
IT_EXCLUDING: Table of inactive function codes
IT_SPECIAL_GROUPS: Grouping fields for column selection
IT_SORT: Sort criteria for first list display
IT_FILTER: Filter criteria for first list output
IS_SEL_HIDE : Selection information modification
I_DEFAULT: Initial variant active/inactive logic
I_SAVE: Variants can be saved
IS_VARIANT : Variant information
IT_EVENTS: Table of events to perform IT_EVENT_EXIT : Standard fcode exit requests table
IS_PRINT: Print information
IS_REPREP_ID: Initialization keys for Re/Re interface
I_SCREEN_START_COLUMN: Coordinates for list in dialog box
I_SCREEN_START_LINE: Coordinates for list in dialog box
I_SCREEN_END_COLUMN: Coordinates for list in dialog box
I_SCREEN_END_LINE: Coordinates f -
Hi!
In Block AlV we r using Fun Mod
REUSE_ALV_BLOCK_LIST_APPEND
To display data in blocks and called again to display other data in block in same screen.
I want to know REUSE_ALV_BLOCK_LIST_DISPLAY Fun mod is optional or mandatory
without using this also shall i get the required o/p.
Looking for your reply.
Rahul.REUSE_ALV_BLOCK_LIST_DISPLAY is mandatory, without calling this FM, you will not get any disply.
In the below ALV if you comment out t REUSE_ALV_BLOCK_LIST_DISPLAY FM call call you will not get disply.
REPORT ztest1 .
TABLES: ekko, mara.
TYPE-POOLS: slis.
*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.
TYPES: BEGIN OF t_mara,
matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
matkl TYPE mara-matkl,
END OF t_mara.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
it_mara TYPE STANDARD TABLE OF t_mara INITIAL SIZE 0.
*ALV data declarations
DATA: fieldcatalog1 TYPE slis_t_fieldcat_alv WITH HEADER LINE,
fieldcatalog2 TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_layout TYPE slis_layout_alv,
gt_events_ekko TYPE slis_t_event,
xs_event TYPE slis_alv_event,
gt_events_mara TYPE slis_t_event,
gd_repid TYPE sy-repid,
gt_print TYPE slis_print_alv.
* START-OF-SELECTION
START-OF-SELECTION.
PERFORM data_retrival.
PERFORM build_fieldcat.
PERFORM build_layout.
PERFORM events_ekko.
PERFORM events_mara.
PERFORM display_alv_report.
*SUBROUTINES
*& Form data_retrival
FORM data_retrival .
SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekko.
SELECT matnr mtart matkl
UP TO 10 ROWS
FROM mara
INTO TABLE it_mara.
ENDFORM. " data_retrival
*& Form build_fieldcat
FORM build_fieldcat .
* FOR EKKO
fieldcatalog1-fieldname = 'EBELN'.
fieldcatalog1-seltext_m = 'Purchase Order'.
fieldcatalog1-col_pos = 0.
fieldcatalog1-outputlen = 10.
fieldcatalog1-emphasize = 'X'.
fieldcatalog1-key = 'X'.
APPEND fieldcatalog1 TO fieldcatalog1.
CLEAR fieldcatalog1.
fieldcatalog1-fieldname = 'EBELP'.
fieldcatalog1-seltext_m = 'PO Item'.
fieldcatalog1-col_pos = 1.
APPEND fieldcatalog1 TO fieldcatalog1.
CLEAR fieldcatalog1.
fieldcatalog1-fieldname = 'STATU'.
fieldcatalog1-seltext_m = 'Status'.
fieldcatalog1-col_pos = 2.
APPEND fieldcatalog1 TO fieldcatalog1.
CLEAR fieldcatalog1.
fieldcatalog1-fieldname = 'AEDAT'.
fieldcatalog1-seltext_m = 'Item change date'.
fieldcatalog1-col_pos = 3.
APPEND fieldcatalog1 TO fieldcatalog1.
CLEAR fieldcatalog1.
fieldcatalog1-fieldname = 'MATNR'.
fieldcatalog1-seltext_m = 'Material Number'.
fieldcatalog1-col_pos = 4.
APPEND fieldcatalog1 TO fieldcatalog1.
CLEAR fieldcatalog1.
fieldcatalog1-fieldname = 'MENGE'.
fieldcatalog1-seltext_m = 'PO quantity'.
fieldcatalog1-col_pos = 5.
APPEND fieldcatalog1 TO fieldcatalog1.
CLEAR fieldcatalog1.
fieldcatalog1-fieldname = 'MEINS'.
fieldcatalog1-seltext_m = 'Order Unit'.
fieldcatalog1-col_pos = 6.
APPEND fieldcatalog1 TO fieldcatalog1.
CLEAR fieldcatalog1.
fieldcatalog1-fieldname = 'NETPR'.
fieldcatalog1-seltext_m = 'Net Price'.
fieldcatalog1-col_pos = 7.
fieldcatalog1-outputlen = 15.
fieldcatalog1-do_sum = 'X'. "Display column total
fieldcatalog1-datatype = 'CURR'.
APPEND fieldcatalog1 TO fieldcatalog1.
CLEAR fieldcatalog1.
fieldcatalog1-fieldname = 'PEINH'.
fieldcatalog1-seltext_m = 'Price Unit'.
fieldcatalog1-col_pos = 8.
APPEND fieldcatalog1 TO fieldcatalog1.
CLEAR fieldcatalog1.
* FOR MARA
fieldcatalog2-fieldname = 'MATNR'.
fieldcatalog2-seltext_m = 'Material No'.
fieldcatalog2-col_pos = 0.
fieldcatalog2-outputlen = 10.
fieldcatalog2-emphasize = 'X'.
fieldcatalog2-key = 'X'.
APPEND fieldcatalog2 TO fieldcatalog2.
CLEAR fieldcatalog1.
fieldcatalog2-fieldname = 'MTART'.
fieldcatalog2-seltext_m = 'Material type'.
fieldcatalog2-col_pos = 1.
APPEND fieldcatalog2 TO fieldcatalog2.
CLEAR fieldcatalog2.
fieldcatalog2-fieldname = 'MATKL'.
fieldcatalog2-seltext_m = 'Material Group'.
fieldcatalog2-col_pos = 2.
APPEND fieldcatalog2 TO fieldcatalog2.
CLEAR fieldcatalog2.
ENDFORM. " build_fieldcat
*& Form build_layout
FORM build_layout .
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
ENDFORM. " build_layout
*& Form events_ekko
FORM events_ekko .
CLEAR xs_event.
xs_event-name = slis_ev_top_of_page.
xs_event-form = 'TOP_OF_PAGE-EKKO'.
APPEND xs_event TO gt_events_ekko.
CLEAR xs_event.
xs_event-name = slis_ev_end_of_list.
xs_event-form = 'END_OF_LIST_EKKO'.
APPEND xs_event TO gt_events_ekko.
ENDFORM. " events_ekko
*& Form TOP_OF_PAGE-EKKO
FORM top_of_page-ekko.
WRITE: / 'TOP OF PAGE : Purchase Order'.
ENDFORM. "XTOP_OF_PAGE
*& Form END_OF_LIST_EKKO
FORM end_of_list_ekko.
WRITE: / 'end OF list : Purchase Order'.
ENDFORM. "END_OF_LIST_EKKO
*& Form events_mara
FORM events_mara .
CLEAR xs_event.
xs_event-name = slis_ev_top_of_list.
xs_event-form = 'TOP_OF_LIST-MARA'.
APPEND xs_event TO gt_events_mara.
CLEAR xs_event.
xs_event-name = slis_ev_end_of_page.
xs_event-form = 'END_OF_PAGE_MARA'.
APPEND xs_event TO gt_events_mara.
ENDFORM. "events_mara
*& Form TOP_OF_LIST-MARA
FORM top_of_list-mara.
WRITE: / 'TOP OF LIST : Material Master'.
ENDFORM. "TOP_OF_LIST-MARA
*& Form END_OF_PAGE_MARA
FORM end_of_page_mara.
WRITE: / 'End OF Page : Material Master'.
ENDFORM. "END_OF_PAGE_MARA
*& Form display_alv_report
FORM display_alv_report .
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = sy-repid.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = gd_layout
it_fieldcat = fieldcatalog1[]
i_tabname = 'it_ekko'
it_events = gt_events_ekko
TABLES
t_outtab = it_ekko
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = gd_layout
it_fieldcat = fieldcatalog2[]
i_tabname = 'it_mara'
it_events = gt_events_mara
TABLES
t_outtab = it_mara
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
gt_print-reserve_lines = 2.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
is_print = gt_print.
ENDFORM. " display_alv_report -
How to print header lines at the top of every page with Alv list display?
Dear all,
I need a requirement with printing issue. A program list should be printed with the function reuse_alv_list_display.
The list has several pages and then can be printed but the header lines appear only first page when they printed. The other pages don't have header lines, they continue with the next record of the list remaining from previous page. I use the alv parameters as below:
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = l_repid
i_callback_pf_status_set = 'ALV_PF_STATUS'
is_layout = ls_layo
it_fieldcat = lt_fcat
i_default = 'X'
i_save = 'A'
is_variant = ls_variant
it_events = lt_events
TABLES
t_outtab = lt_data
EXCEPTIONS
program_error = 1
OTHERS = 2.
and lt_events as below:
ls_event-name = 'END_OF_LIST'.
ls_event-form = 'ALV_END_OF_LIST'.
APPEND ls_event TO lt_events.
ls_event-name = 'END_OF_PAGE'.
ls_event-form = 'ALV_END_OF_PAGE'.
APPEND ls_event TO lt_events.
ls_event-name = 'TOP_OF_LIST'.
ls_event-form = 'ALV_TOP_OF_LIST'.
APPEND ls_event TO lt_events.
ls_event-name = 'TOP_OF_PAGE'.
ls_event-form = 'ALV_TOP_OF_PAGE'.
APPEND ls_event TO lt_events.
So, how can I print header lines for every page?
Best Regards,Hello Saba,
Your point might be very close to solution.
Because in the selection screen of the program there are two radio buttons, one of them visits 'REUSE_ALV_COMMENTARY_WRITE' function and the other doesn't. The one which visits has a problem with header liens in every page when printing. But I couldn't find out the solution yet.
reuse_alv_list_display uses 4 event and of course I call subroutine. There are end_of_list, end_of_page, top_of_list and top_of_page. I use in the subroutine for top_of_page:
CALL FUNCTION 'LVC_TRANSFER_TO_SLIS'
EXPORTING
it_fieldcat_lvc = gt_fcat
IMPORTING
et_fieldcat_alv = lt_fcat
EXCEPTIONS
it_data_missing = 1
it_fieldcat_lvc_missing = 2
OTHERS = 3.
CALL FUNCTION 'REUSE_ALV_LIST_WIDTH_GET'
EXPORTING
it_fieldcat = lt_fcat
IMPORTING
e_width = l_width.
WRITE l_reptx TO l_reptx CENTERED.
NEW-LINE.
WRITE: AT (l_width) l_reptx CENTERED.
SUBTRACT 10 FROM l_width.
WRITE: AT l_width sy-pagno RIGHT-JUSTIFIED.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = lt_header
I_LOGO =
I_END_OF_LIST_GRID =
Do you have other suggestions ? -
How to declare top of page in alv report
hi guru
how to declare top of page in alv report
thanks
subhasisHi,
check this simple program.
REPORT ZBHALV_LIST.
TABLES:MARA.
SELECT-OPTIONS: MATNR FOR MARA-MATNR.
DATA:BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR,
ERSDA LIKE MARA-ERSDA,
MTART LIKE MARA-MTART,
MBRSH LIKE MARA-MBRSH,
END OF ITAB.
SELECT * FROM MARA INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE MATNR
IN MATNR.
TYPE-POOLS SLIS.
DATA:FCAT TYPE slis_t_fieldcat_alv.
DATA:LAYOUT TYPE slis_layout_alv.
DATA:EVE TYPE slis_t_event WITH HEADER LINE.
DATA:HEAD TYPE slis_t_listheader WITH HEADER LINE.
DATA:SORT TYPE slis_t_sortinfo_alv WITH HEADER LINE.
SORT-UP = 'X'.
SORT-SPOS = 1.
SORT-FIELDNAME = 'ERSDA'.
SORT-tabname = 'MARA'.
APPEND SORT.
SORT-SPOS = 2.
SORT-FIELDNAME = 'MTART'.
SORT-tabname = 'MARA'.
APPEND SORT.
EVE-NAME = 'TOP_OF_PAGE'.
EVE-FORM = 'TOPOFPAGE'.
APPEND EVE.
EVE-NAME = 'TOP_OF_LIST'.
EVE-FORM = 'TOPOFLIST'.
APPEND EVE.
EVE-NAME = 'END_OF_LIST'.
EVE-FORM = 'ENDOFLIST'.
APPEND EVE.
LAYOUT-ZEBRA = 'X'.
LAYOUT-no_hline = 'X'.
LAYOUT-NO_VLINE = 'X'.
LAYOUT-window_titlebar = 'MATERIAL DETAILS'.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'ITAB'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = SY-REPID
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = FCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FCAT
IT_SORT = SORT[]
IT_EVENTS = 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 TOPOFPAGE.
REFRESH HEAD.
HEAD-TYP = 'H'.
HEAD-INFO = 'MATERIALS'.
APPEND HEAD.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = HEAD[]
I_LOGO =
I_END_OF_LIST_GRID =
ENDFORM.
FORM TOPOFLIST.
REFRESH HEAD.
HEAD-TYP = 'H'.
HEAD-INFO = 'MATERIALS-LISTTOP'.
APPEND HEAD.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = HEAD[]
I_LOGO =
I_END_OF_LIST_GRID =
ENDFORM.
FORM ENDOFLIST.
REFRESH HEAD.
HEAD-TYP = 'H'.
HEAD-INFO = 'MATERIALS-LISTEND'.
APPEND HEAD.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = HEAD[]
I_LOGO =
I_END_OF_LIST_GRID =
ENDFORM.
Regards,
Priyanka.
Maybe you are looking for
-
How can i post the fields in the screen by selecting a record
Hi, I have a problem in dialog programming. I need to populate the fields in the screen by selecting a single record. For example, Screen consists of 'CARRID, CONNID,FLDATE... fields. By pressing F4 in CARRID field it will display the c
-
How do I add or delete names in my address book
How do I add or delete names and email addresses in my address book?
-
MSI x99 Gaming 7 first install problem
Hi everybody, Could you help me about my next problem? Today I tried to install my X99 G7 MB with I7 5820k CPU. I followed the manual step by step but the MB dosent respond to power button. I can switch on only the OC button on MB and that is lightin
-
In which folder are songs automatically stored, by default, in the Nokia N82? When I transfer a song onto my Nokia N82 from another cellphone by Bluetooth, where does it get stored? In the phone memory or in the memory card? In which folder. Help ple
-
My mac book air turn on with grey apple icon and spining wheel. then it wont turn off.
my mac book air turn on with grey apple icon and spining wheel. then it wont turn off.pls help