Using REUSE_ALV_GRID_DISPLAY
hi folks,
question: how can i use the function REUSE_ALV_GRID_DISPLAY twice in one project?
scenario: i've alv1 and doubleclick in one cell. now should open the alv2 with more info. to the field.
both callings are in one mainprogram.
if i use REUSE_ALV_LIST_DISPLAY - it works, using REUSE_ALV_GRID_DISPLAY doesnt work.
any ideas?
regards thomas
Hi,
This can be done,
CALL SCREEN 9000.
In PAI u will call the REUSE_ALV_GRID_DISPLAY for the dispaly.
When u double click on the cell, in the double click event CALL SCREEN XXXX.
eg.----
CLASS LCL_EVENT_RECEIVER DEFINITION
CLASS LCL_EVENT_RECEIVER DEFINITION.
Event receiver definitions for ALV actions
PUBLIC SECTION.
CLASS-METHODS:
Row Double click for dirll down.
HANDLE_DOUBLE_CLICK
FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW
E_COLUMN
ES_ROW_NO.
ENDCLASS.
CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
*& Method handle_double_click
This method is called when the user double clicks on a line to drill
down.
The following are exported from the ALV
LVC_S_ROW
LVC_S_COL
LVC_S_ROID
METHOD HANDLE_DOUBLE_CLICK.
The double click drill down processing should be
coded in the form below.
PERFORM F9007_HANDLE_DOUBLE_CLICK USING E_ROW
E_COLUMN
ES_ROW_NO.
ENDMETHOD.
ENDCLASS.
In the perform call the next screen u need to display.
In XXXX screen PAI call REUSE_ALV_GRID_DISPLAY and display the second grid.
I have tried the same for set_grid_for_first_display so hope so u will get.
Try this out.
Thanks & Regards,
Judith.
Message was edited by: Judith Jessie Selvi
Similar Messages
-
ALV Grid Excel in Place using REUSE_ALV_GRID_DISPLAY
I have a ALV grid displayed in a report and i have a bunch of layouts created by various users and the layouts works fine when selected. But when I use 'Excel' (excel-in-place) button to export the grid into an excel sheet, the order of the columns are all jumbled up and not in sync with the ALV grid layout on the screen. However, when I use export to local file>excel option, the order of columns are in sync with the layout. Can any one explain why this is happening and how I can fix it ? Is there any OSS note or something that I need to apply ?
PS : I am using REUSE_ALV_GRID_DISPLAY to display the report and I am building the fieldcatalog manually
Eg :
CLEAR r_fieldcatalog.
MOVE 'TB_OUTPUT' TO r_fieldcatalog-tabname.
MOVE 'BUKRS' TO r_fieldcatalog-fieldname.
MOVE 'VBAK' TO r_fieldcatalog-ref_tabname.
MOVE 'BUKRS_VF' TO r_fieldcatalog-ref_fieldname.
MOVE text-f01 TO r_fieldcatalog-seltext_s.
MOVE text-f01 TO r_fieldcatalog-seltext_m.
MOVE text-f01 TO r_fieldcatalog-seltext_l.
add '1' to lv_col_pos .
move lv_col_pos to r_fieldcatalog-col_pos .
APPEND r_fieldcatalog TO tc_fieldcatalog.
CLEAR r_fieldcatalog.
MOVE 'TB_OUTPUT' TO r_fieldcatalog-tabname.
MOVE 'VKORG' TO r_fieldcatalog-fieldname.
MOVE 'VBAK' TO r_fieldcatalog-ref_tabname.
MOVE 'VKORG' TO r_fieldcatalog-ref_fieldname.
MOVE text-f02 TO r_fieldcatalog-seltext_s.
MOVE text-f02 TO r_fieldcatalog-seltext_m.
MOVE text-f02 TO r_fieldcatalog-seltext_l.
add '1' to lv_col_pos .
move lv_col_pos to r_fieldcatalog-col_pos .
APPEND r_fieldcatalog TO tc_fieldcatalog.
Thanks in advance,
ShareenCALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_pf_status_set = 'ALV_PF_STATUS'
i_callback_program = sy-repid
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
i_default = ' '
i_save = g_save
TABLES
t_outtab = it_tab
EXCEPTIONS
program_error = 1
OTHERS = 2.
and beneath this just put a form.as its shown.
FORM alv_pf_status USING l_alv_excl TYPE STANDARD TABLE.
SET PF-STATUS 'STANDARD_FULLSCREEN' "excluding lt_extab
OF PROGRAM 'SAPLSETB'.
ENDFORM. "alv_pf_status -
ALV toolbar excel icon using REUSE_ALV_GRID_DISPLAY
Hi!
Ive created an ALV with using REUSE_ALV_GRID_DISPLAY. In ALV out put on toolbar Ive excel, sort default icons.
If I sort my ALV on some column and press excel icon one row has got deleted and some column I dont get data in rows (where my rows are more than 20).
If anyone know any SAP not or patch or has faced this problem before please let me know on priority basis.
Please find below SAP support pack info. We are running on ECC6.0.
Software component Release Level Highest Suppost Package Short description of softwar componenet
SAP_BASIS 700 13 SAPKB70013 SAP Basis Component
SAP_ABA 700 13 SAPKA70013 Cross-Application Component
PI_BASIS 2006_1_700 2 SAPKIPYM02 Basis Plug-In (PI_BASIS) 2006_1_700
ST-PI 2005_1_700 5 SAPKITLQI5 SAP Solution Tools Plug-In
SAP_BW 700 15 SAPKW70015 SAP NetWeaver BI 7.0
SAP_AP 700 11 SAPKNA7011 SAP Application Platform
SAP_APPL 600 11 SAPKH60011 Logistics and Accounting
SAP_HR 600 22 SAPKE60022 Human Resources
EA-IPPE 400 11 SAPKGPID11 SAP iPPE
EA-APPL 600 11 SAPKGPAD11 SAP Enterprise Extension PLM, SCM, Financials
EA-DFPS 600 11 SAPKGPDD11 SAP Enterprise Extension Defense Forces & Public Security
EA-FINSERV 600 11 SAPKGPFD11 SAP Enterprise Extension Financial Services
EA-GLTRADE 600 11 SAPKGPGD11 SAP Enterprise Extension Global Trade
EA-HR 600 22 SAPKGPHD22 SAP Enterprise Extension HR
EA-PS 600 11 SAPKGPPD11 SAP Enterprise Extension Public Services
EA-RETAIL 600 11 SAPKGPRD11 SAP Enterprise Extension Retail
FINBASIS 600 11 SAPK-60011INFINBASIS Fin. Basis
MDM_TECH 555_700 4 SAPK-57004INMDMTECH MDM_TECH 555 : Add-On Installation
ECC-DIMP 600 11 SAPK-60011INECCDIMP DIMP
ERECRUIT 600 11 SAPK-60011INERECRUIT E-Recruiting
FI-CA 600 11 SAPK-60011INFICA FI-CA
FI-CAX 600 11 SAPK-60011INFICAX FI-CA Extended
INSURANCE 600 11 SAPK-60011ININSURANC SAP Insurance
IS-CWM 600 11 SAPK-60011INISCWM Industry Solution Catch Weight Management
LSOFE 600 11 SAPK-60011INLSOFE SAP Learning Solution Front-End
IS-UT 600 11 SAPK-60011INISUT SAP Utilities/Telecommunication
IS-PS-CA 600 11 SAPK-60011INISPSCA IS-PUBLIC SECTOR CONTRACT ACCOUNTING
IS-OIL 600 11 SAPK-60011INISOIL IS-OIL
SEM-BW 600 11 SAPKGS6011 SEM-BW: Strategic Enterprise Management
IS-M 600 11 SAPK-60011INISM SAP MEDIA
IS-H 600 11 SAPK-60011INISH SAP Healthcare
ST-A/PI 01J_ECC600 0 - Application Servicetools for ECC 600
Warm Regards
NKMuse grid display instead of list display
in grid you have an icon which display the data in excel-sheet
Regards
Phani -
ALV using REUSE_ALV_GRID_DISPLAY question
Folks,
I am use REUSE_ALV_GRID_DISPLAY for ALV report. I have customized
the tool bar to have 3 to 4 columns as editable. In the FORM USER_COMMAND
of ALV, at SAVE, you can check the field name and update your internal table and report the changes. No problem....
Please note, I AM NOT using OO here. Just the regular Grid_display.
But if I change contents of all the 4 cells in a row, how can I capture all together and save these changes back to my internal table? Any thoughts?
-Thanks...RajThanks Chandrasekhar. That works like a charm.
Can I ask you one more question related to the user-command.
1) I run the report.
2) I make changes to certain fields and save.
3) Report displays updated rows
4) I can add more rows etc.
When I click on the back button, it should take me to the selection screen. Instead, it goes one screen back at a time navigating through all the screen changes.
Have you come across this?
Thanks, Rajesh -
Is it possible to add tooltip when using REUSE_ALV_GRID_DISPLAY
All,
Is it possible to add tool-tip when using REUSE_ALV_GRID_DISPLAY. I am using
i_fieldcat_alv TYPE slis_t_fieldcat_alv.
slis_t_fieldcat_alv does not have a tool tip option.
Your earlier response is much appreciated.
Regards
KasiLooks like it is NOT possible to add our own text for tooltip when using REUSE_ALV_GRID_DISPLAY.
See attached thread
Re: quickinfo in ALV -
How to do Field Grouping using REUSE_ALV_GRID_DISPLAY?
Hi,
I am using REUSE_ALV_GRID_DISPLAY to display my result.
how do i do the field grouping as print screen below?(T-Code: ME5A)
[img]http://img388.imageshack.us/img388/451/me5atv4.jpg[/img]HI ,
Please check the following link.
Need help with SCHECK routine in RFFOUS_C(it produces an extra page!) -
Button in alv grid cell using REUSE_ALV_GRID_DISPLAY
Hi all,
I want to make the contents of 2 columns of my alv grid as push button with values as text on it. I am not using classes or methods but alv grid fm. On clicking the button one dialog box has to pop up which gives edit option for the values in that coloumn, my question is how to introduce button in alv grid cell? if i can use t_fieldcatalog-icon, then please give me the complete steps for that.
Thanks.this may helps u
u need to copy stadard screen elemetn to MARATAB1(at PF -STATUS)
You should copy the 'STANDARD' GUI status from program <b>SAPLSLVC_FULLSCREEN</b>
type this one in SE41 program name is:<b>SAPLSLVC_FULLSCREEN</b>
status : <b>STANDARD_FULLSCREEN</b>
and copy it ...
Type-pool
type-pools slis.
Tables
tables: mara,sscrfields.
Selection screen
select-options: s_matnr for mara-matnr.
PARAMETERS: p_email TYPE somlreci1-receiver.
TYPES: BEGIN OF t_charmara,
matnr(18) TYPE c, " Material Number
ernam(12) TYPE c, " Person Credited
aenam(12) TYPE c, " Person Changed Object
pstat(15) TYPE c, " Maintenance Status
END OF t_charmara.
Data Declarations
data: rt_extab type slis_t_extab, " Table of inactive function
codes
wa_charmara TYPE t_charmara, " work area of mara Table
fs_fieldcat type slis_t_fieldcat_alv,
" Field catalog with field
descriptions
t_fieldcat like line of fs_fieldcat,
" Table of Field catalog
r_ucomm like sy-ucomm, " User Command
rs_selfield TYPE slis_selfield. " cursor position ALV
data: filedlayout type slis_layout_alv,
heading type slis_t_listheader with header line,
t_event type slis_t_event.
data: fs_event like line of t_event.
data: fs_sort type slis_sortinfo_alv,
t_sort type slis_t_sortinfo_alv.
data: w_char(200) type c,
w_matnr type mara-matnr.
fs_sort-fieldname = 'MATNR'.
fs_sort-up = 'X'.
fs_sort-group = '*'.
append fs_sort to t_sort.
clear fS_sort.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_cnt TYPE i,
w_sent_all(1) TYPE c,
w_doc_data LIKE sodocchgi1,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
Internal Tables
data: begin of it_mara occurs 0,
matnr like mara-matnr, " Material Number
ernam like mara-ernam, " Person Credited
aenam like mara-aenam, " Person Changed Object
pstat like mara-pstat, " Maintenance Status
end of it_mara.
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
*at selection-screen on field event
AT SELECTION-SCREEN on s_matnr.
PERFORM f0100_VALIDATE_MATERIAL_NUMBER.
start-of-selection.
retrive Data from the data base table Mara
perform retrive_data_from_mara.
end-of-selection.
*Field catalog with field descriptions
perform fieldcat.
*perform top_of_page.
PERFORM EVENT_LIST.
*ALV Grid Display
perform alv_display.
Creating one Push button ENTER
perform maratab1 USING RT_EXTAB.
*& Form f0100_VALIDATE_MATERIAL_NUMBER
text
There are no interface parameters to be passed to this subroutine
FORM F0100_VALIDATE_MATERIAL_NUMBER .
select matnr " Material Number
from mara
up to 1 rows
into mara-matnr
where matnr in s_matnr.
endselect.
IF sy-subrc NE 0.
clear sscrfields-ucomm.
MESSAGE e000 WITH 'Enter valid Material number'(003).
ENDIF. " IF sy-subrc NE 0
ENDFORM. " f0100_VALIDATE_MATERIAL_NUMBER
*& Form retrive_data_from_mara
text
*There are no interface parameters to be passed to this subroutine
FORM retrive_data_from_mara .
select matnr " Material Number
ernam " Person Credited
aenam " Person Changed Object
pstat " Maintenance Status
from mara
into table It_mara
where matnr in s_matnr.
IF sy-subrc NE 0.
MESSAGE i001 WITH 'Records are not found'.
exit.
stop.
ENDIF. " IF sy-subrc NE 0
ENDFORM. " retrive_data_from_mara
*& Form fieldcat
text
*There are no interface parameters to be passed to this subroutine
FORM fieldcat .
*field catalog for MATNR
t_FIELDCAT-REF_TABNAME = 'MARA'.
t_fieldcat-fieldname = 'MATNR'.
t_fieldcat-col_pos = 1.
append t_fieldcat to fs_fieldcat.
clear t_fieldcat.
*field catalog for ERNAM
t_FIELDCAT-REF_TABNAME = 'MARA'.
t_fieldcat-fieldname = 'ERNAM'.
t_fieldcat-col_pos = 2.
append t_fieldcat to fs_fieldcat.
clear t_fieldcat.
*field catalog for AENAM
t_FIELDCAT-REF_TABNAME = 'MARA'.
t_fieldcat-fieldname = 'AENAM'.
t_fieldcat-col_pos = 3.
append t_fieldcat to fs_fieldcat.
clear t_fieldcat.
*field catalog for PSTAT
t_FIELDCAT-REF_TABNAME = 'MARA'.
t_fieldcat-fieldname = 'PSTAT'.
t_fieldcat-col_pos = 4.
append t_fieldcat to fs_fieldcat.
clear t_fieldcat.
ENDFORM. " fieldcat
*& Form EVENT_LIST
text
*There are no interface parameters to be passed to this subroutine
FORM EVENT_LIST .
fs_event-name ='TOP_OF_PAGE'.
fs_event-form = 'TOP_PAGE'.
append fs_event TO t_EVENT.
CLEAR FS_EVENT.
fs_event-name ='END_OF_PAGE'.
fs_event-form = 'END_PAGE'.
append fs_event TO t_EVENT.
CLEAR FS_EVENT.
fs_event-name ='END_OF_LIST'.
fs_event-form = 'LIST_END'.
append fs_event TO t_EVENT.
CLEAR FS_EVENT.
ENDFORM. " EVENT_LIST
*& Form alv_display
text
*There are no interface parameters to be passed to this subroutine
FORM alv_display .
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 = 'MARATAB1'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_STRUCTURE_NAME =
IS_LAYOUT =
IT_FIELDCAT = FS_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = T_SORT
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = T_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
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 = IT_MARA[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " alv_display
form TOP_PAGE.
data:tbl_listheader type slis_t_listheader,
wa_listheader type slis_listheader .
wa_listheader-typ = 'S'.
wa_listheader-info = 'Created by : Vijay Pawar'.
append wa_listheader to tbl_listheader.
wa_listheader-typ = 'S'.
concatenate ' Date ' sy-datum into
wa_listheader-info separated by space.
append wa_listheader to tbl_listheader.
wa_listheader-typ = 'S'.
concatenate ' From ' s_matnr-low ' To ' s_matnr-high into
wa_listheader-info separated by space.
append wa_listheader to tbl_listheader.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = tbl_listheader
I_LOGO =
I_END_OF_LIST_GRID =
I_ALV_FORM =
endform. " form TOP_PAGE.
form END_PAGE.
STATICS W_PAGE TYPE I .
data:tbl_listheader type slis_t_listheader,
wa_listheader type slis_listheader .
wa_listheader-typ = 'S'.
wa_listheader-info = W_PAGE.
append wa_listheader to tbl_listheader.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = tbl_listheader
I_LOGO =
I_END_OF_LIST_GRID =
I_ALV_FORM =
add 1 to w_page.
endform. " form END_PAGE.
form list_end.
data:tbl_listheader type slis_t_listheader,
wa_listheader type slis_listheader .
wa_listheader-typ = 'S'.
wa_listheader-info = '......................................Last Page'
append wa_listheader to tbl_listheader.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = tbl_listheader
I_LOGO =
I_END_OF_LIST_GRID =
I_ALV_FORM =
endform. " form list_end.
*& Form maratab1
text
-->P_RT_EXTAB text
FORM maratab1 USING P_RT_EXTAB.
SET PF-STATUS 'MARATAB1' EXCLUDING rt_extab.
ENDFORM. " maratab1
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
case r_ucomm.
when 'ENTER'.
perform bulid_xls_data_table.
PERFORM send_file_as_email_attachment
tables it_message
it_attach
using p_email "'[email protected]'
'Example .xls documnet attachment'
'XLS'
'filename'
changing gd_error
gd_reciever.
perform populate_email_message_body.
PERFORM initiate_mail_execute_program.
endcase. " case r_ucomm.
endform. " FORM user_command
perform populate_email_message_body.
PERFORM initiate_mail_execute_program.
CALL FUNCTION 'RH_START_EXCEL_WITH_DATA'
EXPORTING
DATA_FILENAME = 'MARA.XLS'
DATA_PATH_FLAG = 'W'
DATA_ENVIRONMENT =
DATA_TABLE = ITAB[]
MACRO_FILENAME =
MACRO_PATH_FLAG = 'E'
MACRO_ENVIRONMENT =
WAIT = 'X'
DELETE_FILE = 'X'
EXCEPTIONS
NO_BATCH = 1
EXCEL_NOT_INSTALLED = 2
INTERNAL_ERROR = 3
CANCELLED = 4
DOWNLOAD_ERROR = 5
NO_AUTHORITY = 6
FILE_NOT_DELETED = 7
OTHERS = 8
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
leave to list-processing.
endcase.
*& Form bulid_xls_data_table
text
*There are no interface parameters to be passed to this subroutine
FORM bulid_xls_data_table .
CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
con_tab TYPE x VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
CONCATENATE 'matnr' 'ernam' 'aenam' 'pstat'
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
LOOP AT It_mara INTO wa_charmara.
CONCATENATE wa_charmara-matnr wa_charmara-ernam
wa_charmara-aenam wa_charmara-pstat
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
ENDLOOP. " LOOP AT it_mara INTO...
ENDFORM. " bulid_xls_data_table
*& Form send_file_as_email_attachment
Send email
-->P_IT_MESSAGE text
-->P_IT_ATTACH text
-->P_P_EMAIL text
-->P_0387 text
-->P_0388 text
-->P_0389 text
-->P_0390 text
-->P_0391 text
-->P_0392 text
<--P_GD_ERROR text
<--P_GD_RECIEVER text
FORM send_file_as_email_attachment tables pit_message
pit_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = pit_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM. " send_file_as_email_attachment
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
FORM initiate_mail_execute_program.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
form populate_email_message_body.
REFRESH it_message.
it_message = 'Please find attached a list test mara records'.
APPEND it_message.
endform. "form populate_email_message_bod
rewards if it helps u -
ALV using Reuse_Alv_grid_display
Hi Abapers,
I have designed one ALV for displaying training details. There can be max 4 trainers for every course..
1. Trainer1
2. Trainer2
3. Trainer3
4. Trainer4
My requirement is that Trainer2 should be displayed only if there is a second trainer for any of the courses being displayed. I have written logic for this by setting no_out = 'X' when there is no value for trainer2 by looping my internal table..
It's working fine when there are no default layouts being set up.
But it's not working when a default layout is existing with 4 trainers.
Please help me to achieve this functionality even when there is layout..
My code: Set no_out = 'X' based on flags being used for trainers.
LOOP AT tb_data INTO wa_data.
l_count = l_count + 1.
*--Trainer 1 Details
IF l_count EQ 1.
alv_itab-reftyp = wa_data-reftyp.
alv_itab-refid = wa_data-refid.
alv_itab-refshort = wa_data-refshort.
alv_itab-refname = wa_data-refname.
*--Trainer 2 Details
ELSEIF l_count EQ 2.
alv_itab-reftyp2 = wa_data-reftyp.
alv_itab-refid2 = wa_data-refid.
alv_itab-refshort2 = wa_data-refshort.
alv_itab-refname2 = wa_data-refname.
g_flag2 = c_x.
*--Trainer 3 Details
ELSEIF l_count EQ 3.
alv_itab-reftyp3 = wa_data-reftyp.
alv_itab-refid3 = wa_data-refid.
alv_itab-refshort3 = wa_data-refshort.
alv_itab-refname3 = wa_data-refname.
g_flag3 = c_x.
*--Trainer 4 Details
ELSEIF l_count EQ 4.
alv_itab-reftyp4 = wa_data-reftyp.
alv_itab-refid4 = wa_data-refid.
alv_itab-refshort4 = wa_data-refshort.
alv_itab-refname4 = wa_data-refname.
g_flag4 = c_x.
ELSE.
EXIT.
ENDIF.
CLEAR wa_data.
ENDLOOP.
Many Thanks in Advance!!Saving the Layout can work only in the program level. so i will tell you how to do that.
First Save a Variant using TECH = ' '.
and second time save a variant using TECH = 'X' both will be availbe for you , which ever you want you can use in the output.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = it_fieldcat
it_sort = it_sort
is_layout = layout "<--pass this too
i_save = 'X' "<----pass this, this enable Save option
TABLES
t_outtab = it_data
EXCEPTIONS
program_error = 1.
Now you can see the Save layout option in the ALV output. -
Handling Enter Key in Editable ALV Grid using REUSE_ALV_GRID_DISPLAY
Hello All,
I have seen a number of threads on captioned issue and everyone of them say to create FCODE for Enter in the Screen's PF Status and then handle the event.
But the catch is when you hit Enter key in ALV Grid, it will not trigger any FCODE at all because the FCODE Enter you have created is for the screen and not for the GRID. Can anyone please let me know if SAP has given any standard utility in REUSE_ALV_GRID_DISPLAY FM for handling the Enter key event.
Thanks and regards,
MaheshHi,
Set the PF-status for OK key and use the FCODE or u can usethe dynamic ok_code generated .
Also try 'ENTE' .
Hope thishelps. -
How to read multiple lines using 'REUSE_ALV_GRID_DISPLAY'
Hi,
In ALV report the FM 'REUSE_ALV_GRID_DISPLAY' used.
EXPORTING
I_CALLBACK_PROGRAM = W_REPID
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
How to read multiple lines in the following dynamic subroutine ?
I am able to read single value through p_selfld.
Nut the requirement is to change the values in more than 1 row for a fld (edit mode)
FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM
P_SELFLD TYPE SLIS_SELFIELD.
endform
Thanks in advanceYou can get the reference by a dirty assign, but this is not offcially supported...
But if you have some limitations.
FORM user_command USING fuw_ucomm LIKE sy-ucomm
fuw_selfield TYPE slis_selfield.
FIELD-SYMBOLS: <lfs_grid> type ref to cl_gui_alv_grid,
<lfs_row> type LVC_S_ROW.
data: li_rows type lvc_t_row.
assign ('(SAPLSLVC_FULLSCREEN)GT_GRID-GRID') to <lfs_grid>.
check sy-subrc is initial.
call method <lfs_grid>->get_selected_rows
IMPORTING
et_index_rows = li_rows.
endform. "user_command -
Exception CNTL_ERROR raised when using REUSE_ALV_GRID_DISPLAY
Hi,
I would like to ask your help concerning the following issue. I have a program called ZBAL_ZSTOCK2 which uses the following FM :
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_interface_check = 'X'
i_buffer_active = space
i_callback_program = g_program
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
it_sort = gt_sort[]
i_save = 'A'
is_variant = gs_variant
it_events = gt_events[]
is_print = gs_print
IMPORTING
e_exit_caused_by_caller = g_exit_caused_by_caller
es_exit_caused_by_user = gs_exit_caused_by_user
TABLES
t_outtab = it_alv[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
It works fine when I run it in foreground.
This program is called from another program, using the statement:
SUBMIT zbal_zstock2
USING SELECTION-SET varianta
WITH SELECTION-TABLE rspar
EXPORTING LIST TO MEMORY AND RETURN.
In this last case, the program ZBAL_ZSTOC2 short dumps during of execution of FM - 'REUSE_ALV_GRID_DISPLAY', method SET_VISIBLE, with following explanation:
Error analysis
A RAISE statement in the program "CL_GUI_CONTROL================CP" raised the
exception
condition "CNTL_ERROR".
Since the exception was not intercepted by a superior
program, processing was terminated.
The line where the error is raised into method SET_VISIBLE is:
16 * check handle
17 IF ME->H_CONTROL IS INITIAL.
>>>> RAISE CNTL_ERROR.
19 ENDIF.
Do you have any idea how to avoid this short dump?
I appreciate any suggestion.
Thank you in advance,
MYou cannot use ALV GRID in background. You need to go for ALV LIST Function Module.
PLease search with ALV GRID BACKGROUND in the search field of SCN. You will get lot many posts related to this and solutions are given.
regards,
Padma -
Hi All,
I am not trying to ask a interview question here.
I have come across many links ,many programs that talk about ALV display like REUSE_ALV_GRID_DISPLAY,CL_GUI_ALV_GRID,CL_SALV_TABLE but i am not able to clearly understand why is one more advantageous than another one and in what scenarios we need to use each one.
Can somebody help me /others who need similar clarification regarding these things
Thanks
Bala DuvvuriHi
1.REUSE_ALV_GRID_DISPLAY is used for displaying alv using functional module.It is more of a procedural approach.If you have used it in any of your programs that you would know that in order to do anythng in alv like displaying header or handling any event or anything else you have to make respective function(form) and internal tables and pass that function or internal table in the respective parameters of REUSE_ALV_GRID_DISPLAY.
2.CL_GUI_ALV_GRID is the oops approach for displaying alv.In this we don't use any functional modules.Instead of this we use the concept of classes and objects.
3.CL_SALV_TABLE is the also the oops approach but more efficient and advanced as compared to the above one.It is the main class used to create the simple 2D table it create a reference variable for this class.In this there is no need to create field catalog , table def. eveything can be handled dynamically....It is preferred to use this approach for alv.
Thanks -
Hi All,
I am not trying to ask a interview question here.
I have come across many links ,many programs that talk about ALV display like REUSE_ALV_GRID_DISPLAY,CL_GUI_ALV_GRID,CL_SALV_TABLE but i am not able to clearly understand why is one more advantageous than another one and in what scenarios we need to use each one.
Can somebody help me /others who need similar clarification regarding these things
Thanks
Bala DuvvuriSorry question posted in wrong forum
Thanks
Bala Duvvuri -
Filter is not working in ALV GRID output using FM 'REUSE_ALV_GRID_DISPLAY'
Hello Experts,
I have searched SCN before posting this thread.
In my report output (by using 'REUSE_ALV_GRID_DISPLAY'), i am trying to filter values which is of type CHAR.
Unable to filter by char30 field in the report output.
Tried to filter using the following steps:
Selected the column which i want to filter-> then selected filter symbol of ALV toolbar.
Selection screen appeared where select-option of that field displayed.
Selection screen only allows user to enter 1 character.
Even though the field contains 30 characters the filed in selection screen appeared with 1char length.
This is the same for all the fields in that ALV. Please suggest how can i change the field length to original field length.In field catalog pass:
wa_alv_fieldcat-outputlen = p_len
Set p_len as 30.
'FIELD' text-001 '01' 'X' '30' 'L' -
How to use the ONF4 event in REUSE_ALV_GRID_DISPLAY?
I am able to use the methods for BUTTON_CLICK and HOTSPOT_CLICK for a report that outputs ALV Grid using REUSE_ALV_GRID_DISPLAY.
But I am not able to trigger the ONF4 event.
How to enable this?
Thanks,hi look at the code ...may be helpful for u..
TYPE-POOLS SLIS.
DATA: BEGIN OF T_OUT_FOR_F4 OCCURS 0,
BUKRS LIKE T001-BUKRS,
BUTXT LIKE T001-BUTXT,
END OF T_OUT_FOR_F4.
PARAMETERS: P_BUKRS TYPE BUKRS.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_BUKRS.
PERFORM F4_FOR_BUKRS.
*& Form F4_FOR_BUKRS
text
--> p1 text
<-- p2 text
FORM F4_FOR_BUKRS.
DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
IT_REPORT TYPE SY-REPID,
ES_SELFIELD TYPE SLIS_SELFIELD.
Get data
SELECT BUKRS BUTXT FROM T001 INTO TABLE T_OUT_FOR_F4
WHERE BUKRS = '0001' OR BUKRS = 'US01'.
Get field
IT_REPORT = SY-REPID.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = IT_REPORT
I_INTERNAL_TABNAME = 'T_OUT_FOR_F4'
I_INCLNAME = IT_REPORT
CHANGING
CT_FIELDCAT = IT_FIELDCAT[].
LOOP AT IT_FIELDCAT.
IT_FIELDCAT-KEY = SPACE.
IF IT_FIELDCAT-FIELDNAME = 'BUTXT'.
IT_FIELDCAT-KEY = 'X'.
ENDIF.
MODIFY IT_FIELDCAT.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
I_TITLE =
I_SELECTION = 'X'
I_ZEBRA = ' '
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_CHECKBOX_FIELDNAME =
I_LINEMARK_FIELDNAME =
I_SCROLL_TO_SEL_LINE = 'X'
I_TABNAME = 'T_OUT_FOR_F4'
I_STRUCTURE_NAME =
IT_FIELDCAT = IT_FIELDCAT[]
IT_EXCLUDING =
I_CALLBACK_PROGRAM =
I_CALLBACK_USER_COMMAND =
IS_PRIVATE =
IMPORTING
ES_SELFIELD = ES_SELFIELD
E_EXIT =
TABLES
T_OUTTAB = T_OUT_FOR_F4
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.
ELSE.
READ TABLE T_OUT_FOR_F4 INDEX ES_SELFIELD-TABINDEX.
P_BUKRS = T_OUT_FOR_F4-BUKRS.
ENDIF.
ENDFORM. " F4_FOR_BUKRS
Maybe you are looking for
-
How do I slice an image for a web banner and upload it to my website?
Hi there! I am trying to slice an image into a web banner to upload it as the headed to my website layout. I have previously done this before, but a few months ago my computer crashed and I lost everything. I have a new computer now (Macbook Pro runn
-
Generate PDF file in SharePoint 2013
Hi, I have a requirement to create .pdf file while one item is submitted to list/library in SharePoint 2013. It means when employee inputs his/her data and after submit one pdf file will generated with the summary/relevant data. Can any one help me t
-
Running a Mac OS 9 (Classic) on Tiger OS
Hi Guys i have a software disk that when i insert it tells me that i need to run on Mac OS 9 (Classic). but i am running Mac OS 10.4.6 on my Power Book G4. This is the final Error i keep getting: You do not have a version of Mac OS 9 installed that s
-
Yet Another Syncing Complaint (when are you going to get it right, Apple?)
I have to say, syncing my phone with itunes is the most miserably frustrating techno-process in my life at the moment. About to step out for lunch, I thought it'd be nice to grab a new audio book to accompany my sandwich and I to the park. I found a
-
Problem with connection to SQl Server ( charecter set cp1255 not found )
Hello my name is Ron , i want to connect to SQL SERVER with the microsoft driver from Java ( with jDeveloper ) . then i did the following steps: 1) i download and install the jdbc driver for Sql server on my machine ( windows XP with , JDK 1.3 ) 2) i