Need class name to display ALV list (not Grid) in objects..
hi,
i need to display ALV list ( not ALV Grid ) in objects.. i dont the class name for tat.. so plz can anyone help me out for the same..
thanks in advance..
With cl_salv_table you can have both grid or list, depending what you want.
cl_salv_table=>factory(
EXPORTING
list_display = 'X' "when space then GRID, when 'X' then LIST
IMPORTING
r_salv_table = ref_table
CHANGING
t_table = gt_sflight ).
Regards
Marcin
Similar Messages
-
ALV Sub total texts. displayed in list not in grid.
Hi,
I am displaying data using alv and sub-totals on a particular column.
i am getting the sub-totals but i am not getting the sub-total texts when i am displaying data in a grid.
'REUSE_ALV_GRID_DISPLAY'.
i am getting subtotals and subtotal texts when i am diSplAying in list.
'REUSE_ALV_LIST_DISPLAY'.
but i want to get subtotal texts using alv grid, is it possible, if so please send me the code.
Any help in this regard is highly appreciated.
Thanks in advance for your help.Hi,
Actually i have wriitten the same code, in the alv. I am using Function modules. for the same code the sub-total and total text is appearing in the list output. but not in the grid output.
code.
wa_layout-zebra = 'X'.
wa_layout-subtotals_text = 'Total'.
wa_layout-totals_text = 'Sum of Marks'.
alv statement.
is_layout = wa_layout
Declaration.
DATA : wa_layout type slis_layout_alv.
for the same declarations (Above) list is showing the texts but not the grid.
Any help in this regard is highly appreciated. -
How to display ALV list with more than 1 structure?
Hello everyone,
I am using REUSE_ALV_LIST_DISPLAY to generate a report that displays vendor/customer items with purchases/sales total. I have 2 internal table for this. For every vendor/customer i need a total table right after, this have a different structure. I cannot use REUSE_ALV_BLOCK_LIST_ as this is not capable of calculating the subtotal per currency and from the documentation it says do not use.
Any idea on how to proceed?
Thanks!Call ALV list function module per table structure.
Closing this thread. -
Display ALV List in Object Oriented Method
Dear Guru ,
I have encountered an issue which i am trying to resolve
I am using following custom code to display lists of the entries of <F_FS> in ALV GRID FORMAT
For display data in ALV GRID FORMAT i am using class cl_gui_alv_grid.
But the requirment is like this i have to show it in ALV LIST Display Format .
when i searched for class cl_gui_alv_list i found that Object Type CL_GUI_ALV_LIST does not exist
Please show me some guide line how to achieve this .....
DATA : gt_cust TYPE REF TO cl_gui_custom_container. "Custom Container
DATA : cust TYPE scrfname VALUE 'CC_OUTPUT'. "Custom controller
DATA : gt_grid TYPE REF TO cl_gui_alv_grid. "ALV List Viewer
FIELD-SYMBOLS : <f_fs> TYPE table. "FieldSymbol for holding fields
DATA : t_cat TYPE STANDARD TABLE OF lvc_s_fcat INITIAL SIZE 0."To hold Field Catalog
IF gt_cust IS INITIAL.
CREATE OBJECT gt_cust
EXPORTING
container_name = cust.
CREATE OBJECT gt_grid
EXPORTING
i_parent = gt_cust.
**--Display the data in the grid control
CALL METHOD gt_grid->set_table_for_first_display
EXPORTING
i_buffer_active = 'X'
i_bypassing_buffer = ' '
CHANGING
it_outtab = <f_fs>
it_fieldcatalog = t_cat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4 .
IF sy-subrc <> 0.
ENDIF.
ENDIF.RECL_SALV_TABLE,
CL_SALV_COLUMNS_TABLE,
CL_SALV_COLUMN_TABLE, -
ALV List not populating data statistics output in ECC6.0
Hi,
I am working in an upgrade upgrade project from 4.6c to ECC6.0.
4.6c is non-unicode system. ECC6 is Unicode system.
I am facing one problem in ALV list output in the background job. In 4.6c the data statistics output is displayed as per the screen
Data statistics
Number of
Records passed
584
but this output is not displayed in ECC 6.0.
I given below the code which we are using in programe 4.6c and ECC6.0
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZNHNZLLVL0'
i_grid_title = l_title
is_layout = alv_layout
it_fieldcat = alv_fieldcat
i_save = 'A'
is_variant = stru_disvar
TABLES
t_outtab = list_table
EXCEPTIONS
program_error = 1
OTHERS = 2.
Give your input to solve this issue .
- Anandakumar.KHi Ganesh,
this problem is mainly printer problem issue, to resovle this isues you have to do small changes in the print setting.
Step1) Execute the report in background -> you will get a popup .....where you will give the output device for ex : LOCL
fruther in the same popup you can see Properties .......click that you can see COVERSHEETs > select coversheets and
then click SPECIFICATIONS buttons > select int he Fied name A) ALVSELECTIONS B) ALVSTATISTICS one bye bone
and then change the Field Default value to YES.... for both the options . Now finally click COPY Settings ...........
now you again shedule the report again in background ........you can see the result you are expecting.......
Cheers
Divya. -
Display ALV list output in PDF format
Hi All,
My requirement is :
I am displaying output using Function module 'REUSE_ALV_LIST_DISPLAY'. then i will click one button which placed in application tool bar say 'Download to PDF' when i click this button it will display the output in PDF format. I tried with exsting threads but i unable to get suitable solution.Anybody can send me the sample code please.
Thanks in advance.
Maheedharplease go throuh the below procedure and sample Code, this might help you.
Procedure
When we activate the Smartform the system generates a Function Module. The function module name we can get from Smartfrom screen from menubar
Environment => Function Module_Name . In a report we can get this Function module name by calling a Function Module standard SSF_FUNCTION_MODULE_NAME. This function module at runtime calls the FM generated by smartform, which in turn is then used to pass data from the report to Smartform. In the report given below the FM generated is /1BCDWB/SF00000152 . In this FM we can see CONTROL_PARAMETERS in import tab. This is of type SSFCTRLOP. We need to set the GETOTF of this to be X. Setting this field will activate the OTF field in smartform.
In export tab of the FM generated by smartform we can see a parameter JOB_OUTPUT_INFO which is of type SSFCRESCL. The SSFCRESCL is a structure of having one of fields as OTFDATA. OTFDATA in turn is a table of type ITCOO. ITCOO has two fields TDPRINTCOM and TDPRINTPAR. TDPRINTCOM represents command line of OTF format data and TDPRINTPAR contains command parameters of OTF format data.
In every Smartform output in OTF format, TDPRINTCOM begins and ends with //. EP represents the end-of-page value for TDPRINTCOM field.
In addition we need to set few fields at the place where we call this FM(generated by smartform) in our program. While calling this FM we should set control_parameters, output_options, user_settings and job_putput_info fields as shown in program.
Once these settings are done we can call Function Module CONVERT_OTF to convert the OTF data of smartfrom output to PDF data format. Once these are done we can call method cl_gui_fronted_services=>file_save_dialog to specify the directory path where we want to save the output PDF file. After this we can call Function Module GUI_DOWNLOAD to download the PDF file on our local system.
Here is a sample code of program to perform the function.
SAMPLE CODE
*& Report ZAMIT_SMART_FORM_PDF *
REPORT ZAMIT_SMART_FORM_PDF .
data: carr_id type sbook-carrid,
cparam type ssfctrlop,
outop type ssfcompop,
fm_name type rs38l_fnam.
DATA: tab_otf_data TYPE ssfcrescl,
pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE,
tab_otf_final TYPE itcoo OCCURS 0 WITH HEADER LINE,
file_size TYPE i,
bin_filesize TYPE i,
FILE_NAME type string,
File_path type string,
FULL_PATH type string.
parameter: p_custid type scustom-id default 1.
select-options: s_carrid for carr_id default 'LH' to 'LH'.
parameter: p_form type tdsfname default 'ZAMIT_SMART_FORM'.
data: customer type scustom,
bookings type ty_bookings,
connections type ty_connections.
start-of-selection.
suppressing the dialog box for print preview****************************
outop-tddest = 'LP01'.
cparam-no_dialog = 'X'.
cparam-preview = SPACE.
cparam-getotf = 'X'.
select single * from scustom into customer where id = p_custid.
check sy-subrc = 0.
select * from sbook into table bookings
where customid = p_custid
and carrid in s_carrid
order by primary key.
select * from spfli into table connections
for all entries in bookings
where carrid = bookings-carrid
and connid = bookings-connid
order by primary key.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting formname = p_form
variant = ' '
direct_call = ' '
importing fm_name = fm_name
exceptions no_form = 1
no_function_module = 2
others = 3.
if sy-subrc 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
exit.
endif.
calling the generated function module
call function fm_name
exporting
archive_index =
archive_parameters =
control_parameters = cparam
mail_appl_obj =
mail_recipient =
mail_sender =
output_options = outop
user_settings = SPACE
bookings = bookings
customer = customer
connections = connections
importing
document_output_info =
job_output_info = tab_otf_data
job_output_options =
exceptions formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
others = 5.
if sy-subrc 0.
error handling
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
tab_otf_final] = tab_otf_data-otfdata[.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
ARCHIVE_INDEX = ' '
COPYNUMBER = 0
ASCII_BIDI_VIS2LOG = ' '
IMPORTING
bin_filesize = bin_filesize
BIN_FILE =
TABLES
otf = tab_otf_final
lines = pdf_tab
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
WINDOW_TITLE =
DEFAULT_EXTENSION =
DEFAULT_FILE_NAME =
FILE_FILTER =
INITIAL_DIRECTORY =
WITH_ENCODING =
PROMPT_ON_OVERWRITE = 'X'
CHANGING
filename = FILE_NAME
path = FILE_PATH
fullpath = FULL_PATH
USER_ACTION =
FILE_ENCODING =
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
others = 4
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
************downloading the converted PDF data to your local PC*******
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = bin_filesize
filename = FULL_PATH
filetype = 'BIN'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
IMPORTING
filelength = file_size
TABLES
data_tab = pdf_tab
FIELDNAMES =
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22
IF sy-subrc 0.
ENDIF.
Check this link it will help you.
https://forums.sdn.sap.com/click.jspa?searchID=5950895&messageID=2375150
Reward points if useful. -
Need to add checkbox in alv header Not in grid
Dear Guru's,
My question is i want to add checkbox on top of alv grid ie on top of page .
my requriement is for SD module- status of order -Mass Update.
suppose status checkbox on header is HFSC is checked ( check box),
for all the sales order which are showed on the alv grid must be updated with this status for which i am calling trasaction VA02 in program and doing changes but i am not able to create checkbox on header .
Again i have already used ALV without classesso please give me solution accordinglly . Thanks in advance.Hi,
For working with top of page we generally use SLIS_LISTHEADER right.
In this type the first field is
type - which can accept values as follows
H - Heading
S - Selection
A - Action
May be the options Selection or Action may help u. -
String contains class name: how to use it for creating new objects
Hi All
I've seen things like this in scripting languages, so I was wondering if things like this are possible in java. Here is an not working example:
String s = "MyClass" ;
MyClass mc = new s() ; // or: s mc = new s() ;
if ( mc instanceof s ) { ..... }
Is something like this possible ?
Thnx in advance
LuCajeanluca wrote:
I've seen things like this in scripting languages, so I was wondering if things like this are possible in java. Here is an not working example:
Is something like this possible ?AFAIK, it is only possible in a very limited way as noted above and is nearly always not recommended and definitely not necessary. The variable name has little importance, but OTOH the object reference has great importance. Instead learn about arrays, Lists, and Maps. -
How to get variants for ALV List or Grid?
Hi,
I have one standard program RGJVSO10, for 4.6c, to diplay variants they r using fm GJ_LIST_VARIANT_VALUE_HELP, where they r passing table name and get the variants.
But in ECC6.0 for the same program they r using FM REUSE_ALV_VARIANT_F4, but the variants are not displaying, form the table what they r passing in 4.6c,
Is ther any option to get those variants using this function module?Hi,
I have check u r db table but not finding variant . i will check with prg and inform u .mean while u check with these variants.
whether it suits u.
REUSE_ALV_VARIANT_ALL_MAINTAIN
REUSE_ALV_VARIANT_SELECT.
REUSE_ALV_VARIANT__MAINTAIN
REUSE_ALV_VARIANT_DEFAULT_GET
Reward if its usefull.
Regards
Durgaprasad -
How do I change a field in the sum in ALV (List or grid)
My alv, for example:
1.10
2.30
1.50
Sum(DO_SUM) : 4.90
But I need to CEIL( 4.90 ) before showing .
It should be shown as 5.00 in alv.
How do I change this field in the sum ?Use the following code in a PBO module or in an adequate event method
data: total type ref to data,
subtotal1 type ref to data.
field-symbols: <total> like gt_sflight,
<subtotal1> like gt_sflight.
call method grid1->get_subtotals
importing
ep_collect00 = total
ep_collect01 = subtotal1.
assign total->* to <total>.
assign subtotal1->* to <subtotal1>.
Look at [ALV Grid Control (BC-SRV-ALE)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf]
Regards -
Problem with printing ALV lists
Hey Guys,
I have a problem with printing ALV lists ,
I created a report with several ALV lists (not grids) on the same screen but when i attempt to print the report
it prints each alv list on a different page..so if i have 3 alv lists in the same report it will print the report on 3 pages
How can i print them all in one page?
Thanks in advance
Noha Salah.Hey Max,
I tried setting the Layout-list_append before my block_list_append function call
And setting the is_print-NO_NEW_PAGE , it printed the 3 lists on one page the only problem i have
is that the lists are truncated and the list formats has totally been messed up..how can i restore them back
to their original format? -
Is it Possible to display the output of the ALV list as POP-UP
Hi Experts,
Is it Possible to display the output of the ALV list as POP-UP, if yes then provide some ideas on it.
thanking in advance,
Samad.Hi samad, it is possible to display alv list as pop-up by using the FM " REUSE_ALV_POPUP_TO_SELECT"
try this sample code
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
I_TITLE = P1_TITLE
I_SELECTION = 'X'
I_ZEBRA = 'X'
I_CHECKBOX_FIELDNAME =
I_LINEMARK_FIELDNAME =
I_SCROLL_TO_SEL_LINE = 'X'
I_TABNAME = 'T_VBAP'
I_STRUCTURE_NAME = 'T_VBAP'
IT_FIELDCAT = T_FCAT2
I_CALLBACK_PROGRAM = 'ZTEST_ALV_POPUP'
IMPORTING
ES_SELFIELD = I_SELFIELD
E_EXIT = W_EXIT
TABLES
T_OUTTAB = T_VBAP.
i think it will solve your problem
Regards,
Vijay -
Dear gurus,
Need help in displaying ALV list report. the below report is an example of AR aging report. The report output is as below:
DEC
NOV
OCT
SEP
0-30
31-60
61-90
90+
xx
xx
xx
xx
SUBTOTAL
The first 2 lines are the list header. While the 'x' is the amount.
How can i display the above output with 2 header lines? I was thinking of using the REUSE_ALV_FIELDCATALOG_MERGE function. But it will have 2 lines of body row too. In fact, i only one one row in the body. But if i define the header lines manually, i would not able to do the subtotal at the end of the alv list. I need to have the subtotal too.
Thanks in advance!Hi,
For this requirement you need to populate the fld catalog using row_pos and col_pos fields specifing proper position.
See this code snippet ..... this is only possible for ALV list.
TYPE-POOLS: slis.
DATA: ld_fieldcat TYPE slis_fieldcat_alv.
DATA: t_alv_fieldcat TYPE STANDARD TABLE OF slis_fieldcat_alv.
DATA : it_fld TYPE slis_t_fieldcat_alv,
wa_fld TYPE slis_fieldcat_alv.
data: BEGIN OF itab OCCURS 0,
carrid like sflight-carrid,
connid like sflight-connid,
planetype like sflight-planetype,
seatsmax like sflight-seatsmax,
END OF itab.
START-OF-SELECTION.
SELECT carrid connid planetype seatsmax
FROM sflight
INTO TABLE itab.
CLEAR: ld_fieldcat.
ld_fieldcat-row_pos = '1'.
ld_fieldcat-col_pos = '1'.
ld_fieldcat-tabname = 'ITAB'.
ld_fieldcat-fieldname = 'CARRID'.
ld_fieldcat-ref_tabname = 'SFLIGHT'.
ld_fieldcat-outputlen = '10'.
APPEND ld_fieldcat TO t_alv_fieldcat.
CLEAR ld_fieldcat.
CLEAR: ld_fieldcat.
ld_fieldcat-row_pos = '1'.
ld_fieldcat-col_pos = '2'.
ld_fieldcat-tabname = 'ITAB'.
ld_fieldcat-fieldname = 'CONNID'.
ld_fieldcat-ref_tabname = 'SFLIGHT'.
ld_fieldcat-outputlen = '10'.
APPEND ld_fieldcat TO t_alv_fieldcat.
CLEAR ld_fieldcat.
CLEAR: ld_fieldcat.
ld_fieldcat-row_pos = '2'.
ld_fieldcat-col_pos = '1'.
ld_fieldcat-tabname = 'ITAB'.
ld_fieldcat-fieldname = 'PLANETYPE'.
ld_fieldcat-ref_tabname = 'SFLIGHT'.
ld_fieldcat-outputlen = '10'.
APPEND ld_fieldcat TO t_alv_fieldcat.
CLEAR ld_fieldcat.
CLEAR: ld_fieldcat.
ld_fieldcat-row_pos = '2'.
ld_fieldcat-col_pos = '2'.
ld_fieldcat-tabname = 'ITAB'.
ld_fieldcat-fieldname = 'SEATSMAX'.
ld_fieldcat-ref_tabname = 'SFLIGHT'.
ld_fieldcat-outputlen = '10'.
APPEND ld_fieldcat TO t_alv_fieldcat.
CLEAR ld_fieldcat.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = t_alv_fieldcat[]
TABLES
t_outtab = ITAB. "internal table
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
Amitava -
ALV list downloading to XML file
hi experts,
im working on ALV reports. i have displayed the list using grid, im also displaying the subtotals and grand total also.
its all working fine.
my problem is, when i try to download it using list -> export -> spreadsheet, im getting only the data. the top of page, end of list and totals are not getting into the xml file.
can some one help me to solve this problem please.
one more problem is when i download using local file button (ctrlshftF9) im gtting header footer and all. but here the problem is its getting some additional coloms and also a list header, which i didnt gave. how to avoid those. please help me to slove these problems.
thanks in advance.hi,
i cannot understand y u r not getting totals and headings in xml file.
check this sample program,i have downloaded now to desktop and iam getting all headings,subtotals and totals.
REPORT ZGM_ALV_SUBTOTAL_TEXT .
*& Table declaration
TABLES: ekko.
*& Type pool declaration
TYPE-POOLS: slis. " Type pool for ALV
*& Selection screen
SELECT-OPTIONS: s_ebeln FOR ekko-ebeln.
*& Type declaration
Type declaration for internal table to store EKPO data
TYPES: BEGIN OF x_data,
ebeln TYPE char30, " Document no.
ebelp TYPE ebelp, " Item no
matnr TYPE matnr, " Material no
matnr1 TYPE matnr, " Material no
werks TYPE werks_d, " Plant
werks1 TYPE werks_d, " Plant
ntgew TYPE entge, " Net weight
gewe TYPE egewe, " Unit of weight
END OF x_data.
*& Internal table declaration
DATA:
i_ekpo TYPE STANDARD TABLE OF x_data INITIAL SIZE 0,
Internal table for storing field catalog information
i_fieldcat TYPE slis_t_fieldcat_alv,
Internal table for Top of Page info. in ALV Display
i_alv_top_of_page TYPE slis_t_listheader,
Internal table for ALV Display events
i_events TYPE slis_t_event,
Internal table for storing ALV sort information
i_sort TYPE slis_t_sortinfo_alv,
i_event TYPE slis_t_event.
*& Work area declaration
DATA:
wa_ekko TYPE x_data,
wa_layout TYPE slis_layout_alv,
wa_events TYPE slis_alv_event,
wa_sort TYPE slis_sortinfo_alv.
*& Constant declaration
CONSTANTS:
c_header TYPE char1
VALUE 'H', "Header in ALV
c_item TYPE char1
VALUE 'S'.
*& Start-of-selection event
START-OF-SELECTION.
Select data from ekpo
SELECT ebeln " Doc no
ebelp " Item
matnr " Material
matnr " Material
werks " Plant
werks " Plant
ntgew " Quantity
gewei " Unit
FROM ekpo
INTO TABLE i_ekpo
WHERE ebeln IN s_ebeln
AND ntgew NE '0.00'. IF sy-subrc = 0.
SORT i_ekpo BY ebeln ebelp matnr .
ENDIF.
To build the Page header
PERFORM sub_build_header. "* To prepare field catalog
PERFORM sub_field_catalog. "* Perform to populate the layout structure
PERFORM sub_populate_layout."* Perform to populate the sort table.
PERFORM sub_populate_sort."* Perform to populate ALV event
PERFORM sub_get_event.
END-OF-SELECTION.
* Perform to display ALV report
PERFORM sub_alv_report_display.
*& Form sub_build_header
To build the header
No Parameter
FORM sub_build_header .
Local data declaration
DATA: l_system TYPE char10 , "System id
l_r_line TYPE slis_listheader, "Hold list header
l_date TYPE char10, "Date
l_time TYPE char10, "Time
l_success_records TYPE i, "No of success records
l_title(300) TYPE c. " Title
Title Display
l_r_line-typ = c_header. " header
l_title = 'Test report'(001).
l_r_line-info = l_title.
APPEND l_r_line TO i_alv_top_of_page.
CLEAR l_r_line.
* Run date Display
CLEAR l_date.
l_r_line-typ = c_item. " Item
WRITE: sy-datum TO l_date MM/DD/YYYY.
l_r_line-key = 'Run Date :'(002).
l_r_line-info = l_date.
APPEND l_r_line TO i_alv_top_of_page.
CLEAR: l_r_line,
l_date.ENDFORM. " sub_build_header
*& Form sub_field_catalog
Build Field Catalog
No Parameter
FORM sub_field_catalog .
Build Field Catalog
PERFORM sub_fill_alv_field_catalog USING: '01' '01' 'EBELN'
'I_EKPO' 'L'
'Doc No'(003) ' ' ' ' ' ' ' ', '01' '02' 'EBELP' 'I_EKPO' 'L'
'Item No'(004) 'X' 'X' ' ' ' ', '01' '03' 'MATNR' 'I_EKPO' 'L'
'Material No'(005) 'X' 'X' ' ' ' ', '01' '03' 'MATNR1' 'I_EKPO'
'L'
'Material No'(005) ' ' ' ' ' ' ' ',
'01' '04' 'WERKS' 'I_EKPO' 'L'
'Plant'(006) 'X' 'X' ' ' ' ', '01' '04' 'WERKS1' 'I_EKPO' 'L'
'Plant'(006) ' ' ' ' ' ' ' ', '01' '05' 'NTGEW' 'I_EKPO' 'R'
'Net Weight'(007) ' ' ' ' 'GEWE' 'I_EKPO'.ENDFORM.
" sub_field_catalog*&----
*& Form sub_fill_alv_field_catalog
*& For building Field Catalog
*& p_rowpos Row position
*& p_colpos Col position
*& p_fldnam Fldname
*& p_tabnam Tabname
*& p_justif Justification
*& p_seltext Seltext
*& p_out no out
*& p_tech Technical field
*& p_qfield Quantity field
*& p_qtab Quantity table
FORM sub_fill_alv_field_catalog USING p_rowpos TYPE sycurow
p_colpos TYPE sycucol
p_fldnam TYPE fieldname
p_tabnam TYPE tabname
p_justif TYPE char1
p_seltext TYPE dd03p-scrtext_l
p_out TYPE char1
p_tech TYPE char1
p_qfield TYPE slis_fieldname
p_qtab TYPE slis_tabname.
Local declaration for field
catalog
DATA: wa_lfl_fcat TYPE slis_fieldcat_alv.
wa_lfl_fcat-row_pos = p_rowpos. "Row
wa_lfl_fcat-col_pos = p_colpos. "Column
wa_lfl_fcat-fieldname = p_fldnam. "Field Name
wa_lfl_fcat-tabname = p_tabnam. "Internal Table Name
wa_lfl_fcat-just = p_justif. "Screen Justified
wa_lfl_fcat-seltext_l = p_seltext. "Field Text
wa_lfl_fcat-no_out = p_out. "No output
wa_lfl_fcat-tech = p_tech. "Technical field
wa_lfl_fcat-qfieldname = p_qfield. "Quantity unit
wa_lfl_fcat-qtabname = p_qtab .
"Quantity table
IF p_fldnam = 'NTGEW'.
wa_lfl_fcat-do_sum = 'X'.
ENDIF.
APPEND wa_lfl_fcat TO i_fieldcat.
CLEAR wa_lfl_fcat.
ENDFORM.
" sub_fill_alv_field_catalog*&----
*& Form sub_populate_layout
Populate ALV layout
No Parameter
FORM sub_populate_layout . CLEAR wa_layout.
wa_layout-colwidth_optimize = 'X'.
" Optimization of Col width
ENDFORM. " sub_populate_layout*&----
*& Form sub_populate_sort
Populate ALV sort table
No Parameter
FORM sub_populate_sort .
Sort on material
wa_sort-spos = '01' .
wa_sort-fieldname = 'MATNR'.
wa_sort-tabname = 'I_EKPO'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO i_sort .
CLEAR wa_sort.
Sort on plant
wa_sort-spos = '02'.
wa_sort-fieldname = 'WERKS'.
wa_sort-tabname = 'I_EKPO'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO i_sort .
CLEAR wa_sort.
ENDFORM.
" sub_populate_sort*&----
*& Form sub_get_event
Get ALV grid event and pass the form name to subtotal_text
event
No Parameter
FORM sub_get_event .
CONSTANTS : c_formname_subtotal_text TYPE slis_formname VALUE
'SUBTOTAL_TEXT'. DATA: l_s_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 4
IMPORTING
et_events = i_event
EXCEPTIONS
list_type_wrong = 0
OTHERS = 0.
Subtotal
READ TABLE i_event INTO l_s_event
WITH KEY name = slis_ev_subtotal_text.
IF sy-subrc = 0.
MOVE c_formname_subtotal_text TO l_s_event-form.
MODIFY i_event FROM l_s_event INDEX sy-tabix.
ENDIF.ENDFORM.
" sub_get_event*&----
*& Form sub_alv_report_display
For ALV Report Display
No Parameter
FORM sub_alv_report_display .
DATA: l_repid TYPE syrepid .
l_repid = sy-repid .
This function module for displaying the ALV
report
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_repid
i_callback_top_of_page = 'SUB_ALV_TOP_OF_PAGE'
is_layout = wa_layout
it_fieldcat = i_fieldcat
it_sort = i_sort
it_events = i_event
i_default = 'X'
i_save = 'A'
TABLES
t_outtab = i_ekpo
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE i000 WITH 'Error in ALV report display'(055).
ENDIF.
ENDFORM.
" sub_alv_report_display*&----
FORM sub_alv_top_of_page
Call ALV top of page
No parameter
FORM sub_alv_top_of_page. "#EC CALLED*
*To write header for the ALV
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_alv_top_of_page.
ENDFORM.
"alv_top_of_page*&----
*& Form subtotal_text
Build subtotal text
P_total Total
p_subtot_text Subtotal text info
FORM subtotal_text CHANGING
p_total TYPE any
p_subtot_text TYPE slis_subtot_text.
Material level sub total
IF p_subtot_text-criteria = 'MATNR'.
p_subtot_text-display_text_for_subtotal
= 'Material level total'(009).
ENDIF.
Plant level sub total
IF p_subtot_text-criteria = 'WERKS'.
p_subtot_text-display_text_for_subtotal = 'Plant level total'(010).
ENDIF.
ENDFORM. "subtotal_textSelection screen: -
ALV list: Multiple headerlines?!
Hi
I need multiple headerlines in my ALV list, as shown here:
Books--MagasinDVD--
Paper-electronPaper-Electron--XXXyyy---
====================================================
232 444 21 998 6655 12
Books, Magasin, and DVD is written as headerline1,
paper, electron, paper, electron, xxx, yyy is written as headerline 2.
Then items line is written.
Can/will anybody help me, please?
Best regards.
LYou can do this in the top-of-page event of ALV.sample code is as below :
data :
IT_EVENTS TYPE SLIS_T_EVENT,
IT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
G_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
*Build the event table
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = IT_EVENTS.
READ TABLE IT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE G_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO IT_EVENTS.
ENDIF.
REFRESH LT_MATNR[].
LOOP AT SO_MATNR.
LT_MATNR-MATNR = SO_MATNR-LOW.
APPEND LT_MATNR.
ENDLOOP.
CLEAR LV_TEXT.
DATA : LV_INDEX TYPE I,LV_MATNR1 LIKE LIPS-MATNR,LV_MATNR2 LIKE LIPS-MATNR.
LV_TEXT = 'Products:'.
DESCRIBE TABLE LT_MATNR LINES LV_INDEX.
IF NOT LV_INDEX IS INITIAL.
READ TABLE LT_MATNR INTO LV_MATNR1 INDEX 1.
READ TABLE LT_MATNR INTO LV_MATNR2 INDEX LV_INDEX.
IF LV_MATNR2 IS INITIAL.LV_MATNR2 = LV_MATNR1.ENDIF.
CONCATENATE LV_TEXT LV_MATNR1 'To' LV_MATNR2 INTO LV_TEXT
SEPARATED BY SPACE.
LS_LINE-TYP = 'H'.
LS_LINE-INFO = LV_TEXT.
APPEND LS_LINE TO IT_LIST_TOP_OF_PAGE.
CLEAR LS_LINE.
ENDIF.
REFRESH LT_SHTYP[].
IF NOT SO_SHTYP[] IS INITIAL.
LOOP AT SO_SHTYP.
LT_SHTYP-SHTYP = SO_SHTYP-LOW.
APPEND SO_SHTYP.
ENDLOOP.
CLEAR :LV_TEXT,LV_INDEX..
FORM TOP_OF_PAGE *
FORM TOP_OF_PAGE.
ULINE.
WRITE : SY-TITLE(65) CENTERED, 'Page :' , SY-PAGNO .
ULINE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
I_LOGO = 'ENJOYSAP_LOGO'
IT_LIST_COMMENTARY = IT_LIST_TOP_OF_PAGE.
ULINE.
ENDFORM. "TOP_OF_PAGE
DATA : LV_SHTYP1 LIKE VTTK-SHTYP ,LV_SHTYP2 LIKE VTTK-SHTYP.
DESCRIBE TABLE LT_SHTYP LINES LV_INDEX.
IF NOT LV_INDEX IS INITIAL.
READ TABLE LT_SHTYP INTO LV_SHTYP1 INDEX 1.
READ TABLE LT_SHTYP INTO LV_SHTYP2 INDEX LV_INDEX.
IF LV_SHTYP2 IS INITIAL.LV_SHTYP2 = LV_SHTYP1.ENDIF.
CONCATENATE LV_TEXT LV_SHTYP1 'To' LV_SHTYP2 INTO LV_TEXT
SEPARATED BY SPACE.
LS_LINE-TYP = 'H'.
LS_LINE-INFO = LV_TEXT.
APPEND LS_LINE TO IT_LIST_TOP_OF_PAGE.
CLEAR LS_LINE.
ENDIF.
ENDIF.
CLEAR LV_TEXT.
CONCATENATE SO_DATE-LOW6(2) SO_DATE-LOW4(2) SO_DATE-LOW+0(4)
INTO LV_LOW SEPARATED BY '.'.
CONCATENATE SO_DATE-HIGH6(2) SO_DATE-HIGH4(2) SO_DATE-HIGH+0(4)
INTO LV_HIGH SEPARATED BY '.'.
IF LV_HIGH = '00.00.0000'. LV_HIGH = LV_LOW.ENDIF.
CONCATENATE 'Posting Date:' LV_LOW 'to' LV_HIGH
INTO LV_TEXT SEPARATED BY SPACE.
LS_LINE-TYP = 'H'.
LS_LINE-INFO = LV_TEXT.
APPEND LS_LINE TO IT_LIST_TOP_OF_PAGE.
CLEAR LS_LINE.
Maybe you are looking for
-
Hi everybody, I know this is probably a commonly asked question, but I've been looking through other threads and haven't found anything that works so far. iPod touch died a while ago and gave me the "restore me" screen. (Showing a USB cord plugging i
-
Selection Variant for Standard transaction
Hi, The requirement is that, On starting a standard transaction the initial selection screen should appear with a default selection variant selected in it. Regards, Prabaharan.G
-
All, I have my ACS loaded on a Win2K server and when I log into a router is it true that the router is the NAS device and that it (the router) sends the username and password information to the ACS server for verification? Also is the information bei
-
Migrate print server from Windows 2000 to Windows 2008 R2
Hi, Want to transfer NTFS permission of printers from Windows 2000 to Windows 2008 R2. Any method can do it ?? Thanks
-
Legit website for after effects?
ok so i dont have a very well paying job considering im pretty young but i have about 600 dollars and i found this site that sells adobe after effects for about the amount of money i have saved up the site is called ztechsoftware.com and i just want