Top-of-page for list display thru ALV
Hi All,
I was suppose to write a detail report thru ALV, this I have handled thru hotspot and in the user_command,I am have the below code.. for ALv I am using FM REUSE_ALV_GRID_DISPLAY
FORM User_command.
WHEN '&IC1'.
PERFORM LIST_DISPLAY using RS_SELFIELD-tabindex.
ENDFORM.
FORM LIST_DISPLAY USING P_INDEX.
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 500.
SET PF-STATUS space.
SUPPRESS DIALOG.
Read table g_t_sum index p_index.
loop at g_t_emp where code = g_t_sum-code and
keyfld = g_t_sum-keyfld
write :/ g_t_emp-pernr, 10(25) g_t_emp-sname.
endloop.
ENDFORM.
The above write statment is not trigerring either top-of-page ot top-od-page during line-selection.
I have even tried pushing the event and form name into it it_events..
Kindly suggest how to go about this, I need to get top-of-page for this list-display.
Thanks in advance
Regards,
Mangalagi S V
Hi All,
Thanks for all your replies.
I am not looking at top_of_page for GRID, it's working for me but I need top_of_page for the list display that is for the list which I am generating when the users double click it particular row.
By default I am getting the below header automatically.
Dynamic data selection 1
Though I have coded the header in top-of-page during line selection since I am writing the list under USER_COMMAND, I thought I will get the header but it's not..
The FM is attached below..
Ausgaberoutine mit FB REUSE_ALV_GRID_DISPLAY
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_f_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
i_callback_top_of_page = 'TOP_OF_PAGE'
is_layout = g_r_layout
it_fieldcat = g_t_fcat
i_save = 'A'
is_variant = s_variant "70492INF0039
is_variant = g_f_variant "70492INF0039
is_events = it_events[]
TABLES
t_outtab = g_t_sum.
FORM USER_COMMAND *
Callbackroutine: Ausgabe Fehlerliste XDGL9CK069538 *
FORM USER_COMMAND USING R_UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
case r_ucomm.
when 'OK'.
WHEN '&IC1'.
PERFORM LIST_DISPLAY using RS_SELFIELD-tabindex.
endcase.
ENDFORM.
Kindly suggest
Thanks in advance.
Regards,
Mangalagi S V
Similar Messages
-
Problem while displaying top of page in list display
Hi,
M facing problem in displaying top of page in list .
M using following methods:-
lr_outer_grid TYPE REF TO cl_salv_form_layout_grid,
lr_inner_grid TYPE REF TO cl_salv_form_layout_grid,
lr_label TYPE REF TO cl_salv_form_label,
lr_text TYPE REF TO cl_salv_form_text.
For displaying the top of page m using event TOP_OF_PAGE.
CREATE OBJECT lr_outer_grid.
*Outer grid
lr_inner_grid = lr_outer_grid->create_grid(
row = 1
column = 1 ).
*... create lable information in inner_grid
User ID
lr_label = lr_inner_grid->create_label(
row = 1
column = 1
text = text-h03 ).
*... create text information in inner_grid
lr_text = lr_inner_grid->create_text(
row = 1
column = 2
text = sy-uname ).
*... set label for text
lr_label->set_label_for( lr_text ).
But while m going to do same coding for second parameter its not intializing length so adding extra spaces while displaying second row.
e.g
USERID abcdefghjik
PLANT jhk to hjk
I want that output should look like
USERID abcdefghjik
PLANT jhk to hjk
Please tell me the solution what should i do for avoiding extra spaceHi Neelema,
You could try this sample code.
[http://sap-img.com/fu037.htm]
[http://sap-img.com/abap/sample-alv-heading-in-alv.htm]
Regards,
Amit. -
How to display horizontal line in top-of-page by using object oriented ALV?
How to display horizontal line in top-of-page by using object oriented ALV.
I am created top-of-page in object oriented alv.
But not be successes in showing horizontal line in it.
Can any one pls give solution for this..
Thanks and regards..Hi
Try like this
data: gt_list_top_of_page type slis_t_listheader. " Top of page text.
Initialization.
perform comment_build using gt_list_top_of_page[].
form top_of_page.
* Note to self: the gif must be loaded into transaction OAOR with
* classname 'PICTURES' AND TYPE 'OT' to work with ALV GRID Functions.
* I Loaded NOVALOGO2 into system.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
* I_LOGO = 'NOVALOGO2'
* i_logo = 'ENJOYSAP_LOGO'
it_list_commentary = gt_list_top_of_page.
endform. " TOP_OF_PAGE
form comment_build using e04_lt_top_of_page type slis_t_listheader.
data: ls_line type slis_listheader.
clear ls_line.
ls_line-typ = 'A'.
ls_line-info = 'Special'(001).
fgrant = xgrant.
concatenate ls_line-info fgrant
'Stock Option Report to the board'(002)
into ls_line-info separated by space.
condense ls_line-info.
append ls_line to e04_lt_top_of_page.
endform. " COMMENT_BUILD
Use following syntex for footer print in alv:
* For End of Page
form END_OF_PAGE.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
write: sy-uline(50).
skip.
write:/40 'Page:', sy-pagno .
endform.
* For End of Report
form END_OF_LIST.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
skip.
write:/40 'Page:', sy-pagno .
endform.
check this link
http://abapprogramming.blogspot.com/
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5dc3e690-0201-0010-1ebf-b85b3bed962d
Changing width of a custom container dynamically
Display Page numbers in ALV
Insert picture in selection screen.
Logo in OO ALV Grid
Reward all helpfull answers
Regards
Pavan -
Hi all,
Somebody Could tell me how can I create a top-of-page for my OO ALV report?
Please help...!
Thanks in advance.
regards Marisol.HI,
You should set the handler for the event :
SET HANDLER l_event->handle_top_of_page FOR grid.
And then call the set_table_for_first_display
CALL METHOD grid->set_table_for_first_display
EXPORTING
is_layout = gd_layout
CHANGING
it_outtab = outtab[]
it_fieldcatalog = gd_fieldcat[].
In The handle_top_of_page method you can then make some WRITE statemments.
Regards,
David Matias -
IW69 from List Display to ALV Gird Display
Hi All
Transaction IW69 is working as List display for other users and ALV gird for my user. I would like to change from list display to ALV gird for other users too. How could i do this.
Kindly help me.
ThanksI am seeing ony Line1 Line2 Line3 tabs in the path Settings->Layout->Current for other users but the option you specified is there for my user.
thanks -
How to print the top of page part along with the ALV list and generate PDF
HI all,
I have created one ALV by using oops concept .
and also am able to get the top of page where I have One standard logo on the right hand side
and some details on the left side .
Now my requirement is to while printing the list the logo and other top of page details should appear
In the PDF output but currently while am pressing the print preview button only the alv data is coming
am already using the method
handle_top_of_page
FOR EVENT print_top_of_page
OF cl_gui_alv_grid,
may be am missing something ... How to get the top of page along with the logo printed ?Hi Surya,
After generating the grid display click on print button,
a spool number is generated. capture the spool number and convert it to pdf using the fm:
CONVERT_ABAPSPOOLJOB_2_PDF and save the file
Hope this will solve your problem.
Regards,
R K. -
ALV Top of Page is not displaying
Hi,
in this program TOP OF PAGE is displaying as empty
* Tables
TABLES:/irm/ipsipart.
* Type pools
TYPE-POOLS slis.
* Types
TYPES:BEGIN OF typ_ipsipart,
depcode TYPE /irm/ip_depcode,
partid TYPE /irm/ip_ktonr,
endda TYPE /irm/ip_pedat,
begda TYPE /irm/ip_pbdat,
END OF typ_ipsipart.
TYPES:BEGIN OF typ_pa0000,
pernr TYPE persno,
endda TYPE endda,
begda TYPE begda,
massn TYPE massn,
massg TYPE massg,
stat2 TYPE stat2,
partid TYPE /irm/ip_ktonr,
END OF typ_pa0000.
TYPES:BEGIN OF typ_pa0001,
pernr TYPE persno,
endda TYPE endda,
ename TYPE ename,
END OF typ_pa0001.
TYPES:BEGIN OF typ_pernr,
pernr TYPE persno,
END OF typ_pernr.
TYPES:BEGIN OF typ_a942,
zzpersnr TYPE persno,
END OF typ_a942.
TYPES:BEGIN OF typ_a943,
zzpersnr TYPE persno,
END OF typ_a943.
TYPES:BEGIN OF typ_a976,
zzpersnr TYPE persno,
END OF typ_a976.
TYPES:BEGIN OF typ_final,
pernr TYPE persno,
ename TYPE ename,
begda TYPE begda,
statx(9) TYPE c,
mgtxt TYPE mgtxt,
depcode TYPE /irm/ip_depcode,
begda_c TYPE /irm/ip_pbdat,
endda_c TYPE /irm/ip_pedat,
END OF typ_final.
TYPES:BEGIN OF typ_t530t,
massn TYPE massn,
massg TYPE massg,
mgtxt TYPE mgtxt,
END OF typ_t530t.
* Internal Tables
DATA:it_a942 TYPE TABLE OF typ_a942,
it_a943 TYPE TABLE OF typ_a943,
it_a976 TYPE TABLE OF typ_a976,
it_pernr TYPE TABLE OF typ_pernr,
it_pa0000 TYPE TABLE OF typ_pa0000,
it_pa0001 TYPE TABLE OF typ_pa0001,
it_ipsipart TYPE TABLE OF typ_ipsipart,
it_final TYPE TABLE OF typ_final,
it_t530t TYPE TABLE OF typ_t530t.
* Work areas
DATA:wa_a942 TYPE typ_a942,
wa_a943 TYPE typ_a943,
wa_a976 TYPE typ_a976,
wa_pernr TYPE typ_pernr,
wa_pa0000 TYPE typ_pa0000,
wa_pa0001 TYPE typ_pa0001,
wa_ipsipart TYPE typ_ipsipart,
wa_final TYPE typ_final,
wa_t530t TYPE typ_t530t.
* Constants
CONSTANTS:c_stat2 TYPE stat2 VALUE '0',
c_statx(9) TYPE c VALUE 'Withdrawn',
c_endda TYPE endda VALUE '99991231',
c_ptype TYPE /irm/ip_patype VALUE 'PE',
c_kappl TYPE kappl VALUE 'V',
c_ysam TYPE kschl VALUE 'YSAM',
c_ysdm TYPE kschl VALUE 'YSDM',
c_yssm TYPE kschl VALUE 'YSSM',
c_ysse TYPE kschl VALUE 'YSSE',
c_sprsl TYPE spras VALUE 'E'.
* Variables
DATA:v_begda TYPE begda,
v_endda TYPE endda.
DATA:v_variant LIKE disvariant,
v_save(1) TYPE c,
v_repid TYPE sy-repid.
* ALV Declaraion Part
* FIELD CATALOG DECLARATION *****
DATA:it_fcat TYPE slis_t_fieldcat_alv,
wa_fcat TYPE slis_fieldcat_alv.
* ALV SORT INFORMATION *****
DATA:wa_sort TYPE slis_sortinfo_alv,
it_sort TYPE slis_t_sortinfo_alv.
*ALV LAYOUT INFORMATION *****
DATA:wa_layout TYPE slis_layout_alv.
*ALV TOOLBAR EXCLUDING *****
DATA:it_excluding TYPE slis_t_extab,
wa_excluding TYPE slis_extab.
* Selection Screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:s_pernr FOR /irm/ipsipart-partid,
s_date FOR /irm/ipsipart-begda OBLIGATORY NO-EXTENSION,
s_depcod FOR /irm/ipsipart-depcode.
SELECTION-SCREEN END OF BLOCK b1.
* At Selection Screen
AT SELECTION-SCREEN.
IF NOT s_date-low IS INITIAL AND s_date-high IS NOT INITIAL.
READ TABLE s_date INDEX 1.
v_begda = s_date-low.
v_endda = s_date-high.
ENDIF.
IF s_date-low IS INITIAL AND s_date-high IS NOT INITIAL.
READ TABLE s_date INDEX 1.
v_begda = s_date-high.
v_endda = s_date-high.
ENDIF.
IF s_date-low IS NOT INITIAL AND s_date-high IS INITIAL.
READ TABLE s_date INDEX 1.
v_begda = s_date-low.
v_endda = s_date-low.
ENDIF.
* Start of selection
START-OF-SELECTION.
break vkreddy1x.
PERFORM get_data.
PERFORM move_data_to_finalitab.
IF NOT it_final[] IS INITIAL.
PERFORM field_catalog TABLES it_final
USING it_fcat[]
wa_fcat.
PERFORM alv_sort_info USING it_sort[]
wa_sort.
PERFORM alv_layout_build USING wa_layout.
PERFORM alv_toolbar_excluding USING it_excluding[]
wa_excluding.
PERFORM load-variant USING v_variant v_repid v_save.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
i_callback_top_of_page = 'TOP_OF_PAGE'
is_layout = wa_layout
it_fieldcat = it_fcat
it_excluding = it_excluding
it_sort = it_sort
i_save = v_save
is_variant = v_variant
TABLES
t_outtab = it_final
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.
ELSE.
PERFORM info_msg.
ENDIF.
*& Form GET_DATA
* text
* --> p1 text
* <-- p2 text
FORM get_data .
SELECT zzpersnr FROM a942 INTO TABLE it_a942 WHERE kappl = c_kappl
AND kschl = c_ysdm
AND datbi >= v_begda
AND datab <= v_endda.
IF sy-subrc EQ 0.
SORT it_a942 BY zzpersnr.
DELETE ADJACENT DUPLICATES FROM it_a942 COMPARING zzpersnr.
LOOP AT it_a942 INTO wa_a942.
MOVE wa_a942-zzpersnr TO wa_pernr-pernr.
APPEND wa_pernr TO it_pernr.
CLEAR:wa_pernr,wa_a942.
ENDLOOP.
ENDIF.
SELECT zzpersnr FROM a943 INTO TABLE it_a943 WHERE kappl = c_kappl
AND ( kschl = c_ysam
OR kschl = c_ysse )
AND datbi >= v_begda
AND datab <= v_endda.
IF sy-subrc EQ 0.
SORT it_a943 BY zzpersnr.
DELETE ADJACENT DUPLICATES FROM it_a943 COMPARING zzpersnr.
LOOP AT it_a943 INTO wa_a943.
MOVE wa_a943-zzpersnr TO wa_pernr-pernr.
APPEND wa_pernr TO it_pernr.
CLEAR:wa_pernr,wa_a943.
ENDLOOP.
ENDIF.
SELECT zzpersnr FROM a976 INTO TABLE it_a976 WHERE kappl = c_kappl
AND kschl = c_yssm
AND datbi >= v_begda
AND datab <= v_endda.
IF sy-subrc EQ 0.
SORT it_a976 BY zzpersnr.
DELETE ADJACENT DUPLICATES FROM it_a976 COMPARING zzpersnr.
LOOP AT it_a976 INTO wa_a976.
MOVE wa_a976-zzpersnr TO wa_pernr-pernr.
APPEND wa_pernr TO it_pernr.
CLEAR:wa_pernr,wa_a976.
ENDLOOP.
ENDIF.
SORT it_pernr BY pernr.
DELETE ADJACENT DUPLICATES FROM it_pernr COMPARING pernr.
IF NOT it_pernr[] IS INITIAL.
SELECT pernr endda begda massn massg stat2 FROM pa0000
INTO TABLE it_pa0000
FOR ALL ENTRIES IN it_pernr
WHERE pernr = it_pernr-pernr
AND endda >= v_begda
AND begda <= v_endda
AND stat2 = c_stat2.
ENDIF.
LOOP AT it_pa0000 INTO wa_pa0000.
wa_pa0000-partid = wa_pa0000-pernr.
MODIFY TABLE it_pa0000 FROM wa_pa0000 .
ENDLOOP.
IF NOT it_pa0000[] IS INITIAL.
SELECT depcode partid endda begda FROM /irm/ipsipart
INTO CORRESPONDING FIELDS OF TABLE it_ipsipart
FOR ALL ENTRIES IN it_pa0000
WHERE nrart = c_ptype
AND partid = it_pa0000-partid
AND endda >= it_pa0000-begda
AND begda <= it_pa0000-endda.
SELECT pernr ename FROM pa0001 INTO TABLE it_pa0001
FOR ALL ENTRIES IN it_pa0000
WHERE pernr = it_pa0000-pernr
AND endda = c_endda.
SELECT mgtxt FROM t530t INTO TABLE it_t530t
FOR ALL ENTRIES IN it_pa0000
WHERE sprsl = c_sprsl
AND massn = it_pa0000-massn
AND massg = it_pa0000-massg.
ENDIF.
ENDFORM. " GET_DATA
*& Form MOVE_DATA_TO_ITAB
FORM move_data_to_finalitab .
LOOP AT it_pa0000 INTO wa_pa0000.
MOVE wa_pa0000-pernr TO wa_final-pernr.
MOVE wa_pa0000-begda TO wa_final-begda.
IF wa_pa0000-stat2 = c_stat2.
MOVE c_statx TO wa_final-statx.
ENDIF.
READ TABLE it_pa0001 INTO wa_pa0001 WITH KEY pernr = wa_pa0000-pernr.
IF sy-subrc EQ 0.
MOVE wa_pa0001-ename TO wa_final-ename.
ENDIF.
READ TABLE it_t530t INTO wa_t530t WITH KEY massn = wa_pa0000-massn
massg = wa_pa0000-massg.
IF sy-subrc EQ 0.
MOVE wa_t530t-mgtxt TO wa_final-mgtxt.
ENDIF.
READ TABLE it_ipsipart INTO wa_ipsipart WITH KEY
partid = wa_pa0000-partid.
IF sy-subrc EQ 0.
MOVE wa_ipsipart-depcode TO wa_final-depcode.
MOVE wa_ipsipart-begda TO wa_final-begda_c.
MOVE wa_ipsipart-endda TO wa_final-endda_c.
ENDIF.
APPEND wa_ipsipart TO it_ipsipart.
CLEAR wa_ipsipart.
ENDLOOP.
ENDFORM. " MOVE_DATA_TO_ITAB
*& Form FIELD_CATALOG
* text
* --> p1 text
* <-- p2 text
FORM field_catalog TABLES p_it_final LIKE it_final
USING p_it_fcat TYPE slis_t_fieldcat_alv
p_wa_fcat TYPE slis_fieldcat_alv.
CLEAR p_wa_fcat.
p_wa_fcat-col_pos = '1'.
p_wa_fcat-tabname = p_it_final.
p_wa_fcat-fieldname = 'PERNR'.
p_wa_fcat-key = 'X'.
p_wa_fcat-seltext_l = 'Personnel Number'.
p_wa_fcat-seltext_m = 'Personnel No.'.
p_wa_fcat-seltext_s = 'Pers.No.'.
APPEND p_wa_fcat TO p_it_fcat.
CLEAR p_wa_fcat.
p_wa_fcat-col_pos = '2'.
p_wa_fcat-tabname = p_it_final.
p_wa_fcat-fieldname = 'ENAME'.
p_wa_fcat-key = 'X'.
p_wa_fcat-seltext_l = 'Employee Name'.
p_wa_fcat-seltext_m = 'Emp Name'.
p_wa_fcat-seltext_s = 'Name'.
APPEND p_wa_fcat TO p_it_fcat.
CLEAR p_wa_fcat.
p_wa_fcat-col_pos = '3'.
p_wa_fcat-tabname = p_it_final.
p_wa_fcat-fieldname = 'BEGDA'.
p_wa_fcat-key = ' '.
p_wa_fcat-seltext_l = 'Termination start date'.
p_wa_fcat-seltext_m = 'Term start date'.
p_wa_fcat-seltext_s = 'Term start date'.
APPEND p_wa_fcat TO p_it_fcat.
CLEAR p_wa_fcat.
p_wa_fcat-col_pos = '4'.
p_wa_fcat-tabname = p_it_final.
p_wa_fcat-fieldname = 'MGTXT'.
p_wa_fcat-seltext_l = 'Reason f.action text'.
p_wa_fcat-seltext_m = 'Reason for action'.
p_wa_fcat-seltext_s = 'Act.reason'.
APPEND p_wa_fcat TO p_it_fcat.
CLEAR p_wa_fcat.
p_wa_fcat-col_pos = '5'.
p_wa_fcat-tabname = p_it_final.
p_wa_fcat-fieldname = 'STATX'.
p_wa_fcat-seltext_l = 'Employment status text'.
p_wa_fcat-seltext_m = 'Employment status'.
p_wa_fcat-seltext_s = 'Employment status'.
APPEND p_wa_fcat TO p_it_fcat.
CLEAR p_wa_fcat.
p_wa_fcat-col_pos = '6'.
p_wa_fcat-tabname = p_it_final.
p_wa_fcat-fieldname = 'DEPCODE'.
p_wa_fcat-seltext_l = 'Deployment Code'.
p_wa_fcat-seltext_m = 'Deployment Code'.
p_wa_fcat-seltext_s = 'Dep. Code'.
APPEND p_wa_fcat TO p_it_fcat.
CLEAR p_wa_fcat.
p_wa_fcat-col_pos = '7'.
p_wa_fcat-tabname = p_it_final.
p_wa_fcat-fieldname = 'BEGDA_C'.
p_wa_fcat-seltext_l = 'Participation Start Date'.
p_wa_fcat-seltext_m = 'Participation Start'.
p_wa_fcat-seltext_s = 'Start Date'.
APPEND p_wa_fcat TO p_it_fcat.
CLEAR p_wa_fcat.
p_wa_fcat-col_pos = '8'.
p_wa_fcat-tabname = p_it_final.
p_wa_fcat-fieldname = 'ENDDA_C'.
p_wa_fcat-seltext_l = 'Participation End Date'.
p_wa_fcat-seltext_m = 'Participation End'.
p_wa_fcat-seltext_s = 'End Date'.
APPEND p_wa_fcat TO p_it_fcat.
ENDFORM. " FIELD_CATALOG
*& Form ALV_SORT_INFO
* text
* -->P_IT_SORT[] text
* -->P_WA_SORT text
FORM alv_sort_info USING p_it_sort TYPE slis_t_sortinfo_alv
p_wa_sort TYPE slis_sortinfo_alv .
p_wa_sort-fieldname = 'PERNR'.
p_wa_sort-up = 'X'.
APPEND p_wa_sort TO p_it_sort.
ENDFORM. " ALV_SORT_INFO
*& Form ALV_LAYOUT_BUILD
FORM alv_layout_build CHANGING p_wa_layout TYPE slis_layout_alv.
p_wa_layout-no_input = 'X'.
p_wa_layout-colwidth_optimize = 'X'.
ENDFORM. " ALV_LAYOUT_BUILD
*& Form ALV_TOOLBAR_EXCLUDING
* text
FORM alv_toolbar_excluding USING p_it_excluding TYPE slis_t_extab
p_wa_excluding TYPE slis_extab.
p_wa_excluding-fcode = '&GRAPH'.
APPEND p_wa_excluding TO p_it_excluding.
p_wa_excluding-fcode = '&ABC'.
APPEND p_wa_excluding TO p_it_excluding.
p_wa_excluding-fcode = '%SL'.
APPEND p_wa_excluding TO p_it_excluding.
ENDFORM. " ALV_TOOLBAR_EXCLUDING
*& Form LOAD-VARIANT
FORM load-variant USING p_v_variant STRUCTURE disvariant
p_v_repid
p_v_save.
CLEAR p_v_variant.
p_v_variant-report = p_v_repid.
p_v_save = 'A'.
ENDFORM. " LOAD-VARIANT
*& Form info_msg
* text
FORM info_msg .
MESSAGE i016(rp) WITH 'No Data Selected for the Selection Criteria'.
ENDFORM. "info_msg
*& Form top_of_page
* text
FORM top_of_page.
DATA:it_listhead TYPE slis_t_listheader.
DATA:wa_listhead TYPE slis_listheader.
wa_listhead-typ = 'H'.
wa_listhead-info = 'Withdrawn Employees Still Active on Commission Plan'.
APPEND wa_listhead TO it_listhead.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_listhead.
ENDFORM. "top_of_pageHello,
You try in this way you will get the solution
data:
y_i_events TYPE STANDARD TABLE OF slis_alv_event,
constants:
y_k_top_of_page TYPE slis_alv_event-name VALUE 'TOP_OF_PAGE',
y_k_top_of_form TYPE slis_alv_event-form VALUE 'Y_F_TOP_OF_FORM'.
PERFORM y_f_build_events CHANGING y_i_events.
FORM y_f_build_events CHANGING y_li_events TYPE STANDARD TABLE.
DATA : y_lwa_events TYPE slis_alv_event.
y_lwa_events-name = y_k_top_of_page.
y_lwa_events-form = y_k_top_of_form.
APPEND y_lwa_events TO y_li_events.
CLEAR y_lwa_events.
ENDFORM. " y_f_BUILD_EVENTS
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = y_lv_progname
is_layout = y_wa_layout
it_fieldcat = y_i_fieldcat[]
it_events = y_i_events
TABLES
t_outtab = y_i_error
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 y_f_top_of_form .
*To display the date in dd mm yyyy formate
CLEAR y_v_date.
MOVE: sy-datum TO y_v_date.
y_wa_header-typ = y_k_h.
CONCATENATE text-h01 y_v_date+6(2)
y_v_date+4(2)
y_v_date+0(4)
INTO y_wa_header-info
SEPARATED BY space.
APPEND y_wa_header TO y_i_listheader.
CLEAR y_wa_header.
*Top of page
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = y_i_listheader[].
REFRESH y_i_listheader[].
ENDFORM. " y_f_top_of_form
Try this you we get the top-of-page. -
Changing customer number in alv top of page for every new customer
hi experts,
in alv grid display top-of- page, how to change customer number customer name for every new customer.
please help me.
Regards
Naveen.You may look into this blog
http://help-abap.blogspot.com/2008/09/salv-model-5-add-header-top-of-page.html
This is has been contributed by one of the SCN contributor Naimesh Patel.
a® -
Issue with Secondary list display in ALV BLocked List
Hi all,
I am using ALV Blocked List consissting of 3 blocks.
For my requirement, in the 1st block, I need to make a colum clickable, for which I have used the User_Command Event.
But this is not working. The second list is not gettin displayed.
Here'z my code:
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = v_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_EXCLUDING =
REFRESH: it_events[].
wa_events-name = slis_ev_top_of_list.
wa_events-form = 'FIRST_HEADING'.
APPEND wa_events TO it_events.
wa_events-name = slis_ev_user_command.
wa_events-form = 'USER_COMMAND'.
APPEND wa_events TO it_events.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = v_layout
it_fieldcat = it_disptab_field[]
i_tabname = 'DISPTAB'
it_events = it_events[] " Call 1st BLOCK TO BE APPENDED For SALES ANALYSIS
IT_SORT =
I_TEXT = ' '
TABLES
t_outtab = it_disptab
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
READ TABLE it_disptab INTO w_disptab INDEX rs_selfield-tabindex.
IF rs_selfield-fieldname = 'KUNAG'.
WRITE:/1 'invoice',
10 'Quantity in Base Unit',
20 'Base Unit',
30 'Qty in KL',
40 'Price'.
ENDIF.
ENDCASE.
ENDFORM. " USER_COMMAND
Please Help..Hi Ganesh,
Thanks for your reply. I have already used hotspot on the fieldcat of the clickable field. But it seems that except for the hand cursor appearing only on that field, the other columns are also clickable.
Moreover, only the fiirst block should be clickable but all the blocks are applying the user_command.
This might be due to the REUSE_ALV_BLOCK_LIST_INIT Function Module, which applies to all the blocks.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = v_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = 'USER_COMMAND'
IT_EXCLUDING =
In orser to avoid this, I am using the following code, which can be a temporary solution to the problem.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: row_count TYPE sy-lilli.
CASE r_ucomm.
WHEN '&IC1'.
DESCRIBE TABLE it_disptab LINES row_count.
READ TABLE it_disptab INTO w_disptab INDEX rs_selfield-tabindex.
IF rs_selfield-tabindex LE row_count AND rs_selfield-tabindex ne 0 AND rs_selfield-tabname = 'DISPTAB'.
PERFORM get_data.
PERFORM build_fieldcat.
PERFORM display_second_list.
ELSE.
EXIT.
ENDIF.
ENDCASE.
ENDFORM. " USER_COMMAND -
TOP-OF-PAGE During line-selection in alv report
Hi Expart
In intractive Alv report u using top-of-page during line-selection . If u using so u give me one example with codeing .
Regards
BhabaniHi,
try this code...
*& Report ZCS_PRG8
REPORT Z_SJALV__PRG8.
TYPE-POOLS: SLIS.
*type declaration for values from ekko
TYPES: BEGIN OF I_EKKO,
EBELN LIKE EKKO-EBELN,
AEDAT LIKE EKKO-AEDAT,
BUKRS LIKE EKKO-BUKRS,
BSART LIKE EKKO-BSART,
LIFNR LIKE EKKO-LIFNR,
END OF I_EKKO.
DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
WA_EKKO TYPE I_EKKO.
*type declaration for values from ekpo
TYPES: BEGIN OF I_EKPO,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MATNR LIKE EKPO-MATNR,
MENGE LIKE EKPO-MENGE,
MEINS LIKE EKPO-MEINS,
NETPR LIKE EKPO-NETPR,
END OF I_EKPO.
DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
WA_EKPO TYPE I_EKPO .
*variable for Report ID
DATA: V_REPID LIKE SY-REPID .
*declaration for fieldcatalog
DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
declaration for events table where user comand or set PF status will
be defined
DATA: V_EVENTS TYPE SLIS_T_EVENT,
WA_EVENT TYPE SLIS_ALV_EVENT.
declartion for layout
DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
declaration for variant(type of display we want)
DATA: I_VARIANT TYPE DISVARIANT,
I_VARIANT1 TYPE DISVARIANT,
I_SAVE(1) TYPE C.
*PARAMETERS : p_var TYPE disvariant-variant.
*Title displayed when the alv list is displayed
DATA: I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
DATA: I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
INITIALIZATION.
V_REPID = SY-REPID.
PERFORM BUILD_FIELDCATLOG.
PERFORM EVENT_CALL.
PERFORM POPULATE_EVENT.
START-OF-SELECTION.
PERFORM DATA_RETRIEVAL.
PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
PERFORM DISPLAY_ALV_REPORT.
*& Form BUILD_FIELDCATLOG
Fieldcatalog has all the field details from ekko
FORM BUILD_FIELDCATLOG.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'AEDAT'.
WA_FIELDCAT-SELTEXT_M = 'DATE.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'BUKRS'.
WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'BUKRS'.
WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'LIFNR'.
WA_FIELDCAT-NO_OUT = 'X'.
WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. "BUILD_FIELDCATLOG
*& Form EVENT_CALL
we get all events - TOP OF PAGE or USER COMMAND in table v_events
FORM EVENT_CALL.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "EVENT_CALL
*& Form POPULATE_EVENT
Events populated for TOP OF PAGE & USER COMAND
FORM POPULATE_EVENT.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-FORM.
ENDIF.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'USER_COMMAND'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-NAME.
ENDIF.
ENDFORM. "POPULATE_EVENT
*& Form data_retrieval
retreiving values from the database table ekko
FORM DATA_RETRIEVAL.
SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
ENDFORM. "data_retrieval
*& Form bUild_listheader
text
-->I_LISTHEADEtext
FORM BUILD_LISTHEADER USING IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
DATA HLINE TYPE SLIS_LISTHEADER.
HLINE-INFO = 'this is my first alv pgm'.
HLINE-TYP = 'H'.
ENDFORM. "build_listheader
*& Form display_alv_report
text
FORM DISPLAY_ALV_REPORT.
V_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_GRID_TITLE = I_TITLE_EKKO
I_GRID_SETTINGS =
IS_LAYOUT = ALV_LAYOUT
IT_FIELDCAT = I_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
i_default = 'ZLAY1'
I_SAVE = 'A'
is_variant = i_variant
IT_EVENTS = V_EVENTS
TABLES
T_OUTTAB = IT_EKKO
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "display_alv_report
*& Form TOP_OF_PAGE
text
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LISTHEADER
i_logo =
I_END_OF_LIST_GRID =
ENDFORM. "TOP_OF_PAGE
*& Form USER_COMMAND
text
-->R_UCOMM text
-->, text
-->RS_SLEFIELDtext
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
PERFORM BUILD_FIELDCATLOG_EKPO.
PERFORM EVENT_CALL_EKPO.
PERFORM POPULATE_EVENT_EKPO.
PERFORM DATA_RETRIEVAL_EKPO.
PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
PERFORM DISPLAY_ALV_EKPO.
ENDCASE.
ENDFORM. "user_command
*& Form BUILD_FIELDCATLOG_EKPO
text
FORM BUILD_FIELDCATLOG_EKPO.
WA_FIELDCAT-TABNAME = 'IT_EKPO'.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKPO'.
WA_FIELDCAT-FIELDNAME = 'EBELP'.
WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'MENGE'.
WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'MEINS'.
WA_FIELDCAT-SELTEXT_M = 'UOM'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'NETPR'.
WA_FIELDCAT-SELTEXT_M = 'PRICE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. "BUILD_FIELDCATLOG_EKPO
*& Form event_call_ekpo
we get all events - TOP OF PAGE or USER COMMAND in table v_events
FORM EVENT_CALL_EKPO.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "event_call_ekpo
*& Form POPULATE_EVENT
Events populated for TOP OF PAGE & USER COMAND
FORM POPULATE_EVENT_EKPO.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-FORM.
ENDIF.
ENDFORM. "POPULATE_EVENT
*& Form TOP_OF_PAGE
text
FORM F_TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LISTHEADER
i_logo =
I_END_OF_LIST_GRID =
ENDFORM. "TOP_OF_PAGE
*& Form USER_COMMAND
text
-->R_UCOMM text
-->, text
-->RS_SLEFIELDtext
*retreiving values from the database table ekko
FORM DATA_RETRIEVAL_EKPO.
SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.
ENDFORM.
FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
DATA: HLINE1 TYPE SLIS_LISTHEADER.
HLINE1-TYP = 'H'.
HLINE1-INFO = 'CHECKING PGM'.
ENDFORM.
FORM DISPLAY_ALV_EKPO.
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 = 'F_USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = '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_TITLE_EKPO
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = I_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT =
I_SAVE = 'A'
IS_VARIANT =
IT_EVENTS = V_EVENTS
TABLES
T_OUTTAB = IT_EKPO
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.
reward if helpful
regards
Shashi -
TOP OF PAGE printing according to SORT - ALV main internal table
Hi guys
I manage to solve my previous issues but 1 minor problem here
Lets say I have an itab which has 3 records
Sales Order | Purchase No, | Distributor
1 | 123 | abc
1 | 123 | abc
2 | 456 | TGIF
I'm using FM REUSE_ALV_BLOCK_LIST_APPEND to display the ALV
its working for the main INTERNAL TABLE but when it comes to top of page, it doesn't follow the sort
I want it to print
Sales Order: 1
Purchase No: 123
Distributor: abc
TABLE 1
Sales Order: 2
Purchase No: 456
Distributor: TGIF
TABLE 2
But now its printing
Sales Order: 1
Purchase No: 123
Distributor: abc
TABLE 1
Sales Order: 1
Purchase No: 123
Distributor: abc
TABLE 2
Sales Order: 2
Purchase No: 456
Distributor: TGIF
TABLE <empty table>
My codes was working previously but its not longer the same.
READ TABLE it_report INTO l_report INDEX SY-tabix
WRITE: text-003, "Sales Order Number
AT 22 l_report-ebeln.
WRITE: / text-004, "Purchase Order Number
AT 25 l_report-purch_no.
WRITE: / text-005, "Distributor Number
AT 22 l_report-kunnr.
WRITE: / text-006, "Ship to Name
AT 16 l_report-wename1.
WRITE: / text-007, "Order Date
AT 14 l_report-vdate.
WRITE: / text-008, "Delivery Date
AT 17 i_vdatu.
Can anyone help me out here? How do I make it print just like the SORT for ALV?Refresh the work areas then it work fine
-
How to read complete line displayed thru ALV report on double click? urgent
Hi guys,
An ALV report is displayed using 'REUSE_ALV_LIST_DISPLAY' and i have a requirement such that i have to read the line item on which double click is done.
I have to fetch the line item, field by field and not by characters. I have attached the function code and all using PF status.
Please tell me an approach as how to fetch the line item on which double click is done.
Points will be rewarded.
Regards
RahulHi ..
i did report with belnr , bukrs , Gjahr . which will call the transcation code FB03 displaing thedocument ...
please cut and paste the report it will work ..
REPORT zdemo_alvgrid .
TABLES: bkpf . " ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
BUKRS like bkpf-BUKRS,
BELNR like bkpf-BELNR,
GJAHR like bkpf-GJAHR,
BLART like bkpf-BLART,
BLDAT like bkpf-BLDAT,
BUDAT like bkpf-BUDAT,
MONAT like bkpf-MONAT,
XBLNR like bkpf-XBLNR ,
* ebeln TYPE ekpo-ebeln,
* ebelp TYPE ekpo-ebelp,
* statu TYPE ekpo-statu,
* aedat TYPE ekpo-aedat,
* matnr TYPE ekpo-matnr,
* menge TYPE ekpo-menge,
* meins TYPE ekpo-meins,
* netpr TYPE ekpo-netpr,
* peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid,
gt_events type slis_t_event,
gd_prntparams type slis_print_alv.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform build_events.
perform build_print_params.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
* Build Fieldcatalog for ALV Report
form build_fieldcatalog.
* There are a number of ways to create a fieldcat.
* For the purpose of this example i will build the fieldcatalog manualy
* by populating the internal table fields individually and then
* appending the rows. This method can be the most time consuming but can
* also allow you more control of the final product.
* Beware though, you need to ensure that all fields required are
* populated. When using some of functionality available via ALV, such as
* total. You may need to provide more information than if you were
* simply displaying the result
* I.e. Field type may be required in-order for
* the 'TOTAL' function to work.
fieldcatalog-fieldname = 'BUKRS'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
* fieldcatalog-do_sum = 'X'.
* fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BELNR'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'GJAHR'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BLART'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BLDAT'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BUDAT'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MONAT'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'XBLNR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
* fieldcatalog-do_sum = 'X'.
* fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
** fieldcatalog-fieldname = 'PEINH'.
** fieldcatalog-seltext_m = 'Price Unit'.
** fieldcatalog-col_pos = 8.
** append fieldcatalog to fieldcatalog.
* clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
* Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
* gd_layout-totals_only = 'X'.
* gd_layout-f2code = 'DISP'. "Sets fcode for when double
* "click(press f2)
* gd_layout-zebra = 'X'.
* gd_layout-group_change_edit = 'X'.
* gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
* Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
* i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
* it_special_groups = gd_tabgroup
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
* is_variant = z_template
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
* Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select BUKRS
BELNR
GJAHR
BLART
BLDAT
BUDAT
MONAT
XBLNR up to 10 rows
from bkpf
into table it_ekko.
*select ebeln ebelp statu aedat matnr menge meins netpr peinh
* up to 10 rows
* from ekpo
* into table it_ekko.
endform. " DATA_RETRIEVAL
* Form TOP-OF-PAGE *
* ALV Report Header *
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c.
* Title
wa_header-typ = 'H'.
wa_header-info = 'EKKO Table Report'.
append wa_header to t_header.
clear wa_header.
* Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
append wa_header to t_header.
clear: wa_header.
* Total No. of Records Selected
describe table it_ekko lines ld_lines.
ld_linesc = ld_lines.
concatenate 'Total No. of Records Selected: ' ld_linesc
into t_line separated by space.
wa_header-typ = 'A'.
wa_header-info = t_line.
append wa_header to t_header.
clear: wa_header, t_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header.
* i_logo = 'Z_LOGO'.
endform.
* FORM USER_COMMAND *
* --> R_UCOMM *
* --> RS_SELFIELD *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
* Check function code
CASE r_ucomm.
WHEN '&IC1'.
* Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'BELNR'.
* Read data table, using index of row user clicked on
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
* Set parameter ID for transaction screen field
SET PARAMETER ID 'BES' FIELD wa_ekko-bELNR .
SET PARAMETER ID 'MES' FIELD wa_ekko-bUKRS .
SET PARAMETER ID 'DES' FIELD wa_ekko-GJAHR .
* Sxecute transaction ME23N, and skip initial data entry screen
* CALL TRANSACTION 'FB03' AND SKIP first screen.
SUBMIT RFBUEB00
* WITH ALCUR ...
* WITH ARCHOBJ ...
* WITH ARCH_SEL ...
* WITH ARUSETYP ...
* WITH AUTBEXNO ...
* WITH AUTH_BUK ...
* WITH AUTH_LDR ...
* WITH BR_AWKEY ...
* WITH BR_AWSYS ...
* WITH BR_AWTYP ...
WITH BR_BELNR = wa_ekko-bELNR
* WITH BR_BLART ...
* WITH BR_BLDAT ...
* WITH BR_BUDAT ...
WITH BR_BUKRS = wa_ekko-bUKRS
* WITH BR_CPUDT ...
WITH BR_GJAHR = wa_ekko-GJAHR
* WITH BR_RLDNR ...
* WITH BR_SEQ ...
* WITH BR_USNAM ...
* WITH BR_XBLNR ...
* WITH EXCDT ...
* WITH P_STATS ...
* WITH STATISTK ...
* WITH STATUSD ...
* WITH STATUSL ...
* WITH STATUSM ...
* WITH STATUSS ...
* WITH STATUSV ...
* WITH TCODE ...
* WITH UNAME ...
* WITH XEMUCNV ...
* WITH XUSEAR ...
* WITH XUSEAS ...
* WITH XUSEDB
AND RETURN .
ENDIF.
ENDCASE.
ENDFORM.
*& Form BUILD_EVENTS
* Build events table
form build_events.
data: ls_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = gt_events[].
read table gt_events with key name = slis_ev_end_of_page
into ls_event.
if sy-subrc = 0.
move 'END_OF_PAGE' to ls_event-form.
append ls_event to gt_events.
endif.
read table gt_events with key name = slis_ev_end_of_list
into ls_event.
if sy-subrc = 0.
move 'END_OF_LIST' to ls_event-form.
append ls_event to gt_events.
endif.
endform. " BUILD_EVENTS
*& Form BUILD_PRINT_PARAMS
* Setup print parameters
form build_print_params.
gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
gd_prntparams-no_coverpage = 'X'.
endform. " BUILD_PRINT_PARAMS
*& Form END_OF_PAGE
form END_OF_PAGE.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
write: sy-uline(50).
skip.
write:/40 'Page:', sy-pagno .
endform.
*& Form END_OF_LIST
form END_OF_LIST.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
skip.
write:/40 'Page:', sy-pagno .
endform.
reward points if it is usefull ...
Girish -
List Display After ALV Display.
Hi,
i want to use write statement after display of the GRID ALV report. I User-command is getting dynamically called up when i presses the button.
FORM user_command USING p_ucomm LIKE sy-ucomm
p_selfield TYPE slis_selfield.
CASE p_ucomm.
WHEN '&GENERAL'.
READ TABLE i_general INTO wa_general INDEX p_selfield-tabindex.
IF sy-subrc = 0.
LEAVE TO LIST-PROCESSING.
WRITE : sy-uline(90).
write: / 'Serial: ', wa_general-serial.
ENDIF.
ENDFORM.
the problem is i m not able to use back button in the dynamic list display. Use pf-status as well but not working. Pressing BACK button does nothing.
Want to activate print and back button in the dynamic list display. (used pf-status which has back and print fucntion code but not working.)
Reward points sure for right answers.
KartavyaHi..
Try this.....
FORM user_command USING p_ucomm LIKE sy-ucomm
p_selfield TYPE slis_selfield.
CASE p_ucomm.
WHEN '&GENERAL'.
READ TABLE i_general INTO wa_general INDEX p_selfield-tabindex.
IF sy-subrc = 0.
<b>SET PF-STATUS SPACE.</b> "this will call the Standard GUI
LEAVE TO LIST-PROCESSING.
WRITE : sy-uline(90).
write: / 'Serial: ', wa_general-serial.
ENDIF.
ENDFORM.
<b>Reward if Helpful.</b> -
How to change layout for list display in background
Hi All,
I want to change layout for the list display of tcode fbl1n when i execute in background. is there anyway to select our own layout when i execute in background. When i execute in foreground we can change the layout by selecting change layout button, but how it possible when in backgroung, is there any way please let me know.
Thanks in advance.
Regards,
VishalHi,
Create a list variant by executing the program and changing the layout and saving..
Then use the "Layout" parameter in the selection screen and give the variant you created earlier...
Then while executing in background the list variant will be pickedup accordingly (given in the selection screen)..
Hope this helps...
THanks,
Naren
Message was edited by: Narendran Muthukumaran -
Moderator message: Please do not use ALL CAPITALS in your message subjects
I am facing a peculiar situation with respect to a report with 2 block lists.
STEP 1:
I first use REUSE_ALV_BLOCK_LIST_INIT with EXPORTING parameter as
i_callback_program = SY-REPID.
This works fine with return code of sy-subrc = 0.
STEP 2:
I build the field catalog and internal table - in debug I also check the sequence of fields of both the internal tables and field calatogs - perfect - no issues.
Then I call REUSE_ALV_BLOCK_LIST_APPEND with exporting parameters as layout, field catalog, table name & event and tables parameter as internal table and exception handling, I repeat this call for the two internal tables.
This works fine with return code of sy-subrc = 0
STEP 3:
I use REUSE_ALV_BLOCK_LIST_DISPLAY to display the two lists one after the other, and I have coded for error message if sy-subrc is non zero.
This works fine with return code of sy-subrc = 0
ISSUE :
Internal table 1 and internal table 2 both have say 4 records, then I see the two lists with heading(s) perfec and col width also optimized and zebra (alternate steipes also in place), and 4 rows for each internal table on output, however the rows are BLANK - NO DATA, whereas I have checked both internal tables before the call and they seem to have the data perfectly and in the same sequence as the field catalog - however the rows are BLANK.
I checked in debugging but was just not able to find out why if the internal tables and field catalog is perfect, no data is passed to output.
Please help !!
Edited by: M N on Nov 14, 2008 5:22 AM
Edited by: Matt on Nov 14, 2008 10:23 AM*& Report Y_ALV_BLOCKLIST_
REPORT Y_ALV_BLOCKLIST_16131.
TYPE-POOLS : SLIS.
DATA: X_LAYOUT TYPE SLIS_LAYOUT_ALV.
Events
DATA: GT_XEVENTS TYPE SLIS_T_EVENT.
DATA: GT_YEVENTS TYPE SLIS_T_EVENT.
data : XS_EVENT TYPE SLIS_ALV_EVENT.
DATA: XFIELD TYPE SLIS_T_FIELDCAT_ALV.
DATA: YFIELD TYPE SLIS_T_FIELDCAT_ALV.
DATA: AFIELD TYPE SLIS_FIELDCAT_ALV.
DATA: GT_PRINT TYPE SLIS_PRINT_ALV.
TYPES : BEGIN OF TY_MARA ,
MATNR TYPE MATNR,
MTART TYPE MTART,
END OF TY_MARA.
TYPES: BEGIN OF TY_MAKT ,
MATNR TYPE MATNR,
MAKTX TYPE MAKTX,
END OF TY_MAKT.
DATA : ITAB TYPE TABLE OF TY_MARA,
PTAB TYPE TABLE OF TY_MAKT.
START-OF-SELECTION.
SELECT DATA
SELECT MATNR MAKTX FROM MAKT INTO TABLE PTAB UP TO 10 ROWS.
SELECT MATNR MTART FROM MARA INTO TABLE ITAB UP TO 10 ROWS.
*eVENT FOR Heading
PERFORM F_EVENTS.
FIELD CATALOG
PERFORM F_FIELDCAT.
INIT BLOCK ALV
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID.
ADD INTERNAL TABLE ITAB
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = X_LAYOUT
IT_FIELDCAT = XFIELD "ALVFC
I_TABNAME = 'ITAB'
IT_EVENTS = GT_XEVENTS
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 2
OTHERS = 3.
ADD INTERNAL TABLE PTAB
REFRESH ALVFC[].
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = X_LAYOUT
IT_FIELDCAT = YFIELD "ALVFC
I_TABNAME = 'PTAB'
IT_EVENTS = GT_YEVENTS
TABLES
T_OUTTAB = PTAB
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 2
OTHERS = 3.
DISPLAY
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
*GT_PRINT-RESERVE_LINES = 2.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
IS_PRINT = GT_PRINT.
*& Form F_FIELDCAT
text
--> p1 text
<-- p2 text
FORM F_FIELDCAT .
DATA: L_COUNT TYPE I.
CLEAR AFIELD.
L_COUNT = L_COUNT + 1.
AFIELD-COL_POS = L_COUNT.
AFIELD-FIELDNAME = 'MATNR'.
AFIELD-REF_TABNAME = 'MARA'.
AFIELD-KEY = 'X'. "define field as key
AFIELD-DO_SUM = 'X'.
APPEND AFIELD TO XFIELD.
CLEAR AFIELD.
L_COUNT = L_COUNT + 1.
AFIELD-COL_POS = L_COUNT.
AFIELD-FIELDNAME = 'MTART'.
AFIELD-REF_TABNAME = 'MARA'.
AFIELD-KEY = 'X'. "define field as key
APPEND AFIELD TO XFIELD.
L_COUNT = 0.
CLEAR AFIELD.
L_COUNT = L_COUNT + 1.
AFIELD-COL_POS = L_COUNT.
AFIELD-FIELDNAME = 'MATNR'.
AFIELD-REF_TABNAME = 'MAKT'.
AFIELD-KEY = 'X'. "define field as key
APPEND AFIELD TO YFIELD.
CLEAR AFIELD.
L_COUNT = L_COUNT + 1.
AFIELD-COL_POS = L_COUNT.
AFIELD-FIELDNAME = 'MAKTX'.
AFIELD-REF_TABNAME = 'MAKT'.
AFIELD-KEY = 'X'. "define field as key
APPEND AFIELD TO YFIELD.
ENDFORM. " F_FIELDCAT
*& Form F_EVENTS
text
--> p1 text
<-- p2 text
FORM F_EVENTS .
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
XS_EVENT-FORM = 'TOP1'.
APPEND XS_EVENT TO GT_XEVENTS.
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
XS_EVENT-FORM = 'TOP2'.
APPEND XS_EVENT TO GT_YEVENTS.
ENDFORM. " F_EVENTS
FORM TOP1.
WRITE : 'MARA TABLE'.
ENDFORM.
FORM TOP2.
WRITE : 'MAKT TABLE'.
ENDFORM.
Maybe you are looking for
-
Podcast in Store, 1 item total but episode is not listed
Podcast is in the Store but episode is not listed. My new podcast was recently approved by Itunes. It is now dispays in the store and shows a total of one item, but the podcast episode is not listed. I can subscribe to it and listen to it through Itu
-
All of a sudden I am getting a background picture of angry birds in my e mail. I can view the mail but it is annoying. I have cleard the history an still it appears. Any ideas on how to get rid of this garbage? Thanks for your help.
-
Strange issue in FBA internet site
Hello All.. Last week we observed very strange issue in our production servers, it is pure FBA public site.. No matter we click anything it shows the authentication (login page), the site custome master page was coming and this was a custom login pag
-
Notified when the active page changes
Hello, We have a panel that displays the content of script lables. A script label can be added to a page. How do we determine the current page? The page might be selected from the from the pages panel and might not have any items on the page. Our Act
-
i hanve an i phone 2g and it is stuced in recovery mode it is not going in dfu mode it is purchased from usa what shoud i do??