Creating a simple ALV report based on join condition
Dear All
SAP Version: ECC6 EHP7
I wan to create simple ALV report based on join condition. can anyone provide me the complete steps to create this report.
Regards,
Hi Syed,
Please check the link,
ALV report - Joining 2 tables
Regards,
Prakash.
Similar Messages
-
Authorization of alv report based on plants
I have created a new alv report for sale order statement.The problem is which can be seen in all plants
irespective of the user.Suppose our company has 5 palnt
Plant 1100 to 1500
The problem is suppose a user he has only rights in a prticular plant but he can see all the palnt sale order details
How can we authorize this particular alv report based on the plantsHello,
My assumption: You have Company Code(T001-BUKRS) in the selection-screen.
Plz check the code snippet below:
DATA:
IT_PLANT TYPE STANDARD TABLE OF WERKS,
WA_PLANT LIKE LINE OF IT_PLANT.
DATA:
IT_R_WERKS TYPE RANGE_T_WERKS_D,
R_WERKS TYPE RANGE_S_WERKS_D.
SELECT BWKEY INTO TABLE IT_PLANT
FROM T001K
WHERE BUKRS = '1000'. "--> Here you have to use your sel. scr. parameter
IF SY-SUBRC = 0.
SORT IT_PLANT BY WERKS.
ENDIF.
LOOP AT IT_PLANT INTO WA_PLANT.
* Check the authority for the plant
AUTHORITY-CHECK OBJECT 'M_MSEG_WMB'
ID 'ACTVT' FIELD '03'
ID 'WERKS' FIELD WA_PLANT-WERKS.
IF SY-SUBRC = 0.
R_WERKS-SIGN = 'I'.
R_WERKS-OPTION = 'EQ'.
R_WERKS-LOW = WA_PLANT-WERKS.
APPEND R_WERKS TO IT_R_WERKS.
CLEAR R_WERKS.
ENDIF.
ENDLOOP.
IF IT_R_WERKS IS NOT INITIAL.
"Select data using the Plants for which user is authorised
ELSE.
"User has no authority to display any Plant data
ENDIF.
Hope this is of some help to you.
BR,
Suhas
Edited by: Suhas Saha on Mar 18, 2009 10:18 AM -
Creating a Form with Report based on View
Hi All,
I wanted to create a form with report based on two tables so:
1. I created a view (called COMBO) based on two tables
2. I then created a form with report based on the view
Everything seemed fine thus far until I tried to edit existing records - I got the error:
ORA-20505: Error in DML: p_rowid=2002082600001172, p_alt_rowid=REPATRIATION_ID, p_rowid2=, p_alt_rowid2=. ORA-01776: cannot modify more than one base table through a join view
Unable to process row of table COMBO.NB: REPATRIATION_ID is the primary key of the Repatriation table. The other table is Applicant.
& when I tried to create a new record - I got the error:
ORA-01776: cannot modify more than one base table through a join view
Unable to process row of table COMBO.Someone please enlighten me!
Kind Regards
Kamo
Edited by: Kamo on 2009/03/12 2:33 AMHello Kamo,
You need to create an 'instead of' (update/insert/delete) trigger on your view to process the inserts etc into the 'real' tables.
Greetings,
Roel
http://roelhartman.blogspot.com/
You can reward this reply by marking it as either Helpful or Correct ;-) -
A simple ALV report using classes & methods ...
i want a simple ALV report using classes & methods ...
my requirement : i have to use classes & methods instead of calling a function module to display in grid or list format.
plz send me with explanation ASAP...it's very urgent..
Thanks in advance .Hi
Please refer
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
U can use methods for vreating ALVs.
There is a method named set_table_for_first_display in OOP Concepts.
Use this Object Oriented Approach for ALV Creation
Calling the method set_table_for_first_display
CALL METHOD cust_alv->set_table_for_first_display
EXPORTING
is_layout = gst_layout
CHANGING
it_outtab = gt_list
it_fieldcatalog = gt_fcat
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.
Object Creation and all
Creation of Object for Container
CREATE OBJECT cust_container
EXPORTING
container_name = 'ALV_CONTAINER'
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.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Creation of Object for ALV Grid
CREATE OBJECT cust_alv
EXPORTING
i_parent = cust_container
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Layout settings
gst_layout-zebra ='X'.
gst_layout-cwidth_opt = 'X'.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_BUFFER_ACTIVE =
I_STRUCTURE_NAME = 'ZCS_INACTV_CUST'
I_CLIENT_NEVER_DISPLAY = 'X'
I_BYPASSING_BUFFER =
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Calling the method set_table_for_first_display
CALL METHOD cust_alv->set_table_for_first_display
EXPORTING
is_layout = gst_layout
CHANGING
it_outtab = gt_list
it_fieldcatalog = gt_fcat
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.
For object oriented concepts refer this link https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b6cae890-0201-0010-ef8b-f970a9c41d47
Reaward if helpful -
Create a Procedural ALV Report with editable fields and save the changes
Hi,
I am new to ABAP. I have created a Procedural ALV Report with 3 fields. I want to make 2 fields editable. When executed, if the fields are modified, I want to save the changes. All this I want to do without using OO concepts. Please help . Also, I checked out the forum and also the examples
BCALV_TEST_GRID_EDIT_01
BCALV_TEST_GRID_EDIT_02
BCALV_TEST_GRID_EDIT_04_FORMS
BCALV_TEST_GRID_EDITABLE
BCALV_EDIT_01
BCALV_EDIT_02
BCALV_EDIT_03
BCALV_EDIT_04
BCALV_EDIT_05
BCALV_EDIT_06
BCALV_EDIT_07
BCALV_EDIT_08
BCALV_FULLSCREEN_GRID_EDIT
But all these are using OO Concepts.
Please help.
Regards,
SmruthiTABLES: ekko.
TYPE-POOLS: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
line_color(4) TYPE c, "Used to store row color attributes
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-edit = 'X'
fieldcatalog-col_pos = 5.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-datatype = 'CURR'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
FORM build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
gd_layout-info_fieldname = 'LINE_COLOR'.
ENDFORM. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
FORM display_alv_report.
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_pf_status_set = 'STATUS'
i_callback_top_of_page = 'TOP-OF-PAGE'
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
IT_EVENTS = GT_XEVENTS
i_save = 'X'
is_variant = z_template
TABLES
t_outtab = it_ekko
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
DATA: ld_color(1) TYPE c.
SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekko.
LOOP AT it_ekko INTO wa_ekko.
ld_color = ld_color + 1.
IF ld_color = 8.
ld_color = 1.
ENDIF.
CONCATENATE 'C' ld_color '10' INTO wa_ekko-line_color.
MODIFY it_ekko FROM wa_ekko.
ENDLOOP.
ENDFORM. " DATA_RETRIEVAL
FORM top-of-page *
FORM top-of-page.
WRITE:/ 'This is First Line of the Page'.
ENDFORM.
FORM status *
FORM status USING rt_extab TYPE slis_t_extab. .
SET PF-STATUS 'ALV'.
ENDFORM.
FORM USER_COMMAND *
--> RF_UCOMM *
--> RS *
FORM user_command USING rf_ucomm LIKE sy-ucomm
rs TYPE slis_selfield.
DATA ref1 TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref1.
CALL METHOD ref1->check_changed_data.
CASE rf_ucomm.
when 'SAVE'.
get all the modified entries and store them in an internal table and udpate them in to the required transaction or your custom table.
endcase.
endform.
ENDFORM.
here u need to 2 performs for PF status and USER_COMMAND in the ALV parameters.
create a custom PF status and create push buttons and assign your ok codes in your PF status.
if the field has to be edited in the ALV then pass EDIT = 'X' for that field in the fieldcatlog preparation.
Hope this will help you.
Regards,
phani. -
Example of a Simple ALV Report using Function Modules (not OO)
Hi,
I am new to ABAP. Where can I get a proper Example of a Simple ALV Report using Function Modules? I searched the forum but did not find a proper solution. Kindly help.
Smruthi.
Edited by: Smruthi Acharya on Jan 29, 2009 7:13 PMHi,
Use this demo code:-
REPORT z_alv01 MESSAGE-ID zmsg.
* TABLES
TABLES : ekpo.
* TYPE POOLS
TYPE-POOLS : slis.
* TYPE DECLARATION
TYPES : BEGIN OF t_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
matnr TYPE ekpo-matnr,
werks TYPE ekpo-werks,
menge TYPE ekpo-menge,
END OF t_ekpo.
* PARAMETERS
PARAMETERS : s_var TYPE disvariant-variant.
* DATA DECLARATION
*VARIABLES
DATA : check(1),
rep_id TYPE sy-repid.
*INTERNAL TABLE TYPE OF ZEKPO
DATA : it_ekpo TYPE STANDARD TABLE OF t_ekpo WITH HEADER LINE.
*FIELD CATALOG
DATA : it_field TYPE slis_t_fieldcat_alv,
wa_field TYPE slis_fieldcat_alv.
*SORTING
DATA : it_sort TYPE slis_t_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv.
*FOR TOP OF THE PAGE
DATA : it_top TYPE slis_t_listheader,
wa_top TYPE slis_listheader.
*FOR END OF THE PAGE
DATA : it_end TYPE slis_t_listheader,
wa_end TYPE slis_listheader.
*TO CAPTURE EVENTS AND HANDLE
DATA : it_event TYPE slis_t_event,
wa_event TYPE slis_alv_event.
*FOR GRID TITLE
DATA : wa_title TYPE lvc_title.
*FOR LAYOUT
DATA : wa_layout TYPE slis_layout_alv.
*FOR EXCLUDING STANDARD BUTTON FROM ALV TOOLBAR
DATA : it_exclude TYPE slis_t_extab,
wa_exclude TYPE slis_extab.
*FOR VARIANT
DATA : wa_variant TYPE disvariant.
* INITIALIZATION
INITIALIZATION.
check = 'X'.
rep_id = sy-repid.
wa_variant-report = sy-repid.
*GET DEFUALT ON THE SELECTION SCREEN FOR DEFAULT DISPLAY
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = 'A'
CHANGING
cs_variant = wa_variant
EXCEPTIONS
wrong_input = 1
not_found = 2
program_error = 3
OTHERS = 4.
IF sy-subrc = 0. " IF DEFAULT VARIANT FOUND
s_var = wa_variant-variant. " PASS THE DEFAULT VARIANT TO THE SELECTION SCREEN FIELD
ENDIF.
* AT-SELECTION SCREEN ON VALUE REQUEST
* TO GET THE F4 HELP FOR VARIANT
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_var.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = wa_variant
* I_TABNAME_HEADER =
* I_TABNAME_ITEM =
* IT_DEFAULT_FIELDCAT =
i_save = 'A'
* I_DISPLAY_VIA_GRID = ' '
IMPORTING
* E_EXIT =
es_variant = wa_variant
EXCEPTIONS
not_found = 1
program_error = 2
OTHERS = 3.
IF sy-subrc = 0.
s_var = wa_variant-variant. " PASS THE SELECTED VARIANT TO THE SELECTION SCREEN FIELD
ENDIF.
* AT-SELECTION SCREEN
* TO CHECK THE EXISTENCE FOR VARIANT
AT SELECTION-SCREEN.
wa_variant-variant = s_var.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = 'A'
CHANGING
cs_variant = wa_variant
EXCEPTIONS
wrong_input = 1
not_found = 2
program_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE w001.
ENDIF.
* START OF SELECTION
START-OF-SELECTION.
SELECT ebeln
ebelp
matnr
werks
menge
FROM ekpo
INTO TABLE it_ekpo.
* FIELD CATALOG
wa_field-fieldname = 'EBELN'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 10.
wa_field-seltext_l = 'PO #'.
APPEND wa_field TO it_field.
CLEAR wa_field.
wa_field-fieldname = 'EBELP'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 10.
wa_field-seltext_l = 'Line Item'.
APPEND wa_field TO it_field.
CLEAR wa_field.
wa_field-fieldname = 'MATNR'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 15.
wa_field-seltext_l = 'Material'.
* wa_field-input = check.
* wa_field-edit = check.
APPEND wa_field TO it_field.
CLEAR wa_field.
wa_field-fieldname = 'WERKS'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 6.
wa_field-seltext_l = 'Plant'.
* wa_field-input = check.
* wa_field-edit = check.
APPEND wa_field TO it_field.
CLEAR wa_field.
wa_field-fieldname = 'MENGE'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 10.
wa_field-seltext_l = 'Qty.'.
* wa_field-input = check.
* wa_field-edit = check.
wa_field-do_sum = check.
APPEND wa_field TO it_field.
CLEAR wa_field.
* SORT W.R.T. PURCHASE ORDER NUMBER
wa_sort-spos = 1.
wa_sort-fieldname = 'EBELN'.
wa_sort-tabname = 'IT_EKPO'.
wa_sort-up = check.
wa_sort-subtot = check.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
* FOR GRID TITLE
wa_title = 'Hello'.
* FOR LAYOUT
wa_layout-zebra = check.
* FOR EXCLUDING STANDARD BUTTONS FROM ALV TOOLBAR
wa_exclude-fcode = '&OUP'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
wa_exclude-fcode = '&ODN'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
wa_exclude-fcode = '&OAD'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
* wa_exclude-fcode = '&AVE'.
* APPEND wa_exclude TO it_exclude.
* CLEAR wa_exclude.
wa_exclude-fcode = '&INFO'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
* POPULATE ALL EVENTS INTO INTERNAL TABLE
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_event
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 it_event INTO wa_event WITH KEY name = 'END_OF_LIST'.
wa_event-form = 'END'.
MODIFY it_event FROM wa_event INDEX sy-tabix.
CLEAR wa_event.
* DISPLAY RECORDS IN ALV GRID
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = rep_id
* i_callback_pf_status_set = 'PF'
i_callback_user_command = 'COMMAND'
i_callback_top_of_page = 'TOP'
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
i_grid_title = wa_title
* I_GRID_SETTINGS =
is_layout = wa_layout
it_fieldcat = it_field
it_excluding = it_exclude
* IT_SPECIAL_GROUPS =
it_sort = it_sort
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
i_save = 'A'
is_variant = wa_variant
it_events = it_event
* 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
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_ekpo
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
*& Form top
* TO WRITE THE HEADER
FORM top.
REFRESH it_top.
wa_top-typ = 'S'.
wa_top-key = text-001.
wa_top-info = rep_id.
APPEND wa_top TO it_top.
CLEAR wa_top.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_top
* I_LOGO =
* I_END_OF_LIST_GRID =
* I_ALV_FORM =
ENDFORM. "top
*& Form end
* TO WRITE THE FOOTER
FORM end.
REFRESH it_end.
wa_end-typ = 'S'.
wa_end-key = text-001.
wa_end-info = rep_id.
APPEND wa_end TO it_end.
CLEAR wa_end.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_end
* I_LOGO =
* I_END_OF_LIST_GRID =
* I_ALV_FORM =
ENDFORM. "end
*& Form pf
* FOR PF-STATUS WITH USER DEFINED BUTTONS
* -->RT_EXTAB text
FORM pf USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZTG_PF_ALV'.
ENDFORM. "pf
*& Form command
* TO HANDLE USER ACTIONS AGAINST PF-STATUS
* -->UCOMM text
* -->SELFIELD text
FORM command USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
DATA : ok_code TYPE sy-ucomm.
ok_code = ucomm.
CASE ok_code.
WHEN 'T_DOWN'.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'HELLO'
txt1 = 'USER COMMAND'
txt2 = 'TOTAL DOWN'.
WHEN 'DOWN'.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'HELLO'
txt1 = 'USER COMMAND'
txt2 = 'DOWN'.
WHEN 'UP'.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'HELLO'
txt1 = 'USER COMMAND'
txt2 = 'UP'.
WHEN 'T_UP'.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'HELLO'
txt1 = 'USER COMMAND'
txt2 = 'TOTAL UP'.
ENDCASE.
ENDFORM. "command
Hope this helps you.
Thanks & Regards,
Tarun Gambhir -
How to create an interactive alv report in which some parameters
hi all,
i want to create an interactive alv report in which some parameters in selection screen
& when fill those & press f8 then an alv list display will show & when user double click on
any row then those contents get shown in header details of module pool program which call by
tcode mentioned in same alv .And same an interactive alv report used for change & display.
please help me give me some code same as required above.
ketan
abap consultant.
Edited by: ketan pande on Feb 14, 2009 6:09 AMHi Ketan,
Please find Sample Code.
TYPE-POOLS:slis.
DATA:
w_carrid TYPE scarr-carrid,
it_fieldcat TYPE slis_t_fieldcat_alv,
fs_fieldcat LIKE LINE OF it_fieldcat,
it_eventcat TYPE slis_t_event,
fs_eventcat LIKE LINE OF it_fieldcat.
DATA:
t_spfli LIKE STANDARD TABLE OF spfli,
fs_spfli LIKE LINE OF t_spfli,
t_sflight LIKE STANDARD TABLE OF sflight,
fs_sflight LIKE LINE OF t_sflight.
SELECT-OPTIONS:
s_carrid FOR w_carrid.
START-OF-SELECTION.
SELECT * FROM spfli INTO TABLE t_spfli WHERE carrid IN s_carrid.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'PICK'
i_structure_name = 'SPFLI'
TABLES
t_outtab = t_spfli
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*& Form PICK
FORM pick USING command LIKE sy-ucomm
selfield TYPE slis_selfield.
READ TABLE t_spfli INTO fs_spfli INDEX selfield-tabindex.
CASE command.
WHEN '&IC1'.
SELECT * FROM sflight
INTO TABLE t_sflight
WHERE carrid = fs_spfli-carrid
and connid = fs_spfli-connid.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
I_INTERNAL_TABNAME =
i_structure_name = 'SFLIGHT'
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = it_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
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 = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
IS_LAYOUT =
it_fieldcat = it_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = it_eventcat
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
IR_SALV_LIST_ADAPTER =
IT_EXCEPT_QINFO =
I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = t_sflight
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.
ENDCASE.
ENDFORM. "pick
Hope this will Be Helpful
Thanks
Kalyan -
Different between coding of simple ALV report and interactive ALV report
Hi
Please some one tell me the difference (extra coding) for interactive ALV report.
I know how to design simple ALV report but i dont know what extra I hace to code for interactive ALV report.
Thanks in advance.View at se38, ALV grid demos, search BCALGRID
-
How to secure access of Report based on a condition
Hello Experts,
My project requirement is to secure BW Reports based on a condition. For e.g a user should be authorized to access the Report if:
1. He is the WBS Manager of the selected WBS Element
OR
2. If he is authorized to access the Profit center Hierarchy Node which is the parent of the selected WBS Element.
I think this may be achieved by using a Customer exit in the Analysis authorization but i don't know how.
Do you have any idea, whether it is possible to achieve in BI7 Security Model? Any help will be highly appreciated.
Thanks
RajatHi Tomer,
There will be a selection variable for WBS in all BW reports. If the user selects a particular WBS Element then he can only see the result of the report if he fulfill EITHER of the following conditions:
1. If he is the WBS Manager of the selected WBS Element
OR
2. If he is authorized to access the Profit center Hierarchy Node which is the parent of the selected WBS Element.
WBS managers will keep on changing so it is not possible to maintain the users in one role.
Secondly, according to the second condition, even if the user is not WBS Manager but he is authorized to access Profit center Hierarchy Node, which is the parent of the selected WBS Element, he should view the report.
Please let me know if don't understand the question.
Thanks
Rajat -
Subtotal in alv report based on the particular field value
Hi,
As per my requirement, i need to do subtotal of quntity field based on the material number field value in alv report.
Ex: if material number falls 1 to 10 then i need to be calculate and display subtotal qty amount with text " total of the mat1" and if material number falls 11 to 20 then again i need to be claculate and display subtotal qty amount with text "total of the mat2". similarily i need to display the details.
<removed_by_moderator>
Regards
NagendraHi,
Ex: if material number falls 1 to 10 then i need to be calculate and display subtotal qty amount with text " total of the mat1" and if material number falls 11 to 20 then again i need to be claculate and display subtotal qty amount with text "total of the mat2". similarily i need to display the details.
What you can do is in your output table, you will have to create an auxilary field, lets call it as material group (groupid). Now you can do a subtotal on the material group. However the logic to determine what materials belong to which group should be coded. I guess you might be having some logic for that.
So lets say that material 1 to 10 as G1 ( group 1 ) and material 11 to 20 as G2 ( group 2 )
The output of the internal table would be
Groupid matnr ...
1 1
1 2
1 3.....and so on
2 11
2 12
2 13....upto 20.
Now in the fieldcatalog assign an 'X' to the 'dosum' parameter to the field Groupid
In the sort info do the following :
gs_sort-fieldname = 'GROUPID'.
gs_sort-spos = 1.
gs_sort-up = 'X'.
gs_sort-subtot = 'X'. ***CRUCIAL STATEMENT****
append gs_sort to gt_sort.
Now pass all this data to the alv grid function. And you are done.
regards,
Advait -
Regarding the simple ALV report
Hi All,
I created the simple code for disply of the alv report the code is provided below,but the output is showing only the column heading not the data in the grid, i won't came to know where the problem is please find the problem in the code.
Regards
Sai
********sample code**********
type-pools : slis.
data : b_display type slis_t_fieldcat_alv,
w_display type slis_fieldcat_alv.
data : begin of itab_display occurs 0,
kunnr type kna1-kunnr,
name1 type kna1-name1,
end of itab_display.
data : gd_repid like sy-repid.
itab_display-name1 = 'ram'.
itab_display-kunnr = '10000033242'.
append itab_display.
clear itab_display.
itab_display-name1 = 'sai'.
itab_display-kunnr = '10000033243'.
append itab_display.
clear itab_display.
w_display-col_pos = 0.
w_display-fieldname = 'name1'.
w_display-seltext_m = 'name'.
append w_display to b_display.
clear w_display.
w_display-col_pos = 1.
w_display-fieldname = 'kunnr'.
w_display-seltext_m = 'cus.no'.
append w_display to b_display.
clear w_display.
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = gd_repid
IT_FIELDCAT = b_display[]
I_SAVE = 'X'
TABLES
t_outtab = itab_display.Hi,
Please use the following code.
type-pools : slis.
data : b_display type slis_t_fieldcat_alv,
w_display type slis_fieldcat_alv.
data : begin of itab_display occurs 0,
kunnr type kna1-kunnr,
name1 type kna1-name1,
end of itab_display.
data : gd_repid like sy-repid.
itab_display-name1 = 'ram'.
itab_display-kunnr = '10000033242'.
append itab_display.
clear itab_display.
itab_display-name1 = 'sai'.
itab_display-kunnr = '10000033243'.
append itab_display.
clear itab_display.
w_display-col_pos = 0.
w_display-fieldname = 'NAME1'.
w_display-tabname = ITAB_DISPLAY.
w_display-seltext_m = 'Name'.
w_display-ddictxt = 'M'.
append w_display to B_DISPLAY.
w_display-col_pos = 1.
w_display-fieldname = 'KUNNR'.
w_display-tabname = ITAB_DISPLAY.
w_display-seltext_m = 'cus.no'.
w_display-ddictxt = 'M'.
append w_display to B_DISPLAY.
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = gd_repid
IT_FIELDCAT = b_display[]
I_SAVE = 'X'
TABLES
t_outtab = itab_display[].
Regards,
Sankar. -
How to create Status in ALV reports?
Hi experts,
I need to create a status in a alv report. but i am not getting how to create it. i have declared a variable type slis_formname. and appended the events with it. now how to create the status in form.answers will be rewarded.
Thanks in advance,
RamanaHello Venkat,
Copy the standard pf status of the ALV in SE41 and do the following.
DATA: IT_EVENTS TYPE SLIS_T_EVENT,
WA_EVENTS LIKE LINE OF IT_EVENTS.
REFRESH: IT_EVENTS.
CLEAR: WA_EVENTS,IT_EVENTS.
WA_EVENTS-NAME = 'PF_STATUS_SET'.
WA_EVENTS-FORM = 'STATUS'.
APPEND WA_EVENTS TO IT_EVENTS .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = IT_VARIANT-REPORT
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = IT_FIELDCAT
I_SAVE = 'A'
IS_VARIANT = IT_VARIANT
IT_SORT = IT_SORT
IT_EVENTS = IT_EVENTS
TABLES
T_OUTTAB = G_T_OUTTAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
FORM status *
FORM STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STANDARD' EXCLUDING RT_EXTAB.
ENDFORM.
If useful reward.
Vasanth -
ABAP webdynpro :Creating column in alv report
I have generated a dynamic alv report when ever unwanted columns appear i deleted column using IF_SALV_WD_COLUMN_SETTINGS~DELETE_COLUMN.
some times I want to create columns in alv .
how to do that ?code sample will be much usefull.Hi,
the same interface you used to delete has the create_column method.
IF_SALV_WD_COLUMN_SETTINGS~CREATE_COLUMN( id = 'id of the column' ).
" create the cell_editor.
data:
lr_text type ref to cl_salv_wd_uie_text_view.
create object lr_text.
lr_text->set_text_fieldname( ls_fields-fieldname ).
lr_column->set_cell_editor( lr_text ). -
Simple alv report displaying double click on that goto application
HI Experts,
i will working for that simple alv display the report . when ever user double click on that go to next scren . i will work for ECC 6.0 and function module is REUSE_ALV_LIST_DISPLAY i will write the logic is
at user-command
SET PARAMETER ID 'LIF' VALUE FVAL.
CALL TRANSACTION 'LF03' AND SKIP FIRST SCREEN.
so any body plz help me.
advance thanking u.Hi
try this code...
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = W_PROG
I_CALLBACK_USER_COMMAND = 'PICK'
I_STRUCTURE_NAME = 'EKKO'
TABLES
T_OUTTAB = T_EKKO
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*& Form pick
* -->UCOMM text
* -->SELFIELD text
FORM PICK USING COMMAND LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
READ TABLE T_EKKO INTO FS_EKKO INDEX SELFIELD-TABINDEX.
CASE COMMAND.
WHEN '&IC1'.
SET PARAMETER ID 'LIF' VALUE FS_EKKO-EBELN. "here write your field name
CALL TRANSACTION 'LF03' AND SKIP FIRST SCREEN. -
Hi everyone,
i have a requirement that
when i enter the plant number, material number, MRP element version, and range of date starting from today date till the date - it should provide the output this way.
Material leadtime Satety stock available quantity -(for the range of dates)
27/8 28/8 29/8 so on
eg.BMR168345 7 8000 1650 1350 1350 ....
on 28th there is order for 300 elements so it is 1350
It is a report based on MD04 transaction.Hello,
My assumption: You have Company Code(T001-BUKRS) in the selection-screen.
Plz check the code snippet below:
DATA:
IT_PLANT TYPE STANDARD TABLE OF WERKS,
WA_PLANT LIKE LINE OF IT_PLANT.
DATA:
IT_R_WERKS TYPE RANGE_T_WERKS_D,
R_WERKS TYPE RANGE_S_WERKS_D.
SELECT BWKEY INTO TABLE IT_PLANT
FROM T001K
WHERE BUKRS = '1000'. "--> Here you have to use your sel. scr. parameter
IF SY-SUBRC = 0.
SORT IT_PLANT BY WERKS.
ENDIF.
LOOP AT IT_PLANT INTO WA_PLANT.
* Check the authority for the plant
AUTHORITY-CHECK OBJECT 'M_MSEG_WMB'
ID 'ACTVT' FIELD '03'
ID 'WERKS' FIELD WA_PLANT-WERKS.
IF SY-SUBRC = 0.
R_WERKS-SIGN = 'I'.
R_WERKS-OPTION = 'EQ'.
R_WERKS-LOW = WA_PLANT-WERKS.
APPEND R_WERKS TO IT_R_WERKS.
CLEAR R_WERKS.
ENDIF.
ENDLOOP.
IF IT_R_WERKS IS NOT INITIAL.
"Select data using the Plants for which user is authorised
ELSE.
"User has no authority to display any Plant data
ENDIF.
Hope this is of some help to you.
BR,
Suhas
Edited by: Suhas Saha on Mar 18, 2009 10:18 AM
Maybe you are looking for
-
When editing a photo with external editor I can't open that photo in viewer
When I edit a photo in an external program like NIK Collection after I save the photo I can't open any pictures anymore in Aperture. Mosaic and grid view is no problem but in full Viewer nothing happens. When I restart Aperture I can, untill the next
-
I have a windows computer before i purchased my mac and i had already spend $500 for microsoft office professional 2010, i would ike to know if i can download the same one to my macbook air and how to do it. please need help!
-
Mozilla just stopped working with Yahoo and yahoo mail properly, any ideas?
For whatever reason yahoo apparently stopped working properly sometime in the last week. When I go to yahoo.com the site loads but I can't move the stories to the left or the right as it just shows the little loading circle going around. I also notic
-
Installing the Java-Plugin without administrative rights
I would like to find a way to allow a user without administrative rights to install the Java-Plugin for using Java-Applets. As far as I understood, the plugin can be installed in a silent way withou registry modifiactions. Is this working for users w
-
Cannot erase the middle name field in contacts?
I cannot erase the Middle Name Field in Contacts, is this a bug or is there a trick?