‎2007 Aug 07 3:02 PM
Hi all,
hope all are doing good..
im working on alvs using function modules reuse_alv*
1.How can we handle date values.for example 13072007 had to be displayed in 13.07.2007 in ALV using function modules.
2.how to handle top-of-page in alv using function modules?
3. how to handle left and right justification in alvs using function modules?
urgent plss
regards
jack
‎2007 Aug 07 3:04 PM
2A)
data:
i_fieldcat_alv type slis_t_fieldcat_alv,
i_events type slis_t_event,
i_event_exit type slis_t_event_exit,
i_list_comments type slis_t_listheader,
i_excluding type slis_t_extab.
Global Variables
*----
data:
w_variant like disvariant,
wx_variant like disvariant,
w_variant_save(1) type c,
w_exit(1) type c,
w_repid like sy-repid,
w_user_specific(1) type c,
w_callback_ucomm type slis_formname,
w_print type slis_print_alv,
w_layout type slis_layout_alv,
w_html_top_of_page type slis_formname,
w_fieldcat_alv like line of i_fieldcat_alv,
w_excluding like line of i_excluding,
w_events like line of i_events,
w_event_exit like line of i_event_exit,
w_list_comments like line of i_list_comments.
perform event_build.
&----
*& Form event_build
&----
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 w_events.
if sy-subrc = 0.
move 'ALV_TOP_OF_PAGE' to w_events-form.
modify i_events from w_events index sy-tabix.
endif.
read table i_events
with key name = slis_ev_end_of_list
into w_events.
if sy-subrc = 0.
move 'ALV_END_OF_LIST' to w_events-form.
modify i_events from w_events index sy-tabix.
endif.
read table i_events
with key name = slis_ev_end_of_page
into w_events.
if sy-subrc = 0.
move 'ALV_END_OF_PAGE' to w_events-form.
modify i_events from w_events index sy-tabix.
endif.
endform.
----
FORM alv_end_of_list *
----
form alv_end_of_list.
clear: i_list_comments[].
w_list_comments-typ = 'A'. "H = Header, S = Selection, A = Action
w_list_comments-key = ''.
w_list_comments-info = 'End of list'.
append w_list_comments to i_list_comments.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = i_list_comments
i_logo = 'ZMYOBJECTKEY'
i_end_of_list_grid = 'X'.
endform.
----
FORM alv_end_of_page *
----
form alv_end_of_page.
endform.
Regards,
Pavan
‎2007 Aug 07 3:07 PM
1A)
CTCF_SET_EDIT_MASK.
Hope this FM may help you......
Or develop your logic using
WRITE /(30) time USING EDIT MASK
'RRThe duration is __:__:__'.
3A)
same with justification.......
WRITE: /(60) 'Left' LEFT-JUSTIFIED,
/(60) 'Center' CENTERED,
/(60) 'Right' RIGHT-JUSTIFIED.
Regards,
Pavan
‎2007 Aug 07 3:08 PM
Hi,
if you goto SE38 and give BCALV* then press F4 then you will all the SAP standard ALV demo programs, you will all the answers in those programs, you can look at the programs based on the Description of the program
Regards
Sudheer
‎2007 Aug 07 3:10 PM
Hi Jack,
You can check these,
1) Maintain the field as date or 8 character, for which you would like to show the date format. Before passing the internal table to the ALV FunctionModule, you can change the format of the value to date using
CONCATENATE <FIELD>0(2) '.' <FIELD>2(2) '.' <FIELD>+4(4) INTO <FIELD>.
2) Regarding the Usage of TOP OF PAGE event, refer to the code below,
<b>DATA: gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
DATA: gt_list_top_of_page TYPE slis_t_listheader.
FORM display_output1.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = wa_repname
i_callback_pf_status_set = 'STATUS_SET'(003)
i_callback_user_command = 'USER_COMMAND'(004)
i_callback_top_of_page = 'TOP_OF_PAGE'
is_layout = i_layout1
it_fieldcat = i_fieldcat1
TABLES
t_outtab = i_first.
ENDFORM. " display_output
FORM top_of_page.
DATA: theader TYPE slis_t_listheader,
waheader TYPE slis_listheader.
*
waheader-typ = c_h.
CONCATENATE 'Selection Criteria '(t01) ' '
INTO waheader-info SEPARATED BY space.
APPEND waheader TO theader.
CLEAR waheader.
*
waheader-typ = c_s.
CONCATENATE 'Sales Organization'(s02)
s_vkorg-low 'TO'(s03) s_vkorg-high
INTO waheader-info SEPARATED BY space.
APPEND waheader TO theader.
CLEAR waheader.
*
waheader-typ = c_s.
CONCATENATE 'Distribution Channel'(s04)
s_vtweg-low 'TO'(s03) s_vtweg-high
INTO waheader-info SEPARATED BY space.
APPEND waheader TO theader.
CLEAR waheader.
*
waheader-typ = c_s.
CONCATENATE 'Sold-To-Party :'(s05)
s_kunnr-low 'TO'(s03) s_kunnr-high
INTO waheader-info SEPARATED BY space.
APPEND waheader TO theader.
CLEAR waheader.
*
waheader-typ = c_s.
CONCATENATE 'Plant :'(s06)
s_werks-low 'TO'(s03) s_werks-high
INTO waheader-info SEPARATED BY space.
APPEND waheader TO theader.
CLEAR waheader.
*
waheader-typ = c_s.
CONCATENATE 'Billing Date :'(s07)
s_fkdat-low 'TO'(s03) s_fkdat-high
INTO waheader-info SEPARATED BY space.
APPEND waheader TO theader.
CLEAR waheader.
*
waheader-typ = c_s.
CONCATENATE 'Billing Type :'(s08)
s_fkart-low 'TO'(s03) s_fkart-high
INTO waheader-info SEPARATED BY space ..
APPEND waheader TO theader.
CLEAR waheader.
*
waheader-typ = c_s.
CONCATENATE 'Billing Number :'(s09)
s_vbeln-low 'TO'(s03) s_vbeln-high
INTO waheader-info SEPARATED BY space ..
APPEND waheader TO theader.
CLEAR waheader.
*
waheader-typ = c_s.
CONCATENATE 'Sales Order Number :'(s10)
s_slord-low 'TO'(s03) s_slord-high
INTO waheader-info SEPARATED BY space ..
APPEND waheader TO theader.
CLEAR waheader.
*
waheader-typ = c_s.
CONCATENATE 'Reference :'(s11)
s_ihrez-low 'TO'(s03) s_ihrez-high
INTO waheader-info SEPARATED BY space .
APPEND waheader TO theader.
CLEAR waheader.
*
IF NOT rb_loc IS INITIAL.
CLEAR v_filenam.
v_filenam = p_avpf.
PERFORM retrieve_filename CHANGING v_filenam.
waheader-typ = c_s.
CONCATENATE 'AVP Filename :'(s12)
v_filenam
INTO waheader-info SEPARATED BY space .
APPEND waheader TO theader.
CLEAR waheader.
*
CLEAR v_filenam.
v_filenam = p_sapf.
PERFORM retrieve_filename CHANGING v_filenam.
waheader-typ = c_s.
CONCATENATE 'SAP Filename :'(s13)
v_filenam
INTO waheader-info SEPARATED BY space .
APPEND waheader TO theader.
CLEAR waheader.
*
ELSEIF NOT rb_net IS INITIAL.
waheader-typ = c_s.
CONCATENATE 'Logical Path :'(s14)
p_dsser
INTO waheader-info SEPARATED BY space .
APPEND waheader TO theader.
CLEAR waheader.
*
CLEAR v_filenam.
v_filenam = p_avpfil.
PERFORM retrieve_filename CHANGING v_filenam.
waheader-typ = c_s.
CONCATENATE 'AVP Filename :'(s12)
v_filenam
INTO waheader-info SEPARATED BY space .
APPEND waheader TO theader.
CLEAR waheader.
*
CLEAR v_filenam.
v_filenam = p_sapfil.
PERFORM retrieve_filename CHANGING v_filenam.
waheader-typ = c_s.
CONCATENATE 'SAP Filename :'(s13)
v_filenam
INTO waheader-info SEPARATED BY space .
APPEND waheader TO theader.
CLEAR: waheader, v_filenam.
*
ENDIF.
*
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = theader.
ENDFORM. " TOP_OF_PAGE
</b>
3) Right Justification and Left Justification in ALV doesn't require Function Modules, You can use JUST property within the Field Catalog.
eg. W_FIELDCATALOG-JUST = 'R'. "for right justification.
<b>Reward points if this helps,</b>
Kiran