SUBMITTING ALV GRID LIST
Hi,
can we call a standard program using SUBMIT and EXPORTING TO LIST TO MEMORY, which generates output in <b>ALV GRID</b>.
Some body saying it is only possible with ALV LIST display,
can anyone clarifies me???
it's a bit urgent...
Thanks
Praneet
Hi Amit,
I got the clarificaiton that we can submit a program which generates the output in ALV gird format in the calling program.
can u just have a look at standard program RVPKMASS96, from which i need to extract the list. I've checked it in the program it is going to short dump.
As u can see in RVPKMASS96 output a button appears like 'Detalil list' if we click on it, it shows detailed from there i need to catch the output.
can u just explain what are things to be taken care of? or just send me any psuedocode if u have any...
i will be waiting for your reply
Regards,
Raja
Similar Messages
-
Editable field in ALV GRID/LIST
Hi All,
I developed an alv program in which 10 rows is there. In alv grid/list first column is check box. I want 1,5 and 10th row is editable for first column (check box) while rest is not editable. Can you please give solution for same. Please tell me simple method not oops methos
coz I have taken FM REUSE_ALV_GRID_DISPLAY or REUSE_ALV_LIST_DISPLAY.
Thanks,
Rakeshgoto se38.
BCALVEDIT*
press F4
many examples are there..
BCALV_GRID_EDIT try this... -
Adding pushbutton in alv grid list
hai friends,
i have developed an alv grid list and i place a pushbutton called 'GETEXCEL'.when i click on 'GETEXCEL' it should generate an excel sheet and it should get placed in application server.
for the reference plz check my code also.
the issue is when i debug, the transfer statement is getting executed then it is going to the standard program(moduel pool) and then it is not going to application server.of course excel sheet is also getting generated.can anybody find the solution for this.
*& Form events_get
text
--> p1 text
<-- p2 text
FORM events_get .
*DATA t_event TYPE slis_t_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = tab_events
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE tab_events INTO wa_events WITH KEY name = 'USER_COMMAND'.
wa_events-form = 'USER_COMMAND'.
MODIFY tab_events FROM wa_events TRANSPORTING form WHERE name =
wa_events-name.
READ TABLE tab_events INTO wa_events WITH KEY name = 'PF_STATUS_SET'.
wa_events-form = 'PF_STATUS_SET'.
MODIFY tab_events FROM wa_events TRANSPORTING form WHERE name =
wa_events-name.
ENDFORM. " events_get
**& Form pf_status_set
FORM pf_status_set USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'STATUS'.
ENDFORM. " pf_status_set
**& Form user_command
FORM user_command
USING u_comm TYPE sy-ucomm
r_selfield TYPE slis_selfield.
CASE u_comm.
WHEN 'GETEXCEL'.
PERFORM f400_column_headings.
PERFORM f500_generate_excel_file.
PERFORM f600_transfer_excel_file.
ENDCASE.
ENDFORM. "user_command
then i am passing the parameters in grid fm also for user command and set pf status.Hi Mahesh,
1. No need to populate the EVENTS table in your case, just pass the Subroutine names for PF status and USER_COMMAND to GRId Display
I_CALLBACK_PFSTATUS = 'PF_STATUS_SET'.
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
2. make sure you pass SY-REPID/SY-CPROG to REUSE_ALV_GRID_DISPLAY FM -
ALV grid list report when selected from selection screen
Hi folks,
I need to get ALV grid display in my list report when selected the interval values from the selection screen. If I change the values in list of ALV grid it needs to be updated when I press UPDATE pushbutton. The output of list should be in ALV grid display.I need sorting ,flitering,totaling functionality in the list output.
For example if I selected BUKRS = 100 and 200 in the selection screen ,I need to display the ALV grid list in below the selection screen as ALV grid display...
Its urgent as I am new to ALV grid functionality...
Thanks in advance..hi raja,
check with the folllowing code.
REPORT zca0m_zca0fcstftop NO STANDARD PAGE HEADING
MESSAGE-ID zcsv_usrtbl_maintain.
Type pools *
TYPE-POOLS : slis. " Used for ALV display
Tables
TABLES: zca0fcstftop,
dd04t, "R/3 DD: Data element texts
tactt. "Activities that can be protected
internal tables
DATA: BEGIN OF wa_zca0fcstftop .
INCLUDE STRUCTURE zca0fcstftop.
DATA: END OF wa_zca0fcstftop.
DATA: t_zca0fcstftop LIKE STANDARD TABLE OF wa_zca0fcstftop.
DATA: BEGIN OF i_fcode OCCURS 0,
fcode LIKE sy-ucomm,
END OF i_fcode.
*Record for variant selection
DATA : BEGIN OF ws_variant,
selected TYPE c,
variant LIKE ltdx-variant, "Variant name
text LIKE ltdxt-text, "Variant description
END OF ws_variant.
*Table for variant selection
data : itab_variant LIKE STANDARD TABLE OF ws_variant WITH HEADER LINE.
Variant selection pop-up global variables
DECLARATION OF TABLECONTROL 'VARIANT_CNTL' ITSELF
CONTROLS: variant_cntl TYPE TABLEVIEW USING SCREEN 0200.
LINES OF TABLECONTROL 'VARIANT_CNTL'
DATA: g_variant_cntl_lines LIKE sy-loopc.
DATA:grid1 TYPE REF TO cl_gui_alv_grid ,
g_custom_container TYPE REF TO cl_gui_custom_container.
Work fields
DATA: table_name LIKE dd02l-tabname, "To store table name
field_name LIKE dd03l-fieldname, "To Store Field Name
act_auth LIKE tactz-actvt, "To pass Activity ID
tab_maint LIKE dd02l-tabname, "To pass Table Name to be Maintd.
wg_confirm_ind, "To trap User responses
flag, "To trap changes made to an entry
f_copy, "To Identify 'COPY' Command Use
f_select, "To decide between Select-options
" and Internal Table
l_transaction_code LIKE tstc-tcode,
v_langu LIKE sy-langu,
v_repid LIKE sy-repid,
s_variant TYPE disvariant.
DATA: ok_code LIKE sy-ucomm.
DATA:selected_rows TYPE lvc_t_row ,
sel_rows TYPE lvc_t_row WITH HEADER LINE.
DATA:t_lines TYPE i.
Constants *
CONSTANTS :
c_x TYPE c VALUE 'X', " Constant 'X'.
c_f TYPE c VALUE 'F'. " Constant 'F'.
Parameters and Selection Options
*Selection Screen for table maintenance
*Selection option for Plant
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-b01.
PARAMETERS: p_werks LIKE zca0fcstftop-werks OBLIGATORY.
SELECT-OPTIONS: s_prdfml FOR zca0fcstftop-product_family,
s_bmach FOR zca0fcstftop-base_machine,
s_factop FOR zca0fcstftop-factory_top,
s_optval FOR zca0fcstftop-option_value,
s_week FOR zca0fcstftop-week.
SELECTION-SCREEN END OF BLOCK block1.
SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME TITLE text-b02.
PARAMETERS : p_varant LIKE ltdx-variant. " ALV variant
SELECTION-SCREEN END OF BLOCK block2.
At selection screen *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_varant.
PERFORM alv_variant_f4 CHANGING p_varant.
AT SELECTION-SCREEN ON p_werks .
Validating Plant on the selection screen
PERFORM validate_plant.
Initialization
INITIALIZATION.
Check Authorization for the Transaction
Authorization Check For T Code
SELECT tcode
INTO l_transaction_code
FROM tstc UP TO 1 ROWS
WHERE pgmna = sy-repid.
ENDSELECT.
AUTHORITY-CHECK OBJECT 'S_TCODE'
ID 'TCD' FIELD l_transaction_code.
IF sy-subrc NE 0.
MESSAGE e001 WITH l_transaction_code.
ENDIF.
v_langu = sy-langu. " language
v_repid = sy-repid . " abap Program name
Start Of Selection
START-OF-SELECTION.
CALL SCREEN 0050.
*& Form validate_plant *
Validating Plant on the selection screen *
FORM validate_plant .
DATA : l_werks LIKE t001w-werks. " Plant
IF p_werks IS NOT INITIAL.
SELECT SINGLE werks
FROM t001w
INTO l_werks
WHERE werks EQ p_werks.
IF sy-subrc NE 0.
MESSAGE e100(ra) WITH text-001 .
ENDIF.
ENDIF.
AUTHORITY-CHECK OBJECT 'Z_PP_PLANT'
ID 'ACTVT' FIELD '03'
ID 'WERKS' FIELD p_werks
ID 'TCD' FIELD l_transaction_code.
IF sy-subrc NE 0.
MESSAGE e000(oo) WITH 'No authorization for plant:'(e80) p_werks.
ENDIF.
ENDFORM. " validate_plant
*& Form get_data *
Get data *
FORM get_data .
SELECT * FROM zca0fcstftop
INTO TABLE t_zca0fcstftop
WHERE werks = p_werks
AND product_family IN s_prdfml
AND base_machine IN s_bmach
AND factory_top IN s_factop
AND option_value IN s_optval
AND week IN s_week.
ENDFORM. " get_data
*& Form fill_fcode
FORM fill_fcode USING value(p_0029).
i_fcode-fcode = p_0029.
APPEND i_fcode.
CLEAR i_fcode.
ENDFORM. " fill_fcode
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
SET PF-STATUS 'UPDATE'.
CLEAR flag.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module MODIFY_0100 OUTPUT
MODULE modify_0100 OUTPUT.
IF sy-ucomm = 'CHNG' OR
sy-ucomm = 'PICK'.
LOOP AT SCREEN.
CHECK screen-group1 = 'CHG'.
screen-required = '0'.
screen-output = '1'.
screen-input = '0'.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
Check if you are in create mode & if yes then set the screen elements
as mandatory
IF ok_code = 'CREA'.
LOOP AT SCREEN.
CHECK screen-group1 = 'CHG'.
screen-required = '1'.
screen-output = '1'.
screen-input = '1'.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
ENDMODULE. " MODIFY_0100 OUTPUT
*& Module Check_Exit INPUT
text
MODULE check_exit INPUT.
IF ( sy-ucomm = 'BACK' OR sy-ucomm = 'CANC' OR sy-ucomm = 'EXIT' ) AND
( flag = 'Y' ).
CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
EXPORTING
defaultoption = 'Y'
textline1 = text-008
textline2 = text-009
titel = text-004
cancel_display = ' '
IMPORTING
answer = wg_confirm_ind.
CASE wg_confirm_ind.
WHEN 'J'. "Yes
sy-ucomm = 'SAVE'.
CLEAR flag.
WHEN 'N'. "No
sy-ucomm = 'BACK'.
CLEAR flag.
ENDCASE.
ENDIF.
ENDMODULE. " Check_Exit INPUT
*& Module Exit_0100 INPUT
text
MODULE exit_0100 INPUT.
SET SCREEN 0. LEAVE SCREEN.
ENDMODULE. " Exit_0100 INPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'SAVE'. "Save
Check to see if the user has the appropriate authorization
IF p_werks NE zca0fcstftop-werks.
could not update - not in selection
MESSAGE e000(oo) WITH 'Entry not within selection'.
SET SCREEN 0. LEAVE SCREEN.
PERFORM get_data.
ENDIF.
IF f_copy = 'X'.
INSERT zca0fcstftop.
IF sy-subrc = 0.
MESSAGE s004.
PERFORM initialize.
SET SCREEN 0. LEAVE SCREEN.
PERFORM get_data.
ELSE.
MESSAGE w005.
ENDIF.
ELSE.
MODIFY zca0fcstftop.
IF sy-subrc = 0.
MESSAGE s004.
PERFORM initialize.
SET SCREEN 0. LEAVE SCREEN.
PERFORM get_data.
ELSE.
MESSAGE w005.
ENDIF.
ENDIF.
PERFORM get_data.
WHEN 'BACK'. "Back
SET SCREEN 0. LEAVE SCREEN.
WHEN 'CANC'. "Cancel
SET SCREEN 0. LEAVE SCREEN.
WHEN OTHERS.
ENDCASE.
COMMIT WORK.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form Initialize
FORM initialize.
CLEAR : table_name,
field_name,
wg_confirm_ind,
f_copy,
flag,
t_zca0fcstftop,
zca0fcstftop,
wa_zca0fcstftop,
i_fcode.
REFRESH: t_zca0fcstftop.
ENDFORM. " Initialize
*& Form alv_variant_f4
text
<--P_VARIANT text
FORM alv_variant_f4 CHANGING variant.
DATA: rs_variant LIKE disvariant.
DATA nof4 TYPE c.
CLEAR nof4.
LOOP AT SCREEN.
IF screen-name = 'VARIANT'.
IF screen-input = 0.
nof4 = 'X'.
ENDIF.
ENDIF.
ENDLOOP.
rs_variant-report = sy-repid.
rs_variant-username = sy-uname.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = rs_variant
i_save = 'A'
IMPORTING
es_variant = rs_variant
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0 AND nof4 EQ space.
variant = rs_variant-variant.
ENDIF.
ENDFORM. " ALV_VARIANT_F4
*& Module STATUS_0050 OUTPUT
text
MODULE status_0050 OUTPUT.
In this module Initialize the container and put the grid in it
DATA:grid_layout TYPE lvc_s_layo,
fieldcat TYPE lvc_t_fcat,
wa_fieldcat LIKE LINE OF fieldcat.
PERFORM set_auth.
SET PF-STATUS 'UPD_0050' EXCLUDING i_fcode.
SET TITLEBAR 'UPD_0050'.
IF g_custom_container IS INITIAL .
CREATE OBJECT g_custom_container
EXPORTING
container_name = 'FTDATA'.
CREATE OBJECT grid1
EXPORTING
i_parent = g_custom_container.
ELSE.
CALL METHOD grid1->free.
CALL METHOD g_custom_container->free.
CREATE OBJECT g_custom_container
EXPORTING
container_name = 'FTDATA'.
CREATE OBJECT grid1
EXPORTING
i_parent = g_custom_container.
ENDIF.
Every time refresh The variables
PERFORM initialize.
PERFORM get_data.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZCA0FCSTFTOP'
CHANGING
ct_fieldcat = fieldcat.
grid_layout-grid_title = text-t01.
grid_layout-sel_mode = 'A'.
grid_layout-stylefname = 'CT'.
s_variant-report = sy-repid.
s_variant-username = sy-uname.
s_variant-variant = p_varant.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'ZCA0FCSTFTOP'
is_layout = grid_layout
is_variant = s_variant
i_save = 'A'
CHANGING
it_outtab = t_zca0fcstftop
it_fieldcatalog = fieldcat.
Create Object to receive events and link them to handler methods.
When the ALV Control raises the event for the specified instance
the corresponding method is automatically called.
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_button_click FOR grid1.
ENDMODULE. " STATUS_0050 OUTPUT
*& Module USER_COMMAND_0050 INPUT
MODULE user_command_0050 INPUT.
CALL METHOD grid1->get_selected_rows
IMPORTING
et_index_rows = selected_rows.
DESCRIBE TABLE selected_rows LINES t_lines.
IF t_lines > 1 .
MESSAGE e048(zcsv_sfdr).
ENDIF.
Clear Header
CLEAR wa_zca0fcstftop.
sel_rows[] = selected_rows .
READ TABLE sel_rows INDEX 1.
READ TABLE t_zca0fcstftop INTO wa_zca0fcstftop INDEX sel_rows-index.
CASE ok_code.
WHEN 'EXIT'.
PERFORM exit_program.
WHEN 'CREA'.
CLEAR zca0fcstftop.
ok_code = sy-ucomm.
zca0fcstftop-werks = p_werks.
CALL SCREEN 100.
WHEN 'COPY'.
MOVE wa_zca0fcstftop TO zca0fcstftop .
CLEAR wa_zca0fcstftop.
f_copy = 'X'.
CALL SCREEN 100.
WHEN 'CHNG'.
CHECK NOT wa_zca0fcstftop IS INITIAL.
MOVE wa_zca0fcstftop TO zca0fcstftop .
CLEAR wa_zca0fcstftop.
ok_code = sy-ucomm.
CALL SCREEN 100.
WHEN 'DELE'.
CHECK NOT wa_zca0fcstftop IS INITIAL.
CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
EXPORTING
defaultoption = 'N'
textline1 = text-005
textline2 = text-006
titel = text-007
cancel_display = ' '
IMPORTING
answer = wg_confirm_ind.
IF wg_confirm_ind EQ 'J'.
DELETE zca0fcstftop FROM wa_zca0fcstftop .
IF sy-subrc EQ 0.
MESSAGE s004.
ELSE.
MESSAGE e005.
ENDIF.
ELSEIF wg_confirm_ind EQ 'N'.
ENDIF.
ENDCASE.
CLEAR ok_code.
ENDMODULE. " USER_COMMAND_0050 INPUT
*& Form exit_program
FORM exit_program .
CALL METHOD g_custom_container->free.
CALL METHOD cl_gui_cfw=>flush.
SET SCREEN 0.
LEAVE SCREEN.
ENDFORM. " exit_program
*& Form set_auth
FORM set_auth.
REFRESH: i_fcode.
Check authorization for change
MOVE '02' TO act_auth. "02 --> Change
MOVE 'ZCA0FCSTFTOP' TO tab_maint.
AUTHORITY-CHECK OBJECT 'ZZ:TABLMNP'
ID 'ACTVT' FIELD act_auth
ID 'TABLE' FIELD tab_maint.
IF sy-subrc NE 0.
PERFORM fill_fcode USING 'CHNG'.
ENDIF.
Check for authorization for create
MOVE '01' TO act_auth. "01 --> Create
MOVE 'ZCA0FCSTFTOP' TO tab_maint.
AUTHORITY-CHECK OBJECT 'ZZ:TABLMNP'
ID 'ACTVT' FIELD act_auth
ID 'TABLE' FIELD tab_maint.
IF sy-subrc NE 0.
PERFORM fill_fcode USING 'CREA'.
PERFORM fill_fcode USING 'COPY'.
ENDIF.
Check for authorization for delete
MOVE '06' TO act_auth. "06 --> Delete
MOVE 'ZCA0FCSTFTOP' TO tab_maint.
AUTHORITY-CHECK OBJECT 'ZZ:TABLMNP'
ID 'ACTVT' FIELD act_auth
ID 'TABLE' FIELD tab_maint.
IF sy-subrc NE 0.
PERFORM fill_fcode USING 'DELE'.
ENDIF.
ENDFORM. " set_auth
*& Module check_change INPUT
MODULE check_change INPUT.
flag = 'Y'.
ENDMODULE. " check_change INPUT
regards,
vikas.
plz reward if helpful -
How to create editable ALV grid/list
Hi,
I want to create editable ALV grid/list so that user can modify the data in the ALV.
And when user presses save button data will get saved in Z table.
I dont know how to create editable ALV so could anybody please help me regarding this?
Thanks & regards,
Sameer DhukeHI
check the demo programs BCALV_FULLSCREEN_GRID_EDIT
BCALV_GRID_EDIT
BCALV_TEST_GRID_EDIT_01
BCALV_TEST_GRID_EDITABLE
REUSE_ALV_GRID EDITABLE
ALV Grid editable fields
Just to make things a bit easy
In the layout,there is a property called edit, make it 'X' for the particular field whichever you want to make editable.
Hope this helps,
Suruchi
Message was edited by:
Suruchi Mahajan -
Need a perfect example program for ALV GRID LIST
first hi to all,i am new to this community.i am still in learning process of SAP.one of my friend suggeted this community and i think this is the perfect place to learn and excel my skill in SAP.so my requirement is a perfect example program for ALV GRID LIST DISPLAY.while i am trying another program,the sysntax is ok but i am not getting any output and it is not showing any error also.hope i will get an answer asap.thank you.
Check [OO ALV Guide Simple|http://wiki.sdn.sap.com/wiki/display/ABAP/OBJECTORIENTEDALV+Guide] and [Easy Reference to ALV|http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907]
-
ALV-Grid list box in Cell Event when a value is selected
Hello to all,
I've got a editable alv grid with a list box in one cell.
Is there any event fired after user selection in order to update other cells?
A workaround may be to use event "data_changed" but I think this isn't a smart way.
Any ideas?
Best regards
ChristianHi Christian,
I think data_changed is right one here, as this one has is recording couple "states":
METHODS: handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed e_onf4 e_onf4_before e_onf4_after,
"these are fired up in different "state" of control during selection itself
"e_onF4
"e_onf4_before
"e_onf4_after
You can. however, try with handle_on_f4 . This works fine for input help, I didn't test it for listbox but should work as well. First you need to register this event with:
DATA: lt_fields_f4 TYPE lvc_t_f4,
ls_fields_f4 TYPE lvc_s_f4.
"activate event F4 only for particular fields
ls_fields_f4-fieldname = 'SEATSMAX_F'.
ls_fields_f4-register = 'X'.
ls_fields_f4-getbefore = 'X'.
ls_fields_f4-chngeafter = 'X'.
APPEND ls_fields_f4 TO lt_fields_f4.
CALL METHOD g_alv_grid_ref->register_f4_for_fields
EXPORTING
it_f4 = lt_fields_f4[].
...and then just method handler
METHODS: handle_on_f4 FOR EVENT onf4 OF cl_gui_alv_grid
IMPORTING e_fieldname e_fieldvalue er_event_data,
SET HANDLER ...
Regards
Marcin -
Can we control the output screen area of alv grid list
Hi All,
can we control the screen area of grid control in alv's , not using ooalv's. By default grid list is displaying in the whole screen, but i want to display this grid list in specific area in output screen , not in full screen, how to set these screen area for this grid control. Please let me know.Hi,
If you use the following parameters
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
you will get the output in the size expected but it will be in the form of a pop up box and a blank screen at the back and user action like cancel etc will take you back to the selection screen. -
Hi there,
I would like to create a checkbox on the ALV list output..I used the option Checkbox when doing the field catalogue ,but the problem is the checkbox is not clickable..
Can u please help on which options must I use to have a clickable checkbox on an ALV list(NB not Grid)
and Again How do I see which lines have been selected
(if more than one check box marked) . At user command I used internal table of type slis_selfield and it only shows on the field tabix it only shows 1 field which is the last to be marked..Please advise on how to keep track of all the marked rows..Hi makgatho,
1. To get a taste of it,
just copy paste this program.
2. It will display alv (t001)
It will show CHECKBOXES (besides every row)
TICK some rows,
and DOUBLE-CLICK ON any row.
3. It will display all the row numbers which have been checked/ticked.
4.
report abc.
TYPE-POOLS : slis.
Data
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE t001.
DATA : flag tyPE c,
END OF itab.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvly TYPE slis_layout_alv.
Select Data
SELECT * FROM t001 INTO TABLE itab.
*------- Field Catalogue
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB'
i_inclname = sy-repid
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
Display
alvly-box_fieldname = 'FLAG'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
i_callback_program = sy-repid "<-------Important
i_callback_user_command = 'ITAB_USER_COMMAND' "<------ Important
is_layout = alvly
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
CALL BACK FORM
FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
slis_selfield.
data : msg(100) type c.
LOOP AT itab.
if itab-flag = 'X'.
msg = sy-tabix.
condense msg.
concatenate 'Row Number ' msg ' ' into msg
separated by space.
message msg type 'I'.
endif.
ENDLOOP.
ENDFORM. "ITAB_user_command
regards,
amit m. -
Hotspot click in methods for alv grid list
Hi all ,
i written a program for grid display and hotspot click.
but it is not capturing the value at the event hotspot click,
please anybody help me in capturing the value in the following code.
it will be great will it happens soon.
REPORT zag_tables MESSAGE-ID zag .
DATA : gt_tables TYPE TABLE OF zag_tables,
gs_tables type zag_tables.
DATA : gt_cust_cont TYPE REF TO cl_gui_custom_container ,
gt_alv_grid TYPE REF TO cl_gui_alv_grid,
gt_cont TYPE scrfname VALUE 'ZAG_TABLES'.
*data declarations for grid layout
DATA : gt_fieldcat TYPE lvc_t_fcat,
gs_fieldcat TYPE lvc_s_fcat,
gs_layout TYPE lvc_s_layo,
gs_variant TYPE disvariant.
DATA : gv_repid TYPE syrepid,
okcode TYPE syucomm..
*data : gs_row_id type lvc_s_row,
gs_col_id type lvc_s_col,
gs_row_no type lvc_s_roid.
data : e_row_id type lvc_s_row,
gs_col_id type lvc_s_col,
gs_row_no type lvc_s_roid.
*CLASS DEFINITIONS
CLASS cl_event_handler DEFINITION.
PUBLIC SECTION.
CLASS-METHODs : cm_hotspot_click FOR EVENT hotspot_click OF
cl_gui_alv_grid IMPORTING
e_row_id e_column_id es_row_no .
ENDCLASS.
CLASS cl_event_handler IMPLEMENTATION
CLASS cl_event_handler IMPLEMENTATION.
METHOD : cm_hotspot_click .
PERFORM hotspot_click.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
PERFORM select_data.
END-OF-SELECTION.
CALL SCREEN 100.
*& Form select_data
text
--> p1 text
<-- p2 text
FORM select_data.
SELECT * FROM zag_tables INTO TABLE gt_tables.
ENDFORM. " select_data
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'ZAG_TABLES'.
SET TITLEBAR 'ZAG_TABLES'.
gv_repid = sy-repid.
IF gt_cust_cont IS INITIAL.
CREATE OBJECT gt_cust_cont
EXPORTING
container_name = gt_cont
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6
IF sy-subrc <> 0.
ENDIF.
CREATE OBJECT gt_alv_grid
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
i_parent = gt_cust_cont
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_USE_VARIANT_CLASS = SPACE
I_NAME =
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5
IF sy-subrc <> 0.
ENDIF.
ELSE.
CALL METHOD gt_alv_grid->refresh_table_display
EXCEPTIONS
finished = 1
OTHERS = 2
IF sy-subrc <> 0.
ENDIF.
ENDIF.
*perform layout changing gs_layout.
PERFORM fieldcat CHANGING gt_fieldcat.
*perform variant changing gs_variant.
gs_layout-zebra = 'X'.
gs_layout-sel_mode = 'A'.
gs_variant-report = gv_repid.
SET HANDLER cl_event_handler=>cm_hotspot_click FOR gt_alv_grid.
CALL METHOD gt_alv_grid->set_table_for_first_display
EXPORTING
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
is_variant = gs_variant
i_save = 'A'
i_default = 'X'
is_layout = gs_layout
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
it_outtab = gt_tables
it_fieldcatalog = gt_fieldcat
IT_SORT =
IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4
IF sy-subrc <> 0.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Form fieldcat
text
<--P_GS_fieldcat text
FORM fieldcat CHANGING gt_fieldcat TYPE lvc_t_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_BUFFER_ACTIVE =
i_structure_name = 'ZAG_TABLES'
I_CLIENT_NEVER_DISPLAY = 'X'
I_BYPASSING_BUFFER =
CHANGING
ct_fieldcat = gt_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3
IF sy-subrc <> 0.
ENDIF.
LOOP AT gt_fieldcat INTO gs_fieldcat.
gs_fieldcat-fieldname = 'MANDT'.
gs_fieldcat-no_out = ''.
MODIFY gt_fieldcat FROM gs_fieldcat.
gs_fieldcat-fieldname = 'Z_TABLES'.
gs_fieldcat-hotspot = 'X'.
MODIFY gt_fieldcat FROM gs_fieldcat.
ENDLOOP.
ENDFORM. " fieldcat
*& Form layout
text
--> p1 text
<-- p2 text
*form layout changing gs_layout.
*gs_layout-zebra = 'X'.
*gs_layout-sel_mode = 'A'.
*endform. " layout
*& Form variant
text
<--P_GS_variant text
<--P_ENDMODULE text
*form variant changing gs_variant
gs_variant-report = gv_repid.
*endform. " variant
*& Module USER_COMMAND_0100 INPUT
text
MODULE user_command_0100 INPUT.
TRANSLATE okcode TO UPPER CASE.
CASE okcode.
WHEN 'EXIT' OR 'BACK' OR 'CANCEL'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form hotspot_click
text
--> p1 text
<-- p2 text
FORM hotspot_click ."importing gs_row_id type lvc_s_row.
data : lv_prog type syrepid,
lv_tcode type tcode.
read table gt_tables into gs_tables index e_row_id-index.
if sy-subrc eq 0 and gs_col_id-fieldname = 'ZTABLES'.
move gs_tables-z_tables to lv_prog.
translate lv_prog to upper case.
select single tcode from tstc into lv_tcode where pgmna = lv_prog.
call transaction lv_tcode.
endif.
ENDFORM. " hotspot_click
thanks in advance..
plsHi ,
please go through this Program it was handled by Hot spot only .
report zbnstest.
* TABLES AND DATA DECLARATION.
*TABLES: mara,makt.",marc.
data syrepid like sy-repid.
data sydatum(10). " LIKE sy-datum.
data sypagno(3) type n.
* WHEN USING MORE THAN ONE TABLE IN ALV WE NEEED TO DECLARE THE TYPE
* GROUP (TYPE-POOLS--------->SLIS)
type-pools : slis.
* INTERNAL TABLE DECLARATION.
* INTERNAL TABLE TO HOLD THE VALUES FROM THE MARA TABLE
data: begin of t_mara occurs 0,
matnr like mara-matnr,
meins like mara-meins,
mtart like mara-mtart,
matkl like mara-matkl,
end of t_mara.
* INTERNAL TABLE TO HOLD THE CONTENTS FROM THE EKKO TABLE
data : begin of t_marc occurs 0,
matnr like mara-matnr,
werks like marc-werks,
minbe like marc-minbe.
data: end of t_marc.
* INTERNAL TABLE TO HOLD THE VALUES FROM MAKT TABLE.
data : begin of t_makt occurs 0,
matnr like mara-matnr,
maktx like makt-maktx,
spras like makt-spras,
end of t_makt.
* INTERNAL TABLE WHICH ACTUALLY MERGES ALL THE OTHER INTERNAL TABLES.
data: begin of itab1 occurs 0,
matnr like mara-matnr,
meins like mara-meins,
maktx like makt-maktx,
spras like makt-spras,
werks like marc-werks,
minbe like marc-minbe,
end of itab1.
* THE FOLLOWING DECLARATION IS USED FOR DEFINING THE FIELDCAT
* AND THE LAYOUT FOR THE ALV.
* HERE AS slis_t_fieldcat_alv IS A INTERNAL TABLE WITHOUT A HEADER LINE
* WE EXPLICITELY DEFINE AN INTERNAL TABLE OF THE SAME STRUCTURE AS THAT
* OF slis_t_fieldcat_alv BUT WITH A HEADER LINE IN THE DEFINITION.
* THIS IS DONE TO MAKE THE CODE SIMPLER.
* OTHERWISE WE MAY HAVE TO DEFINE THE STRUCTURE AS IN THE NORMAL SAP
* PROGRAMS.
* IN THE FIELDCATALOG TABLE WE ACTUALLY PASS THE FIELDS FROM ONE OR
* MORE TABLES AND CREATE A STRUCTURE
* IN THE LAYOUT STRUCTURE WE BASICALLY DEFINE THE FORMATTING OPTIONS
* LIKE DISPLAY IN THE ZEBRA PATTERN ,THE HOTSPOT OPTIONS ETC.
data: fieldcatalog type slis_t_fieldcat_alv with header line,
fieldlayout type slis_layout_alv.
* DECLARING THE EVENTTABLE INTERNL TABLE FOR USING EVENTS LIKE
* TOP-OF-PAGE ETC.
data : eventstab type slis_t_event with header line.
* DECLARING AN INTERNAL TABLE TO HOLD THE DATA FOR THE TOP-OF-PAGE
data : heading type slis_t_listheader with header line.
data : heading1 type slis_t_listheader with header line.
data : heading2 type slis_t_listheader with header line.
data : heading3 type slis_t_listheader with header line.
data : heading4 type slis_t_listheader with header line.
data : heading5 type slis_t_listheader with header line.
data : heading6 type slis_t_listheader with header line.
data : heading7 type slis_t_listheader with header line.
data : heading8 type slis_t_listheader with header line.
* STRUCTURE TO PASS THE COLOR ATTRIBUTES FOR DISPLAY.
data : colorstruct type slis_coltypes.
* INITIALIZATION. *
initialization.
syrepid = sy-repid.
sypagno = sy-pagno.
clear fieldcatalog.
* START-OF-SELECTION. *
start-of-selection.
* SUBROUTINE TO POPULATE THE COLORSTRUCT
perform fill_colorstruct using colorstruct.
* SUBROUTINE TO POPULATE THE FIELDS OF THE FIELD CATALOGUE
perform populate_fieldcatalog.
* SUBROUTINE TO SELECT DATA FROM VARIOUS TABLES AND POPULATE IT IN THE
* INTERNAL TABLE.
perform selectdata_and_sort.
* SUBROUTINE TO POPULATE THE LAYOUT STRUCTURE.
perform populate_layout using fieldlayout.
* SUBROUTINE TO CALL THE FUNCTION MERGE TO ENSURE PROPER DISPLAY.
perform merge_fieldcatalog.
* SUBROUTINE TO POPULATE THE EVENTSTAB.
perform fill_eventstab tables eventstab.
* SUBROUTINE TO POPULATE THE HEADING TABLES.
perform fill_headingtable tables heading using 'HEADING'.
perform fill_headingtable tables heading1 using 'HEADING1'.
perform fill_headingtable tables heading2 using 'HEADING2'.
perform fill_headingtable tables heading3 using 'HEADING3'.
perform fill_headingtable tables heading4 using 'HEADING4'.
perform fill_headingtable tables heading5 using 'HEADING5'.
perform fill_headingtable tables heading6 using 'HEADING6'.
perform fill_headingtable tables heading7 using 'HEADING7'.
perform fill_headingtable tables heading8 using 'HEADING8'.
* SUBROUTINE TO DISPLAY THE LIST.
perform display_alv_list.
* FORMS
* IN THIS SUBROUTINE WE POPULATE THE FIELDCATALOG TABLE WITH THE NAMES
* OF THE TABLE,FIELDNAME,WHETHER IT IS KEY FIELD OR NOT,HEADING AND
* COLUMN JUSTIFICATION.
form populate_fieldcatalog.
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MATNR' 'X' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MEINS' ' '.
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MAKTX' ' ' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MTART' ' ' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MATKL' ' ' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'SPRAS' ' ' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'WERKS' ' ' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MINBE' ' ' .
endform. " POPULATE_FIELDCATALOG
* FORM FILL_FIELDS_OF_FIELDCATALOG *
* --> FIELDCATALOG *
* --> P_TABNAME *
* --> P_FIELDNAME *
* --> P_KEY *
* --> P_KEY *
form fill_fields_of_fieldcatalog tables fieldcatalog
structure fieldcatalog
using p_tabname
p_fieldname
p_key.
* p_no_out.
fieldcatalog-tabname = p_tabname.
fieldcatalog-fieldname = p_fieldname.
fieldcatalog-key = p_key.
fieldcatalog-emphasize = '1234'.
*fieldcatalog-no_out = p_no_out.
append fieldcatalog.
endform. " FILL_FIELDSOFFIELDCATALOG
* FORM POPULATE_LAYOUT *
* --> FIELDLAYOUT *
form populate_layout using fieldlayout type slis_layout_alv.
fieldlayout-f2code = '&ETA' .
fieldlayout-zebra = 'X'.
* FOR THE WINDOW TITLE.
fieldlayout-window_titlebar = 'ALV with Events'.
fieldlayout-colwidth_optimize = 'X'.
fieldlayout-no_vline = ' '.
*fieldlayout-no_input = 'X'.
fieldlayout-confirmation_prompt = ''.
fieldlayout-key_hotspot = 'X'.
* This removes the column headings if the flag is set to 'X'
fieldlayout-no_colhead = ' '.
*fieldlayout-hotspot_fieldname = 'MAKTX'.
fieldlayout-detail_popup = 'X'.
* fieldlayout-coltab_fieldname = 'X'.
endform. " POPULATE_LAYOUT
* FORM SELECTDATA_AND_SORT *
form selectdata_and_sort.
select matnr meins mtart matkl from mara
into corresponding fields of t_mara
up to 500 rows .
select matnr maktx spras from makt
into corresponding fields of t_makt
where matnr = t_mara-matnr and
spras = sy-langu.
select matnr werks minbe from marc
into corresponding fields of t_marc
where matnr = t_mara-matnr.
append t_marc.
endselect.
append t_makt.
endselect.
append t_mara.
endselect.
perform populate_itab1.
sort itab1 by matnr.
endform. " SELECTDATA_AND_SORT
* FORM MERGE_FIELDCATALOG *
form merge_fieldcatalog.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = syrepid
i_internal_tabname = 'ITAB1'
* i_structure_name = 'COLORSTRUCT'
* I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = syrepid
changing
ct_fieldcat = fieldcatalog[]
exceptions
inconsistent_interface = 1
program_error = 2
others = 3.
endform. " MERGE_FIELDCATALOG
* IN THIS FUNCTION THE MINIMUM PARAMETERS THAT WE NEED TO PASS IS AS
* FOLLOWS:-
* i_callback_program --> CALLING PROGRAM NAME
* i_structure_name --> STRUCTURE NAME.
* is_layout --> LAYOUT NAME.
* it_fieldcat ---> BODY OF THE FIELD CATALOGUE INTERNAL TABLE
form display_alv_list.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
i_callback_program = syrepid
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
i_structure_name = 'ITAB1'
is_layout = fieldlayout
it_fieldcat = fieldcatalog[]
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* THE FOLLOWING PARAMETER IS SET AS 'A' INORDER TO DISPLAY THE STANDARD
* TOOL BAR
i_save = 'A'
* IS_VARIANT = ' '
it_events = eventstab[]
* IT_EVENT_EXIT =
* IS_PRINT =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = itab1
exceptions
program_error = 1
others = 2.
endform. " DISPLAY_ALV_LIST
*& Form POPULATE_ITAB1
* text
* --> p1 text
* <-- p2 text
form populate_itab1.
loop at t_mara.
loop at t_makt where matnr = t_mara-matnr.
loop at t_marc where matnr = t_mara-matnr.
move-corresponding t_mara to itab1.
move-corresponding t_makt to itab1.
move-corresponding t_marc to itab1.
append itab1.
endloop.
endloop.
endloop.
endform. " POPULATE_ITAB1
*& Form FILL_EVENTSTAB
* text
* -->P_EVENTSTAB text *
form fill_eventstab tables p_eventstab structure eventstab.
* WHEN THE FOLLOWING FUNCTION IS CALLED THE SYSTEM POPULATES THE
* INTERNAL TABLE EVENTSTAB WITH A LIST OF EVENTS NAME.
* AS SHOWN BELOW WHEN USING I_LIST_TYPE = 0 THE FUNCTION RETURNS 14
* EVENTS NAME.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = p_eventstab[]
exceptions
list_type_wrong = 1
others = 2.
* BY CALLING THE ABOVE FUNCTION WE FIRST POPULATE THE EVENTSTAB WITH
* THE PREDEFINED EVENTS AND THEN WE MOVE THE FORM NAME AS SHOWN BELOW.
* WE ASSIGN A FORM NAME TO THE EVENT AS REQUIRED BY THE USER.
* FORM NAME CAN BE ANYTHING.THE PERFORM STATEMENT FOR THIS FORM
* IS DYNAMICALY CALLED.
read table p_eventstab with key name = slis_ev_top_of_page.
if sy-subrc = 0 .
move 'TOP_OF_PAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_top_of_coverpage.
if sy-subrc = 0 .
move 'TOP_OF_COVERPAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_end_of_coverpage .
if sy-subrc = 0 .
move 'END_OF_COVERPAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_foreign_top_of_page.
if sy-subrc = 0 .
move 'FOREIGN_TOP_OF_PAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_foreign_end_of_page.
if sy-subrc = 0 .
move 'FOREIGN_END_OF_PAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_list_modify.
if sy-subrc = 0 .
move 'LIST_MODIFY' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_top_of_list.
if sy-subrc = 0 .
move 'TOP_OF_LIST' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_end_of_page.
if sy-subrc = 0 .
move 'END_OF_PAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_end_of_list .
if sy-subrc = 0 .
move 'END_OF_LIST' to p_eventstab-form.
append p_eventstab.
endif.
endform. " FILL_EVENTSTAB
*& Form FILL_HEADINGTABLE
* text
* -->P_HEADING text *
form fill_headingtable tables p_heading structure heading
using tablename.
case tablename.
when 'HEADING'.
p_heading-typ = 'H'.
concatenate
' REPORT NAME:-' syrepid
' ABB Industry Pte Ltd' into p_heading-info.
append p_heading.
write sy-datum using edit mask '__/__/____' to sydatum.
concatenate
' DATE:-' sydatum ' USER: ' sy-uname 'PAGE NO:' sypagno
into p_heading-info.
append p_heading.
when 'HEADING1'.
p_heading-typ = 'H'.
p_heading-info = 'TOP-OF-COVER-PAGE'.
append p_heading.
when 'HEADING2'.
p_heading-typ = 'H'.
p_heading-info = 'END-OF-COVER-PAGE'.
append p_heading.
when 'HEADING3'.
p_heading-typ = 'H'.
p_heading-info = 'FOREIGN-TOP-OF-PAGE'.
append p_heading.
when 'HEADING4'.
p_heading-typ = 'H'.
p_heading-info = 'FOREIGN-END-OF-PAGE'.
append p_heading.
* WHEN 'HEADING5'.
* P_HEADING-TYP = 'H'.
* P_HEADING-INFO = 'LIST-MODIFY'.
* APPEND P_HEADING.
when 'HEADING6'.
p_heading-typ = 'H'.
p_heading-info = 'END-OF-PAGE'.
append p_heading.
when 'HEADING7'.
p_heading-typ = 'H'.
p_heading-info = 'END-OF-LIST'.
append p_heading.
when 'HEADING8'.
p_heading-typ = 'H'.
p_heading-info = 'TOP-OF-LIST'.
append p_heading.
endcase.
endform. " FILL_HEADINGTABLE
* FORM TOP_OF_PAGE *
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading[]
exceptions
others = 1.
endform.
*& Form FILL_COLORSTRUCT
* text
* -->P_COLORSTRUCT text *
form fill_colorstruct using p_colorstruct type slis_coltypes .
p_colorstruct-heacolfir-col = 6.
p_colorstruct-heacolfir-int = 1.
p_colorstruct-heacolfir-inv = 1.
endform. " FILL_COLORSTRUCT
* FORM TOP_OF_COVERPAGE *
form top_of_coverpage.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading1[]
exceptions
others = 1.
endform.
* FORM END_OF_COVERPAGE *
form end_of_coverpage.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading2[]
exceptions
others = 1.
endform.
* FORM FOREIGN_TOP_OF_PAGE *
form foreign_top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading3[]
exceptions
others = 1.
endform.
* FORM FOREIGN_END_OF_PAGE *
form foreign_end_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading4[]
exceptions
others = 1.
endform.
* FORM LIST_MODIFY *
*FORM LIST_MODIFY.
* CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
* EXPORTING
* IT_LIST_COMMENTARY = HEADING5[]
* EXCEPTIONS
* OTHERS = 1.
*ENDFORM.
* FORM END_OF_PAGE *
form end_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading6[]
exceptions
others = 1.
endform.
* FORM END_OF_LIST *
form end_of_list.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading7[]
exceptions
others = 1.
endform.
* FORM TOP_OF_LIST *
form top_of_list.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading8[]
exceptions
others = 1.
endform.
*--- End of Program
Reward points if it is usefull ..
Girish -
ALV grid list giving run time error
hi
after lot of struggle , i over come by previous issue .
but now another is coming . i.e.
my ALV is displaying in GRID fine . But when i am selecting a column and doing SUMMATION (Icon) . it is giving runtime error.
same if i am clicking on PRINT PREVIEW of LIST
please guide me.my ALV is displaying in GRID fine . But when i am selecting a column and doing SUMMATION (Icon) . it is giving runtime error.
same if i am clicking on PRINT PREVIEW of LIST
from the above issue i can see that you populated the fieldcatalog wrong . some where you made the mistake.
fieldcat-fieldname = 'VBELN'. "this should be caps
fieldcat-tablename = 'IT_VBAK'. "provide the table also if you are not.
post your field catalog part, there we can see the mistake. -
To change the subtotals row color in ALV(Grid / List ) .
I am trying to change the color of a row which gives the subtotal...in ALV report...
but it is not working....
I have used the following code but not getting where i m wrong
I have u sed the following code wih the help of our forum only...
<CODE>
TYPE-POOLS: SLIS.
*& Internal Table Delcaration
DATA : BEGIN OF IT_SCALE OCCURS 0,
DATUM LIKE ZSCALE-DATUM,
MCOD1 LIKE ZSCALE-MCOD1,
MATNR LIKE ZSCALE-MATNR,
MAKTG LIKE ZSCALE-MAKTG,
MEINS LIKE ZSCALE-MEINS,
RATE LIKE ZSCALE-RATE,
TOTAL LIKE ZSCALE-TOTAL,
LI_COLOR(4),
END OF IT_SCALE.
DATA : INDEX LIKE SY-TABIX.
*& ALV Data Declaration
DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: WA_FIELDCAT LIKE LINE OF IT_FIELDCAT.
DATA : T_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
DATA : IT_EVENTS TYPE SLIS_T_EVENT WITH HEADER LINE.
DATA : G_SAVE(1) TYPE C VALUE 'A',
GX_SAVE(1) TYPE C VALUE 'A',
GX_VARIANT LIKE DISVARIANT,
G_VARIANT LIKE DISVARIANT,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
T_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
T_I_EVENT TYPE SLIS_ALV_EVENT.
DATA : L_LIST(105) TYPE C, "Store the Top-of-page headings
L_DATEFROM(10) TYPE C, "Store date in top-of-page
L_DATETO(10) TYPE C. "Store date in top-of-page
<code>
START-OF-SELECTION.
PERFORM GET_DATA.
PERFORM ALV_FIELDCAT.
PERFORM GET_EVENTS.
PERFORM SUB_COMMENT_BUILD USING T_LIST_TOP_OF_PAGE.
PERFORM ALV_DISPLAY.
FORM GET_DATA .
DATA : LINE_COLOR.
SELECT DATUM MCOD1 MATNR MAKTG MEINS RATE TOTAL
FROM ZSCALE INTO CORRESPONDING FIELDS OF TABLE IT_SCALE
WHERE DATUM IN S_DATE
AND LIFNR IN S_LIFNR
AND MATNR IN S_MATNR.
loop at IT_SCALE.
LINE_color = LINE_color + 2.
if LINE_color < 7.
LINE_color = 1.
endif.
concatenate 'C' lINE_color '00' into IT_SCALE-li_color.
modify it_SCALE TRANSPORTING LI_COLOR.
endloop.
FORM ALV_FIELDCAT.
DATA: COUNTER TYPE I.
COUNTER = COUNTER + 1.
WA_FIELDCAT-COL_POS = COUNTER.
WA_FIELDCAT-FIELDNAME = 'DATUM'.
WA_FIELDCAT-TABNAME = 'IT_SCALE'.
WA_FIELDCAT-SELTEXT_L = 'Date'.
WA_FIELDCAT-JUST = 'C'.
WA_FIELDCAT-NO_ZERO = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
.endform.
FORM ALV_DISPLAY .
GS_LAYOUT-ZEBRA = 'X'.
GS_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
GS_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
gS_layout-no_input = 'X'.
gS_layout-totals_text = 'Totals'(201).
gS_layout-subtotals_text = 'Subtotal'.
IF IT_SCALE[] IS INITIAL.
MESSAGE I001(38) WITH 'No Data to Display'.
ELSE.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
I_SAVE = G_SAVE
IS_VARIANT = GX_VARIANT
TABLES
T_OUTTAB = IT_SCALE[].
ENDIF.
ENDFORM. " ALV_DISPLAY
ThanX in Adavance....Hi Prasad,
I provided some code snippets for you. Please go through.
Hope this proves to be helpful to you.
The steps for coloring a line i the grid is much the same as making a traffic light.
To color a line the structure of the table must include a Char 4 field for color properties
TYPES: BEGIN OF st_sflight.
INCLUDE STRUCTURE zsflight.
Field for line color
types: line_color(4) type c.
TYPES: END OF st_sflight.
TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
DATA: gi_sflight TYPE tt_sflight.
Loop trough the table to set the color properties of each line. The color properties field is
Char 4 and the characters is set as follows:
Char 1 = C = This is a color property
Char 2 = 6 = Color code (1 - 7)
Char 3 = Intensified on/of = 1 = on
Char 4 = Inverse display = 0 = of
LOOP AT gi_sflight INTO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
g_wa_sflight-line_color = 'C610'.
ENDIF.
MODIFY gi_sflight FROM g_wa_sflight.
ENDLOOP.
Name of the color field
gs_layout-info_fname = 'LINE_COLOR'.
Grid setup for first display
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_layout = gs_layout
CHANGING it_outtab = gi_sflight.
Heres another Example for you:
& Report Z_ALV_COLOURS &
& This report shows how to use colours in REUSE_ALV_GRID_DISPLAY &
& C = Colour (all codes must start with 'C') &
& X = Colour number (1-9) &
& Y = Intensified (0 = off, 1 = on) &
& Z = Inverse (0 = off, 1 = on) &
report z_alv_colours.
data count_1(1) type c.
ALV definitions
type-pools: slis.
data i_fieldcat type slis_t_fieldcat_alv with header line.
data i_layout type slis_layout_alv.
types: begin of t_alv,
f1(4) type c,
f2(15) type c,
f3(4) type c,
f4(4) type c,
f5(4) type c,
f6(4) type c,
colour(4) type c,
coltab type slis_t_specialcol_alv,
end of t_alv.
data: i_alv type standard table of t_alv with header line.
data l_alvcolor type slis_specialcol_alv.
& create table entries for LINE colours &
do 9 times.
count_1 = sy-index.
clear i_alv.
concatenate 'C' count_1 '0' '0' into i_alv-f1.
concatenate 'C' count_1 '0' '0' into i_alv-colour.
i_alv-f2 = 'Line colour'.
i_alv-f3 = 'X'.
append i_alv.
Intensified
clear i_alv.
concatenate 'C' count_1 '1' '0' into i_alv-f1.
concatenate 'C' count_1 '1' '0' into i_alv-colour.
i_alv-f2 = 'Line colour'.
i_alv-f4 = 'X'.
append i_alv.
Inverse
clear i_alv.
concatenate 'C' count_1 '0' '1' into i_alv-f1.
concatenate 'C' count_1 '0' '1' into i_alv-colour.
i_alv-f2 = 'Line colour'.
i_alv-f5 = 'X'.
append i_alv.
Intensified & Inverse
clear i_alv.
concatenate 'C' count_1 '1' '1' into i_alv-f1.
concatenate 'C' count_1 '1' '1' into i_alv-colour.
i_alv-f2 = 'Line colour'.
i_alv-f6 = 'X'.
append i_alv.
enddo.
create table entries for CELL colours
do 9 times.
count_1 = sy-index.
concatenate 'C' count_1 '0' '0' into i_alv-f1.
i_alv-f2 = 'Cell colour'.
concatenate 'C' count_1 '0' '0' into i_alv-f3.
concatenate 'C' count_1 '1' '0' into i_alv-f4.
concatenate 'C' count_1 '0' '1' into i_alv-f5.
concatenate 'C' count_1 '1' '1' into i_alv-f6.
append i_alv.
enddo.
& Create table entries for CELL colours &
loop at i_alv where f2 = 'Cell colour'.
Colour cells
clear l_alvcolor.
l_alvcolor-fieldname = 'F3'.
l_alvcolor-color-col = i_alv-f3+1(1).
l_alvcolor-color-int = i_alv-f3+2(1).
l_alvcolor-color-inv = i_alv-f3+3(1).
l_alvcolor-nokeycol = 'X'.
append l_alvcolor to i_alv-coltab.
clear l_alvcolor.
l_alvcolor-fieldname = 'F4'.
l_alvcolor-color-col = i_alv-f4+1(1).
l_alvcolor-color-int = i_alv-f4+2(1).
l_alvcolor-color-inv = i_alv-f4+3(1).
l_alvcolor-nokeycol = 'X'.
append l_alvcolor to i_alv-coltab.
clear l_alvcolor.
l_alvcolor-fieldname = 'F5'.
l_alvcolor-color-col = i_alv-f5+1(1).
l_alvcolor-color-int = i_alv-f5+2(1).
l_alvcolor-color-inv = i_alv-f5+3(1).
l_alvcolor-nokeycol = 'X'.
append l_alvcolor to i_alv-coltab.
clear l_alvcolor.
l_alvcolor-fieldname = 'F6'.
l_alvcolor-color-col = i_alv-f6+1(1).
l_alvcolor-color-int = i_alv-f6+2(1).
l_alvcolor-color-inv = i_alv-f6+3(1).
l_alvcolor-nokeycol = 'X'.
append l_alvcolor to i_alv-coltab.
modify i_alv.
endloop.
& Configure ALV settings &
Create field catalog
perform create_field_catalog using 'F1' 'T_ALV' 'Colour name'.
perform create_field_catalog using 'F2' 'T_ALV' 'Description'.
perform create_field_catalog using 'F3' 'T_ALV' 'BaseColour'.
perform create_field_catalog using 'F4' 'T_ALV' 'Intensified'.
perform create_field_catalog using 'F5' 'T_ALV' 'Inverse'.
perform create_field_catalog using 'F6' 'T_ALV' 'Both Inv/Int'.
perform create_field_catalog using 'COLOUR' 'T_ALV' 'Colour'.
Layout
clear i_layout.
i_layout-colwidth_optimize = 'X'.
i_layout-info_fieldname = 'COLOUR'. " for line colour
i_layout-coltab_fieldname = 'COLTAB'. " for cell colour
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'
is_layout = i_layout
it_fieldcat = i_fieldcat[]
i_default = 'X'
i_save = 'A'
tables
t_outtab = i_alv.
& Form CREATE_FIELD_CATALOG &
form create_field_catalog using p_fieldname
p_tabname
p_text.
i_fieldcat-fieldname = p_fieldname.
i_fieldcat-tabname = p_tabname.
i_fieldcat-seltext_l = p_text.
append i_fieldcat.
endform. " CREATE_FIELD_CATALOG
For more information about Coloring in ALV, Please refer :
Coloring Rows in ALV
Hope this helps you in solving your issue.
Please Reward Points if any of the above points are helpful to you.
Regards,
Kalyan Chakravarthy -
Sign in front of numeric/currency field in ALV grid/list
Dear all,
We need to display sign in front for numeric/currency values which will
use the sub-total functionality. Currently there is no option for doing
this in ALV output options.
Is this possible?
regards
NiteshHi,
Please go throw below links ,
may be it will solve u r problem
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
Regards
Suresh.d -
How to get check box in alv grid list output
hi gurus,
can anyone inform me
how to get check box in alv output it should not be a pop up window
thank you
regards
kals.or
hi go through the fallowing code.
code*&----
*& Report YGS_ALV_BOM *
REPORT YGS_ALV_BOM .
TABLES : MAST,STKO,STPO.
TYPE-POOLS: SLIS.
TYPES : BEGIN OF TY_MAST,
CHECK_BOX,
MATNR TYPE MAST-MATNR,
WERKS TYPE MAST-WERKS,
STLAN TYPE MAST-STLAN,
STLNR TYPE MAST-STLNR,
STLAL TYPE MAST-STLAL,
END OF TY_MAST.
TYPES : BEGIN OF TY_STKO,
STLTY TYPE STKO-STLTY,
STLNR TYPE STKO-STLNR,
STLAL TYPE STKO-STLAL,
STKOZ TYPE STKO-STKOZ,
BMENG TYPE STKO-BMENG,
BMEIN TYPE STKO-BMEIN,
END OF TY_STKO.
TYPES : BEGIN OF TY_STPO,
LIGHTS,
STLTY TYPE STPO-STLTY,
STLNR TYPE STPO-STLNR,
STLKN TYPE STPO-STLKN,
STPOZ TYPE STPO-STPOZ,
IDNRK TYPE STPO-IDNRK,
MENGE TYPE STPO-MENGE,
MEINS TYPE STPO-MEINS,
END OF TY_STPO.
DATA : IT_MAST TYPE TABLE OF TY_MAST,
WA_MAST TYPE TY_MAST,
IT_STKO TYPE TABLE OF TY_STKO,
WA_STKO TYPE TY_STKO,
IT_STPO TYPE TABLE OF TY_STPO,
WA_STPO TYPE TY_STPO.
DATA : lt_fieldcat TYPE slis_t_fieldcat_alv,
ls_layout TYPE slis_layout_alv,
ls_event TYPE slis_alv_event,
lt_event TYPE slis_t_event,
it_sortinfo type slis_t_sortinfo_alv,
ls_header TYPE slis_listheader,
lt_header TYPE slis_t_listHEADER.
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
SELECT-OPTIONS : S_MATNR FOR MAST-MATNR.
START-OF-SELECTION.
PERFORM GET_DATA.
PERFORM BUILD_FIELDCAT USING LT_FIELDCAT.
PERFORM BUILD_LAYOUT.
END-OF-SELECTION.
PERFORM DISPLAY_DATA.
*& Form GET_DATA
text
--> p1 text
<-- p2 text
form GET_DATA .
REFRESH : IT_MAST.
SELECT MATNR
WERKS
STLAN
STLNR
FROM MAST
INTO CORRESPONDING FIELDS OF TABLE IT_MAST
WHERE MATNR IN S_MATNR.
endform. " GET_DATA
*& Form BUILD_FIELDCAT
text
--> p1 text
<-- p2 text
form BUILD_FIELDCAT USING LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA : L_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
REFRESH : LT_FIELDCAT.
L_FIELDCAT-COL_POS = 1.
L_FIELDCAT-FIELDNAME = 'MATNR'.
L_FIELDCAT-TABNAME = 'IT_MAST'.
L_FIELDCAT-REF_FIELDNAME = 'MATNR'.
L_FIELDCAT-REF_TABNAME = 'MAST'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 2.
L_FIELDCAT-FIELDNAME = 'WERKS'.
L_FIELDCAT-TABNAME = 'IT_MAST'.
L_FIELDCAT-REF_FIELDNAME = 'WERKS'.
L_FIELDCAT-REF_TABNAME = 'MAST'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 3.
L_FIELDCAT-FIELDNAME = 'STLNR'.
L_FIELDCAT-TABNAME = 'IT_MAST'.
L_FIELDCAT-REF_FIELDNAME = 'STLNR'.
L_FIELDCAT-REF_TABNAME = 'MAST'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
endform. " BUILD_FIELDCAT
*& Form BUILD_LAYOUT
text
--> p1 text
<-- p2 text
form BUILD_LAYOUT .
CLEAR LS_LAYOUT.
LS_LAYOUT-BOX_FIELDNAME = 'CHECK_BOX'.
LS_LAYOUT-BOX_TABNAME = 'IT_MAST'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_DATA
text
--> p1 text
<-- p2 text
form DISPLAY_DATA .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_STRUCTURE_NAME =
IS_LAYOUT = LS_LAYOUT
IT_FIELDCAT = LT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = IT_MAST
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. " DISPLAY_DATA
FORM PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'YSTATUS' OF PROGRAM SY-REPID
EXCLUDING RT_EXTAB.
ENDFORM.
FORM USER_COMMAND USING RF_UCOMM TYPE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
CASE RF_UCOMM.
WHEN '&NEXT'.
PERFORM GET_DATA_BOM .
PERFORM BUILD_FIELDCAT_BOM USING LT_FIELDCAT.
PERFORM BUILD_LAYOUT_BOM.
PERFORM DISPLAY_DATA_BOM.
ENDCASE.
ENDFORM.
*& Form GET_DATA_BOM
text
--> p1 text
<-- p2 text
form GET_DATA_BOM .
CLEAR : WA_STPO,
WA_MAST.
REFRESH : IT_STPO.
DATA : IT_CHECK TYPE TABLE OF TY_MAST.
LOOP AT IT_MAST INTO WA_MAST.
IF WA_MAST-CHECK_BOX EQ 'X'.
APPEND WA_MAST TO IT_CHECK.
ENDIF.
ENDLOOP.
SELECT STLTY
STLNR
STLKN
VGKNT
IDNRK
MENGE
MEINS
FROM STPO
INTO CORRESPONDING FIELDS OF TABLE IT_STPO
FOR ALL ENTRIES IN IT_CHECK
WHERE IDNRK EQ IT_CHECK-MATNR.
CLEAR WA_STPO.
LOOP AT IT_STPO INTO WA_STPO.
SELECT SINGLE * FROM MAST WHERE MATNR EQ WA_STPO-IDNRK.
IF SY-SUBRC = 0.
WA_STPO-LIGHTS = '2'.
ELSE.
WA_STPO-LIGHTS = '1'.
ENDIF.
MODIFY IT_STPO FROM WA_STPO.
ENDLOOP.
endform. " GET_DATA_BOM
*& Form BUILD_FIELDCAT_BOM
text
--> p1 text
<-- p2 text
form BUILD_FIELDCAT_BOM USING LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA : L_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
REFRESH : LT_FIELDCAT.
L_FIELDCAT-COL_POS = 1.
L_FIELDCAT-FIELDNAME = 'STLTY'.
L_FIELDCAT-TABNAME = 'IT_STPO'.
L_FIELDCAT-REF_FIELDNAME = 'STLTY'.
L_FIELDCAT-REF_TABNAME = 'STPO'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 2.
L_FIELDCAT-FIELDNAME = 'STLNR'.
L_FIELDCAT-TABNAME = 'IT_STPO'.
L_FIELDCAT-REF_FIELDNAME = 'STLNR'.
L_FIELDCAT-REF_TABNAME = 'STPO'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 3.
L_FIELDCAT-FIELDNAME = 'STLKN'.
L_FIELDCAT-TABNAME = 'IT_STPO'.
L_FIELDCAT-REF_FIELDNAME = 'STLKN'.
L_FIELDCAT-REF_TABNAME = 'STPO'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 4.
L_FIELDCAT-FIELDNAME = 'IDNRK'.
L_FIELDCAT-TABNAME = 'IT_STPO'.
L_FIELDCAT-REF_FIELDNAME = 'IDNRK'.
L_FIELDCAT-REF_TABNAME = 'STPO'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 5.
L_FIELDCAT-FIELDNAME = 'MENGE'.
L_FIELDCAT-TABNAME = 'IT_STPO'.
L_FIELDCAT-REF_FIELDNAME = 'MENGE'.
L_FIELDCAT-REF_TABNAME = 'STPO'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
endform. " BUILD_FIELDCAT_BOM
*& Form BUILD_LAYOUT_BOM
text
--> p1 text
*<-- p2 text
form BUILD_LAYOUT_BOM .
CLEAR : LS_LAYOUT.
LS_LAYOUT-LIGHTS_FIELDNAME = 'LIGHTS'.
LS_LAYOUT-LIGHTS_TABNAME = 'IT_STPO'.
endform. " BUILD_LAYOUT_BOM
*& Form DISPLAY_DATA_BOM
text
--> p1 text
<-- p2 text
form DISPLAY_DATA_BOM .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND_BOM'
I_CALLBACK_TOP_OF_PAGE = 'TOP9'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = 'ALV_BACKGROUND'
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = LS_LAYOUT
IT_FIELDCAT = LT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = IT_STPO
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. " DISPLAY_DATA_BOM
FORM TOP9 .
CLEAR LS_HEADER.
REFRESH LT_HEADER.
LS_HEADER-TYP = 'H'.
LS_HEADER-INFO = 'BILL OF MATERIALS'.
APPEND LS_HEADER TO LT_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = LT_HEADER
I_LOGO = 'ENJOYSAP_LOGO'
I_END_OF_LIST_GRID =
ENDFORM.
FORM USER_COMMAND_BOM USING RF_UCOMM_BOM LIKE SY-UCOMM
SEL_FIELD TYPE SLIS_SELFIELD.
CASE RF_UCOMM_BOM.
WHEN '&IC1'.
SET PARAMETER ID 'MAT' FIELD WA_STPO-IDNRK.
SET PARAMETER ID 'WRK' FIELD WA_MAST-WERKS.
SET PARAMETER ID 'CSA' FIELD WA_MAST-STLAN.
CALL TRANSACTION 'CS03' AND SKIP FIRST SCREEN.
ENDCASE.[/code] -
Average value for a Date Field in an OO Alv Grid.
Hi Abapers.
I've been searching for some info about averages in OO Alv grid lists but cannot find an answer to what I'm really need. The question is that, for getting an average, a 'C' value must be set in the field DO_SUM of the fieldcatalog structure for a field.
Now, the problem is that I need the average of a date field (in 'normal' date format). I've tried it several times and read a lot of things but cannot find a real answer: Could it be done the average of a date field (e.g. for dates 01.05.2009, 02.05.2009 and 03.05.2009 the average is 02.05.2009).
Best Regards.Hi,
It will come along with the standard tool bar.For number fields, you can see it(Mean).
Maybe you are looking for
-
My iPod Touch will not play through external speakers when it is docked. It only plays through it's internal speaker. All the other functions on the iPod can be controlled by the external speakers (volume,track, etc). How do I fix this?
-
[dataTable] fixed header and scrollable content all-in-one
Hi folks, In your opinion, how can I use CSS like here (see [http://www.imaputz.com/cssStuff/bigFourVersion.html] or [http://web.tampabay.rr.com/bmerkey/examples/nonscroll-table-header.html]) in a "h:dataTable", to have a fixed header? Have you a qui
-
IProcurement Customization Non-Catalogue Request
Hello, We are looking to have information on how to create a customization on the Non-Catalogue Request Form so it has the category filled by default. Please let me know if someone has done this before and how to achieve it or where to look for docum
-
User exit Shipping point determination
Hi, Shipping point determination based on item category/loading group/site. User exit is USER_EXIT_SOURCE_DETERMINATION Any suggestion will be wellcomed Thanks
-
Hide and Show Tabs in Tab Canvas
hiiii i have created a tab form with about 9 Tabs ... and i have a menue that will be used to show and hide these tabs .... the problem that its not working probably --> the second tab is always appears the others change probably ... am using the SET