Alv grid Should Display In Three Tabstrips
Hi Experts,
Could you please tell me how to display alv in three tabstrips using oops abap
Best answer rewarded
Regards
Fareedas
Follow the following code for the 3rd tabstrip (I have done it for 2).
*& Report ZTEST_READ_CLUSTER
REPORT ztest_read_cluster.
TABLES: vbak, likp.
TYPES: BEGIN OF types_vbak ,
vbeln TYPE vbeln,
vkorg TYPE vkorg,
netwr TYPE netwr,
END OF types_vbak,
BEGIN OF types_likp ,
vbeln TYPE vbeln_vl,
vstel TYPE vstel,
vkorg TYPE vkorg,
netwr TYPE netwr,
END OF types_likp.
DATA: w_cntx_menu TYPE REF TO cl_rsdme_ui_context_menu_gen,
t_vbak TYPE STANDARD TABLE OF types_vbak,
t_likp TYPE STANDARD TABLE OF types_likp,
w_sale TYPE char01.
CONSTANTS: c_check TYPE c VALUE 'X'.
** ALV relavent Data
DATA: w_grid TYPE REF TO cl_gui_alv_grid,
wl_ref_container TYPE REF TO cl_gui_custom_container,
w_container TYPE scrfname VALUE 'C_CONTAINER',
t_fcat TYPE lvc_t_fcat,
t_sort TYPE lvc_t_sort.
CONTROLS: c_tab TYPE TABSTRIP.
DATA: c_dynnr TYPE sy-dynnr.
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-011.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln,
s_delvr FOR likp-vbeln.
SELECTION-SCREEN: END OF BLOCK b1.
START-OF-SELECTION.
SELECT vbeln
vkorg
netwr
FROM vbak INTO TABLE t_vbak
WHERE vbeln IN s_vbeln.
IF sy-subrc = 0.
SORT t_vbak BY vbeln.
ENDIF.
SELECT vbeln
vstel
vkorg
netwr
FROM likp INTO TABLE t_likp
WHERE vbeln IN s_delvr.
IF sy-subrc = 0.
SORT t_likp BY vbeln.
ENDIF.
CALL SCREEN '9001'.
*& Module STATUS_9001 OUTPUT
* text
MODULE status_9001 OUTPUT.
SET PF-STATUS ' '.
SET TITLEBAR 'MAIN'.
IF c_tab-activetab IS INITIAL OR
c_dynnr IS INITIAL.
c_tab-activetab = 'TAB1'.
c_dynnr = '9002'.
ENDIF.
ENDMODULE. " STATUS_9001 OUTPUT
*& Module USER_COMMAND_9001 INPUT
* text
MODULE user_command_9001 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR
'%EX' OR
'CANC'.
SET SCREEN 0.
WHEN 'TAB1'.
c_dynnr = '9002'.
WHEN 'TAB2'.
c_tab-activetab = 'TAB2'.
c_dynnr = '9003'.
WHEN 'TAB3'.
c_tab-activetab = 'TAB3'.
c_dynnr = '9004'.
ENDCASE.
ENDMODULE. " USER_COMMAND_9001 INPUT
*& Module STATUS_9002 OUTPUT
* text
MODULE status_9002 OUTPUT.
** Create the Container
CREATE OBJECT wl_ref_container
EXPORTING
container_name = w_container.
** Create the Grid object
CREATE OBJECT w_grid
EXPORTING
i_parent = wl_ref_container
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
CHECK sy-subrc = 0.
PERFORM sub_fill_fcat_sale.
CALL METHOD w_grid->set_table_for_first_display
CHANGING
it_outtab = t_vbak
it_fieldcatalog = t_fcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
ENDMODULE. " STATUS_9002 OUTPUT
*& Module STATUS_9004 OUTPUT
* text
MODULE status_9003 OUTPUT.
** Create the Container
CREATE OBJECT wl_ref_container
EXPORTING
container_name = w_container.
** Create the Grid object
CREATE OBJECT w_grid
EXPORTING
i_parent = wl_ref_container
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
CHECK sy-subrc = 0.
PERFORM sub_fill_fcat_delv.
CALL METHOD w_grid->set_table_for_first_display
CHANGING
it_outtab = t_likp
it_fieldcatalog = t_fcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
ENDMODULE. " STATUS_9004 OUTPUT
*& Form sub_fill_fcat
* text
* --> p1 text
* <-- p2 text
FORM sub_fill_fcat_sale .
DATA: wa_fcat TYPE lvc_s_fcat.
REFRESH t_fcat.
CLEAR wa_fcat.
wa_fcat-row_pos = 1.
wa_fcat-fieldname = wa_fcat-rollname = 'VBELN'.
APPEND wa_fcat TO t_fcat.
CLEAR wa_fcat.
wa_fcat-row_pos = 2.
wa_fcat-fieldname = wa_fcat-rollname = 'VKORG'.
APPEND wa_fcat TO t_fcat.
CLEAR wa_fcat.
wa_fcat-row_pos = 3.
wa_fcat-fieldname = wa_fcat-rollname = 'NETWR'.
APPEND wa_fcat TO t_fcat.
ENDFORM. " sub_fill_fcat
*& Form sub_fill_fcat_delv
* text
* --> p1 text
* <-- p2 text
FORM sub_fill_fcat_delv .
DATA: wa_fcat TYPE lvc_s_fcat.
REFRESH t_fcat.
CLEAR wa_fcat.
wa_fcat-row_pos = 1.
wa_fcat-fieldname = 'VBELN'.
wa_fcat-rollname = 'VBELN_VL'.
APPEND wa_fcat TO t_fcat.
CLEAR wa_fcat.
wa_fcat-row_pos = 2.
wa_fcat-fieldname = wa_fcat-rollname = 'VKORG'.
APPEND wa_fcat TO t_fcat.
CLEAR wa_fcat.
wa_fcat-row_pos = 3.
wa_fcat-fieldname = wa_fcat-rollname = 'VSTEL'.
APPEND wa_fcat TO t_fcat.
CLEAR wa_fcat.
wa_fcat-row_pos = 4.
wa_fcat-fieldname = wa_fcat-rollname = 'NETWR'.
APPEND wa_fcat TO t_fcat.
ENDFORM. " sub_fill_fcat_delv
Similar Messages
-
Double-click in ALV grid should take to BSP application
Hi,
In the portals, in an application, R/3 ALV grid is displayed. On double clicking one of the entries in the list, corresponding transaction in R/3 is opened and the details are displayed. Now, instead of opening the transaction in R/3, Corresponding PCUI application has to be opened. Is it possible to do it Portals? Can you please tell me how this can be acheived?
Thanks & Regards
G.Raja
P.S:- I'm not sure whether this topic can be discussed in this forum. Since the functionality is required in Portals, I'm putting it here.Hello G.Raja,
I think we should connect the Topics:
<a href="https://forums.sdn.sap.com/thread.jspa?threadID=70688">Calling PCUI application on clicking ALV grid in portals</a> by a link.
Regards
Gregor -
Alv grid layout display in 2 pages
Hi All,
I am presently working in ALV programming.
The client requierment is "GL line items and summary sheet will be listed in separate pages."
i am dispalying the output using ALV grid layout display.
Can you please conform that how to write logic for summary sheet.that will display after the line items and also saparate page.
Thanks,
SridharHi ,
Use event END OF PAGE .
Write a Form for end of page
then do calcualtions.
Reward if useful. -
ALV Grid to display in Excel Format
Hi All,
When I am executing the report RFBILA00 in ALV grid and I want to display it in EXCEL. I could not able to do.
I have selected various options like selecting Views---Excel, but the excel sheet is opened but the values are not been displayed.
Can any one suggest any other way.
Thanks,
SriniHi,
it may sound a bit silly, but I have tried to replicate what you did, and managed to get a simple download.
- run RFBILA00, selet ALV gid control for list output
- wait for the report to appear on the screen
- go to the "List" option (upper left row)
- from the drop-down menu of the "List" option select "Export" and the "Spreadsheet"
- the system flags in information box, confirm this message
- after confirmation the system flags another information box, "Export list to XXL", select the "Table" option and confirm
- after confirmation wait for the next information box, confirm that you want "Microsoft Excel"
- wait a few seconds for the system to populate the upcoming spreadsheet
- save a copy of the spreadsheet in .xls-format.
Instead of spreadsheet you may want to consider to "Save to Local File" and then convert to spreadsheet format within "Excel" itself.
Hope this helps.
Kind regards,
Rudolf -
ALV Grid - Columns Displays?
Any way to display an ALV grid in different sections?
Meaning, The top half of the report lines up columns differently then the bottom half of the report.
For instance, The first two columns are always the same for all fields, but becuse the rest of the fields are not related to one another in any way the report breaks and displays te columns differently at a certain point in the output of the display?
Thank -YouIn the field catalog give the <b>emphasize</b>.
For first 2 columns:
ls_fcat-emphasize = 'C310'.
For all other columns:
ls_fcat-emphasize = 'C400'.
These make the ALV columns in different colors.
In case if u want to color a particular row or particular cell, do the below things:
Assign a variable celltab TYPE lvc_t_styl, in the internal table which u dispaly the data.
In the layout give, wa_layout-stylefname = 'CELLTAB'.
Modify the final internal table like this sample code:
DATA : lt_celltab TYPE lvc_t_styl,
ls_celltab TYPE lvc_s_styl.
READ TABLE i_final_data INTO wa_final_data INDEX 1.
ls_celltab-fieldname = 'LNG_TYPES'.
ls_celltab-style = '00000060'.
INSERT ls_celltab INTO TABLE lt_celltab.
CLEAR ls_celltab.
ls_celltab-fieldname = 'LNG_QUANTITY'.
ls_celltab-style = '00003060'.
INSERT ls_celltab INTO TABLE lt_celltab.
CLEAR ls_celltab.
ls_celltab-fieldname = 'NG_TYPES'.
ls_celltab-style = '00000666'.
INSERT ls_celltab INTO TABLE lt_celltab.
CLEAR ls_celltab.
ls_celltab-fieldname = 'NG_QUANTITY'.
ls_celltab-style = '00000066'.
INSERT ls_celltab INTO TABLE lt_celltab.
CLEAR ls_celltab.
wa_final_data-celltab[] = lt_celltab[].
MODIFY i_final_data FROM wa_final_data INDEX 1.
CLEAR: ls_celltab, lt_celltab, wa_final_data.
Here ls_celltab-style = '00003060' will make that particular cell in different color.
Regards,
Prakash.
Message was edited by: Prakash Ramu -
Printing Selection-Screen while printing ALV Grid output display
Hi,
I have a requirement wherein I want to print the Selection Screen also while printing the output in simple ALV grid Display.
Currently when I print the ALV output report, only the header and the Body of the ALV is getting printed. But the requirement is that I also want to print Selection screen along with this.
If anyone has faced a similar situation, plz let me know what needs to be done in order to print the selection screen also while printing the ALV report output.
Rgds,
NitinHi,
You can use given function module to print your
selection screen
RS_REFRESH_FROM_SELECTOPTIONS
>This will get Current contents of selection screen
RS_LIST_SELECTION_TABLE
>This will Generates list according to values in selection table(RSPARAMS)
Sample
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = p_repid
TABLES
selection_table = it_int_tab
EXCEPTIONS
not_found = 1
no_report = 2
OTHERS = 3.
IF sy-subrc EQ 0.
WRITE:1 'Selection Criteria'(i19),
/1 sy-uline(18),
/1 'Variant Name'(i21),
23 sy-slset.
*-- This function module lists the Selection Screen contents
CALL FUNCTION 'RS_LIST_SELECTION_TABLE'
EXPORTING
report = p_repid
seltext = 'X'
newpage = space
TABLES
sel_tab = it_int_tab
EXCEPTIONS
sel_tab_empty = 1
OTHERS = 2.
Mark all helpful answers -
Problem with ALV Grid Not Displaying Data
Hi Gurus,
I have a report program, when i run it I display an output summary on ALV Grid, and when i click on each of the row in the output summary, I'm suppose to see the item detail of each record.
This item detail is showing for some record and is not showing for some other records (when i use different selections). I debugged it and observed that the table populating the ALV grid actually has records in it. The ALV grid is not just displaying the records.
I debugged the 2 examples (one showing record and the other not showing), I found out that nothing is different in the way they run till they populate the final internal record to passed to the ALV Grid.
Please any suggestions on this:
This is the function code for the ALV grid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_program_id
i_callback_pf_status_set = c_detail_status
i_callback_user_command = c_detail_user_comm
i_grid_title = lv_grid_title
is_layout = w_detail_layout
it_fieldcat = i_detail_fieldcat
it_sort = i_detail_sort
TABLES
t_outtab = i_faglflexa[] "NEM - detail
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e064
WITH sy-subrc.
Function REUSE_ALV_GRID_DISPLAY failed on detail view SY-SUBRC = &
ENDIF.This is the full code:
***INCLUDE ZFIGL_HYPERION_F01.
*& Form open_files
Open files used by the program.
FORM open_files.
OPEN DATASET p_fileot FOR OUTPUT IN TEXT MODE ENCODING DEFAULT
MESSAGE g_message.
IF sy-subrc <> 0.
MESSAGE e056
WITH g_message.
Unable to open output file &
ENDIF.
ENDFORM. " open_files
*& Form close_files
Close files used by the program.
FORM close_files.
CLOSE DATASET p_fileot.
ENDFORM. " close_files
*& Form extract_data
Extract data from database needed to generate output file and report.
FORM extract_data.
Get the required general ledger totals records.
PERFORM get_faglflext_data.
Derive any other necessary fields for I_FAGLFLEXT.
PERFORM derive_add_fields_faglflext.
Split records by fiscal period.
PERFORM split_records_by_period.
Summarize the detail records to allow for creation of the file and
reporting.
PERFORM summarize_records_by_period.
Get the required general ledger actual line items records.
PERFORM get_faglflexa_data.
Derive any other necessary fields for I_FAGLFLEXA.
PERFORM derive_add_fields_faglflexa.
Sort the detail and summary output tables into key sequence.
PERFORM sort_output_tables.
ENDFORM. " extract_data
*& Form process_data
Create the requested file and report.
FORM process_data.
Create the local file if requested by the user or the month-end file
at month-end.
IF cb_test = c_not_selected.
PERFORM create_pc_file.
ELSEIF sy-uname = c_user_batch_admin.
PERFORM create_output_file.
ENDIF.
Create the necessary tables for summary ALV report.
PERFORM build_summary_layout.
PERFORM build_summary_field_catalog.
PERFORM build_summary_sort_table.
Check to see that there is data in the summary output table. If yes,
generate report, if not, then give a message to the user.
READ TABLE i_output_summary INDEX 1 TRANSPORTING NO FIELDS.
IF sy-subrc <> 0.
MESSAGE s062.
STOP.
No data extracted for selection criteria entered
ENDIF.
Generate the summary ALV report view.
PERFORM generate_summary_alv_report.
ENDFORM. " process_data
*& Form verify_user_selections
Verify data input by the user.
FORM verify_user_selections.
IF NOT p_ryear IS INITIAL.
IF p_ryear < 2006 OR
p_ryear > 2100.
MESSAGE e057.
Fiscal year is invalid
ENDIF.
ENDIF.
If program is being run in a non-test mode and the user has left the
fiscal year selection blank, display a error message.
IF cb_test IS INITIAL AND
p_ryear IS INITIAL.
MESSAGE e058.
A fiscal year must be entered when generating the file
ENDIF.
If program is being run in a non-test mode and the user has left the
period selection blank, display a error message.
IF cb_test IS INITIAL AND
s_rpmax IS INITIAL.
MESSAGE e132.
A period must be entered when generating the file
ENDIF.
IF cb_test IS INITIAL AND
p_lfile IS INITIAL.
MESSAGE e071.
Local filename is required when generating the file
ENDIF.
****Basil Balogun's addition to include the hyperion acct in selection. (10/03/2007)***
IF s_rhype IS NOT INITIAL.
LOOP AT s_rhype.
CLEAR r_hyper.
r_hyper-sign = 'I'.
r_hyper-option = 'CP'.
CONCATENATE '' s_rhype-low '' INTO r_hyper-low.
APPEND r_hyper.
ENDLOOP.
SELECT bukrs saknr hyper
FROM zall_gl_hype INTO TABLE i_zall_gl
WHERE hyper IN r_hyper.
LOOP AT i_zall_gl INTO w_zall_gl.
w_zall_gl1-saknr = w_zall_gl-saknr.
w_zall_gl2-bukrs = w_zall_gl-bukrs.
APPEND w_zall_gl1-saknr TO i_zall_gl1.
APPEND w_zall_gl2-bukrs TO i_zall_gl2.
CLEAR: w_zall_gl, w_zall_gl1, w_zall_gl2.
ENDLOOP.
SORT i_zall_gl1 BY saknr.
SORT i_zall_gl2 BY bukrs.
DELETE ADJACENT DUPLICATES FROM i_zall_gl1 COMPARING saknr.
DELETE ADJACENT DUPLICATES FROM i_zall_gl2 COMPARING bukrs.
IF s_racct IS INITIAL.
LOOP AT i_zall_gl1 INTO w_zall_gl1.
r_saknr-sign = 'I'.
r_saknr-option = 'EQ'.
r_saknr-low = w_zall_gl1.
APPEND r_saknr.
CLEAR r_saknr.
CLEAR w_zall_gl1.
ENDLOOP.
ELSE.
r_saknr[] = s_racct[].
ENDIF.
IF s_rbukrs IS INITIAL.
LOOP AT i_zall_gl2 INTO w_zall_gl2.
r_bukrs-sign = 'I'.
r_bukrs-option = 'EQ'.
r_bukrs-low = w_zall_gl2-bukrs.
APPEND r_bukrs.
CLEAR r_bukrs.
CLEAR w_zall_gl2.
ENDLOOP.
ELSE.
r_bukrs[] = s_rbukrs[].
ENDIF.
ELSE.
r_saknr[] = s_racct[].
r_bukrs[] = s_rbukrs[].
SELECT bukrs saknr hyper
FROM zall_gl_hype INTO TABLE i_zall_gl.
ENDIF.
****Basil Balogun's addition to include the hyperion acct in selection. (10/03/2007)***
ENDFORM. " verify_user_selections
*& Form get_faglflext_data
Get FAGLFLEXT (General Ledger: Totals) data from the database.
FORM get_faglflext_data .
Use the fiscal year for the selection, if it was populated by the
user.
IF NOT p_ryear IS INITIAL.
SELECT ryear rldnr rvers racct rbukrs prctr rfarea kokrs segment
zzsarea zzsareaim rassc hsl01 hsl02 hsl03 hsl04 hsl05 hsl06
hsl07 hsl08 hsl09 hsl10 hsl11 hsl12 hsl13 hsl14 hsl15 hsl16
hslvt
INTO TABLE i_faglflext
FROM faglflext
WHERE rldnr = c_run_ledger AND
rbukrs IN r_bukrs AND
racct IN r_saknr AND
rfarea IN s_rfarea AND
prctr IN s_prctr AND
ryear = p_ryear AND
rvers = c_run_version.
ELSE.
SELECT ryear rldnr rvers racct rbukrs prctr rfarea kokrs segment
zzsarea zzsareaim rassc hsl01 hsl02 hsl03 hsl04 hsl05 hsl06
hsl07 hsl08 hsl09 hsl10 hsl11 hsl12 hsl13 hsl14 hsl15 hsl16
hslvt
INTO TABLE i_faglflext
FROM faglflext
WHERE rldnr = c_run_ledger AND
rbukrs IN r_bukrs AND
racct IN r_saknr AND
rfarea IN s_rfarea AND
prctr IN s_prctr AND
rvers = c_run_version.
ENDIF.
ENDFORM. " get_faglflext_data
*& Form derive_add_fields_faglflext
Derive additional fields needed for the I_FAGLFLEXT.
FORM derive_add_fields_faglflext.
Get needed company code and profit center data from the database.
PERFORM get_t001_data.
PERFORM get_t880_data.
READ TABLE i_faglflext INDEX 1 TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
PERFORM get_cepc_data.
ENDIF.
SORT i_zall_gl BY bukrs saknr.
LOOP AT i_faglflext INTO w_faglflext.
Get necessary company code data.
READ TABLE i_t001 INTO w_t001
WITH KEY bukrs = w_faglflext-rbukrs
BINARY SEARCH.
IF sy-subrc <> 0.
MESSAGE e059
WITH w_faglflext-rbukrs.
Company code & not found on table T001
ENDIF.
Determine the entity.
PERFORM derive_entity USING w_t001-rcomp
CHANGING w_faglflext-entity.
Determine the strategic segment.
PERFORM derive_strategic_segment USING w_faglflext-rassc
w_faglflext-prctr
CHANGING w_faglflext-strat_seg
w_faglflext-zzsareaim
w_faglflext-zzsarea.
Determine the strategic segment channel.
PERFORM derive_strat_seg_chnl USING w_faglflext-rassc
w_faglflext-prctr
CHANGING w_faglflext-strat_seg_chnl.
Determine the all item ID and all products.
PERFORM derive_all_item_id USING w_t001-waers
CHANGING w_faglflext-all_item_id
w_faglflext-all_products.
Determine the all customers and all customers channel.
PERFORM derive_all_customers_fields USING w_faglflext-strat_seg
*w_faglflext-strat_seg_chnl
CHANGING w_faglflext-all_cust
*w_faglflext-all_cust_chnl.
Determine the sub account using the company ID of the trading partner.
PERFORM derive_sub_account USING w_faglflext-rassc
CHANGING w_faglflext-sub_acct.
PERFORM derive_sub_account USING w_t001-rcomp
w_faglflext-rassc
CHANGING w_faglflext-sub_acct.
****Begin Basil changes to include hyperion acct in selection (10/03/2007).
READ TABLE i_zall_gl INTO w_zall_gl
WITH KEY bukrs = w_faglflext-rbukrs
saknr = w_faglflext-racct
BINARY SEARCH.
IF sy-subrc = 0.
****End Basil changes to include hyperion acct in selection (10/03/2007).
Determine the Hyperion account number from G/L account long text.
PERFORM derive_hyperion_account USING w_faglflext-racct
w_faglflext-rfarea
"KMK5/22/06 ITR: 20592
w_faglflext-sub_acct
w_faglflext-rassc
w_faglflext-prctr
CHANGING w_faglflext-hyperion_acct
w_faglflext-reverse_sign "NEM8/21/06 ITR: 24286
w_faglflext-balance_sheet "NEM8/21/06 ITR: 24286
w_faglflext-zzsarea
w_faglflext-zzsareaim
w_faglflext-strat_seg.
ENDIF.
Determine the all customers and all customers channel.
PERFORM derive_all_customers_fields USING w_faglflext-strat_seg
w_faglflext-strat_seg_chnl
CHANGING w_faglflext-all_cust
w_faglflext-all_cust_chnl.
Update i_FAGLFLEXT with the newly derive fields.
MODIFY i_faglflext FROM w_faglflext
TRANSPORTING entity
strat_seg
strat_seg_chnl
all_item_id
all_products
all_cust
all_cust_chnl
hyperion_acct
sub_acct
fiscal_period
zzsarea
zzsareaim
reverse_sign "NEM8/21/06 ITR: 24286
balance_sheet. "NEM8/21/06 ITR: 24286
ENDLOOP.
CHECK s_rhype IS NOT INITIAL.
SORT s_rhype BY low.
LOOP AT i_faglflext INTO w_faglflext.
READ TABLE s_rhype WITH KEY low = w_faglflext-hyperion_acct.
IF sy-subrc NE 0.
CLEAR w_faglflext-hyperion_acct.
MODIFY i_faglflext FROM w_faglflext.
ENDIF.
ENDLOOP.
DELETE i_faglflext WHERE hyperion_acct IS INITIAL.
ENDFORM. " derive_add_fields_faglflext
*& Form derive_entity
Derive the entity using the company code.
-->RCOMP - Company code.
<--ENTITY - Entity
FORM derive_entity USING rcomp TYPE t_t001-rcomp
CHANGING entity TYPE t_faglflext-entity.
CLEAR:
entity.
Get necessary global company code data.
READ TABLE i_t880 INTO w_t880
WITH KEY rcomp = rcomp
BINARY SEARCH.
IF sy-subrc = 0.
entity = w_t880-name2+0(3).
TRANSLATE entity TO UPPER CASE.
ELSE.
MESSAGE e060
WITH w_t001-rcomp.
Company code & not found on table T880
ENDIF.
ENDFORM. " derive_entity
*& Form get_t001_data
Get T001 (Company Codes) data from the database.
FORM get_t001_data.
SELECT bukrs waers rcomp
INTO TABLE i_t001
FROM t001
CLIENT SPECIFIED
WHERE mandt = sy-mandt.
SORT i_t001 BY bukrs.
ENDFORM. " get_t001_data
*& Form get_t880_data
Get T880 (Global Company Data (for KONS Ledger)) data from the
database.
FORM get_t880_data.
SELECT rcomp name2
INTO TABLE i_t880
FROM t880
CLIENT SPECIFIED
WHERE mandt = sy-mandt.
SORT i_t880 BY rcomp.
ENDFORM. " get_t880_data
*& Form derive_all_item_id
Derive the all item ID from the company code currency key.
-->WAERS - Currency key.
<--ALL_ITEM_ID - All item ID.
<--ALL_ITEM_ID - All item ID.
FORM derive_all_item_id USING waers TYPE t_t001-waers
CHANGING all_item_id TYPE t_faglflext-all_item_id
all_products TYPE t_faglflext-all_products
CLEAR:
all_item_id.
Populate all item ID.
all_item_id = c_all_item_id.
IF waers = c_us_dollars.
REPLACE '*' WITH c_united_states INTO all_item_id.
ELSE.
REPLACE '*' WITH c_local INTO all_item_id.
ENDIF.
Populate all products.
all_products = c_all_products.
TRANSLATE all_products TO UPPER CASE.
ENDFORM. " derive_all_item_id
*& Form derive_all_customers_fields
Derive the all customers and all customer channel fields from
the strategic segment and strategic segment channel respectively.
-->STRAT_SEG - Strategic segment.
-->STRAT_SEG_CHNL - Strategic segment channel.
<--ALL_CUST - All customers.
<--ALL_CUST_CHNL - All customers channel.
FORM derive_all_customers_fields USING strat_seg TYPE
t_faglflext-strat_seg
strat_seg_chnl TYPE
t_faglflext-strat_seg_chnl
CHANGING all_cust TYPE
t_faglflext-all_cust
all_cust_chnl TYPE
t_faglflext-all_cust_chnl.
CLEAR:
all_cust,
all_cust_chnl.
all_cust = strat_seg.
all_cust+2(1) = c_all_customers.
TRANSLATE all_cust TO UPPER CASE.
all_cust_chnl = strat_seg_chnl.
TRANSLATE all_cust_chnl TO UPPER CASE.
ENDFORM. " derive_all_customers_fields
*& Form derive_hyperion_account
Read G/L account long text to get the Hyperion account number.
-->RACCT - SAP G/L account number.
<--HYPERION_ACCT - Hyperion account number.
FORM derive_hyperion_account USING racct TYPE t_faglflext-racct
farea TYPE t_faglflext-rfarea
"KMK5/22/06 ITR 20592
sub_account TYPE
t_faglflext-sub_acct
rassc TYPE t_faglflext-rassc
prctr TYPE t_faglflext-prctr
CHANGING hyperion_acct TYPE t_faglflext-hyperion_acct
reverse_sign TYPE t_faglflext-reverse_sign "NEM8/21/06 ITR: 24286
balance_sheet TYPE t_faglflext-balance_sheet "NEM8/21/06 ITR: 24286
zzsarea TYPE t_faglflext-zzsarea
zzsareaim TYPE t_faglflext-zzsareaim
strat_seg TYPE t_faglflext-strat_seg.
DATA:
lv_text_name TYPE thead-tdname,
l_strl TYPE i VALUE 0,
l_hyperion_acct(10), "KMK5/20/06 ITR 20527
l_farea(10) VALUE '0000000000', "KMK5/22/06 ITR 20592
l_balance_sheet(1), "NEM8/17/06 ITR 25792
l_string TYPE tline-tdline. "NEM8/17/06 ITR 25792
DATA: l_hyp_account_1 TYPE tline-tdline,
l_hyp_account_2 TYPE tline-tdline,
l_hyp_account_3 TYPE tline-tdline.
reverse_sign = '1'.
SELECT SINGLE bilkt xbilk
FROM ska1
INTO (l_hyperion_acct,l_balance_sheet)
WHERE ktopl = c_global_tcoa
AND saknr = racct.
balance_sheet = l_balance_sheet.
l_string = w_zall_gl-hyper.
SEARCH l_string FOR '-'.
IF sy-subrc = '0'.
reverse_sign = -1.
ELSE.
reverse_sign = 1.
ENDIF.
CHECK w_zall_gl-hyper IS NOT INITIAL.
CLEAR: l_hyp_account_1, l_hyp_account_2, l_hyp_account_3.
SPLIT w_zall_gl-hyper
AT ';'
INTO l_hyp_account_1 l_hyp_account_2 l_hyp_account_3.
IF l_hyp_account_2 IS INITIAL. " Only one hyperion account
hyperion_acct = l_hyp_account_1+0(7).
l_strl = STRLEN( hyperion_acct ) - 1.
IF hyperion_acct+l_strl(1) EQ '1'.
CLEAR sub_account.
PERFORM repopulate_strategic_segment
USING rassc prctr
CHANGING strat_seg.
zzsareaim = g_hold_sales_type.
zzsarea = g_hold_sales_area.
ENDIF.
ELSE. " Two or more hyperion accounts
IF sub_account > ''.
hyperion_acct = l_hyp_account_2+0(7).
ELSE.
hyperion_acct = l_hyp_account_1+0(7).
ENDIF.
ENDIF.
CLEAR: w_hyperion.
w_hyperion-racct = racct.
w_hyperion-hyperion_acct = hyperion_acct.
w_hyperion-reverse_sign = reverse_sign.
ENDFORM. " derive_hyperion_account
*& Form derive_sub_account
Determine the sub account based on the company ID of the trading
partner.
-->RASSC - Company ID of trading partner.
<--SUB_ACCT - Sub account.
*FORM derive_sub_account USING rassc TYPE t_faglflext-rassc
CHANGING sub_acct TYPE t_faglflext-sub_acct.
IF rassc IS INITIAL.
CLEAR: sub_acct.
ELSE.
sub_acct = rassc.
TRANSLATE sub_acct TO UPPER CASE.
ENDIF.
*ENDFORM. " derive_sub_account
FORM derive_sub_account USING rcomp TYPE t_t001-rcomp
rassc TYPE t_faglflext-rassc
CHANGING sub_acct TYPE t_faglflext-sub_acct.
IF rassc IS INITIAL.
CLEAR: sub_acct.
ELSE.
READ TABLE i_t880 INTO w_t880
WITH KEY rcomp = rassc
BINARY SEARCH.
IF sy-subrc = 0.
sub_acct = w_t880-name2.
TRANSLATE sub_acct TO UPPER CASE.
ELSE.
MESSAGE e060
WITH w_t001-rcomp.
Company code & not found on table T880
ENDIF.
ENDIF.
ENDFORM. " derive_sub_account
*& Form repopulate_strategic_segment
Derive the strategic segment based on the company ID of the trading
partner or the profit center.
-->RASSC - Company ID of trading partner.
-->PRCTR - Profit center.
<--STRAT_SEG - Strategic segment.
FORM repopulate_strategic_segment USING rassc TYPE t_faglflext-rassc
prctr TYPE t_faglflext-prctr
CHANGING strat_seg TYPE t_faglflext-strat_seg
DATA:
lv_segment TYPE cepc-segment.
CLEAR:
strat_seg.
Find the valid profit center record.
LOOP AT i_cepc INTO w_cepc
WHERE prctr = prctr AND
datab <= sy-datum AND
datbi >= sy-datum.
Pad segment with leading zeros if necessary.
lv_segment = w_cepc-segment.
SHIFT lv_segment RIGHT DELETING TRAILING ' '.
TRANSLATE lv_segment USING ' 0'.
Get the segment name from FAGL_SEGMT (Master Data for Segments).
SELECT SINGLE *
FROM fagl_segmt
WHERE langu = sy-langu AND
segment = lv_segment.
IF sy-subrc = 0.
strat_seg = fagl_segmt-name+0(3).
TRANSLATE strat_seg TO UPPER CASE.
ENDIF.
ENDLOOP.
ENDFORM. "repopulate_strategic_segment
" repopulate_strategic_segment&----
*& Form derive_strategic_segment
Derive the strategic segment based on the company ID of the trading
partner or the profit center.
-->RASSC - Company ID of trading partner.
-->PRCTR - Profit center.
<--STRAT_SEG - Strategic segment.
FORM derive_strategic_segment USING rassc TYPE t_faglflext-rassc
prctr TYPE t_faglflext-prctr
CHANGING strat_seg TYPE t_faglflext-strat_seg
sales_type TYPE t_faglflext-zzsareaim
sales_area TYPE t_faglflext-zzsarea.
DATA:
lv_segment TYPE cepc-segment.
CLEAR:
strat_seg.
*Hold values in Sales Type and Sales area before setting to default
*values
In case need to use them later
g_hold_sales_type = sales_type.
g_hold_sales_area = sales_area.
If the company ID of the trading partner is populated, then set the
strategic segment to a default value.
And set Sales Type and Sales area to default values **NEM 07/13/06
IF NOT rassc IS INITIAL.
strat_seg = c_def_strat_seg.
sales_type = c_sales_type.
sales_area = c_sales_area.
TRANSLATE strat_seg TO UPPER CASE.
TRANSLATE sales_type TO UPPER CASE.
TRANSLATE sales_area TO UPPER CASE.
EXIT.
ENDIF.
Find the valid profit center record.
LOOP AT i_cepc INTO w_cepc
WHERE prctr = prctr AND
datab <= sy-datum AND
datbi >= sy-datum.
Pad segment with leading zeros if necessary.
lv_segment = w_cepc-segment.
SHIFT lv_segment RIGHT DELETING TRAILING ' '.
TRANSLATE lv_segment USING ' 0'.
Get the segment name from FAGL_SEGMT (Master Data for Segments).
SELECT SINGLE *
FROM fagl_segmt
WHERE langu = sy-langu AND
segment = lv_segment.
IF sy-subrc = 0.
strat_seg = fagl_segmt-name+0(3).
TRANSLATE strat_seg TO UPPER CASE.
ENDIF.
ENDLOOP.
ENDFORM. " derive_strategic_segment
*& Form get_cepc_data
Get CEPC (Profit Center Master Data Table) data from the database.
FORM get_cepc_data.
SELECT prctr datbi kokrs datab khinr segment
INTO TABLE i_cepc
FROM cepc
FOR ALL ENTRIES IN i_faglflext
WHERE prctr = i_faglflext-prctr.
SORT i_cepc BY prctr datab.
ENDFORM. " get_cepc_data
*& Form derive_strat_seg_chnl
Derive the strategic segment channel based on the company ID of the
trading partner or the profit center area.
-->RASSC - Company ID of trading partner.
-->PRCTR - Profit center.
<--STRAT_SEG_CHNL - Strategic segment channel.
FORM derive_strat_seg_chnl USING rassc TYPE t_faglflext-rassc
prctr TYPE t_faglflext-prctr
CHANGING strat_seg_chnl TYPE
t_faglflext-strat_seg_chnl.
CLEAR:
g_setclass,
g_subclass,
g_setname,
strat_seg_chnl.
If the company ID of the trading partner is populated, then set the
strategic segment to a default value.
IF NOT rassc IS INITIAL.
strat_seg_chnl = c_def_strat_seg_chnl.
TRANSLATE strat_seg_chnl TO UPPER CASE.
EXIT.
ENDIF.
Check for SETNAME = 2*** in setleaf table.
PERFORM get_setleaf_data USING c_prctr_group
prctr
CHANGING g_subrc.
IF g_subrc NE c_no_record.
PERFORM find_setleaf_record CHANGING g_subrc.
SELECT SINGLE *
FROM setheadert
WHERE setclass = g_setclass AND
subclass = g_subclass AND
setname = g_setname AND
langu = sy-langu.
IF sy-subrc = 0.
strat_seg_chnl = setheadert-descript+0(2).
TRANSLATE strat_seg_chnl TO UPPER CASE.
ENDIF.
ELSE.
Find the valid profit center record.
LOOP AT i_cepc INTO w_cepc
WHERE prctr = prctr AND
datab <= sy-datum AND
datbi >= sy-datum.
Get the correct SETNODE (Lower-level sets in sets) record.
PERFORM get_setnode_data USING c_prctr_group
w_cepc-khinr
CHANGING g_subrc.
PERFORM find_setnode_record CHANGING g_subrc.
IF g_subrc = c_no_record.
EXIT.
ENDIF.
If an appropriate SETNODE record still has not been found, then
keep looking.
IF g_subrc = c_wrong_record.
DO.
PERFORM get_setnode_data USING c_prctr_group
w_setnode-setname
CHANGING g_subrc.
PERFORM find_setnode_record CHANGING g_subrc.
IF g_subrc = c_no_record OR
g_subrc = c_correct_record.
EXIT.
ENDIF.
ENDDO.
ENDIF.
In the end, there was no SETNODE record to find.
IF g_subrc = c_no_record.
EXIT.
ENDIF.
SELECT SINGLE *
FROM setheadert
WHERE setclass = g_setclass AND
subclass = g_subclass AND
setname = g_setname AND
langu = sy-langu.
IF sy-subrc = 0.
strat_seg_chnl = setheadert-descript+0(2).
TRANSLATE strat_seg_chnl TO UPPER CASE.
ENDIF.
ENDLOOP.
ENDIF.
ENDFORM. " derive_strat_seg_chnl
*& Form get_setnode_data
Get SETNODE (Lower-level sets in sets) data from the database.
-->SETCLASS - Set class.
-->SUBSETNAME - Subordinate set ID.
<--SUBRC - Return code.
FORM get_setnode_data USING setclass TYPE c
subsetname TYPE c
CHANGING subrc TYPE sy-subrc.
SELECT setclass subclass setname
INTO TABLE i_setnode
FROM setnode
WHERE setclass = c_prctr_group AND
subsetname = subsetname.
subrc = sy-subrc.
ENDFORM. " get_setnode_data
*& Form get_setleaf_data
Get SETLEAF (Values in Sets) data from the database.
-->SETCLASS - Set class.
-->VALFROM - Subordinate set ID.
<--SUBRC - Return code.
FORM get_setleaf_data USING setclass TYPE c
valfrom TYPE c
CHANGING subrc TYPE sy-subrc.
subrc = c_correct_record.
SELECT setclass setname valfrom subclass
INTO TABLE i_setleaf
FROM setleaf
WHERE setclass = c_prctr_group AND
valfrom = valfrom AND
setname GE '2000' AND
setname LE '2999'.
IF sy-subrc <> 0.
subrc = c_no_record.
EXIT.
ENDIF.
ENDFORM. " get_setleaf_data
*& Form find_setleaf_record
Find the appropriate SETLEAF record.
<--SUBRC - Return code.
FORM find_setleaf_record CHANGING subrc TYPE sy-subrc.
subrc = c_wrong_record.
If no records were found during selection, then exit the routine.
READ TABLE i_setleaf INDEX 1 TRANSPORTING NO FIELDS.
IF sy-subrc <> 0.
subrc = c_no_record.
EXIT.
ENDIF.
Check to see if one of the records has a setname in the 2000 series of
numbers.
LOOP AT i_setleaf INTO w_setleaf.
g_setclass = w_setleaf-setclass.
g_subclass = w_setleaf-subclass.
g_setname = w_setleaf-setname.
subrc = c_correct_record.
ENDLOOP.
ENDFORM. " find_setleaf_record
*& Form find_setnode_record
Find the appropriate SETNODE record.
<--SUBRC - Return code.
FORM find_setnode_record CHANGING subrc TYPE sy-subrc.
subrc = c_wrong_record.
If no records were found during selection, then exit the routine.
READ TABLE i_setnode INDEX 1 TRANSPORTING NO FIELDS.
IF sy-subrc <> 0.
subrc = c_no_record.
EXIT.
ENDIF.
Check to see if one of the records has a setname in the 2000 series of
numbers.
LOOP AT i_setnode INTO w_setnode.
IF w_setnode-setname+0(1) = c_valid_number.
g_setclass = w_setnode-setclass.
g_subclass = w_setnode-subclass.
g_setname = w_setnode-setname.
subrc = c_correct_record.
EXIT.
ENDIF.
ENDLOOP.
ENDFORM. " find_setnode_record
*& Form split_records_by_period
Split the i_FAGLFLEXT records by fiscal period. This is necessary
because all (16) fiscal periods are on one record.
FORM split_records_by_period .
REFRESH:
i_output_detail.
LOOP AT i_faglflext INTO w_faglflext.
START OF CHANGES BY BAYAPV on 07/07/2007**********************
*SELECT SINGLE BUKRS
SAKNR
XOPVW
into w_skb1
from skb1
FOR ALL ENTRIES IN I_FAGLFLEXT
where bukrs = w_faglflext-rbukrs
and SAKNR = w_faglflext-racct.
*IF w_skb1-XOPVW = 'X'.
*SELECT BUKRS
HKONT -
Display error message in ALV grid using OOPS
Hi,
I have a requirement to display report in ALV. I have created ALV grid using OOPS with three editable cells and 1 button on toolbar. When user enter values in Ediatble cell and click on the Toolbar button, sales order item should be assigned to contract.
When the user select the row and click on toolbar button, a salesorder item should be assigned to contract and i am using BAPI and fine with BAPI. All the error message should be displayed in a popup and the corresponding failed row should change its color .
Once the user identified the failed row, he can edit the value in the ediatble cells and should reprocess in the same screen ( without going back to selection screen).
To display POP Up, I am using FM BAL_LOG_CREATE, BAL_LOG_MSG_ADD, BAL_DSP_PROFILE_NO_TREE_GET, BAL_CNTL_CREATE.
by using above 4 FM , i can display POP UP. but i cannot change the color of the failed row.
Once I identified the failed row and reprocess from the same screen , I am successful in processing the failed row, but my error log still has the reprocessed row as failed row because, error log is not refreshing.
Please suggest me how to clear error log which was created by using the above FM's and change the color of the failed row .
Thanks in AdvanceHi
Please suggest me how to clear error log which was created by using the above FM's....
U can use BAL_LOG_REFRESH
....and change the color of the failed row
You need to insert a new field for Colour Attributes in your output table and input its name in the layout structure:
IS_LAYOUT-INFO_FNAME = <field name for colour>
The field has to be a CHAR 3 and its value can be -
> Cxy
C is a constant
x is the colour number (from 1 to 9)
y is intensified (0 = off, 1 = on)
After changing the value of output table you need to run the method REFRESH_TABLE_DISPLAY for refreshing the output
Max -
How to make the first row selected before the display of ALV grid
Hello Experts,
I created a ALV grid using custom container in a screen . Now i want do the follwing:
1. i want that, the <b>first line must be selected before the display of ALV.</b>
2. I have selection buttons . But i dont want the multiselect button and the
standard toolbar in the ALV grid.
Could any one please help me regarding the above?
Thanks & Regards
Sudhansucan u pls explain in more details with an example?
I am telling u the scenario.
1. i have a screen(Modal dialog Box) containing ALV grid with selection buttons for each row (top part) and a subscreen(second part).
Now when i click on a selection button, it will display the corresponding values in the subscreen.
When this screen will display for the first time , then first row of the ALV grid should be selected and the corresponding values should be displayed in the subscreen.
i wrote the following code in the PAI. But when i select a record its not triggering the PAI.
DATA:
gi_index_rows TYPE lvc_t_row, " Internal table for indexes of selected rows
g_selected_row LIKE lvc_s_row, " Information about 1 row
l_lines TYPE i.
CLEAR g_wa_vdmeko.
*get selected row
CALL METHOD g_alv_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.
DESCRIBE TABLE gi_index_rows LINES l_lines.
LOOP AT gi_index_rows INTO g_selected_row.
READ TABLE g_int_vdmeko INDEX g_selected_row-index INTO g_wa_vdmeko.
SELECT SINGLE *
FROM vdmepov
WHERE bukrs = g_wa_vdmeko-bukrs AND
styp = g_wa_vdmeko-styp AND
sbez = g_wa_vdmeko-sbez AND
svym = g_wa_vdmeko-svym AND
svnr = g_wa_vdmeko-svnr.
ENDLOOP.
I am displayinng the ALV using method "set_alv_for_first_display".
Please help if u have any idea..................
Thanks
Sudhansu -
Display alv grids in selection screen based on the user event
Hi All,
I am workign on displaying ALV in same selection screen.I am able to display the ALV in selection screen.
But i have 2 buttons in my selection screen 'Create' and 'change'.
When i click on create i need with some type of data and when i click on 'change' my alv grid another type of data.Ex: if i click on crate mara data should be dispalyed when i click on change makt table data should be dispalyed and also i have user defined buttons are in my grids.
So i have used 2 containers to dispaly to different data.I am able to display the perfectly but the problem is first time when i click on create the grid is displaying when i click on change button the create alv grid is displaying down and change data is dispalying up.
I need only one alv grid at a time.Can anybody please let me know how can i do this.
Thanks,
TaraginiHello,
Also I would suggest if it is relevant data maintain in one interntal table and show/hide based on condition
through fieldcatalog (NO_OUT) parameter.
Thanks -
Hi all abap gurus,
I am using REUSE_ALV_GRID_DISPLAY, now wat is want is that i have 15 fields in my fieldcatalog but when alv grid is displayed first time i want to display only 10 fields, after the display user can display the remaning fields by changing the layout settings at display level itself,
now i can abe to change the the number of fields displayed at screen level that is the standard func. ALV provides but first time ALV grid is displayed all the fields are displayed which i want to restrict to fewer fields.
thanks
Devender.>ALV grid is displayed all the fields are displayed which i want >to restrict to fewer fields.
If you Don't want all the fields then you can use NO_OUT option in the fieldcatalog for the column which you Don't want them in first display.
fieldcat-no_out = 'X'. "mention for the columns which you want
"to hide. -
How to Edit the CheckBox in Classic ALV GRID Display
Hi,
I want to Edit the checkbox in Grid Display.
I have one checkbox field in my internal Table,
Code Of the Program,
Data :
Begin of itab occurs 0,
CHK type C,
MATNR like MARA-MATNR,
end of itab.
Iam building the fieldcatelog using Merge Funcion module.
After that I am chaning the properties of the field
catelog like below,
loop at I_FCAT assigning <FCAT>.
Case <FCAT>-Fieldname
When 'CHK'.
<FCAT>-Checkbox = 'X'.
<FCAT>-INPUT = 'X'.
I dont have edit option in fieldcatelog.
modify I_FCAT from <FCAT>.
endcase.
endloop.
In the Layout,
I_LAYOUT-box_fieldname = 'CHK'.
I_LAYOUT-box_tabname = 'ITAB'.
It is displaying the Checkbox field.but I couldnt edit the checkBox.
I can able to edit in REUSE_ALV_LIST_DISPLAY.
But I have to use REUSE_ALV_GRID_DISPLAY.How to edit the checkbox.
Thanks in Advance,
SumithraHi vasu,
The below procedure explains you to create a checkbox cloumn in the grid and allows you to edit i hope this will helps u.
The ALV Grid Control displays the cells of a column as checkboxes if the column is marked as a checkbox column in the field catalog.
Add another field to the output table in which you want to display checkboxes
OR
Define an existing field as a checkbox.
Procedure
1. Add a field to your output table:
Data: gt_fieldcat type lvc_t_fcat.
Types: begin of gs_outtab.
Types: checkbox type c. "field for checkbox
Include structure <ABAP Dictionary structure> .
Types: end of gs_outtab.
Data: gt_outtab type gs_outtab occurs 0 with header line.
2 * Add an entry for the checkbox to the field catalog
clear ls_fcat.
ls_fcat-fieldname = 'CHECKBOX'.
* Essential: declare field as checkbox and
* mark it as editable field:
ls_fcat-checkbox = 'X'.
ls_fcat-edit = 'X'.
* do not forget to provide texts for this extra field
ls_fcat-coltext = text-f01.
ls_fcat-tooltip = text-f02.
ls_fcat-seltext = text-f03.
append ls_fcat to gt_fieldcat.
regards,
venu. -
Display of "Average Values Text in ALV grid"
Hi
I use ALV grid to display the fields from a table. I have 15 columns. I need to do average for four columns.
In the field catalog i did a do_sum for those fields.
When the ALV grid is displayed I get average values for these columns.
Eg. Let suppose the grid looks like
Field1 Field2 Field3 Field4 Field5 Field 6.
vendor1 18 22 6 17 28
vendor1 54 11 16 62 28
vendor1 33 21 26 79 18
35 18 16 52 24
My requirement is I need to display the text "AVERAGE VALUES" . ( I need something like this.)
Field1 Field2 Field3 Field4 Field5 Field 6.
vendor1 18 22 6 17 28
vendor1 54 11 16 62 28
vendor1 33 21 26 79 18
Average values 35 18 16 52 24
Could someone help me in this?
Thanks & Regards
KavithaHello,
you can use event subtotal_text of ALV_GRID.
Regards,
Pedro Santos -
This is a follow-up to a question I posed earlier regarding my inability to get the ALV grid to display with a new table name.
Can anyone tell me what I need to do to get it to re-display with the new table name?
To use it, you enter a table name in the editor screen. Screens 100 and 200 are just custom containers with no other attributes.
Thanks (and points) for any help!
PROGRAM zz_temp.
TYPES: BEGIN OF type_text_lines,
line(2048) TYPE c,
END OF type_text_lines.
DATA: g_editor TYPE REF TO cl_gui_textedit,
g_r_editor_container TYPE REF TO cl_gui_custom_container,
g_r_alv_grid TYPE REF TO cl_gui_alv_grid ,
g_r_alv_container TYPE REF TO cl_gui_custom_container ,
g_container TYPE scrfname VALUE 'ALV_CUSTOM_CONTROL_0200' ,
g_t_text_lines TYPE TABLE OF type_text_lines,
g_t_fcat TYPE lvc_t_fcat,
g_ok_code TYPE sy-ucomm,
g_save_ok TYPE sy-ucomm,
g_repid TYPE sy-repid,
l_tab(20) TYPE c.
FIELD-SYMBOLS <struc> TYPE ANY.
FIELD-SYMBOLS <tab> TYPE table.
DATA s_ref TYPE REF TO data.
DATA t_ref TYPE REF TO data.
START-OF-SELECTION.
CALL SCREEN 100.
FORM runsql.
CONCATENATE LINES OF g_t_text_lines INTO l_tab.
CREATE DATA s_ref TYPE (l_tab).
CREATE DATA t_ref TYPE TABLE OF (l_tab).
ASSIGN t_ref->* TO <tab>.
SELECT * FROM (l_tab) INTO TABLE <tab>.
CALL SCREEN 200.
ENDFORM."
MODULE pbo OUTPUT.
CASE sy-dynnr.
WHEN '0100'.
IF g_editor IS INITIAL.
SET PF-STATUS 'MAIN100'.
g_repid = sy-repid.
CREATE OBJECT g_r_editor_container
EXPORTING
container_name = 'TEXTEDITOR1'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
CREATE OBJECT g_editor
EXPORTING
parent = g_r_editor_container
wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
EXCEPTIONS
OTHERS = 1.
ENDIF.
WHEN '0200'.
PERFORM create_alv_grid.
ENDCASE.
ENDMODULE."
MODULE pai INPUT.
g_save_ok = g_ok_code.
CASE g_save_ok.
WHEN 'BACK'.
WHEN 'EXIT'.
WHEN 'CANCEL'.
PERFORM exit_program.
WHEN 'RUNSQL'.
CALL METHOD g_editor->get_text_as_r3table
IMPORTING
table = g_t_text_lines
EXCEPTIONS
OTHERS = 1.
PERFORM runsql.
ENDCASE.
ENDMODULE."
FORM create_field_catalog.
DATA: l_structure_name LIKE dd02l-tabname.
CLEAR g_t_fcat.
l_structure_name = l_tab.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = l_structure_name
i_bypassing_buffer = 'X'
CHANGING
ct_fieldcat = g_t_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
ENDFORM."
FORM create_alv_grid.
DATA: l_s_layout TYPE lvc_s_layo.
CLEAR: g_r_alv_container,
g_r_alv_grid.
PERFORM create_field_catalog.
CREATE OBJECT g_r_alv_container
EXPORTING container_name = g_container.
CREATE OBJECT g_r_alv_grid
EXPORTING i_parent = g_r_alv_container.
CALL METHOD g_r_alv_grid->set_table_for_first_display
EXPORTING
is_layout = l_s_layout
i_bypassing_buffer = 'X'
CHANGING
it_outtab = <tab>
it_fieldcatalog = g_t_fcat.
CALL METHOD g_r_alv_grid->refresh_table_display.
ENDFORM."
FORM exit_program.
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS
OTHERS = 1.
LEAVE PROGRAM.
ENDFORM."Hello Bjorn
I would recommend a few changes:
(1) Create the container and ALV grid instance for screen '200' only once (in a PBO module of screen '200' using a switch:
CHECK ( g_r_alv_container IS INITIAL ).
(2) Call method SET_TABLE_FOR_FIRST_DISPLAY in a PBO module of screen '200'. Perhaps add a "flush" to this PBO module, too.
Regards
Uwe -
Display different record in ALV Grid after provide different selection
Hi All,
I am a newbie.
This is my situation:
Firstly, on dropdown list, I select 'Annual'. Then, the alv grid display all records for 'Annual'.
Then, I select 'Sick', I'd like to use the same ALV Grid to display all records for 'Sick'.
I'd like to know if this is doable. If yes, can you show me some sample of coding which I can use as references.
If it is not possible, I'd like to ask for y'all opinion whether it is efficient to use different ALV Grid for different selection?
Hope to hear from you soon. Thank you very much.This is the snippet of the code:
if l_rbtlvreqlvid = 'X'.
"search based on leave id
select *
into gw_leave
from zabmd_leave
where lv_id = l_lvreqlvid.
append gw_leave to gt_leave.
endselect.
if g_lvreq_cus_cont is initial.
create object g_lvreq_cus_cont
exporting
container_name = 'L_LVREQCONT2'.
create object g_lvreq_alv_grid
exporting
i_parent = g_lvreq_cus_cont.
g_lvreq_alv_grid->set_table_for_first_display(
exporting
i_structure_name = 'zabmd_leave'
changing
it_outtab = gt_leave
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 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.
call screen 222.
else.
g_lvreq_alv_grid->refresh_table_display(
exceptions
finished = 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.
call screen 222.
endif.
Maybe you are looking for
-
Need Help with Javascript for Acrobat Pro 9
Hello, I am creating a PDF form in Adobe Acrobat Profession 9. Not having a lot of experience with Javascript, I have found this forum very helpful and have used many of the script examples for other issues I have had. I was hoping someone could he
-
I am unable to change settings, message I get is power save mode active, how do I disable power save mode? Manual does not explain how. Solved! Go to Solution.
-
Why can't I open new tabs?
When I click on a new tab, or go to 'File', 'New Tab' nothing happens. If I click on a link a new tab will open up, but I cannot get a blank one to open so I can type in a new website.
-
Newbie help on COUNT functions
Hi, I am new to Siebel/Answers, and I need to learn something about the COUNT funtions. I have a table of 102 numerical entries, where only one entry is 0. These are the results from the different COUNT functions COUNT(expr) = 129 COUNT(*) = 129 COUN
-
Need help with activating Voice Mail. I am new to Verizon moving from At
HELP!