Regarding ALV event
Hi
I have one double click event defination and one same event implementation. But two event handler one for top alv and one for bottom alv. Now from the event implementation I want to know which (top or bottom alv) alv is double clicked(top or bottom).
CONSTANTS: formname_user_command TYPE slis_formname VALUE 'user_command'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = formname_user_command
FORM formname_user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
CASE ucomm.
WHEN '&IC1'.
SELECT * FROM sflight
INTO CORRESPONDING FIELDS OF
TABLE it_sflight1
WHERE CARRID = selfield-value.
Similar Messages
-
Urgent: regarding ALV report display problem
hi,
There are 3 problems:-
1.) I had made a ALV report in which i have to display 'POSTING DATE' (iseg-budat) when we execute the report i.e. it should be displayed as PERIOD :- _______ to _______ on alv report ..
2.)the 2nd problem is dat when i use the ' wa_fieldcat-no_zero = 'X'. It eliminates all the leading zeros which are present which is okay when i it displays material no.. but the problem is dat it also deletes the other fields where the values are to be zeros.
i had used this FM:-
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = ITS1-MATNR
IMPORTING
OUTPUT = ITS1-MATNR.
so that only matnr field are to be 0's.
3.) I want to delete the rows which use to contain the values 0's as there are no calculations are performing as these are displayed .
ANYbody having solution of this problem ,plzzzz provide the soluion of it as it is most urgent to me and dat person will definately rewarded.
regards,
ric.shi kiran,
thanks for ur response. here is d code which i am using it and plzz help me to figure out where i have to make changes:-
REPORT ZTEST03.
TABLES: ISEG,MARA.
TYPE-POOLS : SLIS.
INTERNAL TABLE FOR INVENTORY STOCK *****************
DATA: BEGIN OF ITS1 OCCURS 0,
MATNR LIKE ISEG-MATNR,
MEINS LIKE ISEG-MEINS,
MENGE LIKE ISEG-MENGE,
WRTZL LIKE ISEG-WRTZL,
BUCHM LIKE ISEG-BUCHM,
WRTBM LIKE ISEG-WRTBM,
WERKS LIKE ISEG-WERKS,
BUDAT LIKE ISEG-BUDAT,
MTART LIKE MARA-MTART,
ITEMDESC LIKE MAKT-MAKTX,
DIFFQTY LIKE ISEG-BUCHM,
DIFFVALUE LIKE ISEG-WRTBM,
END OF ITS1.
data: t_heading type slis_t_listheader.
SELECTION-SCREEN BEGIN OF BLOCK PAR1 WITH FRAME TITLE TEXT-001.
*********PARAMETERS*********
PARAMETERS : PLANT LIKE ISEG-WERKS OBLIGATORY.
*********SELECTION SCREEN OPTIONS*********
SELECT-OPTIONS : R_DATE FOR ISEG-BUDAT,
M_TYPE FOR MARA-MTART,
IT_M FOR MARA-MATNR.
*********DEFINING VARIABLES*********
SELECTION-SCREEN END OF BLOCK par1.
TOP-OF-PAGE.
PERFORM PG_HEADER.
START-OF-SELECTION.
SELECT DISTINCT A~MATNR A~MEINS A~MENGE A~WRTZL A~BUCHM A~WRTBM A~WERKS A~BUDAT B~MTART
FROM ISEG AS A INNER JOIN MARA AS B ON B~MATNR = A~MATNR
INTO CORRESPONDING FIELDS OF TABLE ITS1 WHERE B~MATNR = A~MATNR AND B~MEINS = A~MEINS AND A~WERKS = PLANT AND A~BUDAT IN R_DATE AND B~MTART IN M_TYPE AND B~MATNR IN IT_M.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = ITS1-MATNR
IMPORTING
OUTPUT = ITS1-MATNR.
SORT ITS1 BY MATNR.
DELETE ADJACENT DUPLICATES FROM ITS1 WHERE MENGE = 0 AND BUCHM = 0.
LOOP AT ITS1.
ITS1-DIFFQTY = ITS1-MENGE - ITS1-BUCHM.
ITS1-DIFFVALUE = ITS1-WRTZL - ITS1-WRTBM.
SELECT SINGLE MAKTX FROM MAKT INTO ITS1-ITEMDESC WHERE MATNR = ITS1-MATNR.
MODIFY ITS1.
ENDLOOP.
PERFORM PRN_SMSTOCK_ALV.
WRITING DATA FROM D TABLES**********
FORM PG_HEADER.
WRITE : 'PHYSICAL INVENTORY AUDIT REPORT PLANT : ', PLANT.
ENDFORM.
*& Form PRN_SMSTOCK_ALV
text
--> p1 text
<-- p2 text
form PRN_SMSTOCK_ALV .
data: w_title type lvc_title,
w_repid type syrepid,
w_comm type slis_formname,
w_status type slis_formname,
x_layout type slis_layout_alv,
t_event type slis_t_event,
t_fieldcat type slis_t_fieldcat_alv,
t_sort type slis_t_sortinfo_alv.
refresh t_fieldcat.
refresh t_event.
refresh t_sort.
clear x_layout.
clear w_title.
perform set_fieldcat2 using:
1 'MTART' 'MTART' 'MARA' '15' space 'MATERIAL TYPE' space space space space space space space space SPACE t_fieldcat 'L' 'C',
2 'MATNR' 'MATNR' 'MARA' '13' space 'MATERIAL NO. ' space space space space space space space space SPACE t_fieldcat 'R' 'C',
3 'ITEMDESC' 'MAKTX' 'MAKT' '25' space 'MATERIAL DESCRIPTION' space space space space space space space space SPACE t_fieldcat 'L' 'C',
4 'MEINS' 'MEINS' 'MARA' '5' space 'UOM' space space space space space space space space SPACE t_fieldcat 'C' 'C',
5 'MENGE' 'MENGE' 'ISEG' '13' space 'ORG.INV.QTY' space space space space space space space space SPACE t_fieldcat 'R' 'C',
6 'WRTZL' 'WRTZL' 'ISEG' '13' space 'ORG.INV.VALUE' space space space space space space space space SPACE t_fieldcat 'R' 'C',
7 'BUCHM' 'BUCHM' 'ISEG' '13' space 'PHY.INV.QTY' space space space space space space space space SPACE t_fieldcat 'R' 'C',
8 'WRTBM' 'WRTBM' 'ISEG' '13' space 'PHY.INV.VALUE' space space space space space space space space SPACE t_fieldcat 'R' 'C',
9 'DIFFQTY' 'MENGE' 'ISEG' '13' space 'DIFF.INV.QTY' space space space space space space space space SPACE t_fieldcat 'R' 'C',
10 'DIFFVALUE' 'WRTZL' 'ISEG' '13' space 'DIFF.INV.VALUE' space space space space space space space space SPACE t_fieldcat SPACE 'P'.
x_layout-zebra = 'X'.
perform set_top_page_heading using t_heading t_event.
perform set_events using t_event.
w_status = ''.
w_repid = sy-repid.
w_comm = 'USER_COMMAND'.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = w_repid
it_fieldcat = t_fieldcat
i_Callback_top_of_page = 'Top-of-page'
is_layout = x_layout
it_sort = t_sort
i_callback_pf_status_set = w_status
i_callback_user_command = w_comm
i_save = 'X'
it_events = t_event
i_grid_title = w_title
tables
t_outtab = ITS1
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.
FORM set_fieldcat2 USING
p_colpos p_fieldname p_ref_fieldname p_ref_tabname
p_outputlen p_noout
p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt
p_hotspot p_showasicon p_checkbox p_edit
p_dosum
t_fieldcat TYPE slis_t_fieldcat_alv
P_JUST
P_FTYPE.
DATA: wa_fieldcat TYPE slis_fieldcat_alv.
CLEAR wa_fieldcat.
General settings
wa_fieldcat-fieldname = p_fieldname.
wa_fieldcat-no_zero = 'X'.
wa_fieldcat-col_pos = p_colpos.
wa_fieldcat-no_out = p_noout.
wa_fieldcat-hotspot = p_hotspot.
wa_fieldcat-checkbox = p_checkbox.
wa_fieldcat-icon = p_showasicon.
wa_fieldcat-do_sum = p_dosum.
Set output length.
IF NOT p_outputlen IS INITIAL.
wa_fieldcat-outputlen = p_outputlen.
ENDIF.
Set text headers.
IF NOT p_seltext_m IS INITIAL.
wa_fieldcat-seltext_m = p_seltext_m.
ENDIF.
IF NOT p_seltext_l IS INITIAL.
wa_fieldcat-seltext_l = p_seltext_l.
ENDIF.
IF NOT p_seltext_s IS INITIAL.
wa_fieldcat-seltext_s = p_seltext_s.
ENDIF.
IF NOT p_reptext_ddic IS INITIAL.
wa_fieldcat-reptext_ddic = p_reptext_ddic.
ENDIF.
IF NOT p_ddictxt IS INITIAL.
wa_fieldcat-ddictxt = p_ddictxt.
ENDIF.
IF NOT P_JUST IS INITIAL.
WA_FIELDCAT-JUST = P_JUST.
ENDIF.
Set as editable or not.
IF NOT p_edit IS INITIAL.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
ENDIF.
APPEND wa_fieldcat TO t_fieldcat.
ENDFORM. "set_fieldcat2
======================== Subroutines called by ALV ================
*& Form top_of_page
Called on top_of_page ALV event.
Prints the heading.
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_heading.
ENDFORM.
form set_top_page_heading using t_heading type slis_t_listheader
t_events type slis_t_event.
data: x_heading type slis_listheader,
x_event type line of slis_t_event.
Report title
clear t_heading[].
clear x_heading.
x_heading-typ = 'H'.
x_heading-info = 'PHYSICAL INVENTORY AUDIT REPORT'.
append x_heading to t_heading.
Plant Name
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'PLANT: '.
x_heading-info = its1-werks.
append x_heading to t_heading.
Posting Date
*clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'POSTING DATE: '.
x_heading-info = ITS1-BUDAT.
append x_heading to t_heading.
Control Date
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'CONTROL No: '.
x_heading-info = its1-werks.
append x_heading to t_heading.
Control date
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'CONTROL DATE: '.
x_heading-info = its1-werks.
append x_heading to t_heading.
User who is running the report
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'User: '.
x_heading-info = sy-uname.
append x_heading to t_heading.
Date of execution
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Date: '.
write sy-datum to x_heading-info.
append x_heading to t_heading.
Time of execution
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Time: '.
write sy-uzeit to x_heading-info.
append x_heading to t_heading.
Top of page event
x_event-name = slis_ev_top_of_page.
x_event-form = 'TOP_OF_PAGE'.
append x_event to t_events.
endform.
form set_events using t_events type slis_t_event.
data: x_event type line of slis_t_event.
endform.
plzzz help me out as it is most urgent to me.
regards,
ric.s -
Regarding ALV ( To be displayed in Tree Format)
Hi all,
I am working on a ALV report which is to be displayed in Tree Structure . I found some demo programs within SAP .. but do we have an Alternative .. all those Demos use OOPS concept .. Can this Report be done without using OOPS in ALV.
Please Suggest.
Thanks & Regards
SrinivasHi,
This is a ALV Report with tree structure.
report zwmr_pick_status_report no standard page heading
message-id zw.
Type Pools *
type-pools: icon, slis.
Tables *
tables: tvst,
likp,
t30b,
vekp,
zpallettr,
zvantr.
Types *
types:
begin of ty_data,
lgtor like likp-lgtor, " door
vbeln like likp-vbeln, " delivery
wbstk like vbuk-wbstk, " Goods movement status
kostk like vbuk-kostk, " Picking status
posnr like lips-posnr, " item
route like likp-route, " route
wadat like likp-wadat, " goods issue date
lvsta like vbup-lvsta, " warehouse status
packvorschr like vekp-packvorschr, " pack mnemonic
exidv like vekp-exidv, " handling unit
zpallet_no(10), "like zpallettr-zpallet_no, " pallet no
zcount_check like zpallettr-zcount_check," count check flag
zvan_no(10), "like zvantr-zvan_no, " van no
zvan_print like zvantr-zvan_print, " van manifest print
zeod_print like zvantr-zeod_print, " eod manifest print
zzpackclass like vekp-zzpackclass, " package class
zzti like vekp-zzti, " T.I. value
end of ty_data.
Data *
ranges: r_del for likp-vbeln,
r_lgtor for likp-lgtor.
ranges: r_vanno for zvantr-zvan_no,
r_palno for zpallettr-zpallet_no.
data: begin of number_range occurs 0,
mark(1),
id(3),
num(10) type n,
desc like zpalletmd-zdesc,
end of number_range.
data: t_disp_tab type standard table of zpickdisp,
t_data_tab type ty_data occurs 0 with header line,
t_disp_head type standard table of zpickhead.
data: w_numrnge like number_range,
w_number(10) type n.
data: t_likp like likp occurs 0 with header line,
t_lips like lips occurs 0 with header line,
t_vbuk like vbuk occurs 0 with header line,
t_vbup like vbup occurs 0 with header line,
t_vepo like vepo occurs 0 with header line,
t_vekp like vekp occurs 0 with header line,
t_vantr like zvantr occurs 0 with header line,
t_pallettr like zpallettr occurs 0 with header line,
w_likp like likp,
w_lips like lips,
w_vbuk like vbuk,
w_vbup like vbup,
w_vepo like vepo,
w_vekp like vekp.
ALV DATA *****
data:
g_grid type ref to cl_gui_alv_grid,
g_sort type slis_t_sortinfo_alv,
g_custom_container type ref to cl_gui_custom_container,
g_layout type slis_layout_alv,
gt_fieldcat type slis_t_fieldcat_alv,
t_fldcat like line of gt_fieldcat,
g_keyinfo type slis_keyinfo_alv,
gt_events type slis_t_event,
gs_event type slis_alv_event,
w_sy_repid like sy-repid.
data: begin of seltab occurs 0.
include structure rsparams.
data: end of seltab.
SYSTEM GENERATED TABLE CONTROL DATA ********
DECLARATION OF TABLECONTROL 'TC_TABCON' ITSELF
controls: tc_tabcon type tableview using screen 0100.
LINES OF TABLECONTROL 'TC_TABCON'
data: g_tc_tabcon_lines like sy-loopc.
data: ok_code like sy-ucomm.
Constants *
constants: c_data_class like klah-class value 'DG_DATA',
c_mat_class like rmclf-klart value '001',
c_pack like lips-mtart value 'VERP',
c_a(1) value 'A',
c_b(1) value 'B',
c_c(1) value 'C',
c_yes(1) value 'X',
c_no(1) value ' '.
Selection screen *
standard report select options block
selection-screen begin of block a with frame title text-002.
select-options:
s_wadat for likp-wadat no-extension obligatory. " Goods Issue Date
*parameters: "TR01-
p_vstel like tvst-vstel obligatory. " Shipping Point "TR01-
select-options: "TR01+
p_vstel for tvst-vstel. " Shipping Point "TR01+
select-options:
s_lfart for likp-lfart, " Delivery type
s_lgtor for t30b-lgtor, " Door selection
s_exidv for vekp-exidv, " Handling Unit
s_vbeln for likp-vbeln. " Delivery
parameters:
p_exdata as checkbox. " Show extra columns flag
selection-screen end of block a.
van/pallet specific select options block
selection-screen begin of block b with frame title text-001.
select-options:
s_palno for zpallettr-zpallet_no, " no-extension,
s_vanno for zvantr-zvan_no. " no-extension.
selection-screen end of block b.
Value Request Events *
at selection-screen on value-request for s_palno-low.
clear: number_range, w_number .
refresh number_range.
select numbers and display pop up screen for selection
perform select_pal_nos.
s_palno-low = w_number.
at selection-screen on value-request for s_palno-high.
clear: number_range, w_number .
refresh number_range.
select numbers and display pop up screen for selection
perform select_pal_nos.
s_palno-high = w_number.
at selection-screen on value-request for s_vanno-low.
clear: number_range, w_number .
refresh number_range.
select numbers and display pop up screen for selection
perform select_van_nos.
s_vanno-low = w_number.
at selection-screen on value-request for s_vanno-high.
clear: number_range, w_number .
refresh number_range.
select numbers and display pop up screen for selection
perform select_van_nos.
s_vanno-high = w_number.
At Selection Screen *
at selection-screen.
perform validate_selections.
Initialization *
initialization.
Start of selection *
start-of-selection.
clear all data tables
clear: t_likp,
t_lips,
t_vbuk,
t_vbup,
t_vepo,
t_vantr,
t_pallettr,
w_likp,
w_lips,
w_vbuk,
w_vbup,
w_vepo,
w_vekp.
refresh: t_likp,
t_lips,
t_vbuk,
t_vbup,
t_vepo,
t_vantr,
t_pallettr.
select data for ALV
due to different input parameters being used, to streamline the data
selection process, different selection methods are required
if not s_vanno is initial
or not s_palno is initial.
if selecting by van/pallet number, need to select the data from the
handling unit upwards to delivery
perform select_data_up.
else.
otherwise the data can be selected from the delivery downwards
perform select_data_down.
endif.
End of selection *
end-of-selection.
call hierarchical ALV display function module
call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
exporting
i_callback_program = 'ZWMR_PICK_STATUS_REPORT'
i_callback_pf_status_set = 'SET_STATUS'
i_callback_user_command =
'USER_COMMAND' "custom gui status form
is_layout = g_layout "user command form
it_fieldcat = gt_fieldcat
it_sort = g_sort
it_events = gt_events
i_tabname_header = 't_disp_head'
i_tabname_item = 't_disp_tab'
i_structure_name_header = 'ZPICKHEAD'
i_structure_name_item = 'ZPICKDISP'
is_keyinfo = g_keyinfo
tables
t_outtab_header = t_disp_head
t_outtab_item = t_disp_tab.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
FORMS *
Includes inserted by Screen Painter Wizard. DO NOT CHANGE THIS LINE!
include zwmr_pick_status_reporto01 .
include zwmr_pick_status_reporti01 .
include zwmr_pick_status_reportf01 .
*& Form select_pal_nos
select pallet numbers for search help
form select_pal_nos.
data: begin of t_palno occurs 0,
zpallet_no like zpallettr-zpallet_no,
end of t_palno.
select all available pallet numbers
select distinct zpallet_no from zpallettr
into corresponding fields of table t_palno.
loop at t_palno.
get pallet id
select single zpallet_id from zpallettr
into number_range-id
where zpallet_no = t_palno-zpallet_no.
get pallet description
select single zdesc from zpalletmd
into number_range-desc
where zpallet_id = number_range-id.
number_range-num = t_palno-zpallet_no.
append to search help table
append number_range.
endloop.
call pop up dialog box
call screen 0100 starting at 5 5.
endform. " select_pal_nos
*& Form select_van_nos
select van numbers for search help
form select_van_nos.
data: begin of t_vanno occurs 0,
zvan_no like zvantr-zvan_no,
end of t_vanno.
select available van numbers
select distinct zvan_no from zvantr
into corresponding fields of table t_vanno.
loop at t_vanno.
select van id
select single zvan_id from zvantr
into number_range-id
where zvan_no = t_vanno-zvan_no.
select van description (maintained in pallet tables)
select single zdesc from zpalletmd
into number_range-desc
where zpallet_id = number_range-id.
number_range-num = t_vanno-zvan_no.
append to search help table
append number_range.
endloop.
call pop up dialog box
call screen 0100 starting at 5 5.
endform. " select_van_nos
*& Form select_data_down
select data if selecting from delivery down
form select_data_down.
select all deliveries from LIKP that fulfill selection criteria
select * from likp into table t_likp
where vbeln in s_vbeln
and vstel eq p_vstel "TR01-
and vstel in p_vstel
and lgtor in s_lgtor
and wadat in s_wadat
and lfart in s_lfart.
if sy-subrc ne 0.
no data found
message i007.
exit.
endif.
if not t_likp[] is initial.
select sales document headers from VBUK
select * from vbuk into table t_vbuk
for all entries in t_likp
where vbeln eq t_likp-vbeln.
select all relevant delivery items from LIPS
select * from lips into table t_lips
for all entries in t_likp
where vbeln eq t_likp-vbeln
and pstyv ne 'ZPAC'
and pstyv ne 'ZGDP' "TR02+
and lfimg gt 0. "TR01+
endif.
if not t_lips[] is initial.
select all sales document line items from VBUP
select * from vbup into table t_vbup
for all entries in t_lips
where vbeln eq t_lips-vbeln
and posnr = t_lips-posnr.
select corresponding handling unit ID's (venum)
TR03 Replace start
select * from vepo appending corresponding fields of table t_vepo
for all entries in t_lips
where vbeln = t_lips-vbeln
and posnr = t_lips-posnr
and matnr = t_lips-matnr
and charg = t_lips-charg.
select * from vepo
inner join vekp on vepovenum = vekpvenum
appending corresponding fields of table t_vepo
for all entries in t_lips
where vepo~vbeln = t_lips-vbeln
and vepo~posnr = t_lips-posnr
and vepo~matnr = t_lips-matnr
and vepo~charg = t_lips-charg
and vekp~exidv in s_exidv.
TR03 Replace end
endif.
build process table
perform move_to_table.
endform. "select_data_down
*& Form select_data_up
select data if selecting from van/pallet up
form select_data_up.
if not s_vanno is initial.
if van then select van numbers and hence pallet numbers
select * from zvantr into table t_vantr
where zvan_no in s_vanno.
and vstel eq p_vstel."TR01-
if not t_vantr[] is initial.
select * from zpallettr into table t_pallettr
for all entries in t_vantr
where zpallet_no eq t_vantr-zpallet_no.
and vstel eq p_vstel."TR01-
endif.
else.
otherwise can get pallet numbers directly
select * from zpallettr into table t_pallettr
where zpallet_no in s_palno.
and vstel eq p_vstel."TR01-
endif.
if not t_pallettr[] is initial.
from the pallet nos. we can select the handling units
select * from vekp into table t_vekp
for all entries in t_pallettr
where exidv eq t_pallettr-exidv
and exidv ne space
and exidv in s_exidv "TR03+
and ( exida = 'E' "TR01+
or exida = 'F' ). "TR01+
endif.
if not t_vekp[] is initial.
build vbeln range from t_vekp.
loop at t_vekp.
r_del-sign = 'I'.
r_del-option = 'EQ'.
r_del-low = t_vekp-vpobjkey.
append r_del.
endloop.
select all deliveries from LIKP that correspond to HU's
select * from likp into table t_likp
where vbeln in r_del
and wadat in s_wadat
and lfart in s_lfart.
endif.
if not t_likp[] is initial.
select sales document headers from VBUK
select * from vbuk into table t_vbuk
for all entries in t_likp
where vbeln eq t_likp-vbeln.
select all relevant delivery items from LIPS
select * from lips into table t_lips
for all entries in t_likp
where vbeln eq t_likp-vbeln
and pstyv ne 'ZPAC'
and pstyv ne 'ZGDP' "TR02+
and lfimg gt 0. "TR01+
endif.
if not t_lips[] is initial.
select all sales document line items from VBUP
select * from vbup into table t_vbup
for all entries in t_lips
where vbeln eq t_lips-vbeln
and posnr = t_lips-posnr.
select corresponding handling unit ID's (venum)
select * from vepo appending corresponding fields of table t_vepo
for all entries in t_lips
where vbeln = t_lips-vbeln
and posnr = t_lips-posnr
and matnr = t_lips-matnr
and charg = t_lips-charg.
endif.
build process table
perform move_to_table.
endform. "select_data_up
*& Form move_to_table
move data to processing table
form move_to_table.
loop at t_vepo.
clear t_data_tab.
delivery lines.
clear w_lips.
read table t_lips with key vbeln = t_vepo-vbeln
posnr = t_vepo-posnr
into w_lips.
move-corresponding w_lips to t_data_tab.
sales document line items
clear w_vbup.
read table t_vbup with key vbeln = t_vepo-vbeln
posnr = t_vepo-posnr
into w_vbup.
if w_vbup-kosta = space. "TR01-
not relevant for picking
delete t_vepo. "TR01-
continue. "TR01-
else. "TR01-
move-corresponding w_vbup to t_data_tab.
endif. "TR01-
sales doc header
clear w_vbuk.
read table t_vbuk with key vbeln = t_vepo-vbeln
into w_vbuk.
move-corresponding w_vbuk to t_data_tab.
delivery header
clear w_likp.
read table t_likp with key vbeln = t_vepo-vbeln
into w_likp.
move-corresponding w_likp to t_data_tab.
select handling unit info using vepo entry
clear w_vekp.
if t_vekp[] is initial.
select single * from vekp into w_vekp
where venum = t_vepo-venum.
else.
read table t_vekp with key venum = t_vepo-venum
into w_vekp.
if sy-subrc ne 0.
select single * from vekp into w_vekp
where venum = t_vepo-venum.
endif.
endif.
move-corresponding w_vekp to t_data_tab.
select pallet / van load information
select single zpallet_no zcount_check from zpallettr
into (t_data_tab-zpallet_no,
t_data_tab-zcount_check)
where exidv eq w_vekp-exidv.
if not t_data_tab-zpallet_no in s_palno. "TR01+
continue. "TR01+
endif. "TR01+
if sy-subrc = 0.
select single zvan_no zvan_print zeod_print from zvantr
into (t_data_tab-zvan_no,
t_data_tab-zvan_print,
t_data_tab-zeod_print)
where zpallet_no eq t_data_tab-zpallet_no.
if not t_data_tab-zvan_no in s_vanno. "TR01+
continue. "TR01+
endif. "TR01+
endif.
append t_data_tab.
endloop.
*-----> TR01+ start
If the delivery has yet to be packed, then need to include in report
Thus delete t_lips here and if any entries left after looping through
t_vepo, these will also need to be added to t_data_tab
if the selection is by handling unit though we do not want these"TR03+
if s_exidv is initial. "TR03+
loop at t_vepo.
read table t_lips with key vbeln = t_vepo-vbeln
posnr = t_vepo-posnr.
if sy-subrc = 0.
delete t_lips index sy-tabix.
endif.
endloop.
if not t_lips[] is initial.
move any unpacked items to the data table
perform move_lips_to_table.
endif.
endif. "TR03+
*<---- TR01+ End
get relevant status icons
perform select_icons.
prepare ALV data
perform prepare_alv.
endform. " select_data
*& Form select_icons
select icons for display and move data to display table
form select_icons.
data: w_disp_tab like zpickdisp,
w_disp_head like zpickhead,
w_color like zpickdisp-color,
ov_icon like zpickdisp-ov_icon,
gi_icon like zpickdisp-gi_icon,
to_icon like zpickdisp-to_icon,
lp_icon like zpickdisp-lp_icon,
pc_icon like zpickdisp-pc_icon,
lv_icon like zpickdisp-lv_icon,
vm_icon like zpickdisp-vm_icon,
em_icon like zpickdisp-em_icon,
t_ovst_tab like t_disp_tab with header line.
constants: c_col1(3) value 'C10',
c_col2(3) value 'C20'.
sort t_data_tab by lgtor vbeln.
w_color = c_col2.
loop at t_data_tab.
at new lgtor.
fill ALV header table
clear w_disp_head.
w_disp_head-lgtor = t_data_tab-lgtor.
append w_disp_head to t_disp_head.
endat.
goods issue status & overall amber/green only
case t_data_tab-wbstk.
when c_c.
move icon_green_light to gi_icon.
move icon_green_light to ov_icon.
when others.
move icon_red_light to gi_icon.
move icon_yellow_light to ov_icon.
endcase.
transfer order status
case t_data_tab-lvsta.
when c_a.
move icon_red_light to to_icon.
when c_b.
move icon_yellow_light to to_icon.
when c_c.
move icon_green_light to to_icon.
when space.
write N/A
to_icon = 'N/A'.
endcase.
loaded to pallet status
if not t_data_tab-zpallet_no is initial.
move icon_green_light to lp_icon.
else.
move icon_red_light to lp_icon.
endif.
pallet count status
if not t_data_tab-zcount_check is initial.
move icon_green_light to pc_icon.
else.
move icon_red_light to pc_icon.
endif.
loaded to van status
if not t_data_tab-zvan_no is initial.
move icon_green_light to lv_icon.
else.
move icon_red_light to lv_icon.
endif.
van manifest status
if not t_data_tab-zvan_print is initial.
move icon_green_light to vm_icon.
else.
move icon_red_light to vm_icon.
endif.
end of day manifest status
if not t_data_tab-zeod_print is initial.
move icon_green_light to em_icon.
else.
move icon_red_light to em_icon.
endif.
move working data table to display table
move-corresponding t_data_tab to w_disp_tab.
w_disp_tab-ov_icon = ov_icon.
w_disp_tab-gi_icon = gi_icon.
w_disp_tab-to_icon = to_icon.
w_disp_tab-lp_icon = lp_icon.
w_disp_tab-pc_icon = pc_icon.
w_disp_tab-lv_icon = lv_icon.
w_disp_tab-vm_icon = vm_icon.
w_disp_tab-em_icon = em_icon.
w_disp_tab-color = w_color.
fill N/A values for initial fields for display
if w_disp_tab-packvorschr is initial.
w_disp_tab-packvorschr = 'N/A'.
endif.
if w_disp_tab-exidv is initial.
w_disp_tab-exidv = 'N/A'.
endif.
if w_disp_tab-zpallet_no is initial.
write 'N/A' to w_disp_tab-zpallet_no.
endif.
if w_disp_tab-zvan_no is initial.
write 'N/A' to w_disp_tab-zvan_no.
endif.
display different color for new doc number
at end of vbeln.
if w_color = c_col1.
w_color = c_col2.
elseif w_color = c_col2.
w_color = c_col1.
endif.
endat.
append w_disp_tab to t_disp_tab.
clear w_disp_tab.
endloop.
we have all the icons in display but need to check the overall status
as this refers to the line items
green and amber statuses already set and use the same criteria as the
goods issue status unless detected as red here
data: ov_stat_red(1).
clear w_disp_tab.
sort t_disp_tab by vbeln.
loop at t_disp_tab into w_disp_tab.
at new vbeln.
check all line items for delivery
loop at t_data_tab where vbeln = w_disp_tab-vbeln.
if t_data_tab-lvsta = c_a.
set overall status to red
ov_stat_red = c_yes.
exit.
else.
leave green/amber status icon as previosly determined
endif.
endloop.
if ov_stat_red = c_yes.
set overall status to red for all items in that delivery
clear ov_stat_red.
move icon_red_light to w_disp_tab-ov_icon.
modify t_disp_tab from w_disp_tab transporting ov_icon
where vbeln = w_disp_tab-vbeln.
endif.
endat.
endloop.
endform. " select_icons
*& Form fill_layout
fill ALV layout parameters
form fill_layout.
clear g_layout.
g_layout-colwidth_optimize = c_yes. " column width optimisation
g_layout-zebra = space. " alternate line colors
g_layout-box_fieldname = 'MARK'. " checkbox fieldname
g_layout-info_fieldname = 'COLOR'. " highlight row indicator
g_layout-no_vline = space. " vertical line
g_layout-key_hotspot = space. " hotspot field
g_layout-f2code = 'PICK'. " F2 ok_code
g_layout-numc_sum = c_yes. " sum numc fields
g_layout-box_tabname = 't_disp_head'. " checkbox table name
g_layout-expand_fieldname = 'EXPAND'. " expand field name
endform. " fill_layout
*& Form fill_sort
fill ALV sort table
form fill_sort.
data: w_g_sort type slis_sortinfo_alv.
w_g_sort-spos = 1.
w_g_sort-fieldname = 'LGTOR'.
w_g_sort-tabname = 't_disp_tab'.
w_g_sort-up = c_yes.
append w_g_sort to g_sort.
w_g_sort-spos = 2.
w_g_sort-fieldname = 'VBELN'.
w_g_sort-tabname = 't_disp_tab'.
w_g_sort-up = c_yes.
append w_g_sort to g_sort.
w_g_sort-spos = 3.
w_g_sort-fieldname = 'POSNR'.
w_g_sort-tabname = 't_disp_tab'.
w_g_sort-up = c_yes.
append w_g_sort to g_sort.
w_g_sort-spos = 4.
w_g_sort-fieldname = 'WADAT'.
w_g_sort-tabname = 't_disp_tab'.
w_g_sort-up = c_yes.
append w_g_sort to g_sort.
endform. " fill_sort
*& Form fill_fieldcat
Fill field category structure for ALV
form fill_fieldcat.
clear t_fldcat.
create field catalogue for header table
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = 'ZWMR_PICK_STATUS_REPORT'
i_internal_tabname = 't_disp_head'
i_structure_name = 'ZPICKHEAD'
i_client_never_display = c_yes
changing
ct_fieldcat = gt_fieldcat[].
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
ceate field catalogue for items table
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = 'ZWMR_PICK_STATUS_REPORT'
i_internal_tabname = 't_disp_tab'
i_structure_name = 'ZPICKDISP'
i_client_never_display = c_yes
changing
ct_fieldcat = gt_fieldcat[].
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
modify field catalogue for this report
set no display flag if not requested on selection screen
if p_exdata ne c_yes.
t_fldcat-no_out = c_yes.
modify gt_fieldcat from t_fldcat transporting no_out
where fieldname eq 'PACKVORSCHR'
or fieldname eq 'EXIDV'
or fieldname eq 'ZPALLET_NO'
or fieldname eq 'ZVAN_NO'
or fieldname eq 'ZZPACKCLASS'
or fieldname eq 'ZZTI'.
endif.
set no display flag for item level LGTOR field
t_fldcat-no_out = c_yes.
modify gt_fieldcat from t_fldcat transporting no_out
where fieldname eq 'LGTOR'
and tabname eq 't_disp_tab'.
prevent display of technical fields
t_fldcat-tech = c_yes.
modify gt_fieldcat from t_fldcat transporting tech
where fieldname eq 'EXPAND'
or fieldname eq 'SELKZ'.
set vbeln as key
t_fldcat-key = c_yes.
modify gt_fieldcat from t_fldcat transporting key
where fieldname eq 'VBELN'.
prevent scrolling for info fields
t_fldcat-fix_column = c_yes.
modify gt_fieldcat from t_fldcat transporting fix_column
where fieldname eq 'VBELN'.
endform. " fill_fieldcat
*& Form prepare_ALV
Fill ALV parameters
form prepare_alv.
fill ALV key info
g_keyinfo-header01 = 'LGTOR'.
g_keyinfo-item01 = 'LGTOR'.
fill ALV events
gs_event-name = 'TOP_OF_PAGE'.
gs_event-form = 'TOP_OF_PAGE'.
append gs_event to gt_events.
fill ALV sort table
perform fill_sort.
fill ALV layout structure
perform fill_layout.
fill ALV field category
perform fill_fieldcat.
endform. " prepare_ALV
*& Form user_command
form called on user command from ALV list
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
data: index type i,
w_disp_head like line of t_disp_head,
w_door like likp-lgtor.
clear r_lgtor. refresh r_lgtor.
case r_ucomm.
when 'PICK'. " Double click line
when 'VANM'. " Van Manifest button
read the header table where has been selected
loop at t_disp_head into w_disp_head where mark = c_yes.
r_lgtor-sign = 'I'.
r_lgtor-option = 'EQ'.
r_lgtor-low = w_disp_head-lgtor.
append r_lgtor.
endloop.
print the van manifest
perform print_van_manifest tables r_lgtor.
when 'EODM'. " EOD Manifest button
read the header table where has been selected
loop at t_disp_head into w_disp_head where mark = c_yes.
r_lgtor-sign = 'I'.
r_lgtor-option = 'EQ'.
r_lgtor-low = w_disp_head-lgtor.
append r_lgtor.
endloop.
print the end of day manifest
perform print_eod_manifest tables r_lgtor.
when 'REFR'. "Refresh
refresh display
w_sy_repid = sy-repid.
call function 'RS_REFRESH_FROM_SELECTOPTIONS'
exporting
curr_report = w_sy_repid
tables
selection_table = seltab.
exceptions
not_found = 1
no_report = 2
others = 3.
if sy- -
Need docu on alv events with examples
hi experts,
Need help on docu in <b>alv events</b> with exam</b>ples
thanks in advance.Hi,
Check this link..
http://www.sap-basis-abap.com/abap/events-in-alv-and-their-fm.htm
go through following links......
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf
Re: Performance Optimization for the following Code (URGENT & VERY IMPORTAN
The main events in alv and their FM and why we use these:
1. SLIS_PRINT_ALV.
2. SLIS_T_LISTHEADER.
3. SLIS_T_EVENT.
4. SLIS_T_SORTINFO_ALV.
5. SLIS_T_LAYOUT_ALV.
6. SLIS_T_FIELDCAT_ALV.
For more information check the following link:
http://sap-img.com/abap/what-are-the-events-in-alv.htm
Regards,
Omkar. -
Help needed regarding ALV report
Hi,
I have a query regarding ALV report.
The requirement is as follows:-
When the user executes the ALV report and if he sums one numeric field column values and filters out some of the field columns ( for example there r 5 columns in the report and the user has filtered out 2 of them and viewing only 3 columns)
and now the requirements is that when the user runs the report later he should see the modified report ( i mean only 3 cloumns and the total value of the column which he has made) but not the original output which was there when the report was developed.
First of all i wanna know is it possible to do r not. If yes then how
Hope u have got what i want.
eagerly waiting for ur reply.
regards,
maqsoodHi
Yes you can! You have to manage the layout variant.
So when you call your ALV you have to set the parameter I_SAVE = 'A'.
In this way you'll allow the user to save the variants for layout.
After you has to have a chance to choose the variant in selection-screen.
See the demo program BCALV_GRID_11 to manage the variant in selection-screen.
Max -
Hi all,
i am having one issue regarding ALV GRID.
my issue is after executin report O/P in grid format is ok,
but the same format i want to display when u click print preview or when u execute it in back ground,
it is displaying as same as ALV LIST,hi use the coding like this,
here i am calling hirarchial from list check this....
*& Report ZZZ00
REPORT ZPR_02.
TYPE-POOLS: SLIS.
TABLES:pa0002,pa0008.
data:begin of it_pa0002 occurs 0,
checkbox,
pernr like pa0002-pernr,
begda like pa0002-begda,
endda like pa0002-endda,
vorna like pa0002-vorna,
nachn like pa0002-nachn,
end of it_pa0002.
data:begin of it_pa00021 occurs 0,
pernr like pa0002-pernr,
begda like pa0002-begda,
endda like pa0002-endda,
vorna like pa0002-vorna,
nachn like pa0002-nachn,
expand TYPE xfeld value 'X',
end of it_pa00021.
data:begin of it_pa0008 occurs 0,
pernr like pa0008-pernr,
begda like pa0008-begda,
endda like pa0008-endda,
ANSAL like pa0008-ANSAL,
LGA01 like pa0008-LGA01,
BET01 LIKE PA0008-BET01,
end of it_pa0008.
DATA: IT_FIELD_CAT TYPE SLIS_T_FIELDCAT_ALV,
IT_FIELD_CAT1 TYPE SLIS_T_FIELDCAT_ALV,
IT_LAYOUT1 TYPE SLIS_LAYOUT_ALV,
WA_FIELD_CAT TYPE SLIS_FIELDCAT_ALV,
WA_FIELD_CAT1 TYPE SLIS_FIELDCAT_ALV,
IT_LAYOUT TYPE SLIS_LAYOUT_ALV,
IT_EVENTS TYPE SLIS_T_EVENT,
WA_EVENTS TYPE SLIS_ALV_EVENT,
IT_HEADER TYPE SLIS_T_LISTHEADER,
WA_HEADER TYPE SLIS_LISTHEADER,
wa_keyinfo TYPE slis_keyinfo_alv.
CONSTANTS:c VALUE 'X'.
SELECT-OPTIONS: S_pernr FOR pa0002-pernr.
START-OF-SELECTION.
SET PF-STATUS 'DATA' .
PERFORM GET_DATA.
PERFORM BUILD_FIELD_CAT.
PERFORM GET_EVENTS.
PERFORM DISPLAY_DATA.
*& Form get_data
text
FORM GET_DATA .
SELECT pernr
begda
endda
vorna
nachn
FROM pa0002
INTO CORRESPONDING FIELDS OF TABLE IT_pa0002
WHERE pernr IN S_pernr.
ENDFORM. " get_data
*& Form build_field_cat
text
FORM BUILD_FIELD_CAT .
wa_field_cat-tabname = 'PA0002'.
WA_FIELD_CAT-FIELDNAME = 'CHECKBOX'.
wa_field_cat-ref_tabname = 'IT_PA0002'.
WA_FIELD_CAT-REPTEXT_DDIC = 'Check Box'.
APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
CLEAR WA_FIELD_CAT.
wa_field_cat-tabname = 'PA0002'.
WA_FIELD_CAT-FIELDNAME = 'PERNR'.
wa_field_cat-ref_tabname = 'IT_PA0002'.
WA_FIELD_CAT-REPTEXT_DDIC = 'Personnel no'.
APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
CLEAR WA_FIELD_CAT.
wa_field_cat-tabname = 'PA0002'.
WA_FIELD_CAT-FIELDNAME = 'BEGDA'.
wa_field_cat-ref_tabname = 'IT_PA0002'.
WA_FIELD_CAT-REPTEXT_DDIC = 'Start date'.
APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
CLEAR WA_FIELD_CAT.
wa_field_cat-tabname = 'PA0002'.
WA_FIELD_CAT-FIELDNAME = 'ENDDA'.
wa_field_cat-ref_tabname = 'IT_PA0002'.
WA_FIELD_CAT-REPTEXT_DDIC = 'End date'.
APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
CLEAR WA_FIELD_CAT.
wa_field_cat-tabname = 'PA0002'.
WA_FIELD_CAT-FIELDNAME = 'VORNA'.
wa_field_cat-ref_tabname = 'IT_PA0002'.
WA_FIELD_CAT-REPTEXT_DDIC = 'First name'.
APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
CLEAR WA_FIELD_CAT.
wa_field_cat-tabname = 'PA0002'.
WA_FIELD_CAT-FIELDNAME = 'NACHN'.
wa_field_cat-ref_tabname = 'IT_PA0002'.
WA_FIELD_CAT-REPTEXT_DDIC = 'Last name'.
APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
CLEAR WA_FIELD_CAT.
wa_field_cat1-tabname = 'PA0002'.
WA_FIELD_CAT1-FIELDNAME = 'PERNR'.
wa_field_cat1-ref_tabname = 'IT_PA00021'.
WA_FIELD_CAT1-REPTEXT_DDIC = 'Personnel no'.
APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
CLEAR WA_FIELD_CAT1.
wa_field_cat1-tabname = 'PA0002'.
WA_FIELD_CAT1-FIELDNAME = 'BEGDA'.
wa_field_cat1-ref_tabname = 'IT_PA00021'.
WA_FIELD_CAT1-REPTEXT_DDIC = 'Start date'.
APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
CLEAR WA_FIELD_CAT1.
wa_field_cat1-tabname = 'PA0002'.
WA_FIELD_CAT1-FIELDNAME = 'ENDDA'.
wa_field_cat1-ref_tabname = 'IT_PA00021'.
WA_FIELD_CAT1-REPTEXT_DDIC = 'End date'.
APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
CLEAR WA_FIELD_CAT1.
wa_field_cat1-tabname = 'PA0002'.
WA_FIELD_CAT1-FIELDNAME = 'VORNA'.
wa_field_cat1-ref_tabname = 'IT_PA00021'.
WA_FIELD_CAT1-REPTEXT_DDIC = 'First name'.
APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
CLEAR WA_FIELD_CAT.
wa_field_cat1-tabname = 'PA0002'.
WA_FIELD_CAT1-FIELDNAME = 'NACHN'.
wa_field_cat1-ref_tabname = 'IT_PA00021'.
WA_FIELD_CAT1-REPTEXT_DDIC = 'Last name'.
APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
CLEAR WA_FIELD_CAT1.
wa_field_cat1-tabname = 'PA0008'.
wa_field_cat1-fieldname = 'PERNR'.
wa_field_cat-ref_tabname = 'IT_PA0008'.
wa_field_cat1-REPTEXT_DDIC = 'personnelno'.
APPEND wa_field_cat1 TO it_field_cat1.
CLEAR WA_FIELD_CAT1.
wa_field_cat1-tabname = 'PA0008'.
wa_field_cat1-fieldname = 'BEGDA'.
wa_field_cat-ref_tabname = 'IT_PA0008'.
wa_field_cat1-REPTEXT_DDIC = 'begindate'.
APPEND wa_field_cat1 TO it_field_cat1.
CLEAR WA_FIELD_CAT1.
wa_field_cat1-tabname = 'PA0008'.
wa_field_cat1-fieldname = 'ENDDA'.
wa_field_cat-ref_tabname = 'IT_PA0008'.
wa_field_cat1-REPTEXT_DDIC = 'enddate'.
APPEND wa_field_cat1 TO it_field_cat1.
CLEAR WA_FIELD_CAT1.
wa_field_cat1-tabname = 'PA0008'.
wa_field_cat1-fieldname = 'ANSAL'.
wa_field_cat-ref_tabname = 'IT_PA0008'.
wa_field_cat1-REPTEXT_DDIC = 'annualsalary'.
APPEND wa_field_cat1 TO it_field_cat1.
CLEAR WA_FIELD_CAT1.
wa_field_cat1-tabname = 'PA0008'.
wa_field_cat1-fieldname = 'LGA01'.
wa_field_cat-ref_tabname = 'IT_PA0008'.
wa_field_cat1-REPTEXT_DDIC = 'wagetype'.
APPEND wa_field_cat1 TO it_field_cat1.
CLEAR WA_FIELD_CAT1.
wa_field_cat1-tabname = 'PA0008'.
wa_field_cat1-fieldname = 'BET01'.
wa_field_cat-ref_tabname = 'IT_PA0008'.
wa_field_cat1-REPTEXT_DDIC = 'Amount'.
APPEND wa_field_cat1 TO it_field_cat1.
CLEAR WA_FIELD_CAT1.
ENDFORM. " build_field_cat
*& Form display_data
text
FORM DISPLAY_DATA .
it_layout-box_fieldname = 'CHECKBOX'.
it_layout-EDIT = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = IT_FIELD_CAT
IS_LAYOUT = IT_LAYOUT
IT_EVENTS = IT_EVENTS
TABLES
T_OUTTAB = IT_pa0002.
ENDFORM. " display_data
*& Form get_events
text
FORM GET_EVENTS .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
IMPORTING
ET_EVENTS = IT_EVENTS .
READ TABLE IT_EVENTS INTO WA_EVENTS
WITH KEY NAME = SLIS_EV_TOP_OF_PAGE.
IF SY-SUBRC = 0.
WA_EVENTS-FORM = 'TOP_OF_PAGE'.
MODIFY IT_EVENTS FROM WA_EVENTS INDEX SY-TABIX.
ENDIF.
ENDFORM. " get_events
*& Form top_of_page
text
FORM TOP_OF_PAGE.
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = 'EMPLOYEE DATA'.
APPEND WA_HEADER TO IT_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_HEADER
ENDFORM. "top_of_page
*& Form GUI_SET
FORM GUI_SET USING RT_EXTAB TYPE SLIS_T_EXTAB .
SET PF-STATUS 'DATA' .
ENDFORM. "GUI_SET
*& Form USER_COMMAND
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
R_SELFIELD TYPE SLIS_SELFIELD.
DATA:V_PERNR LIKE PA0002-PERNR.
CASE R_UCOMM.
WHEN 'DET'.
DATA: V_FLAG.
clear : v_flag.
LOOP AT IT_PA0002.
if it_PA0002-checkbox = 'X'.
v_flag = 'X'.
v_pernr = IT_PA0002-PERNR.
SELECT PERNR
BEGDA
ENDDA
VORNA
NACHN
FROM PA0002
INTO CORRESPONDING FIELDS OF TABLE IT_PA00021
WHERE PERNR = V_PERNR.
SORT IT_PA00021 BY PERNR.
DELETE ADJACENT DUPLICATES FROM IT_PA00021 COMPARING PERNR.
READ TABLE IT_PA00021 INDEX 1.
SELECT PERNR
BEGDA
ENDDA
ANSAL
LGA01
BET01
FROM PA0008
INTO TABLE IT_PA0008
FOR ALL ENTRIES IN IT_PA00021
WHERE PERNR = IT_PA00021-PERNR.
if not it_PA0008[] Is initial.
SORT IT_PA0008 BY PERNR.
delete adjacent duplicates from it_PA0008 comparing pernr.
READ TABLE IT_PA0008 INDEX 1.
endif.
endif.
enddo.
it_layout1-group_change_edit = c.
it_layout1-colwidth_optimize = c.
it_layout1-zebra = c.
it_layout1-detail_popup = c.
it_layout1-get_selinfos = c.
it_layout-expand_fieldname = 'EXPAND'.
wa_keyinfo-header01 = 'PERNR'.
wa_keyinfo-item01 = 'PERNR'.
IF NOT V_FLAG IS INITIAL.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = IT_LAYOUT1
IT_FIELDCAT = IT_FIELD_CAT1
I_TABNAME_HEADER = 'PA0002'
I_TABNAME_ITEM = 'PA0008'
IS_KEYINFO = wa_keyinfo
TABLES
T_OUTTAB_HEADER = IT_PA00021
T_OUTTAB_ITEM = IT_PA0008.
ENDIF.
CLEAR: IT_PA00021,IT_PA0002,IT_PA0008.
ENDLOOP.
WHEN 'BACK'.
EXIT.
ENDCASE.
ENDFORM. "USER_COMMAND
reward points if useful,
venkat. -
Hi Abapers,
I am having one Problem regarding ALV Header on the report. Requirement is to get the data it into this order on ALV Header using Simple ABAP.
Summary
"Building No Room No Comments
111 AA Over Allocated.
545 XX Space Free
787 YY No Space
I have Tried to enter it into the header table but the data is not coming correctly.
Problem is It is coming in this way which is wrong..
Summary
"Building No Room No Comments
111 AA Over Allocated.
545 XX Space Free
787 YY No Space
Can Any body solve my Problem to get the header information it into the below .
Summary
"Building No Room No Comments
111 AA Over Allocated.
545 XX Space Free
787 YY No SpaceHi ,
I have tried but couldn't succeded. Can you Please provide me the solution. -
Hello gurus,
I created a workbench with an edittable ALV for its data. This ALV has several tabs, lets say 5 tabs with individual event handler declaration. Tabs 1, 2 & 3 shares the same event/class and method declaration. 4&5 shares also the same but different to 1,2, & 3.
I have events handle data change and button click (for a column of buttons that pops up a screen when pressed), which are both standard toolbar. Then I also have event toolbar for my custom icon and event user command to handle these icons.
I run my ALV, tabs 1,2 & 3 have their data first. Then I just copy these data going to tab4.
On tab 4, whenever I click on the standard toolbar 'add row' (+ icon), it adds new row and triggers event handle data change.
Now my problem is, whenever I click on any other icon that triggers alv event, instead of going to their respective event, it always go to the handle data change event. (i.e. when I click on my custom toolbar icon, instead of going to event user command, it triggers the handle data change. Same with when I click on any buttons under the button columns, it triggers handle data change.)
Tab 1,2 & 3 works fine. But 4 & 5 are not. They have the same process and coded with the same logic. The only difference I see is that 4 & 5 has handle data change event while 1,2 & 3 have not.
Please help me analysing what's really causing the issue and what solution to apply to handle this.
Thanks,
Sheerayou need to set the subtotal option only to the dummy field. see the below code related.
"no need of subtot option here..
ls_sort-spos = 1.
ls_sort-fieldname = 'EBELN'.
ls_sort-tabname = 'ITAB'.
ls_sort-up = 'X'.
ls_sort-group = 'UL'.
APPEND ls_sort TO it_sort.
CLEAR ls_sort.
ls_sort-spos = 2.
ls_sort-fieldname = 'D'.
ls_sort-tabname = 'ITAB'.
ls_sort-up = 'X'.
ls_sort-group = 'UL'.
ls_sort-subtot = 'X'. "Only specify here
APPEND ls_sort TO it_sort. -
ALV-Event data_changed after searchhelp with userdefined searchhelpexit
Hi there ...
I'm using an OO alv grid with an elementary searchhelp at defined fields.
the search help uses an searchhelpexit, that simply filters data, to show the right stuff
everything works fine!
dependent on the returned value of the searchhelp, I need to trigger a recalculation of values.
the alv-event "data_changed" looks interesting for that issue ... especially the flag "e_onf4_after" ...
BUT: I don't know, when the flag is set :$
the event is raised (with marked flags "e_onf4" and "e_onf4_before") before the Searchhelplist is displayed .... but I need to react AFTER the searchhelp is closed and the selected value is returned ...
all I want to do is:
trigger the recalculation after the user selected a value at the searchhelp
can anybody help me in that case?!
thanks a lot & enjoy your weekend
MarkusHi,
You can call elementary search help like any popup screen
with function F4IF_FIELD_VALUE_REQUEST.
- Call f4 help manually in the event DATA_CHANGED
- Process your recalculation
- set values on cells..
I hope it helps. -
URGENT: - REGARDING ALV REPORT
hi,
i had made dis report in ALV and i want to display d heading format as follows:-
NAME:- TEST PROGRAM
date: - 21.05.2007
time:- 1:30:23 am
moreover i want to see the print perview of it but it is giving runtime error.
plz help me in solving dis problem and he or she will be definately rewarded..
*& Report ZMFTEST5
REPORT ZMFTEST5 no standard page heading LINE-SIZE 310.
TABLES : VBAK,ABAP,VBEP,VBKD,MARA,KNA1,MAKT.
*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_EVENTS TYPE SLIS_T_EVENT,
FS_EVENTCAT LIKE LINE OF GT_EVENTs.
DATA : T_HEADING TYPE slis_t_listheader.
INTERNAL TABLE FOR SALES ORDER *****************
DATA : BEGIN OF ITSO OCCURS 0,
VBELN LIKE VBAK-VBELN,
ERDAT LIKE VBAK-ERDAT,
BSTNK LIKE VBAK-BSTNK,
KUNNR LIKE VBAK-KUNNR,
MATNR LIKE VBAP-MATNR,
POSNR LIKE VBAP-POSNR,
WMENG LIKE VBEP-WMENG,
NTGEW LIKE MARA-NTGEW,
BRGEW LIKE MARA-BRGEW,
GEWEI LIKE MARA-GEWEI,
SPART LIKE VBAK-SPART,
BMENG LIKE VBEP-BMENG,
EDATU LIKE VBEP-EDATU,
BSTKD LIKE VBKD-BSTKD,
WERKS LIKE VBAP-WERKS,
MEINS LIKE MARA-MEINS,
KWMENG LIKE VBAP-KWMENG,
KLMENG LIKE VBAP-KLMENG,
BALQTY LIKE VBAP-KLMENG,
SOGWT LIKE MARA-BRGEW,
SONWT LIKE MARA-BRGEW,
SINWT LIKE MARA-BRGEW,
BALGWT LIKE MARA-BRGEW,
BALNWT LIKE MARA-BRGEW,
DISPNWT LIKE MARA-BRGEW,
PARTYNAME LIKE KNA1-NAME1,
ITEMDESC LIKE MAKT-MAKTX,
STATUS TYPE C,
END OF ITSO.
DATA:B_QTY TYPE P LENGTH 7 DECIMALS 3.
***********PARAMETERS***************
PARAMETERS : PLANT LIKE VBAP-WERKS OBLIGATORY.
*********SELECTION SCREEN OPTIONS*********
SELECT-OPTIONS : SO_ORD FOR VBAK-VBELN,
SO_PARTY FOR VBAK-KUNNR,
IT_M FOR MARA-MATNR,
DIV FOR VBAK-SPART,
SO_DATE FOR VBAK-ERDAT,
S_DATE FOR VBEP-EDATU.
START-OF-SELECTION.
SELECT DISTINCT A~VBELN A~ERDAT A~BSTNK A~KUNNR B~SPART B~MATNR B~POSNR B~WERKS B~KWMENG B~KBMENG C~NTGEW C~BRGEW C~GEWEI D~WMENG D~BMENG D~EDATU D~VBELN
FROM VBAK AS A INNER JOIN VBAP AS B ON B~VBELN = A~VBELN
INNER JOIN MARA AS C ON C~MATNR = B~MATNR
INNER JOIN VBEP AS D ON D~WMENG > 0 AND D~VBELN = A~VBELN AND D~POSNR = B~POSNR
INTO CORRESPONDING FIELDS OF TABLE ITSO
WHERE A~VBELN IN SO_ORD AND A~KUNNR IN SO_PARTY AND B~SPART IN DIV AND A~ERDAT IN SO_DATE AND D~EDATU IN S_DATE AND B~MATNR IN IT_M AND B~WERKS = PLANT.
IF SY-SUBRC <> 0.
MESSAGE E899(M3) WITH 'No records'.
ENDIF.
DATA : V_NETWT LIKE MARA-NTGEW,
V_GRWT LIKE MARA-NTGEW,
V_SOSTAT TYPE C.
LOOP AT ITSO.
if ITSO-bmeng = 0.
V_SOSTAT = 'A'.
ELSEIF ITSO-WMENG <> ITSO-BMENG.
V_SOSTAT = 'B'.
ELSE.
V_SOSTAT = 'C'.
ENDIF.
IF ITSO-GEWEI = 'G'.
V_NETWT = ITSO-NTGEW / 1000.
V_GRWT = ITSO-BRGEW / 1000.
ELSEIF ITSO-GEWEI = 'KG'.
V_NETWT = ITSO-NTGEW.
V_GRWT = ITSO-BRGEW.
ELSEIF ITSO-GEWEI = 'TO'.
V_NETWT = ITSO-NTGEW * 1000.
V_GRWT = ITSO-BRGEW * 1000.
ENDIF.
ITSO-STATUS = V_SOSTAT.
ITSO-SOGWT = V_GRWT * ITSO-WMENG / 1000.
ITSO-SONWT = V_NETWT * ITSO-WMENG / 1000.
ITSO-SINWT = V_GRWT * ITSO-BMENG / 1000.
ITSO-BALGWT = V_GRWT * ( ITSO-WMENG - ITSO-BMENG ) / 1000.
ITSO-BALNWT = V_NETWT * ( ITSO-WMENG - ITSO-BMENG ) / 1000.
ITSO-DISPNWT = V_NETWT * ITSO-BMENG / 1000.
ITSO-BALQTY = ITSO-WMENG - ITSO-BMENG.
SELECT SINGLE NAME1 FROM KNA1 INTO ITSO-PARTYNAME WHERE KUNNR = ITSO-KUNNR.
SELECT SINGLE MAKTX FROM MAKT INTO ITSO-ITEMDESC WHERE MATNR = ITSO-MATNR.
MODIFY ITSO.
ENDLOOP.
perform f_build_eventcat.
PERFORM LAYOUT using t_heading.
END-OF-SELECTION.
FORM LAYOUT using t_heading type slis_t_listheader.
data : t_event type slis_t_event.
PERFORM FCAT USING 'WERKS' 'ITSO' '' 'PLANT ' 'WERKS' 'VBAP' ''.
PERFORM FCAT USING 'VBELN' 'ITSO' '' 'SO NO. ' 'VBELN' 'VBAK' ''.
PERFORM FCAT USING 'ERDAT' 'ITSO' '' 'S.O.DATE' 'ERDAT' 'VBAK' ''.
PERFORM FCAT USING 'BSTNK' 'ITSO' '' 'P.O.N.O.' 'BSTNK' 'VBAK' ''.
PERFORM FCAT USING 'KUNNR' 'ITSO' '' 'PARTY ' 'KUNNR' 'VBAP' ''.
PERFORM FCAT USING 'PARTYNAME' 'ITSO' '' 'PARTY DESCRIPTION' 'PARTYNAME' '' ''.
PERFORM FCAT USING 'ITEMDESC' 'ITSO' '' 'MATERIAL DESCRIPTION' 'ITEMDESC' '' ''.
PERFORM FCAT USING 'MATNR' 'ITSO' '' 'MAT.NO. ' 'MATNR' 'MARA' ''.
PERFORM FCAT USING 'POSNR' 'ITSO' '' 'LINE.ITEM' 'POSNR' 'VBAP' ''.
PERFORM FCAT USING 'WMENG' 'ITSO' '' 'S.O.QTY' 'WMENG' 'VBEP' '' .
PERFORM FCAT USING 'EDATU' 'ITSO' '' 'SCH.DATE' 'EDATU' 'VBEP' ''.
PERFORM FCAT USING 'SONWT' 'ITSO' '' 'S.O.NWT ' 'P' '' ''.
PERFORM FCAT USING 'SOGWT' 'ITSO' '' 'S.O.GWT ' 'P' '' ''.
PERFORM FCAT USING 'SPART' 'ITSO' '' 'DIV ' 'SPART' 'VBAP' ''.
PERFORM FCAT USING 'BMENG' 'ITSO' '' 'DISP.QTY' 'BMENG' 'VBEP' ''.
PERFORM FCAT USING 'DISPNWT' 'ITSO' '' 'DISP.NT.WT ' 'P' '' ''.
PERFORM FCAT USING 'BALQTY' 'ITSO' '' 'BAL.QTY.' 'P' '' ''.
PERFORM FCAT USING 'BALNWT' 'ITSO' '' 'BAL.NT.WT ' 'P' '' ''.
PERFORM FCAT USING 'BALGWT' 'ITSO' '' 'BAL.GR.WT ' 'P' '' ''.
PERFORM FCAT USING 'STATUS' 'ITSO' '' 'STATUS' 'STATUS' '' ''.
refresh t_event.
*perform set_top_page_heading using t_heading t_event.
REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK
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 =
IT_FIELDCAT = F1
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = GT_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 = ITSO
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
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 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.
*FORM F_REPORT_HEADER_ALV.
*CALL FUNCTION 'Z_HEAD_PRINT'
EXPORTING
WRITE: / TITLE1 = 'XYZ Limited'
TITLE2 = 'Sales Order Report'
TITLE3 = 'Created on '
COLOR = 'X'.
*ENDFORM.
FORM F_WRITE_SUMMARY .
write:/ 'Welcome to XYZ Limited'.
write:/ 'This is a test program to display Report in ALV Format'.
ENDFORM.
*& Form set_top_page_heading
text
-->P_T_HEADING text
*form set_top_page_heading using t_heading
t_events type slis_t_event.
*data: x_heading type slis_listheader,
x_event type line of slis_t_event.
Report title
clear t_heading[].
clear x_heading.
x_heading-typ = 'H'.
x_heading-info = ''(001).
append x_heading to t_heading.
t_heading-info = 'TEST'.
t_heading-typ = 'H'.
Program name
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Program: '.
x_heading-info = sy-repid.
append x_heading to t_heading.
User who is running the report
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'User: '.
x_heading-info = sy-uname.
append x_heading to t_heading.
Date of execution
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Date: '.
write sy-datum to x_heading-info.
append x_heading to t_heading.
Time of execution
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Time: '.
write sy-uzeit to x_heading-info.
append x_heading to t_heading.
Top of page event
x_event-name = slis_ev_top_of_page.
x_event-form = 'TOP_OF_PAGE'.
append x_event to t_events.
*endform. " set_top_page_headingHi,
i had change ur code just copy this and try,i hope it will work.
REPORT ZMFTEST5 no standard page heading LINE-SIZE 310.
TABLES : VBAK,ABAP,VBEP,VBKD,MARA,KNA1,MAKT.
*Varriable declaration.
TYPE-POOLS SLIS.
DATA : POS TYPE I.
DATA REPID LIKE SY-REPID.
****************CHANGES**************
DATA : FDATE TYPE STRING,
FTIME TYPE STRING,
FNAME TYPE STRING.
****************CHANGES**************
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_EVENTS TYPE SLIS_T_EVENT,
FS_EVENTCAT LIKE LINE OF GT_EVENTs.
DATA : T_HEADING TYPE slis_t_listheader.
INTERNAL TABLE FOR SALES ORDER *****************
DATA : BEGIN OF ITSO OCCURS 0,
VBELN LIKE VBAK-VBELN,
ERDAT LIKE VBAK-ERDAT,
BSTNK LIKE VBAK-BSTNK,
KUNNR LIKE VBAK-KUNNR,
MATNR LIKE VBAP-MATNR,
POSNR LIKE VBAP-POSNR,
WMENG LIKE VBEP-WMENG,
NTGEW LIKE MARA-NTGEW,
BRGEW LIKE MARA-BRGEW,
GEWEI LIKE MARA-GEWEI,
SPART LIKE VBAK-SPART,
BMENG LIKE VBEP-BMENG,
EDATU LIKE VBEP-EDATU,
BSTKD LIKE VBKD-BSTKD,
WERKS LIKE VBAP-WERKS,
MEINS LIKE MARA-MEINS,
KWMENG LIKE VBAP-KWMENG,
KLMENG LIKE VBAP-KLMENG,
BALQTY LIKE VBAP-KLMENG,
SOGWT LIKE MARA-BRGEW,
SONWT LIKE MARA-BRGEW,
SINWT LIKE MARA-BRGEW,
BALGWT LIKE MARA-BRGEW,
BALNWT LIKE MARA-BRGEW,
DISPNWT LIKE MARA-BRGEW,
PARTYNAME LIKE KNA1-NAME1,
ITEMDESC LIKE MAKT-MAKTX,
STATUS TYPE C,
END OF ITSO.
DATA:B_QTY TYPE P LENGTH 7 DECIMALS 3.
***********PARAMETERS***************
PARAMETERS : PLANT LIKE VBAP-WERKS OBLIGATORY.
*********SELECTION SCREEN OPTIONS*********
SELECT-OPTIONS : SO_ORD FOR VBAK-VBELN,
SO_PARTY FOR VBAK-KUNNR,
IT_M FOR MARA-MATNR,
DIV FOR VBAK-SPART,
SO_DATE FOR VBAK-ERDAT,
S_DATE FOR VBEP-EDATU.
START-OF-SELECTION.
SELECT DISTINCT A~VBELN A~ERDAT A~BSTNK A~KUNNR B~SPART B~MATNR B~POSNR B~WERKS B~KWMENG B~KBMENG C~NTGEW C~BRGEW C~GEWEI D~WMENG D~BMENG D~EDATU D~VBELN
FROM VBAK AS A INNER JOIN VBAP AS B ON B~VBELN = A~VBELN
INNER JOIN MARA AS C ON C~MATNR = B~MATNR
INNER JOIN VBEP AS D ON D~WMENG > 0 AND D~VBELN = A~VBELN AND D~POSNR = B~POSNR
INTO CORRESPONDING FIELDS OF TABLE ITSO
WHERE A~VBELN IN SO_ORD AND A~KUNNR IN SO_PARTY AND B~SPART IN DIV AND A~ERDAT IN SO_DATE AND D~EDATU IN S_DATE AND B~MATNR IN IT_M AND B~WERKS = PLANT.
IF SY-SUBRC <> 0.
MESSAGE E899(M3) WITH 'No records'.
ENDIF.
DATA : V_NETWT LIKE MARA-NTGEW,
V_GRWT LIKE MARA-NTGEW,
V_SOSTAT TYPE C.
LOOP AT ITSO.
if ITSO-bmeng = 0.
V_SOSTAT = 'A'.
ELSEIF ITSO-WMENG <> ITSO-BMENG.
V_SOSTAT = 'B'.
ELSE.
V_SOSTAT = 'C'.
ENDIF.
IF ITSO-GEWEI = 'G'.
V_NETWT = ITSO-NTGEW / 1000.
V_GRWT = ITSO-BRGEW / 1000.
ELSEIF ITSO-GEWEI = 'KG'.
V_NETWT = ITSO-NTGEW.
V_GRWT = ITSO-BRGEW.
ELSEIF ITSO-GEWEI = 'TO'.
V_NETWT = ITSO-NTGEW * 1000.
V_GRWT = ITSO-BRGEW * 1000.
ENDIF.
ITSO-STATUS = V_SOSTAT.
ITSO-SOGWT = V_GRWT * ITSO-WMENG / 1000.
ITSO-SONWT = V_NETWT * ITSO-WMENG / 1000.
ITSO-SINWT = V_GRWT * ITSO-BMENG / 1000.
ITSO-BALGWT = V_GRWT * ( ITSO-WMENG - ITSO-BMENG ) / 1000.
ITSO-BALNWT = V_NETWT * ( ITSO-WMENG - ITSO-BMENG ) / 1000.
ITSO-DISPNWT = V_NETWT * ITSO-BMENG / 1000.
ITSO-BALQTY = ITSO-WMENG - ITSO-BMENG.
SELECT SINGLE NAME1 FROM KNA1 INTO ITSO-PARTYNAME WHERE KUNNR = ITSO-KUNNR.
SELECT SINGLE MAKTX FROM MAKT INTO ITSO-ITEMDESC WHERE MATNR = ITSO-MATNR.
MODIFY ITSO.
ENDLOOP.
perform f_build_eventcat.
PERFORM LAYOUT using t_heading.
END-OF-SELECTION.
FORM LAYOUT using t_heading type slis_t_listheader.
data : t_event type slis_t_event.
PERFORM FCAT USING 'WERKS' 'ITSO' '' 'PLANT ' 'WERKS' 'VBAP' ''.
PERFORM FCAT USING 'VBELN' 'ITSO' '' 'SO NO. ' 'VBELN' 'VBAK' ''.
PERFORM FCAT USING 'ERDAT' 'ITSO' '' 'S.O.DATE' 'ERDAT' 'VBAK' ''.
PERFORM FCAT USING 'BSTNK' 'ITSO' '' 'P.O.N.O.' 'BSTNK' 'VBAK' ''.
PERFORM FCAT USING 'KUNNR' 'ITSO' '' 'PARTY ' 'KUNNR' 'VBAP' ''.
PERFORM FCAT USING 'PARTYNAME' 'ITSO' '' 'PARTY DESCRIPTION' 'PARTYNAME' '' ''.
PERFORM FCAT USING 'ITEMDESC' 'ITSO' '' 'MATERIAL DESCRIPTION' 'ITEMDESC' '' ''.
PERFORM FCAT USING 'MATNR' 'ITSO' '' 'MAT.NO. ' 'MATNR' 'MARA' ''.
PERFORM FCAT USING 'POSNR' 'ITSO' '' 'LINE.ITEM' 'POSNR' 'VBAP' ''.
PERFORM FCAT USING 'WMENG' 'ITSO' '' 'S.O.QTY' 'WMENG' 'VBEP' '' .
PERFORM FCAT USING 'EDATU' 'ITSO' '' 'SCH.DATE' 'EDATU' 'VBEP' ''.
PERFORM FCAT USING 'SONWT' 'ITSO' '' 'S.O.NWT ' 'P' '' ''.
PERFORM FCAT USING 'SOGWT' 'ITSO' '' 'S.O.GWT ' 'P' '' ''.
PERFORM FCAT USING 'SPART' 'ITSO' '' 'DIV ' 'SPART' 'VBAP' ''.
PERFORM FCAT USING 'BMENG' 'ITSO' '' 'DISP.QTY' 'BMENG' 'VBEP' ''.
PERFORM FCAT USING 'DISPNWT' 'ITSO' '' 'DISP.NT.WT ' 'P' '' ''.
PERFORM FCAT USING 'BALQTY' 'ITSO' '' 'BAL.QTY.' 'P' '' ''.
PERFORM FCAT USING 'BALNWT' 'ITSO' '' 'BAL.NT.WT ' 'P' '' ''.
PERFORM FCAT USING 'BALGWT' 'ITSO' '' 'BAL.GR.WT ' 'P' '' ''.
PERFORM FCAT USING 'STATUS' 'ITSO' '' 'STATUS' 'STATUS' '' ''.
refresh t_event.
*perform set_top_page_heading using t_heading t_event.
REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK
I_CALLBACK_HTML_TOP_OF_PAGE = 'TOP'
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = F1
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = GT_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 = ITSO
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
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 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.
*FORM F_REPORT_HEADER_ALV.
*CALL FUNCTION 'Z_HEAD_PRINT'
EXPORTING
WRITE: / TITLE1 = 'XYZ Limited'
TITLE2 = 'Sales Order Report'
TITLE3 = 'Created on '
COLOR = 'X'.
*ENDFORM.
FORM F_WRITE_SUMMARY .
write:/ 'Welcome to XYZ Limited'.
write:/ 'This is a test program to display Report in ALV Format'.
ENDFORM.
FORM TOP.
DATA: WT_HEADER TYPE SLIS_T_LISTHEADER,
WA_HEADER TYPE SLIS_LISTHEADER.
CONCATENATE 'DATE:-' SY-DATUM INTO FDATE.
CONCATENATE 'TIME:-' SY-UZEIT INTO FTIME.
FNAME = 'NAME:- TEST'.
WA_HEADER-TYP = HEADER.
WA_HEADER-INFO = FNAME.
APPEND WA_HEADER TO WT_HEADER.
CLEAR WA_HEADER.
WA_HEADER-TYP = HEADER.
WA_HEADER-INFO = FDATE.
APPEND WA_HEADER TO WT_HEADER.
CLEAR WA_HEADER.
WA_HEADER-TYP = HEADER.
WA_HEADER-INFO = FTIME.
APPEND WA_HEADER TO WT_HEADER.
CLEAR WA_HEADER.
ENDFORM.
*& Form set_top_page_heading
text
-->P_T_HEADING text
*form set_top_page_heading using t_heading
t_events type slis_t_event.
*data: x_heading type slis_listheader,
x_event type line of slis_t_event.
Report title
clear t_heading[].
clear x_heading.
x_heading-typ = 'H'.
x_heading-info = ''(001).
append x_heading to t_heading.
t_heading-info = 'TEST'.
t_heading-typ = 'H'.
Program name
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Program: '.
x_heading-info = sy-repid.
append x_heading to t_heading.
User who is running the report
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'User: '.
x_heading-info = sy-uname.
append x_heading to t_heading.
Date of execution
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Date: '.
write sy-datum to x_heading-info.
append x_heading to t_heading.
Time of execution
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Time: '.
write sy-uzeit to x_heading-info.
append x_heading to t_heading.
Top of page event
x_event-name = slis_ev_top_of_page.
x_event-form = 'TOP_OF_PAGE'.
append x_event to t_events.
*endform. " set_top_page_heading
*please do reward points if helpful
Thanks and Regards,
S.N.Venkatesh -
Hi all,
I've created an ALV report which is having a editable checkbox box field and some more fields that are not editable.
My requirement is that when i check any checkbox, some of the fields in that particular row should become editable.
In table control it can be done easily but can it be done in ALV.
Note: I have created the ALV through container as it was required.
Thanks in Advance.
Regards
DheerajHi,
Basically you will have to first register the data change event after you display the grid as follows:-
CALL METHOD y_lobj_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>MC_EVT_MODIFIED
EXCEPTIONS
error = 1
OTHERS = 2.
Here Y_LOBJ_GRID is my grid object of type CL_GUI_ALV_GRID.
Then you will have to set a handler method for this.
SET HANDLER y_obj_evt_handler->y_m_handle_cell_modified
FOR Y_LOBJ_GRID.
Here y_obj_evt_handler is a local class in your program and y_m_handle_cell_modified is the method of that class.
In this method you can change the fields to make then editable or non editable.
Regards,
Ankur Parab -
Query Regarding ALV - Very Urgent
Hi experts,
I have defined a ALV grid in my program using the startdard function module as editable. Now I want the grid to be displayed in the screen with my pf-status. how can i do that?.
Here is the sample code.
REPORT zadvcformsub
NO STANDARD PAGE HEADING MESSAGE-ID zf
LINE-SIZE 255 LINE-COUNT 66.
INCLUDE zftsvar .
TYPE-POOLS : slis.
TABLES : zftsregstr, zftsintnum, zftscusttc,
zadvcform, konv, knvv, sscrfields.
DATA : it_fieldcat TYPE slis_t_fieldcat_alv.
DATA : w_layout TYPE slis_layout_alv,
w_fieldcat TYPE slis_fieldcat_alv.
DATA : BEGIN OF it_initial OCCURS 1,
bukrs(4) TYPE c,
wkreg(3) TYPE c,
zkunag(10) TYPE c,
validfrom(10) TYPE c,
validto(10) TYPE c,
vkorg(4) TYPE c,
aland(3) TYPE c,
zformtype(1) TYPE c,
frmintno(10) TYPE c,
uname(12) TYPE c,
datum(10) TYPE c,
uzeit(8) TYPE c,
END OF it_initial.
DATA : BEGIN OF it_part OCCURS 1,
zkunag LIKE zadvcform-zkunag,
frmintno LIKE zadvcform-frmintno,
validfrom LIKE zadvcform-validfrom,
validto LIKE zadvcform-validto,
END OF it_part.
DATA : w_sno(2) TYPE c,
w_cust(10) TYPE c,
w_cform(10) TYPE c,
w_from(10) TYPE c,
w_to(10) TYPE c,
w_blank1(10) TYPE c,
w_blank2(10) TYPE c,
w_blank3(10) TYPE c,
w_blank4(10) TYPE c,
w_string_len TYPE i,
w_sel_line(255) TYPE c,
w_indx(2) TYPE c.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:
s_bukrs FOR zadvcform-bukrs NO INTERVALS NO-EXTENSION OBLIGATORY,
s_aland FOR zadvcform-aland NO INTERVALS NO-EXTENSION OBLIGATORY,
s_wkreg FOR zadvcform-wkreg NO INTERVALS NO-EXTENSION OBLIGATORY,
s_vkorg FOR zadvcform-vkorg NO INTERVALS NO-EXTENSION OBLIGATORY,
s_fmtyp FOR zadvcform-zformtype NO INTERVALS NO-EXTENSION OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
INITIALIZATION.
AT SELECTION-SCREEN.
START-OF-SELECTION.
w_fieldcat-fieldname = 'ZKUNAG'.
w_fieldcat-tabname = 'IT_PART'.
w_fieldcat-ref_fieldname = 'ZKUNAG'.
w_fieldcat-ref_tabname = 'ZADVCFORM'.
w_fieldcat-seltext_l = 'Customer Code'.
w_fieldcat-ddictxt = 'L'.
w_fieldcat-input = 'X'.
w_fieldcat-edit = 'X'.
APPEND w_fieldcat TO it_fieldcat.
w_fieldcat-fieldname = 'FRMINTNO'.
w_fieldcat-tabname = 'IT_PART'.
w_fieldcat-ref_fieldname = 'FRMINTNO'.
w_fieldcat-ref_tabname = 'ZADVCFORM'.
w_fieldcat-seltext_l = 'C Form No'.
w_fieldcat-ddictxt = 'L'.
w_fieldcat-input = 'X'.
w_fieldcat-edit = 'X'.
APPEND w_fieldcat TO it_fieldcat.
w_fieldcat-fieldname = 'VALIDFROM'.
w_fieldcat-tabname = 'IT_PART'.
w_fieldcat-ref_fieldname = 'VALIDFROM'.
w_fieldcat-ref_tabname = 'ZADVCFORM'.
w_fieldcat-seltext_l = 'Valid From'.
w_fieldcat-ddictxt = 'L'.
w_fieldcat-input = 'X'.
w_fieldcat-edit = 'X'.
APPEND w_fieldcat TO it_fieldcat.
w_fieldcat-fieldname = 'VALIDTO'.
w_fieldcat-tabname = 'IT_PART'.
w_fieldcat-ref_fieldname = 'VALIDTO'.
w_fieldcat-ref_tabname = 'ZADVCFORM'.
w_fieldcat-seltext_l = 'Valid To'.
w_fieldcat-ddictxt = 'L'.
w_fieldcat-input = ' '.
w_fieldcat-edit = ' '.
APPEND w_fieldcat TO it_fieldcat.
DO 15 TIMES.
CLEAR it_part.
APPEND it_part.
ENDDO.
SET PF-STATUS 'ZADVCFORM_COPY'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_pf_status_set = 'ZADVCFORM_COPY'
it_fieldcat = it_fieldcat
i_grid_title = 'Advanced C Form Submission'
TABLES
t_outtab = it_part[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE i039(zaba) WITH 'Error in ALV'.
ENDIF.
I am geting the editable ALV grid but how to set my gui status.
regards,
Arul Jothi.Hi,
Here is an sample code to handle events.
DATA: I_EVENTS TYPE SLIS_T_EVENT.
PERFORM F4000_EVENTS_INIT CHANGING I_EVENTS.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
IT_EVENTS = I_EVENTS
TABLES
T_OUTTAB = I_MARA
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 F4000_EVENTS_INIT USING I_EVENTS TYPE SLIS_T_EVENT.
DATA: LINE_EVENT TYPE SLIS_ALV_EVENT.
CLEAR LINE_EVENT.
LINE_EVENT-NAME = 'TOP_OF_PAGE'.
LINE_EVENT-FORM = 'F4001_TOP_OF_PAGE'.
APPEND LINE_EVENT TO I_EVENTS.
CLEAR LINE_EVENT.
LINE_EVENT-NAME = 'PF_STATUS_SET'.
LINE_EVENT-FORM = 'F4002_PF_STATUS_SET'.
APPEND LINE_EVENT TO I_EVENTS.
CLEAR LINE_EVENT.
LINE_EVENT-NAME = 'USER_COMMAND'.
LINE_EVENT-FORM = 'F4003_USER_COMMAND'.
APPEND LINE_EVENT TO I_EVENTS.
ENDFORM.
FORM F4003_USER_COMMAND USING UCOMM LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
CASE UCOMM.
WHEN '&CHNG'.
READ TABLE I_MARA INDEX SELFIELD-TABINDEX.
IF I_MARA-MATNR NE SPACE.
SET PARAMETER ID 'MAT' FIELD I_MARA-MATNR.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
CLEAR UCOMM.
ENDIF.
ENDCASE.
ENDFORM. -
I have an internal table . One of the fields can take input in the ALV grid using ABAP objects.
When the user enters a value in this field , I would like to capture the values in all the cells of all the fields that are adjaccent to this editable field.
I think I will have to use data_changed event . The SLIS examples are a bit complex, If there is a simpler example to show how this can be done , it will be great.That's right, that is the event that you want to use. See example programs which start with BCALV_EDIT*
Regards,
Rich Heilman -
ALV event ON_CLICK - find out selected row?
I have an ALV table and in one of the columns I display a linkToAction in each cell.
When the link is clicked, i go to the ON_CLICK event handler and try to find out, which row is selected.
For this, I can take the attribute "INDEX" of the parameter "R_PARAM", and read the context with the given index.
METHOD alv_event_on_click .
DATA lo_nd_my_node TYPE REF TO if_wd_context_node.
DATA lt_my_table TYPE wd_this->elements_my_table.
DATA ls_my_structure TYPE wd_this->element_my_struture.
* click on prduct standard name link
IF r_param->attribute = 'NAME_OF_THE_COLUMN'.
lo_nd_my_node = wd_context->get_child_node( name = wd_this->wdctx_my_node ).
lo_nd_my_node->get_static_attributes_table( IMPORTING table = lt_my_table ). "this is not sorted!!!!
lo_nd_my_node->set_lead_selection_index( index = r_param->index ).
READ TABLE lt_my_table INTO ls_my_structure INDEX r_param->index. "lt_my_table table might be sorted differently!!!!
IF sy-subrc = 0.
wd_this->do_something_with( ls_my_strcture ).
ENDIF.
ENDIF.
ENDMETHOD.
However, this does not work when I sort the ALV before!
For a strange reason, the table that I get from the context is not sorted the same way as the data in the ALV.
What can I do?Hi Daniel,
I don't know if the external mapping messes things up.
Perhaps you could try the following:
lo_nd_my_node->get_static_attributes(
EXPORTING
index = r_param->index
IMPORTING
static_attributes = ls_my_structure ).
It could be that passing the data towards your internal table doesn't take over the sort.
If you try debugging and check out the contents of the node, are they sorted correctly or not?
Regards and good luck.
Jos -
hi,
i had made a report which is showing correct data but now i want to display the heading and other fields which are used to be dere:-
<b>PHYSICAL INVENTORY REPORT</b>
PERIOD:- ___ TO ___ PLANT:-_________
CONTROL NO. :- ______
CONTROL DATE :- _____
I am not able to display dis format in my alv report, so plzzz help me out as it is most urgent to me and u will definately get rewards for it....
Regards,
ric.srefer this code....
use events top of page or top of list whatever u want.....n put required fields....
REPORT ZALV1.
******************TABLE DECLARATION***********************************
TABLES : VBAP. " tables declaration
*****************TYPE POOLS*******************************************
TYPE-POOLS : SLIS. " slis type pool
*****************INTERNAL TABLE DECLARATION***************************
DATA : BEGIN OF IT_VBAP OCCURS 0,
" internal table for sales document item
VBELN LIKE VBAP-VBELN, " sales document
POSNR LIKE VBAP-POSNR, " document item
ERNAM LIKE VBAP-ERNAM,
" name of the person who created the object
ERDAT LIKE VBAP-ERDAT, " date on which the record was created
MATNR LIKE VBAP-MATNR. " material number
DATA : END OF IT_VBAP.
DATA : BEGIN OF IT_MARA OCCURS 0, " general material data
MATNR LIKE MARA-MATNR, " material number
ERNAM LIKE MARA-ERNAM,
" name of the person who created the object
MATKL LIKE MARA-MATKL, " material group
MEINS LIKE MARA-MEINS, " base unit of measure
PSTAT LIKE MARA-PSTAT. " maintainence status
DATA : END OF IT_MARA.
******************VARIABLE
DECLARATION**********************************
DATA : REPID LIKE SY-REPID. " program name
DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
" field catalog table for vbap
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA : IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
" field catalog table for mara
WA_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV.
DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA: GT_XEVENTS TYPE SLIS_T_EVENT.
DATA: GT_YEVENTS TYPE SLIS_T_EVENT. " events table
DATA : XS_EVENT TYPE SLIS_ALV_EVENT. " events type
DATA : GT_PRINT TYPE SLIS_PRINT_ALV. " print table
*******************MULTIPLE SELECT INPUT
PARAMETERS**********************
SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.
" multiple selection for sales document
******************INITIALIZATION**************************************
INITIALIZATION.
REPID = SY-REPID.
*******************START OF
SELECTION************************************
START-OF-SELECTION.
PERFORM POP_VBAP.
" populating the table with document item data
PERFORM POP_MARA.
" populating the table with general material data
PERFORM FIELD_CAT.
" mapping the fields for the field catalog
PERFORM EVENTS. " using the events
PERFORM BLOCK_LIST.
" displaying the data in blocked list
*& Form field_cat
text
--> p1 text
<-- p2 text
FORM FIELD_CAT .
WA_FIELDCAT-FIELDNAME = 'VBELN'.
WA_FIELDCAT-TABNAME = 'IT_VBAP'.
WA_FIELDCAT-SELTEXT_L = 'SALES DOC'.
WA_FIELDCAT-COL_POS = 1.
WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'POSNR'.
WA_FIELDCAT-TABNAME = 'IT_VBAP'.
WA_FIELDCAT-SELTEXT_L = 'DOC ITEM'.
WA_FIELDCAT-COL_POS = 2.
WA_FIELDCAT-OUTPUTLEN = 6.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ERNAM'.
WA_FIELDCAT-TABNAME = 'IT_VBAP'.
WA_FIELDCAT-SELTEXT_L = 'NAME'.
WA_FIELDCAT-COL_POS = 3.
WA_FIELDCAT-OUTPUTLEN = 12.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ERDAT'.
WA_FIELDCAT-TABNAME = 'IT_VBAP'.
WA_FIELDCAT-SELTEXT_L = 'DATE'.
WA_FIELDCAT-COL_POS = 4.
WA_FIELDCAT-OUTPUTLEN = 8.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-TABNAME = 'IT_VBAP'.
WA_FIELDCAT-SELTEXT_L = 'MAT NO'.
WA_FIELDCAT-COL_POS = 5.
WA_FIELDCAT-OUTPUTLEN = 18.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT1-FIELDNAME = 'MATNR'.
WA_FIELDCAT1-TABNAME = 'IT_MARA'.
WA_FIELDCAT1-SELTEXT_L = 'MAT NO'.
WA_FIELDCAT1-COL_POS = 1.
WA_FIELDCAT1-OUTPUTLEN = 18.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-FIELDNAME = 'ERNAM'.
WA_FIELDCAT1-TABNAME = 'IT_MARA'.
WA_FIELDCAT1-SELTEXT_L = 'NAME'.
WA_FIELDCAT1-COL_POS = 2.
WA_FIELDCAT1-OUTPUTLEN = 12.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-FIELDNAME = 'MATKL'.
WA_FIELDCAT1-TABNAME = 'IT_MARA'.
WA_FIELDCAT1-SELTEXT_L = 'MAT DESC'.
WA_FIELDCAT1-COL_POS = 3.
WA_FIELDCAT1-OUTPUTLEN = 9.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-FIELDNAME = 'MEINS'.
WA_FIELDCAT1-TABNAME = 'IT_MARA'.
WA_FIELDCAT1-SELTEXT_L = 'UNITS'.
WA_FIELDCAT1-COL_POS = 4.
WA_FIELDCAT1-OUTPUTLEN = 3.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-FIELDNAME = 'PSTAT'.
WA_FIELDCAT1-TABNAME = 'IT_MARA'.
WA_FIELDCAT1-SELTEXT_L = 'STATUS'.
WA_FIELDCAT1-COL_POS = 5.
WA_FIELDCAT1-OUTPUTLEN = 15.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
ENDFORM. " field_cat
*& Form events
text
--> p1 text
<-- p2 text
FORM EVENTS .
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_END_OF_PAGE.
XS_EVENT-FORM = 'XEND_OF_PAGE'.
APPEND XS_EVENT TO GT_XEVENTS.
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
XS_EVENT-FORM = 'XTOP_OF_PAGE'.
APPEND XS_EVENT TO GT_XEVENTS.
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_TOP_OF_LIST.
XS_EVENT-FORM = 'XTOP_OF_LIST'.
APPEND XS_EVENT TO GT_XEVENTS.
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_END_OF_LIST.
XS_EVENT-FORM = 'XEND_OF_LIST'.
APPEND XS_EVENT TO GT_XEVENTS.
CLEAR XS_EVENT.
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_END_OF_PAGE.
XS_EVENT-FORM = 'YEND_OF_PAGE'.
APPEND XS_EVENT TO GT_YEVENTS.
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
XS_EVENT-FORM = 'YTOP_OF_PAGE'.
APPEND XS_EVENT TO GT_YEVENTS.
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_TOP_OF_LIST.
XS_EVENT-FORM = 'YTOP_OF_LIST'.
APPEND XS_EVENT TO GT_YEVENTS.
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_END_OF_LIST.
XS_EVENT-FORM = 'YEND_OF_LIST'.
APPEND XS_EVENT TO GT_YEVENTS.
ENDFORM. " events
*& Form XTOP_OF_PAGE
text
FORM XTOP_OF_PAGE.
BREAK-POINT.
WRITE: / 'X_TOP_OF_PAGE'.
ENDFORM. "XTOP_OF_PAGE
FORM XTOP_OF_LIST *
FORM XTOP_OF_LIST.
BREAK-POINT.
WRITE: / 'X_TOP_OF_LIST'.
ENDFORM. "XTOP_OF_LIST
FORM XEND_OF_PAGE *
FORM XEND_OF_PAGE.
BREAK-POINT.
WRITE: / 'X_END_OF_PAGE'.
ENDFORM. "XEND_OF_PAGE
FORM XEND_OF_LIST *
FORM XEND_OF_LIST.
BREAK-POINT.
WRITE: / 'X_END_OF_LIST'.
ENDFORM. "XEND_OF_LIST
FORM YTOP_OF_PAGE.
BREAK-POINT.
WRITE: / 'Y_TOP_OF_PAGE'.
ENDFORM. "YTOP_OF_PAGE
FORM YTOP_OF_LIST *
FORM YTOP_OF_LIST.
BREAK-POINT.
WRITE: / 'Y_TOP_OF_LIST'.
ENDFORM. "YTOP_OF_LIST
FORM YEND_OF_PAGE *
FORM YEND_OF_PAGE.
BREAK-POINT.
WRITE: / 'Y_END_OF_PAGE'.
ENDFORM. "YEND_OF_PAGE
FORM YEND_OF_LIST *
FORM YEND_OF_LIST.
BREAK-POINT.
WRITE: / 'Y_END_OF_LIST'.
ENDFORM. "YEND_OF_LIST
*& Form POP_VBAP
text
--> p1 text
<-- p2 text
FORM POP_VBAP .
SELECT VBELN
POSNR
ERNAM
ERDAT
MATNR
FROM VBAP
INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
WHERE VBELN IN S_VBELN.
ENDFORM. " POP_VBAP
*& Form POP_MARA
text
--> p1 text
<-- p2 text
FORM POP_MARA .
LOOP AT IT_VBAP.
SELECT SINGLE MATNR
ERNAM
MATKL
MEINS
PSTAT
FROM MARA
INTO CORRESPONDING FIELDS OF IT_MARA
WHERE MATNR = IT_VBAP-MATNR.
APPEND IT_MARA.
ENDLOOP.
ENDFORM. " POP_MARA
*& Form BLOCK_LIST
text
--> p1 text
<-- p2 text
FORM BLOCK_LIST .
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
I_CALLBACK_PROGRAM = REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'user_command'.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
I_TABNAME = 'IT_VBAP'
IT_EVENTS = GT_XEVENTS
IT_SORT =
I_TEXT = ' '
TABLES
T_OUTTAB = IT_VBAP
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 = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT1
I_TABNAME = 'IT_MARA'
IT_EVENTS = GT_YEVENTS
IT_SORT =
I_TEXT = ' '
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.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
IS_PRINT = GT_PRINT
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
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. " BLOCK_LIST
Maybe you are looking for
-
How can I remove an OVS extension from a context attribute?
In our Web Dynpro application we provide a generic search mask to the user. The information about the search fields like labels, length etc. is retrieved from the backend during runtime. Also, the information if there should be a value help available
-
Hi there, In my SP 2010 document library - When I try to save an Excel file from File > Save As menu to the document library it always prompts me "File already exists. Do you want to replace it?" even though the file does not exist in that document l
-
How to group...
Hi guys, Here's what seems to be a rather easy question. How does one set several tracks up as a group? And once they are set up as a group, can you edit their individual parameters, with every track in the group responding to this one global edit? H
-
Cmd+shift+4 screenshot files do get created on Leopard??
Hi, I have a fresh install of Leopard that has since been "software updated" to 10.5.1. When I cmdshift4 to create a screen shot, I get the screen area selector, and I hear the little camera shutter noise, but no files are created. In Tiger I used to
-
PR field mandetory in Purchase order
Dear All, I want make PR field mandetory in ME21 and ME21N, Not possible from Define Screen Layout at Document Level What are the other ways ? Please reply. Regards, SFG