Display header along with ALV
Hi,
i need to display a report using ALV in the following manner. im using reuse_alv_listdisplay and the display is fine . however, i need to add a header to the list and i need to display total for the currency fields. how can i do that. your help would be appreciated.
Thanks,
kranthi.
________some company header----
alv report----
display total for currency fields------
i appreciate all of you for your quick response.
i need to call a function module which uses couple of 'write' statements to create the header. is it possible to use that in this context.
Thanks,
Kranthi.
Message was edited by: kranthi kumar
*& Report ZVENU_ALV *
Program: ZZ_ALV_REPORT_STUB
Author :
Date :
Purpose: Report using ALV function
Notes:
1) Logos & wallpapers can be found in table BDS_CONN05
with class = PICTURES
2) Transaction OAER can be used to create PICTURES.
Run transaction OAER with class name = PICTURES, Class type = OT,
and Object key with whatever name you want to create. In the
next screen, right clicking on screen and import
Revisions
Name :
Date :
Comments:
report zz_alv_report_stub
no standard page heading
line-size 200
line-count 65
message-id zz.
Tables
tables:
ekpo,
trdir.
Global Types
type-pools: slis.
Global Internal Tables
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.
Display data
data: begin of i_data occurs 0,
name like trdir-name,
clas like trdir-clas,
subc like trdir-subc,
cnam like trdir-cnam,
cdat like trdir-cdat,
myfield(1) type c,
end of i_data.
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.
Global Constants
*constants:
Selection Screen
selection-screen begin of block blk_criteria with frame title text-f01.
select-options:
s_name for trdir-name.
selection-screen end of block blk_criteria.
selection-screen begin of block blk_params with frame title text-f02.
parameters:
p_vari like disvariant-variant.
selection-screen skip 1.
parameters:
p_grid radiobutton group rb01 default 'X',
p_html as checkbox.
selection-screen skip 1.
parameters:
p_list radiobutton group rb01.
selection-screen end of block blk_params.
Initialization
initialization.
perform init_variant.
perform variant_default using p_vari.
clear: s_name[].
s_name-sign = 'I'.
s_name-option = 'CP'.
s_name-low = 'Z*'.
append s_name.
At Selection Screen PBO
at selection-screen output.
At Selection Screen Value Request
at selection-screen on value-request for p_vari.
perform variant_f4 using p_vari.
At Selection Screen
at selection-screen.
perform variant_fill.
Start of Selection
start-of-selection.
perform get_data.
end-of-selection.
perform fieldcat_build.
perform event_build.
perform event_exit_build.
perform exclude_build.
perform print_build.
perform layout_build.
perform display_data.
Top of Page
top-of-page.
Top of Page During Line Sel
top-of-page during line-selection.
At User Command
at user-command.
At Line Selection
at line-selection.
Macros
define skip_1.
write: /001 sy-vline,
at sy-linsz sy-vline.
end-of-definition.
Forms
*& Form variant_f4
form variant_f4 using p_variant.
call function 'LVC_VARIANT_F4'
exporting
is_variant = w_variant
i_save = w_variant_save
importing
e_exit = w_exit
es_variant = wx_variant
exceptions
not_found = 1
program_error = 2
others = 3.
if sy-subrc <> 0.
message i000(zz) with text-g01.
endif.
if w_exit is initial.
w_variant-variant = wx_variant-variant.
p_variant = wx_variant-variant.
endif.
endform.
*& Form init_variant
form init_variant.
clear: w_variant.
w_repid = sy-repid.
w_variant-report = w_repid.
w_variant-username = sy-uname.
w_variant_save = 'A'. "All types
endform.
*& Form variant_default
form variant_default using p_variant.
wx_variant = w_variant.
if not p_variant is initial.
wx_variant-variant = p_variant.
endif.
call function 'LVC_VARIANT_DEFAULT_GET'
exporting
i_save = w_variant_save
changing
cs_variant = wx_variant
exceptions
wrong_input = 1
not_found = 2
program_error = 3
others = 4.
case sy-subrc.
when 0.
p_variant = wx_variant-variant.
when 2.
clear: p_variant.
endcase.
endform.
*& Form variant_fill
form variant_fill.
clear: w_variant.
if p_vari is initial.
w_variant-variant = 'STANDARD'.
w_variant-report = w_repid.
else.
w_variant-variant = p_vari.
w_variant-report = w_repid.
call function 'LVC_VARIANT_EXISTENCE_CHECK'
exporting
i_save = w_variant_save
changing
cs_variant = w_variant
exceptions
others = 01.
if sy-subrc ne 0.
message i000(zz) with text-g02.
endif.
endif.
endform.
*& Form fieldcat_build
form fieldcat_build.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = w_repid
i_structure_name = 'TRDIR'
i_internal_tabname = 'I_DATA'
i_inclname = w_repid
changing
ct_fieldcat = i_fieldcat_alv.
Modify displayed fields
loop at i_fieldcat_alv into w_fieldcat_alv.
case w_fieldcat_alv-fieldname.
when 'NAME'.
w_fieldcat_alv-hotspot = 'X'.
when 'MYFIELD'.
w_fieldcat_alv-checkbox = 'X'.
w_fieldcat_alv-seltext_s = 'MyChkBox'.
when others.
endcase.
modify i_fieldcat_alv from w_fieldcat_alv.
endloop.
endform.
*& Form display_data
form display_data.
w_callback_ucomm = 'CALLBACK_UCOMM'.
case 'X'.
when p_grid.
if p_html = 'X'.
w_html_top_of_page = 'HTML_TOP_OF_PAGE'.
endif.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_background_id = 'SIWB_WALLPAPER'
i_background_id = 'SIWB_WALLPAPER'
i_callback_program = w_repid
i_callback_html_top_of_page = w_html_top_of_page
i_structure_name = 'TRDIR'
i_default = 'X'
i_save = 'A'
is_variant = w_variant
is_layout = w_layout
i_callback_user_command = w_callback_ucomm
it_fieldcat = i_fieldcat_alv
it_events = i_events
it_event_exit = i_event_exit
it_excluding = i_excluding
is_print = w_print
i_screen_start_column = 1
i_screen_start_line = 1
i_screen_end_column = 70
i_screen_end_line = 30
tables
t_outtab = i_data.
when p_list.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_background_id = 'ALV_BACKGROUND'
i_callback_program = w_repid
i_default = 'X'
i_save = 'A'
is_variant = w_variant
is_layout = w_layout
i_callback_user_command = w_callback_ucomm
it_fieldcat = i_fieldcat_alv
it_events = i_events
it_event_exit = i_event_exit
is_print = w_print
tables
t_outtab = i_data.
endcase.
endform.
FORM user_command *
form callback_ucomm using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
message i000(zz) with r_ucomm.
case r_ucomm.
when '&IC1'.
set parameter id 'RID' field rs_selfield-value.
call transaction 'SE38'.
when others.
endcase.
endform.
*& Form get_data
form get_data.
select * up to 15 rows from trdir
into corresponding fields of table i_data
where name in s_name.
endform.
FORM ALV_TOP_OF_PAGE *
form alv_top_of_page.
clear: i_list_comments[].
w_list_comments-typ = 'H'. "H=Header, S=Selection, A=Action
w_list_comments-key = ''.
w_list_comments-info = 'Info 1'.
append w_list_comments to i_list_comments.
w_list_comments-typ = 'A'. " H = Header, S = Selection, A = Action
w_list_comments-key = ''.
w_list_comments-info = 'Begin of list'.
append w_list_comments to i_list_comments.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = 'ENJOYSAP_LOGO'
it_list_commentary = i_list_comments.
endform.
*& Form 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.
*& Form print_build
form print_build.
w_print-no_print_listinfos = 'X'.
endform.
*& Form layout_build
form layout_build.
w_layout-zebra = 'X'.
w_layout-no_vline = 'X'.
w_layout-colwidth_optimize = 'X'.
w_layout-detail_popup = 'X'.
w_layout-detail_initial_lines = 'X'.
w_layout-detail_titlebar = 'Detail Title Bar'.
endform.
*& Form event_exit_build
form event_exit_build.
clear: i_event_exit[].
Pick
w_event_exit-ucomm = '&ETA'.
w_event_exit-before = ' '.
w_event_exit-after = 'X'.
append w_event_exit to i_event_exit.
endform.
FORM HTML_TOP_OF_PAGE *
form html_top_of_page using r_top type ref to cl_dd_document.
data:
text type sdydo_text_element,
s_table type ref to cl_dd_table_element,
col_key type ref to cl_dd_area,
col_info type ref to cl_dd_area,
a_logo type ref to cl_dd_area.
Split TOP-Document
call method r_top->vertical_split
exporting split_area = r_top
split_width = '30%'
importing right_area = a_logo.
Fill TOP-Document
call method r_top->add_text
exporting text = 'Example of a Heading'
sap_style = 'HEADING'.
call method r_top->new_line.
call method r_top->new_line.
call method r_top->add_table
exporting no_of_columns = 2
with_heading = ' '
border = '1'
importing table = s_table.
call method s_table->add_column importing column = col_key.
call method s_table->add_column importing column = col_info.
text = 'A key value marked'.
call method col_key->add_text
exporting text = text
sap_emphasis = 'Strong'.
call method col_info->add_gap exporting width = 6.
text = '600' .
call method col_info->add_text
exporting text = text
sap_style = 'Key'.
call method col_info->add_gap exporting width = 3.
text = 'Block brick units'.
call method col_info->add_text exporting text = text.
call method s_table->new_row.
text = 'Storage Bin'.
call method col_key->add_text
exporting text = text
sap_emphasis = 'Strong'.
call method col_info->add_gap exporting width = 7.
text = 'C-A-004'.
call method col_info->add_text exporting text = text.
call method s_table->new_row.
text = 'Warehouse number' .
call method col_key->add_text
exporting text = text
sap_emphasis = 'Strong'.
call method col_info->add_gap exporting width = 6.
text = '200' .
call method col_info->add_text
exporting text = text
sap_style = 'Success'.
call method col_info->add_gap exporting width = 3.
text = 'marked success'.
call method col_info->add_text exporting text = text.
call method s_table->new_row.
call method r_top->new_line.
text = 'This last line is a comment in italics.'.
call method r_top->add_text
exporting text = text
sap_emphasis = 'EMPHASIS'.
call method r_top->new_line.
call method a_logo->add_picture
exporting picture_id = 'ZZTESTBMP'.
exporting picture_id = 'ENJOYSAP_LOGO'.
endform.
*& Form exclude_build
form exclude_build.
w_excluding = '&GRAPH'. "Graphic
append w_excluding to i_excluding.
endform. " exclude_build
Similar Messages
-
PLD: How to decrease Header along with PLD.
How to Decrease Header along with paper size from A4 to half (Width= 648 Hight= 432),
I am sorry, but I don't know the solution for your problem - like apparently the rest of the SDK community here.
This Forum is (mainly) for SAP Business One SDK.
For questions related to the B1 application itself and around customization the "Implementation" forum in the Channel Partner Solution Network (http://p2p.sap.com/businessoneforum) - or a message to SAP Support - would IMHO be the best options.
Thanks,
Frank
Message was edited by:
Frank Moebius
...but THANKS for the excellent subject you used! I am glad to see someone giving such precise information in the subject! -
Displaying Images along with Drill Drown Results
I'm using MS access 2003 as my data base and CF as the web
language. I cannot find a topic in reference to displaying Images
along with Drill down results. My tables in access have a OLE
object included however I am clueless as how i can display the
images with my drill down results. I just cannot find a link that
talked about this issue already. Does anyone have a link to this
forum topic?College Kid wrote:
> I'm using MS access 2003 as my data base and CF as the
web language. I cannot
> find a topic in reference to displaying Images along
with Drill down results.
> My tables in access have a OLE object included however I
am clueless as how i
> can display the images with my drill down results. I
just cannot find a link
> that talked about this issue already. Does anyone have a
link to this forum
> topic?
>
Sorry, no link, but I think you want to be looking at the
<cfimage...>
and|or the <cfcontent...> tags. One or both of these
tags should allow
you to deliver the image from the database to the client.
You are doing this in a bit of an unusual, but not unheard of
way. Most
people just store the image file in a handy directory
accessible to the
web server and then store the name|URL to this image as text
in the
database.
But it is definitly possible to server up binary image data
as well.
Though I have never heard of this in conjunction with MS
Access and 'OLE
objects'. I usually hear this discussed in relation to more
enterprise
database management systems and BLOB [Binary Large OBjects]
data fields. -
Issue in displaying header details in ALV report
Hi,
I have used slis_t_listheader and REUSE_ALV_COMMENTARY_WRITE to display the header details in ALV report.I want the details to be displayed as below.
Requester : ---------------------- Page: 1
Program: ----------------------- Date:---------
Title of Report
But when I use the structure slis_t_listheader to display the header details,all the fields are coming one below the other.
How can I get the fields as shown in the above format
Edited by: Abaper12345 on Jun 25, 2009 7:54 AMHi,
Go through following code... its showing the data exactly the way you want....
REPORT TEST3.
TYPE-POOLS:slis.
TABLES:MARA.
*Type Declaration
TYPES:BEGIN OF t_mara,
matnr TYPE mara-matnr,
ersda TYPE mara-ersda,
ernam TYPE mara-ernam,
END OF t_mara.
*Internal Table
data:it_mara type standard table of t_mara.
*Work Area
data:wa_mara type t_mara.
DATA:i_repid TYPE sy-repid .
i_repid = sy-repid.
*Declaration for field catalog
DATA : fcat TYPE slis_t_fieldcat_alv,
wa_fcat TYPE slis_fieldcat_alv.
*Declaration for Layout
data : WA_LAYOUT type SLIS_LAYOUT_ALV.
*Initializing ColumnWidth_Optimize For Layout
WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
START-OF-SELECTION
START-OF-SELECTION.
*Fetching data into internal tables
PERFORM get_data.
*Buil Fieldcatalog
PERFORM build_fcat.
*Display ALV Report
PERFORM alv_display.
*Build Fieldcat
FORM build_fcat .
wa_fcat-tabname = 'IT_MARA'.
wa_fcat-fieldname = 'MATNR'.
wa_fcat-inttype = 'C'.
wa_fcat-seltext_m = 'Material Number'.
wa_fcat-outputlen = 25.
wa_fcat-col_pos = 1.
APPEND wa_fcat TO fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'IT_MARA'.
wa_fcat-fieldname = 'ERSDA'.
wa_fcat-inttype = 'C'.
wa_fcat-seltext_m = 'Date'.
wa_fcat-outputlen = 25.
wa_fcat-col_pos = 1.
APPEND wa_fcat TO fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'IT_MARA'.
wa_fcat-fieldname = 'ERNAM'.
wa_fcat-inttype = 'C'.
wa_fcat-seltext_m = 'User'.
wa_fcat-outputlen = 25.
wa_fcat-col_pos = 1.
APPEND wa_fcat TO fcat.
CLEAR wa_fcat.
endform.
*& Form GET_DATA
text
--> p1 text
<-- p2 text
form GET_DATA .
select matnr ersda ernam from mara into table it_mara.
endform. " GET_DATA
*& Form ALV_DISPLAY
text
--> p1 text
<-- p2 text
form ALV_DISPLAY .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = i_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = '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 = fcat
TABLES
t_outtab = it_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.
endform. " ALV_DISPLAY
*& Form html_top_of_page " I_CALLBACK_HTML_TOP_OF_PAGE "
FORM html_top_of_page USING document TYPE REF TO cl_dd_document.
CALL METHOD document->add_text
EXPORTING
text = 'Program'
sap_color = document->list_group
sap_fontstyle = document->standard
sap_emphasis = document->strong.
CALL METHOD document->new_line
EXPORTING
repeat = 1
CALL METHOD document->add_text
EXPORTING
text = 'Requester'
sap_color = document->list_group
sap_fontstyle = document->standard
sap_emphasis = document->strong.
CALL METHOD document->new_line
EXPORTING
repeat = 1
CALL METHOD document->add_gap
EXPORTING
width = 125
CALL METHOD document->add_text
EXPORTING
text = 'This Is Test Data'
sap_color = document->list_group
sap_fontsize = document->LARGE
sap_fontstyle = document->standard
sap_emphasis = document->strong.
ENDFORM. "HTML_TOP_OF_PAGE
Thanks & Regards
Ashu SIngh -
Hi,
I want to display a message on the status bar along with the output . That is output and message should appear on the same screen together. Neither before the output nor after the the output.
Best Regards,Hi,
One option is to use ALV Container. Create a screen with ALV container & keep some blank lines at the footer of the screen. Use classes to call the ALV footer for populating the message.
Thanks,
Best regards,
Prashant -
How to Print Selection-Screen along with ALV Report output
Hi,
I have a requirement wherein i need to also print the Selection Screen of a report when I print the ALV report output.
Basically i need to print the ALV output along with selection screen.
Could you plz suggest me the way.
Regards,
NitinHi,
My selection Screen is a very big one. It contains around 30 select-options.
So is their any standard method in which you can choose whether you want to take the output printout with or without Selection screen.
Regards,
Nitin -
Display usrname along with usrid when workitem is delegated using Forward
Hi
I have a requirement that when ever we want to delegate the work item using Forward action.
It navigates to user selection, on giving some name search results displays only user ids . This makes confusing in the selection of particular user. Our req is to display name in a separate column / name also in the same column along with the user id. is this possible through XML configuration
How we can achieve this req
Thanks a Lot.
Regards
KALYANHi Kaylan,
I am not sure how you can achieve this requirement. I would've said through custom attributes, but this is a dynamic creation based on when the forward button is pressed. (when you press the button, you make the selection). For this reason, I am pretty sure that this is not achievable presently with a new column real-time and especially not in the older releases of the Universal Worklist. You use the people picker when you forward the workitem. In the newer versions of UWL, the real time refresh of custom attributes is also available. Do you know where the userid is stored in the backend?
Regards,
Beth Maben
EP - Senior Support Consultant II
SAP Active Global Support
Global Support Centre Ireland
**SDN Forum Moderator:
SAP Enterprise Portal: Application Integration
**SDN Universal Worklist Wiki:
http://wiki.sdn.sap.com/wiki/x/ehU -
Display records along with checkbox
im trying to do the following
get the records from database and display in jsp along with a checkbox for each record
ive done the database retrival and displayed in the jsp page as a tables.
but ive tried to create checkboxes for each record rows and at the end ive to send the hidden variable as the checkbox value . how could i do this.Hi,
While creating the checkbox u have to write variables in the checkbox's value atrribute.
When ur submiting the form u can also pass these check box variable values.
<input type=checkbox value = <%= value %> name=chk>Reagrds
Madhu -
Displaying images along with data on downloading from excel
Hi All,
I need to show images along with data in the excel sheet when user clicks downld to excel button. Is there possible way to show the images in excel sheet if, kindly help.
Thanks & Regards
Jaspreet KaurHi Vinod
Basically I have a report which needs to be downloaded to excel sheet. For each record there is a particular image in the first column for ex say my colums are img, desc. Now image column contains an image corresponding to each description. If its a file, a folder image is there; if its a document, a page image is there etc. Now i am can display the data of text fields in the following manner ie label =new Label(0,RowCount, wdContext.nodeVn_PortalExcel().getVn_PortalExcelElementAt(i).getVa_Role(), PortalRoleDataFormat);
PortalReportsheet.addCell(label);
but how do i display the image in the excel sheet?
Is it possible to do so, if so please provide assistance.
Thanks & Regards
Jaspreet Kaur -
Data Display table along with Graph
As per my knowledge we are not having any option currently for displaying data table along with graph.
This plot data table can have plot name along with current data.
See the sample below. Many times I need to display number of parameters on graph and current value need to see along with graph.
It will very useful if I get something like this in next version.Hi chameli,
well, you gave the chart as an example to your question - but didn't specify your question any further!
What's wrong with a little coding to have your data presented as you like to?
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
Display Metadata along with images
I am not a programmer, do not know script writing. Is there any simple way where I can manage, my metadata to be displayed along with the images ?
I know how to create metada.hi,
I am implementing the DATA_CELL method of table interface in webtemplate like this,
case I_X.
when 9.
if I_DISPLAY_VALUE = '2'.
c_cell_content = 'AAA'.
endif.
endcase.
endmethod.
I am getting the requirement,but can someone help me how I can access the column based on KF technical name, here i placed the KF in column 9,so I took "when 9".But i dont want to use column number , I want to use technical name of KF.
Thank you
ven -
Printing Header Along With Graphics on Customized Screen
I have taken SAP Standard Program 'GFW_PROG_CHART_TABLE' to print Graphics on my screen. I have alse created my Header for the Screen. is it possibe to take a print of my screen with the header also with Graphics.
How can i do that ?By "print of my screen" do you mean screen shot or actually printed to paper?
Printed to Paper you can try the "Hard Copy" option in your SAP Gui top menu help I believe, it's near the end of the top far right side.
Screen shot you can just use your "Print Screen" button the keyboard then open up a graphics program and hit paste. -
Displaying Header Text in ALV report.
HI Gurus,
I have one sales order which has header Text.
I am displaying that Header Text in my ALV report.
But while displaying in the ALV grid, the text is not coming full.
I have taken the datatype of the column of the ALV grid is string, Still the Header text is not come full.
Please help me.
Thanks in advance.Hi,
If the header text is morethan 60 characters, you can't print with REUSE_ALV_COMMENTARY_WRITE. To overcome above limit we can use dynamic document, which can be implemented through the class CL_DD_DOCUMENT. As dynamic documents use HTML viewer control so instead of triggering the TOP_OF_PAGE event we should trigger event of HTML TOP_OF_PAGE.
First create a subroutine for top of page in HTML format and send that name in I_CALLBACK_HTML_TOP_OF_PAGE parameter of ALV function module. The input parameter for this subroutine will be a variable of class CL_DD_DOCUMENT.
* FORM html_top_of_page *
FORM html_top_of_page USING top TYPE REF TO cl_dd_document.
data: l_text(255) type c.
l_text = '*******************************Hellooooooooooooooooooo************************'.
CALL METHOD top->add_text EXPORTING text = 'Hello world '
sap_style = 'heading' .
CALL METHOD top->add_gap EXPORTING width = 200.
CALL METHOD top->add_picture EXPORTING picture_id = 'ENJOYSAP_LOGO'.
CALL METHOD top->NEW_LINE( ).
CALL METHOD top->add_text EXPORTING
text = l_text.
ENDFORM.
* Display ALV grid
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE' " Use this event
i_callback_program = g_repid
i_structure_name = 'STRUCTURE'
TABLES
t_outtab = gt_outtab.
Regards
Bala Krishna -
How to use Write statement along with ALV output
Hi expert,
currently i have a requirement where i am first displaying message with write statement and after that ALV should be displayed ...something like below:
vendor number is wrong.
material number is wrong.
plant is wrong.
and then here ALV output -list of records updated in the database.
but as of now the ALV is shown first and when going back then the write message information is dispayed.
can anyone help how we can get this in only one screen?
Thanks!!!
RajeshMay below example give you some idea.
TYPE-POOLS: slis.
DATA: BEGIN OF it_kna1 OCCURS 0,
kunnr TYPE kna1-kunnr,
name1 TYPE kna1-name1,
ort01 TYPE kna1-ort01,
END OF it_kna1.
DATA: it_fcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
START-OF-SELECTION.
SELECT kunnr name1 ort01
FROM kna1 INTO TABLE it_kna1 UP TO 10 ROWS.
END-OF-SELECTION.
WRITE:/ 'Write Statement Display' HOTSPOT ON.
AT LINE-SELECTION.
CLEAR it_fcat.
it_fcat-fieldname = 'KUNNR'.
it_fcat-tabname = 'IT_KNA1'.
it_fcat-seltext_l = 'Customer'.
APPEND it_fcat.
CLEAR it_fcat.
it_fcat-fieldname = 'NAME1'.
it_fcat-tabname = 'IT_KNA1'.
it_fcat-seltext_l = 'Customer Name'.
APPEND it_fcat.
CLEAR it_fcat.
it_fcat-fieldname = 'ORT01'.
it_fcat-tabname = 'IT_KNA1'.
it_fcat-seltext_l = 'City'.
APPEND it_fcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = it_fcat[]
TABLES
t_outtab = it_kna1[]. -
How to display header for secondrary alv list
HI ALL,
WHEN I RAN THIS REPORT HEADER IS COMING FOR FIRST ALV.WHEN I DOUBLE CLICK ON SALES ORDER NUMBER IT SHOWS SECONDARY LIST. FOR THIS SECONDARY LIST HEADER IS NOT COMING.ANY BODY CAN SUGGEST HOW TO FIXZ THIS PROBLEM
REPORT ZMAHI1 LINE-SIZE 30.
TYPE-POOLS : SLIS.
*TYPES : BEGIN OF I_VBAK,
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
ERNAM TYPE VBAK-ERNAM,
ERZET TYPE VBAK-ERZET,
VTWEG TYPE VBAK-VTWEG,
VKORG TYPE VBAK-VKORG,
END OF I_VBAK.
DATA : BEGIN OF IT_VBAK OCCURS 0,
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
ERNAM TYPE VBAK-ERNAM,
ERZET TYPE VBAK-ERZET,
VTWEG TYPE VBAK-VTWEG,
VKORG TYPE VBAK-VKORG,
END OF IT_VBAK.
*DATA : IT_VBAK TYPE STANDARD TABLE OF I_VBAK INITIAL SIZE 0,
WA_VBAK TYPE I_VBAK.
*TYPES : BEGIN OF I_VBAP,
VBELN TYPE VBAP-VBELN,
MATNR TYPE VBAP-MATNR,
ERZET TYPE VBAP-ERZET,
POSNR TYPE VBAP-POSNR,
END OF I_VBAP.
DATA : BEGIN OF IT_VBAP OCCURS 0,
VBELN TYPE VBAP-VBELN,
MATNR TYPE VBAP-MATNR,
ERZET TYPE VBAP-ERZET,
POSNR TYPE VBAP-POSNR,
LINE_COLOR(4) TYPE C, "Used to store row color attributes
END OF IT_VBAP.
*DATA : IT_VBAP TYPE STANDARD TABLE OF I_VBAP INITIAL SIZE 0,
WA_VBAP TYPE I_VBAP.
DATA : EVENTCAT TYPE SLIS_T_EVENT.
DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
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.
DATA: I_TITLE_VBAK TYPE LVC_TITLE VALUE 'ALV LIST FIRST'.
DATA: I_TITLE_VBAP TYPE LVC_TITLE VALUE 'ALV LIST SECOND'.
DATA: V_REPID LIKE SY-REPID .
DATA : HEADING TYPE SLIS_T_LISTHEADER.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-T01.
PARAMETERS : P_VBELN TYPE VBAK-VBELN.
SELECTION-SCREEN END OF BLOCK B1.
INITIALIZATION.
V_REPID = SY-REPID.
START-OF-SELECTION.
PERFORM GET_DATA.
PERFORM BUILT_FIELDCATALOG.
PERFORM E03_EVENTTAB_BUILD USING EVENTCAT[].
PERFORM COMMENT_BUILD USING HEADING[].
PERFORM GRID_DISPLAY.
*& Form GET_DATA
text
--> p1 text
<-- p2 text
FORM GET_DATA.
SELECT VBELN
ERDAT
ERNAM
ERZET
VTWEG
VKORG
FROM VBAK
INTO TABLE IT_VBAK
WHERE VBELN EQ P_VBELN.
ENDFORM. " GET_DATA
*& Form BUILT_FIELDCATALOG
text
--> p1 text
<-- p2 text
FORM BUILT_FIELDCATALOG.
CLEAR I_FIELDCAT.
REFRESH : I_FIELDCAT[].
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
WA_FIELDCAT-FIELDNAME = 'VBELN'.
WA_FIELDCAT-SELTEXT_M = 'SALES DOC NO'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
WA_FIELDCAT-FIELDNAME = 'ERDAT'.
WA_FIELDCAT-SELTEXT_M = 'Creation Date'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
WA_FIELDCAT-FIELDNAME = 'ERNAM'.
WA_FIELDCAT-SELTEXT_M = 'NAME'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
WA_FIELDCAT-FIELDNAME = 'ERZET'.
WA_FIELDCAT-SELTEXT_M = 'TIME'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
WA_FIELDCAT-FIELDNAME = 'VTWEG'.
WA_FIELDCAT-SELTEXT_M = 'DIS CHANNEL'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
WA_FIELDCAT-FIELDNAME = 'VKORG'.
WA_FIELDCAT-SELTEXT_M = 'SALES ORG'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. " BUILT_FIELDCATALOG
*& Form GRID_DISPLAY
text
--> p1 text
<-- p2 text
FORM GRID_DISPLAY.
V_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
IT_FIELDCAT = I_FIELDCAT[]
I_SAVE = 'A'
IT_EVENTS = EVENTCAT[]
TABLES
T_OUTTAB = IT_VBAK
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. " GRID_DISPLAY
for header
*& Form HEADER
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = HEADING.
ENDFORM. " HEADER
*& Form E03_EVENTTAB_BUILD
FORM E03_EVENTTAB_BUILD USING E03_LT_EVENTS TYPE SLIS_T_EVENT.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 3
IMPORTING
ET_EVENTS = E03_LT_EVENTS.
READ TABLE E03_LT_EVENTS
WITH KEY NAME = SLIS_EV_TOP_OF_PAGE INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE 'TOP_OF_PAGE' TO LS_EVENT-FORM.
APPEND LS_EVENT TO E03_LT_EVENTS.
ENDIF.
DELETE E03_LT_EVENTS WHERE FORM IS INITIAL.
ENDFORM. " E03_EVENTTAB_BUILD
*& Form COMMENT_BUILD
FORM COMMENT_BUILD USING LT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
DATA: W_HEADING TYPE SLIS_LISTHEADER.
DATA: W_HEADING1 TYPE SLIS_LISTHEADER.
CLEAR : W_HEADING, LT_TOP_OF_PAGE.
REFRESH : LT_TOP_OF_PAGE.
W_HEADING-INFO = 'Synopsys World' .
W_HEADING-TYP = 'H'.
APPEND W_HEADING TO LT_TOP_OF_PAGE .
CLEAR W_HEADING .
ENDFORM. " COMMENT_BUILD
end of header portion.
*& 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'.
IF RS_SELFIELD-FIELDNAME = 'VBELN'.
PERFORM GETDATA_FROM_VBAP.
PERFORM BUILD_FIELDCATLOG_IT_VBAP.
PERFORM BUILD_LAYOUT.
PERFORM E03_EVENTTAB_BUILD USING EVENTCAT[].
PERFORM COMMENT_BUILD USING HEADING[].
PERFORM GRID_DISPLAY1.
ENDIF.
ENDCASE.
ENDFORM. "user_command
*& Form GETDATA_FROM_VBAP
text
--> p1 text
<-- p2 text
FORM GETDATA_FROM_VBAP.
DATA: LD_COLOR(1) TYPE C.
SELECT VBELN
MATNR
ERZET
POSNR
FROM VBAP
INTO TABLE IT_VBAP
FOR ALL ENTRIES IN IT_VBAK
WHERE VBELN = IT_VBAK-VBELN.
LOOP AT IT_VBAP .
LD_COLOR = LD_COLOR + 1.
IF LD_COLOR = 8.
LD_COLOR = 1.
ENDIF.
CONCATENATE 'C' LD_COLOR '10' INTO IT_VBAP-LINE_COLOR.
MODIFY IT_VBAP TRANSPORTING LINE_COLOR.
ENDLOOP.
ENDFORM. " GETDATA_FROM_VBAP
*& Form BUILD_FIELDCATLOG_IT_VBAP
text
--> p1 text
<-- p2 text
FORM BUILD_FIELDCATLOG_IT_VBAP.
CLEAR FIELDCATALOG.
REFRESH : FIELDCATALOG[].
FIELDCATALOG-FIELDNAME = 'VBELN'.
FIELDCATALOG-SELTEXT_M = 'SALES DOC NO'.
FIELDCATALOG-COL_POS = 0.
FIELDCATALOG-OUTPUTLEN = 10.
FIELDCATALOG-EMPHASIZE = 'X'.
FIELDCATALOG-KEY = 'X'.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'POSNR'.
FIELDCATALOG-SELTEXT_M = 'PO Item'.
FIELDCATALOG-COL_POS = 1.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'MATNR'.
FIELDCATALOG-SELTEXT_M = 'MAT NO'.
FIELDCATALOG-COL_POS = 2.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'ERZET'.
FIELDCATALOG-SELTEXT_M = 'TIME'.
FIELDCATALOG-COL_POS = 3.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
ENDFORM. " BUILD_FIELDCATLOG_IT_VBAP
*& Form GRID_DISPLAY1
text
--> p1 text
<-- p2 text
FORM GRID_DISPLAY1.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = GD_REPID
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
IS_LAYOUT = GD_LAYOUT
IT_FIELDCAT = FIELDCATALOG[]
I_SAVE = 'A'
IT_EVENTS = EVENTCAT[]
TABLES
T_OUTTAB = IT_VBAP
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. " GRID_DISPLAY1
*& Form BUILD_LAYOUT
text
--> p1 text
<-- p2 text
FORM BUILD_LAYOUT.
GD_LAYOUT-NO_INPUT = 'X'.
GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
GD_LAYOUT-TOTALS_TEXT = 'Totals'(201).
GD_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
ENDFORM. " BUILD_LAYOUTIn ur report,
in the rountine <b>GRID_DISPLAY1</b>.
<b> GD_REPID = SY-REPID.</b>
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = GD_REPID
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
IS_LAYOUT = GD_LAYOUT
IT_FIELDCAT = FIELDCATALOG[]
I_SAVE = 'A'
IT_EVENTS = EVENTCAT[]
TABLES
T_OUTTAB = IT_VBAP
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.
Maybe you are looking for
-
Accounts Payable Reconciliation Account does not match with sap report
Hello Folks, I have problem with AP reconciliation account, that the balances in FS10N for a particular Company Code for particular reconciliation account balance do not match with the report run to show the vendor balances in local currency (report
-
TNSNAMES.ORA for Oracle database 11.1.0.7
Hi, Im installed oracle database 11.1.0.7 ,but unable find the TNSNAMES.ORA File.Can any help on this.
-
How do I start "rmiregistry" from Eclipse IDE?
Could somebody tell me how I can start rmiregistry from the Eclipse IDE which is running j2se 5.0 ? Also if I try starting from the command prompt I get Windows cannot find rmiregistry with C:\>java -version java version "1.5.0_06" Java(TM) 2 Runtime
-
TS3988 waiting for file to be available in iCloud
When saving a pages document to the cloud I see "waiting" underneath the file name where the date saved should go. Never had to wait before, did i do something wrong?
-
Error in viewing successfully loaded data into cube..
hi gurus, I had a problem on viewing my data into cube. These data were successfully loaded from LIS environment. The errors i had received were 'Your user master record is not sufficiently maintained for object Commodity and Company Code Auth obj