Apply ALV variant before export file in background task
Hi all,
I'm working on an ALV report.
As my report should deal with a great amount of data, it's sometimes running in background.
Users want the result to be sent by mail (in .CSV format so that they can use it in excel).
For now, the sending is OK but the file contains all fields of the internal table (no specific filter, no sort...).
How can i apply ALV variant (i.e keeping some of the fields, filter the list an so on) to the internal table before i build the file ?
Thanks
Salut Jérôme,
un vieux (très vieux) code que j'avais fait.
le but était d'envoyer par email le résultat d'un ALV grid.
il t'en manque une partie, mais le principal est dedans
* Procédure P_GEN_HTML. *
* Génération d'un email en HTML. *
form p_gen_html.
data : struct_zgre000_s2 type zgre000_s2 ,
v_es_layout type lvc_s_layo ,
v_e_var_save(1) ,
v_e_var_def(1) ,
m_calculate_totals(1) value 'X' ,
itab_mt_data type lvc_t_data ,
itab_mt_info type lvc_t_info ,
itab_mt_sort type lvc_t_sort ,
itab_mt_filter type lvc_t_filt ,
itab_mt_filter_i type lvc_t_fidx ,
itab_html type swl_html_t ,
m_cl_variant type ref to cl_alv_variant ,
mt_outtab type ref to data ,
object_hd_change like sood1 occurs 0 with header line,
objpara like selc occurs 0 with header line,
receivers like zbc_receivers occurs 0 with header line ,
ms_total_options type lvc_s_toto,
mt_grouplevels_filter type lvc_t_grpl ,
m_sumlevel type i ,
itab_lt_grouplevels type kkblo_t_grouplevels ,
itab_lt_sort type kkblo_t_sortinfo.
field-symbols: <lt_ct00> type standard table,
<lt_ct01> type standard table,
<lt_ct02> type standard table,
<lt_ct03> type standard table,
<lt_ct04> type standard table,
<lt_ct05> type standard table,
<lt_ct06> type standard table,
<lt_ct07> type standard table,
<lt_ct08> type standard table,
<lt_ct09> type standard table.
* Ref the field-symbols.
data mt_ct00 type ref to data .
data mt_ct01 type ref to data .
data mt_ct02 type ref to data .
data mt_ct03 type ref to data .
data mt_ct04 type ref to data .
data mt_ct05 type ref to data .
data mt_ct06 type ref to data .
data mt_ct07 type ref to data .
data mt_ct08 type ref to data .
data mt_ct09 type ref to data .
v_gjahr1 = p_gjahr + 1.
v_gjahr2 = p_gjahr + 2.
v_gjahr3 = p_gjahr + 3.
* Alimente la table ITAB_ZGRE000_S2.
loop at itab_otp_grid.
move : itab_otp_grid-astnr to struct_zgre000_s2-zdemandeur ,
itab_otp_grid-astna to struct_zgre000_s2-zdemandeurt ,
itab_otp_grid-pspn to struct_zgre000_s2-zprojet ,
itab_otp_grid-pspn2 to struct_zgre000_s2-zotp ,
itab_otp_grid-post1 to struct_zgre000_s2-zdesotp ,
itab_otp_grid-pspnr to struct_zgre000_s2-zotp2 ,
itab_otp_grid-stat to struct_zgre000_s2-zstatut ,
itab_otp_grid-usr02 to struct_zgre000_s2-zoneutil ,
itab_otp_grid-budgt to struct_zgre000_s2-zbudgettotal ,
itab_otp_grid-engag to struct_zgre000_s2-zengagtotal ,
itab_otp_grid-dispo to struct_zgre000_s2-zdispototal ,
itab_otp_grid-depen to struct_zgre000_s2-zdepentotal ,
itab_otp_grid-budgn to struct_zgre000_s2-zbudget ,
itab_otp_grid-le to struct_zgre000_s2-zlatest ,
itab_otp_grid-depea to struct_zgre000_s2-zdepense ,
itab_otp_grid-pourc to struct_zgre000_s2-zpourcen ,
itab_otp_grid-budg1 to struct_zgre000_s2-zbudget1 ,
itab_otp_grid-budg2 to struct_zgre000_s2-zbudget2 ,
itab_otp_grid-budg3 to struct_zgre000_s2-zbudget3 ,
itab_otp_grid-natur to struct_zgre000_s2-znature.
append struct_zgre000_s2 to itab_zgre000_s2.
endloop.
refresh itab_fieldcatalog.
* Alimentation de la table ITAB_FIELDCATALOG.
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'ZGRE000_S2'
i_bypassing_buffer = ' '
i_buffer_active = ' '
changing
ct_fieldcat = itab_fieldcatalog.
* Les modifications des colonnes.
loop at itab_fieldcatalog into tmp_fieldcatalog.
case tmp_fieldcatalog-fieldname.
when 'ZDEMANDEUR'.
move : ' ' to tmp_fieldcatalog-do_sum ,
'Demandeur' to tmp_fieldcatalog-scrtext_s ,
'Demandeur' to tmp_fieldcatalog-scrtext_m ,
'Demandeur' to tmp_fieldcatalog-scrtext_l ,
v_zero to tmp_fieldcatalog-no_zero ,
'10' to tmp_fieldcatalog-outputlen .
when 'ZDEMANDEURT'.
move : ' ' to tmp_fieldcatalog-do_sum ,
'Demandeur' to tmp_fieldcatalog-scrtext_s ,
'Demandeur' to tmp_fieldcatalog-scrtext_m ,
'Demandeur' to tmp_fieldcatalog-scrtext_l ,
v_zero to tmp_fieldcatalog-no_zero ,
'30' to tmp_fieldcatalog-outputlen .
when 'ZPROJET'.
move : ' ' to tmp_fieldcatalog-do_sum ,
'Projet' to tmp_fieldcatalog-scrtext_s ,
'Projet' to tmp_fieldcatalog-scrtext_m ,
'Projet' to tmp_fieldcatalog-scrtext_l ,
v_zero to tmp_fieldcatalog-no_zero ,
'10' to tmp_fieldcatalog-outputlen .
when 'ZOTP'.
move : ' ' to tmp_fieldcatalog-do_sum ,
'OTP' to tmp_fieldcatalog-scrtext_s ,
'OTP' to tmp_fieldcatalog-scrtext_m ,
'OTP' to tmp_fieldcatalog-scrtext_l ,
v_zero to tmp_fieldcatalog-no_zero ,
'20' to tmp_fieldcatalog-outputlen .
when 'ZDESOTP'.
move : ' ' to tmp_fieldcatalog-do_sum ,
'Libellé OTP' to tmp_fieldcatalog-scrtext_s ,
'Libellé OTP' to tmp_fieldcatalog-scrtext_m ,
'Libellé OTP' to tmp_fieldcatalog-scrtext_l ,
v_zero to tmp_fieldcatalog-no_zero ,
'20' to tmp_fieldcatalog-outputlen .
when 'ZOTP2'.
move : ' ' to tmp_fieldcatalog-do_sum ,
'OTP niveau 2' to tmp_fieldcatalog-scrtext_s ,
'OTP niveau 2' to tmp_fieldcatalog-scrtext_m ,
'OTP niveau 2' to tmp_fieldcatalog-scrtext_l ,
v_zero to tmp_fieldcatalog-no_zero ,
'20' to tmp_fieldcatalog-outputlen .
when 'ZSTATUT'.
move : ' ' to tmp_fieldcatalog-do_sum ,
'Statut' to tmp_fieldcatalog-scrtext_s ,
'Statut' to tmp_fieldcatalog-scrtext_m ,
'Statut' to tmp_fieldcatalog-scrtext_l ,
v_zero to tmp_fieldcatalog-no_zero ,
'10' to tmp_fieldcatalog-outputlen .
when 'ZONEUTIL'.
move : ' ' to tmp_fieldcatalog-do_sum ,
'Zone util' to tmp_fieldcatalog-scrtext_s ,
'Zone util' to tmp_fieldcatalog-scrtext_m ,
'Zone util' to tmp_fieldcatalog-scrtext_l ,
v_zero to tmp_fieldcatalog-no_zero ,
'10' to tmp_fieldcatalog-outputlen .
when 'ZNATURE'.
move : ' ' to tmp_fieldcatalog-do_sum ,
'Nature' to tmp_fieldcatalog-scrtext_s ,
'Nature' to tmp_fieldcatalog-scrtext_m ,
'Nature' to tmp_fieldcatalog-scrtext_l ,
v_zero to tmp_fieldcatalog-no_zero ,
'10' to tmp_fieldcatalog-outputlen .
when 'ZBUDGETTOTAL'.
move : 'X' to tmp_fieldcatalog-do_sum ,
'Bud. total' to tmp_fieldcatalog-scrtext_s ,
'Budget total' to tmp_fieldcatalog-scrtext_l ,
v_zero to tmp_fieldcatalog-no_zero ,
'20' to tmp_fieldcatalog-outputlen .
when 'ZENGAGTOTAL'.
move : 'X' to tmp_fieldcatalog-do_sum ,
'Eng. total' to tmp_fieldcatalog-scrtext_s ,
'Engagement total' to tmp_fieldcatalog-scrtext_l ,
v_zero to tmp_fieldcatalog-no_zero ,
'20' to tmp_fieldcatalog-outputlen .
when 'ZDISPOTOTAL'.
move : 'X' to tmp_fieldcatalog-do_sum ,
'Disp total' to tmp_fieldcatalog-scrtext_s ,
'Disponible total' to tmp_fieldcatalog-scrtext_l ,
v_zero to tmp_fieldcatalog-no_zero ,
'20' to tmp_fieldcatalog-outputlen .
when 'ZDEPENTOTAL'.
move : 'X' to tmp_fieldcatalog-do_sum ,
'Dep. total' to tmp_fieldcatalog-scrtext_s ,
v_zero to tmp_fieldcatalog-no_zero ,
'20' to tmp_fieldcatalog-outputlen .
concatenate 'Depenses totales'
p_perio
p_gjahr
into tmp_fieldcatalog-scrtext_l.
when 'ZBUDGET'.
move : 'X' to tmp_fieldcatalog-do_sum ,
v_zero to tmp_fieldcatalog-no_zero ,
'20' to tmp_fieldcatalog-outputlen .
concatenate 'Bud '
p_gjahr
into tmp_fieldcatalog-scrtext_s
separated by ' '.
concatenate 'Budget Exercice:'
p_gjahr
'Version:'
p_vers1
into tmp_fieldcatalog-scrtext_l
separated by ' '.
when 'ZLATEST'.
move : 'X' to tmp_fieldcatalog-do_sum ,
'Latest' to tmp_fieldcatalog-scrtext_s ,
v_zero to tmp_fieldcatalog-no_zero ,
'20' to tmp_fieldcatalog-outputlen .
concatenate 'Latest Exercice:'
p_gjahr
'Version:'
p_vers2
into tmp_fieldcatalog-scrtext_l
separated by ' '.
when 'ZDEPENSE'.
move : 'X' to tmp_fieldcatalog-do_sum ,
v_zero to tmp_fieldcatalog-no_zero ,
'20' to tmp_fieldcatalog-outputlen .
concatenate 'Dep'
p_gjahr
into tmp_fieldcatalog-scrtext_s
separated by ' '.
concatenate 'Depense Exercice:'
p_gjahr
into tmp_fieldcatalog-scrtext_l
separated by ' '.
when 'ZPOURCEN'.
move : ' ' to tmp_fieldcatalog-do_sum ,
'% Dep/LE' to tmp_fieldcatalog-scrtext_s ,
'Pourcentage dépense VS LE'
to tmp_fieldcatalog-scrtext_l ,
v_zero to tmp_fieldcatalog-no_zero ,
'20' to tmp_fieldcatalog-outputlen .
when 'ZBUDGET1'.
move : 'X' to tmp_fieldcatalog-do_sum ,
v_zero to tmp_fieldcatalog-no_zero ,
'20' to tmp_fieldcatalog-outputlen .
concatenate 'Bud'
v_gjahr1
into tmp_fieldcatalog-scrtext_s
separated by ' '.
concatenate 'Budget Exercice:'
v_gjahr1
into tmp_fieldcatalog-scrtext_l
separated by ' '.
when 'ZBUDGET2'.
move : 'X' to tmp_fieldcatalog-do_sum ,
v_zero to tmp_fieldcatalog-no_zero ,
'20' to tmp_fieldcatalog-outputlen .
concatenate 'Bud'
v_gjahr2
into tmp_fieldcatalog-scrtext_s
separated by ' '.
concatenate 'Budget Exercice:'
v_gjahr2
into tmp_fieldcatalog-scrtext_l
separated by ' '.
when 'ZBUDGET3'.
move : 'X' to tmp_fieldcatalog-do_sum ,
v_zero to tmp_fieldcatalog-no_zero ,
'20' to tmp_fieldcatalog-outputlen .
concatenate 'Bud'
v_gjahr3
into tmp_fieldcatalog-scrtext_s
separated by ' '.
concatenate 'Budget Exercice:'
v_gjahr3
into tmp_fieldcatalog-scrtext_l
separated by ' '.
endcase.
move 'X' to tmp_fieldcatalog-tech_comp.
modify itab_fieldcatalog from tmp_fieldcatalog.
endloop.
call function 'WS_DOWNLOAD'
EXPORTING
FILENAME =
'\RNEMS0025BU_girodf1$Desktopit_field.txt'
FILETYPE = 'DAT'
tables
data_tab = itab_fieldcatalog.
data : begin of it_tmp_data occurs 1000 ,
buff(136) ,
zbudgetttotal(20) ,
zengagtotal(20) ,
zdispottotal(20) ,
zdepentotal(20) ,
zbudget(20) ,
zlatest(20) ,
zdepense(20) ,
zpourcen(20) ,
zbudget1(20) ,
zbudget2(20) ,
zbudget3(20) ,
waers(5) ,
end of it_tmp_data.
break girodf1.
loop at itab_zgre000_s2 into struct_zgre000_s2.
move struct_zgre000_s2+0(136) to it_tmp_data-buff .
move-corresponding struct_zgre000_s2 to it_tmp_data.
append it_tmp_data.
endloop.
call function 'DOWNLOAD'
EXPORTING
* BIN_FILESIZE = ' '
* CODEPAGE = ' '
FILENAME =
'\RNEMS0025BU_girodf1$Desktopit_data.txt'
FILETYPE = 'DAT'
* ITEM = ' '
* MODE = ' '
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* FILEMASK_MASK = ' '
* FILEMASK_TEXT = ' '
* FILETYPE_NO_CHANGE = ' '
* FILEMASK_ALL = ' '
* FILETYPE_NO_SHOW = ' '
SILENT = 'S'
* COL_SELECT = ' '
* COL_SELECTMASK = ' '
* NO_AUTH_CHECK = ' '
* IMPORTING
* ACT_FILENAME =
* ACT_FILETYPE =
* FILESIZE =
* CANCEL =
tables
data_tab = it_tmp_data.
* call function 'DOWNLOAD'
* EXPORTING
* FILENAME =
*'\RNEMS0025BU_girodf1$Desktopit_data.txt'
* FILETYPE = 'ASC'
* tables
* data_tab = itab_zgre000_s2.
* Complete.
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'ZGRE000_S2'
i_bypassing_buffer = ' '
i_buffer_active = ' '
changing
ct_fieldcat = itab_fieldcatalog.
call function 'LVC_FIELDCAT_COMPLETE'
EXPORTING
* I_COMPLETE =
IS_LAYOUT = v_es_layout
I_REFRESH_BUFFER = ''
I_BUFFER_ACTIVE = ''
* IMPORTING
* E_EDIT =
changing
ct_fieldcat = itab_fieldcatalog.
call function 'LVC_SORT_COMPLETE'
exporting
it_fieldcat = itab_fieldcatalog
changing
ct_sort = itab_mt_sort.
call function 'ALV_DATA_EXPORT'
exporting
i_report = ''
IT_FIELDCAT = itab_fieldcatalog
tables
it_data = itab_zgre000_s2.
* Recherche de la variante d'affichage.
move : sy-repid to struct_variant-report ,
sy-uname to struct_variant-username ,
'2' to struct_variant-handle.
if p_vgrid ne space.
move p_vgrid to struct_variant-variant.
endif.
* Ne pas demander d'explication, merci :)
get reference of itab_zgre000_s2 into mt_outtab.
* Créé l'objet variant.
create object m_cl_variant
exporting
it_outtab = mt_outtab
it_fieldcatalog = itab_fieldcatalog
it_sort = itab_mt_sort
it_filter = itab_mt_filter
is_variant = struct_variant
is_layout = v_es_layout
i_variant_save = v_e_var_save
i_variant_default = v_e_var_def.
move : 'A' to v_e_var_save ,
'X' to v_e_var_def .
call method m_cl_variant->set_values
exporting it_outtab = mt_outtab
it_fieldcatalog = itab_fieldcatalog
it_sort = itab_mt_sort
it_filter = itab_mt_filter
is_variant = struct_variant
is_layout = v_es_layout
i_variant_save = v_e_var_save
i_variant_default = v_e_var_def.
loop at itab_fieldcatalog into tmp_fieldcatalog
where tabname ne space.
exit.
endloop.
* Recherche de la variante.
call method m_cl_variant->load_variant
exporting i_tabname = tmp_fieldcatalog-tabname
i_bypassing_buffer = 'X'
i_dialog = space.
create data mt_ct00 like itab_zgre000_s2.
create data mt_ct01 like itab_zgre000_s2.
create data mt_ct02 like itab_zgre000_s2.
create data mt_ct03 like itab_zgre000_s2.
create data mt_ct04 like itab_zgre000_s2.
create data mt_ct05 like itab_zgre000_s2.
create data mt_ct06 like itab_zgre000_s2.
create data mt_ct07 like itab_zgre000_s2.
create data mt_ct08 like itab_zgre000_s2.
create data mt_ct09 like itab_zgre000_s2.
assign mt_ct00->* to <lt_ct00>.
assign mt_ct01->* to <lt_ct01>.
assign mt_ct02->* to <lt_ct02>.
assign mt_ct03->* to <lt_ct03>.
assign mt_ct04->* to <lt_ct04>.
assign mt_ct05->* to <lt_ct05>.
assign mt_ct06->* to <lt_ct06>.
assign mt_ct07->* to <lt_ct07>.
assign mt_ct08->* to <lt_ct08>.
assign mt_ct09->* to <lt_ct09>.
* Recherche des valeurs à partir de la variante sélectionnée.
call method m_cl_variant->get_values
importing es_variant = struct_variant
et_fieldcatalog = itab_fieldcatalog
et_sort = itab_mt_sort
et_filter = itab_mt_filter
es_layout = v_es_layout
et_grouplevels_filter = mt_grouplevels_filter
e_variant_save = v_e_var_save
e_variant_default = v_e_var_def.
call function 'LVC_SORT_APPLY'
exporting
it_sort = itab_mt_sort
* I_AS_TEXT = 'X'
* I_STABLE = 'X'
tables
ct_data = itab_zgre000_s2.
call function 'LVC_TRANSFER_TO_KKBLO'
exporting
it_sort_lvc = itab_mt_sort
it_grouplevels_lvc = mt_grouplevels_filter
importing
et_sort_kkblo = itab_lt_sort
et_grouplevels_kkblo = itab_lt_grouplevels
exceptions
it_data_missing = 1
it_fieldcat_lvc_missing = 2
others = 3.
call function 'ALV_GROUPLEVELS_GET'
exporting
i_subtotals_only = 'X'
it_sort = itab_lt_sort
i_subtract_counter = 'X'
importing
et_groups = itab_lt_grouplevels
tables
t_outtab = itab_zgre000_s2.
call function 'LVC_TRANSFER_FROM_KKBLO'
exporting
it_grouplevels_kkblo = itab_lt_grouplevels
importing
et_grouplevels_lvc = mt_grouplevels_filter
exceptions
it_data_missing = 1
others = 2.
* Recupération des totaux.
call function 'LVC_TOTALS_GET'
exporting
it_sort = itab_mt_sort
is_layout = v_es_layout
it_filter_index = itab_mt_filter_i
tables
it_data = itab_zgre000_s2
et_collect00 = <lt_ct00>
et_collect01 = <lt_ct01>
et_collect02 = <lt_ct02>
et_collect03 = <lt_ct03>
et_collect04 = <lt_ct04>
et_collect05 = <lt_ct05>
et_collect06 = <lt_ct06>
et_collect07 = <lt_ct07>
et_collect08 = <lt_ct08>
et_collect09 = <lt_ct09>
changing
cs_total_options = ms_total_options
* ct_fieldcat = mt_fieldcatalog
ct_fieldcat = itab_fieldcatalog
ct_grouplevels = mt_grouplevels_filter
c_calculate_totals = m_calculate_totals
c_sumlevel = m_sumlevel .
* Converti dans un language comprehensible par SAP.
call function 'LVC_TABLE_FOR_DISPLAY'
exporting
it_fieldcat = itab_fieldcatalog
it_sort = itab_mt_sort
it_filter = itab_mt_filter
is_total_options = ms_total_options
is_layout = v_es_layout
importing
et_lvc_data = itab_mt_data
et_lvc_info = itab_mt_info
tables
it_data = itab_zgre000_s2
it_collect00 = <lt_ct00>
it_collect01 = <lt_ct01>
it_collect02 = <lt_ct02>
it_collect03 = <lt_ct03>
it_collect04 = <lt_ct04>
it_collect05 = <lt_ct05>
it_collect06 = <lt_ct06>
it_collect07 = <lt_ct07>
it_collect08 = <lt_ct08>
it_collect09 = <lt_ct09>
changing
ct_grouplevels = mt_grouplevels_filter
exceptions
fieldcat_not_complete = 1
others = 2.
if sy-subrc ne space.
write : /1 'Probleme de convertion.'.
stop.
endif.
* Convertie en HTML.
call function 'LVC_ALV_CONVERT_TO_HTML'
exporting
it_data = itab_mt_data
it_info = itab_mt_info
i_file_dialog = ' '
importing
et_html = itab_html.
* Envois par email.
move : 'HTM' to object_hd_change-file_ext ,
'Liste des commandes passées sur Immobilisation via PM'
to object_hd_change-objdes.
append object_hd_change.
call function 'WS_DOWNLOAD'
EXPORTING
FILENAME =
'\RNEMS0025BU_girodf1$Desktopmt_data.txt'
FILETYPE = 'DAT'
tables
data_tab = itab_mt_data.
call function 'WS_DOWNLOAD'
EXPORTING
FILENAME =
'\RNEMS0025BU_girodf1$Desktopmt_info.txt'
FILETYPE = 'DAT'
tables
data_tab = itab_mt_info.
data : it_var type table of disvariant with header line.
move-corresponding struct_variant to it_var.
append it_var.
call function 'WS_DOWNLOAD'
EXPORTING
FILENAME =
'\RNEMS0025BU_girodf1$Desktopit_var.txt'
FILETYPE = 'DAT'
tables
data_tab = it_var.
*stop.
* Liste des personnes à qui on envoye le email.
select bname
into receivers-uname
from usr02
where bname in s_uname.
append receivers.
endselect.
* Send mail.
call function 'Z_BC_ENVOI_EMAIL'
exporting
object_hd_change = object_hd_change
object_type = 'RAW'
owner = sy-uname
tables
objcont = itab_html
receivers = receivers
exceptions
others = 01.
endform. " P_GEN_HTML.
Similar Messages
-
Numbers pops up exporting before export file choosen
There is a bug with numbers I hoped apple would have fixed a long time ago... When you export something using the share export dialog and are in the location to choose a place to save the exported file. If you were to tab out of the app, it will popup a dialog saying exporting when it is not exporting... The only way to get out of it is if you forcequit Numbers and launch it again... Thankefully because this is lion, it saves the last changes and I just have to go back to export and not tab out of Numbers.
I'm not able to duplicate this. Here is what I tried.
Opened Numbers, which created a default blank document
File/Export
Chose Excel then clicked on Next. The "Save As" window popped up.
Then I tried each of the following
Command-Tabbed to another application then Command-Tabbed back
Command-Tabbed to another application then clicked on the Numbers Icon in the dock to get back
Clicked on an open window of another application then clicked on the Numbers icon to get back
Clicked on an open window of anotehr application then clicked on a Numbers window to get back
In none of those cases did it pop up a dialog box saying "exporting", it always went back to the same place I left off. I assume you meant "command-tab out of the app"; tab moves between fields of the "Save As" window (as it should do)
Could this be a problem related to a third-party utility? -
Data of alv report in excel file in background processing using open datas
Hi Experts,
I have developed report for purchase register . if i execute this report in background process i am not able to get the downloaded file in excel and output is also not coming properly, columns are going to overlap.
i used open dataset read dataset and close dataset but still problem is not solved. so if anyone have code with this and also which will have concatenate statement in the code send it.
Regards,
RahulHi Rahul,
Ur code shud be like below:
DATA : l_filename2 TYPE string,
v_extn.
SPLIT p_filename AT '.xls' INTO l_filename2 v_extn.
CONCATENATE l_filename2 'downloaded' INTO l_filename2 SEPARATED BY '_'.
CONCATENATE l_filename2 'txt' INTO l_filename2 SEPARATED BY '.'.
OPEN DATASET l_filename2 IN TEXT MODE FOR OUTPUT ENCODING DEFAULT.
IF sy-subrc <> 0.
MESSAGE e499(sy) WITH text-e02.
ENDIF.
LOOP AT it_order_number INTO wa_order_number.
TRANSFER wa_order_number TO l_filename2.
ENDLOOP.
CLOSE DATASET l_filename2.
Now, go to tcode AL11 and check it in the Application server itself.
Hope this helps,
Regards,
Arnab. -
Extract ALV list to a file in the background
I am currently working on an ALV report which the user requires that a file be generated automatically based on the ALV list output. Any ideas? Thanks in advance.
Hello Emmanuel,
I have had the same problem, and i found no solution on the forums... So i have implemented my own solution: I implemented a child class, in order to add a new method write_file. This coding creates a file on the application server, considering the field catalog from the choosen variant. It can be enhanced in order to get the sort and the filter criteria (but if the file is exported to excel, the sort and filter can be managed within excel). Such a program can be run in background, and it works perfectly!
Sample coding:
REPORT z_alv_download_file.
CLASS LCL_GUI_ALV_GRID INHERITING FRO
Local child-class in order to implement a new method for *
download in a file in background *
CLASS lcl_gui_alv_grid DEFINITION INHERITING FROM cl_gui_alv_grid.
PUBLIC SECTION.
METHODS: write_file IMPORTING i_structure_name TYPE dd02l-tabname
is_variant TYPE disvariant
i_default TYPE char01
i_save TYPE char01
i_file TYPE fileextern
CHANGING it_outtab TYPE STANDARD TABLE.
ENDCLASS.
CLASS lcl_gui_alv_grid IMPLEMENTATION
Implementation of the new method write_file *
CLASS lcl_gui_alv_grid IMPLEMENTATION.
METHOD write_file.
Local types
TYPES: BEGIN OF ty_fieldnames,
field(60),
field2 TYPE help_info-tabname,
field3 TYPE help_info-fieldname,
key(1),
END OF ty_fieldnames.
Local data
DATA: lt_catalog TYPE lvc_t_fcat,
ls_catalog TYPE lvc_s_fcat,
lt_datatab TYPE TABLE OF hrdatatab,
ls_datatab TYPE hrdatatab,
lt_fieldnames TYPE TABLE OF ty_fieldnames,
ls_fieldnames TYPE ty_fieldnames,
ls_record TYPE string,
l_field(60) TYPE c,
l_nbcol TYPE i,
l_colpos TYPE i,
l_colpos_c(2) TYPE c,
l_fieldname(21) TYPE c VALUE 'ls_datatab-langtext '.
FIELD-SYMBOLS <f> TYPE ANY.
Call the grid display
CALL METHOD me->set_table_for_first_display
EXPORTING i_structure_name = i_structure_name
is_variant = is_variant
i_default = i_default
i_save = i_save
CHANGING it_outtab = it_outtab.
Get the field catalog according to the display variant which is used
CALL METHOD me->get_frontend_fieldcatalog
IMPORTING et_fieldcatalog = lt_catalog.
Get an internal table with only the fields from the field catalog
CALL FUNCTION 'ALV_CONVERT_DATA'
EXPORTING
alv_fieldcat = lt_catalog
TABLES
alv_datatab = it_outtab
hr_datatab = lt_datatab
hr_fieldnametab = lt_fieldnames.
Keep only the displayed fields from the field catalog
DELETE lt_catalog WHERE no_out = 'X'.
SORT lt_catalog BY col_pos DESCENDING.
READ TABLE lt_catalog INTO ls_catalog INDEX 1.
IF sy-subrc = 0.
CLEAR ls_record.
l_nbcol = ls_catalog-col_pos.
Open the file
OPEN DATASET i_file FOR OUTPUT IN TEXT MODE.
Write the column names
LOOP AT lt_fieldnames INTO ls_fieldnames.
CONDENSE ls_fieldnames-field.
CONCATENATE ls_record ls_fieldnames-field
INTO ls_record SEPARATED BY ';'.
ENDLOOP.
SHIFT ls_record.
TRANSFER ls_record TO i_file.
Write the lines
LOOP AT lt_datatab INTO ls_datatab.
CLEAR: l_colpos,
ls_record.
Condense the fields in a single string, separated by ';' (csv)
DO l_nbcol TIMES.
ADD 1 TO l_colpos.
CLEAR l_colpos_c.
l_colpos_c = l_colpos.
CONDENSE l_colpos_c.
l_fieldname+19(2) = l_colpos_c.
ASSIGN (l_fieldname) TO <f>.
WRITE <f> TO l_field.
CONDENSE l_field.
CONCATENATE ls_record l_field INTO ls_record SEPARATED BY ';'.
ENDDO.
SHIFT ls_record.
TRANSFER ls_record TO i_file.
ENDLOOP.
Close the file
CLOSE DATASET i_file.
ENDIF.
ENDMETHOD.
ENDCLASS.
MAIN PROGRAM
DATA: wo_alv TYPE REF TO lcl_gui_alv_grid,
wt_sflight TYPE TABLE OF sflight,
ws_variant TYPE disvariant.
PARAMETERS: p_file TYPE fileextern OBLIGATORY
DEFAULT '/usr/sap/.../file.csv',
p_vari TYPE slis_vari
DEFAULT 'DEFAULT'.
START-OF-SELECTION.
ws_variant-report = sy-repid.
ws_variant-username = sy-uname.
ws_variant-variant = p_vari.
SELECT * FROM sflight INTO TABLE wt_sflight.
CREATE OBJECT wo_alv EXPORTING i_parent = cl_gui_container=>screen0.
CALL METHOD wo_alv->write_file
EXPORTING i_structure_name = 'SFLIGHT'
is_variant = ws_variant
i_default = 'X'
i_save = 'A'
i_file = p_file
CHANGING it_outtab = wt_sflight. -
Retain background jobs and its variants before system refresh activity
Hello All,
I am going to perform system refresh activity on quaity system on monday. Customer wants to retain the background jobs and its variants in the quality system. Please guide me and let me know the steps to retain the background jobs and its variants before starting the system refresh activity.
Regards
SubbuDear Subbu,
You have to export the TBT* Tables to retain the jobs. You can do this with R3trans:
1. Make Export file
2. Make Import file
3. Make Export in Q System before Systemcopy
4. Start Database and not SAP
5. Make Import in Q after Systemcopy
6. Start sap
1. Make Export file /tmp/export_cmd
export
file='/tmp/export_Q.dmp'
client=<your client>
delete from TBTCA
delete from TBTCB
delete from TBTCCNTXT
delete from TBTCCTXTT
delete from TBTCCTXTTP
delete from TBTCI
delete from TBTCJCNTXT
delete from TBTCJSTEP
delete from TBTCO
delete from TBTCO_V01
delete from TBTCP
delete from TBTCPV
delete from TBTCR
delete from TBTCS
delete from TBTC_SPOOLID
delete from BTCEVTJOB
select * from TBTCA
select * from TBTCB
select * from TBTCCNTXT
select * from TBTCCTXTT
select * from TBTCCTXTTP
select * from TBTCI
select * from TBTCJCNTXT
select * from TBTCJSTEP
select * from TBTCO
select * from TBTCO_V01
select * from TBTCP
select * from TBTCPV
select * from TBTCR
select * from TBTCS
select * from TBTC_SPOOLID
select * from BTCEVTJOB
2. Make Import file /tmp/import_cmd
import
file='/tmp/export_Q.dmp'
3. Make Export in Q System before Systemcopy
R3trans -w /tmp/Q_export.log /tmp/export_cmd
4. Start Database and not SAP
sqlplus "/as sysdba"
SQL> startup
or
startsap
stopsap r3
5. Make Import in Q after Systemcopy
R3trans -w /tmp/Q_import.log /tmp/import_cmd
If you want to undo this, start the export script in P system and the Import script in Q system.
Don't be afraid of the delete statement but without delete it doesn't work!
6. Start sap
startsap
Best regards
Willi Eimler -
Runtime Error during export ALV Grid to Local File and Print Priview
Hi all,
While Exporting ALV grid to local file using menu List->export->local file , I m getting following runtime error,
Field Symbol has not yet been assigned.
Details of Errors:
Program : SAPLKKBL
Include : LKKBLF99
Module Type : (FORM)
module name : GEN_FIELD_OUT2
So. pls Suggest any good solution.
Thanks & Regards,
Sandip Sonar.hi
this is happening just because you might have declared that your ALV list should have a checkbox, but defined no field as "checkbox" into your internal table.
and one more thing to check up is that before you call the REUSE_ALV_GRID_DISPLAY, you need to fill a few parameters for instance is_layout. This one has a field box_fieldname, in which you have to enter the name of the field of the internal table that will store the 'X' as and when the checkbox is checked.
hope this helps
regards
Aakash Banga -
I just updated to 5.7 and the exported files are blurry. I compared the ones I exported before the change and they are fine. I have not change any settings.
I don't understand your last paragraph.
"The home page also has a full bar ..." What does "full bar" mean? " ... instead of the tray it had before." What does "tray" mean?
Anyway, you might try Settings > General > Reset > Reset Home Screen Layout
I guess that cannot make things any worse. -
Export file to PDF - where is the"background activity" in InDesign CS6?
Export file to PDF - where is the "background activity" in InDesign CS6?
i´ve been told that I can solve the problem by clicking in to "background activity", but I cant even find it? Where is it?
I have never ever had this problem, and I cant do my work now.
Thank you!jaisy wrote:
i´ve been told that I can solve the problem...
I have never ever had this problem...
It would be easier to help if we actually knew what the problem is. -
Exporting Local File in background
Hi,
I want to export a flat file in background mode. I am currently using WS_DOWNLOAD but this doesn't work in background. What I think is that I will save it in UNIX directory. Can you please give some sample codes for this? or if there's still a way using WS_DOWNLOAD to do this in background?
I appreciate your response.
Thanks!Use the transaction CG3Z to upload your file into application server.
Then you can use
open dataset.
transfer dataset.
close dataset.
commands to access that file from application server. -
Is there an app out there to find the files within Imovie app on my Ipad where the Imovie "preview" is playing from?
I deleted the original vidoe clips from my Camera Roll before exporting the Imovie to Youtube because my camera roll was out of memory.
I'm using the latest Imovie app for Ipad.
Cheers
shoestringladyiPad Photo Recovery: How to Recover Deleted Photos
http://www.iskysoft.com/iphone-data-recovery-mac/ipad-photo-recovery.html
How to Restore Lost or Deleted Files from iPad
http://www.iphone-ipad-recovery.com/recover-ipad-mini-files.html
How to Recover Deleted Files from iPad
http://www.kvisoft.com/tutorials/recover-deleted-files-from-ipad.html
iSkysoft Free iPhone Data Recovery
http://www.iskysoft.com/iphone-data-recovery/
Recover iPhone/iPad/iPod touch lost data, Free.
Free recover iPhone/iPad/iPod touch lost contacts, photos, videos, notes, call logs and more
Recover data directly from iPhone or from iTunes backup
Preview and recover lost iOS data with original quality
Wondershare Dr.Fone for iOS
http://www.wondershare.net/data-recovery/iphone-data-recovery.html?gclid=CJT7i9e 6gb4CFcvm7AodbUEAJQ
Recover contacts, messages, photos, videos, notes, call history, calendars, voicemail, voice memos, reminders, bookmarks and other documents.
Cheers, Tom -
Hi all,
I m displaying records using ALV Grid , I want to export that ALV Grid to Local File ,
using Menu->List->Export->Local File.
I m able to export it in spreadsheet using option List-> Export->Spreadsheet, but while exporting to local file i m getting short dump with error *Field Symbol Has not yet been Assigned*.
Pls, Suggest any good Solution.
Thanks & Regards ,
Sandip Sonar.hi,,,,
In your output are there any empty Columns, Because field Symbol Not assigned generally occurs if any one of your Internal table column is Blank, Just remove that Blank Column and then try it.
Thanks
Saurabh -
How to find number of columns used in a ALV variant
I need to know how many column is active ( will be shown in the ALV report ) related to a specific ALV Variant.
Example :
The structure of my internal table has 147 columns.
The user in a specific ALV variant has chosen 25 columns of those 147 colums, so I need to know that this ALV variant will show 25 columns.
Thanks! JoHi Max,
Thanks for hints.
Finnally I did the verification at the beginning of my process.
Because I need the information before getting the data, so I called the METHOD with a "dummy" table,
and I received the info of what I need, the number of column related to a specific ALV Variant.
I used :
ls_variant-report = sy-repid.
ls_variant-variant = p_alvvar. "<<< Select-option field for AVL Variant
ls_variant-log_group = 'L01'.
CALL METHOD lo_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'MY_STRUCTURE'
is_variant = ls_variant
is_layout = ls_layout
i_save = 'A'
i_default = 'X'
I_BYPASSING_BUFFER = 'X'
CHANGING
it_fieldcatalog = LT_FIELDCATALOG
it_outtab = lt_dummy[].
CALL METHOD lo_grid1->GET_FRONTEND_FIELDCATALOG
IMPORTING
ET_FIELDCATALOG = LT_FIELDCATALOG.
loop at LT_FIELDCATALOG into ls_FIELDCATALOG where no_out = space.
add 1 to LV_NB_COLUMNS.
endloop.
Jo -
Hi Everyone,
I have a question which I cannot see being asked in the forum yet.
I'd like to override the standard behaviour of exporting files to the target system by loading an once exported file again if the POV has not been validated since the last target data load. This is to speed up batch loading (we load 1500 POVs every night to Essbase). As such I need to overwrite the name of the export files as they are not unique and file names may be used more than one time for different POVs.
Is there any way to do this in an action script? I can see that strFile occurs as a parameter in the function calls for BefExportToDat, ActExport etc. I was not able to find an API function for this purpose yet and manipulating tPOVPartition.PartLastExpFile for the location was not doing the trick as this entry is overriden in the background after export.
Thanks in advance.
Regards,
HaukeWayne,
Thank you for your answer. You lead me into the right direction. Obviously, something was going horribly wrong when I tested the manipulated export script for the first time. This caused FDM to overwrite export files during batch and made me believe that the file names are not uniquely exported for all POVs.
For anyone interested, FDM is keeping the export filenames unique for all POVs as long as historical export data files exist in the Outbox folder. When you clear the Outbox folder, file names are reused in different POVs during export. You may query the last file which was exported for any POV in the tDataArchive table in FDM.
I am querying this table instead of tLogActivity now and move the file which was exported last for the respective POV and the filename has not been reused by another POV (due to clearing Outbox) afterwards to the filename which is created by FDM before exporting. This is speeding up the export batch to run in one fourth of the time compared to the original export behaviour as the database is not queried for all these files.
Best regards,
Hauke -
Hi,
I'm having a serious issue with your brend new Cisco Prime Network Control System (NCS) and i would appreciate if someone could give me good answers.
After a background backup task failure, the database was entirelly corrupted and the oracle server no longuer wanted to start. And because of that the NCS web server is unusable, since no one can log in.
We tryed to restore to last known backup obtained after a former suucessful backup. But we get this error:
"ERROR: invalid backup file version. Exception: Error while unzipping invalid wcs 7.x export file"
All the lost data was previously migrated from the former WCS 7.x server. Before this issue everything was working fine.
So we think that the appliance is seeing the backup file from NCS as a WCS backup.
We need to find rapidly a solution. Here is our configuration:
We formerly had WCS 7.0.172.0 hosted on Microsoft Windows Server 2003 SP2 with the above caracteristics:
Intel(R)Xeon(R) CPU 5120 @ 1.86Ghz 1.87Ghz 16GB of RAM.
We now have NCS Version 1.1.1.24 running under Cisco Application Deployment Engine
OS Release: 2.0
ADE-OS Build Version: 2.0.1.038
ADE-OS System Architecture: x86_64I was getting this error too. TL;DR: When you transfer the wcs.zip file to your FTP server, make sure you are using BINARY mode... which is often NOT the default FTP mode.
Long Version:
TO GET THIS ERROR, what I had done was use the Windows CLI FTP command to transfer my "wcs.zip" to the NCS FTP server.
-----BEGIN WRONG STEPS-----
C:\ftp
ftp> open x.x.x.x
Connected to x.x.x.x.
220 Service ready for new user
User (x.x.x.x:(none)): ftp-user
331 User name okay, need password for ftp-user
Password:
230 User logged in, proceed
ftp> put wcs.zip
200 Command PORT okay
150 File status okay; about to open data connection
226 Closing data connection
ftp: 526768949 bytes sent blah blah etc
-----END WRONG STEPS-----
I would then run "ncs stop" and "ncs migrate" and get the "ERROR: invalid backup file version. Exception: Error while unzipping invalid wcs 7.x export file".
I remembered something from my misspent youth: Windows, for no good reason, likes to transfer files in ASCII mode. UNIX (which LINUX comes from) prefers BINARY, and the two do not like to negotiate.
TO FIX THIS, I had to just FTP in Binary mode.
-----BEGIN RIGHT STEPS-----
C:\ftp
ftp> open x.x.x.x
Connected to x.x.x.x.
220 Service ready for new user
User (x.x.x.x:(none)): ftp-user
331 User name okay, need password for ftp-user
Password:
230 User logged in, proceed
ftp> binary
200 Command TYPE okay
ftp> put wcs.zip
200 Command PORT okay
150 File status okay; about to open data connection
226 Closing data connection
ftp: 526768949 bytes sent blah blah etc
-----END RIGHT STEPS-----
NOW when I enter "ncs stop" (actually... had to restart them... then stop them... x.x) and then the proper "ncs migrate" commands, I get a happy output and don't have to go home late troubleshooting this.
" Stage 1 of 5: Decompressing backup ...
-- complete.
Stage 2 of 5: Restoring Support Files ...
: Restoring the Domain Maps ...
: -- complete.
: Restoring the License files ...
: -- complete.
-- complete.
Stage 3 of 5: Restoring Data ...
I hope this helps anyone banging their head against the WCS->PI1.3 install wall.
(Note, WCS needs to be migrated to NCS 1.1.1.24 (NOT NCS 1.1.3!!!!!) before you can migrate to Prime Infrastructure 1.2 or 1.3, because for no readily apparent reason the "ncs migrate" command was removed from PI 1.2 and up. Also note, there is no "Prime Infrastructure 1.1;" they just renamed NCS to Prime Infrastructure after NCS 1.1 because. Yes, the sentence ends there. Great products, all 3, just... agonizing to migrate.) -
Rework exported file and what's with catalogs?
OK ... let's see if I can explain what I've done. I was working with a RAW file and then exported it as a jpeg of fairly low resolution. This file was worked on more than a month ago. Although I removed the folder within which the exported file was ... I copied that to an external hard disk. When I re-imported the original RAW file I was working on ... there is no history associated with it. I assume I have to reload the catalog that was created when I worked on the raw file the first time around ... is that correct? So, when I did ... there was still no history.
I have the low res jpeg file ... but I want the original RAW file as it was just before I exported it. How can I recover that? With the original raw file and the appropriate catalog?
I'd like to go into the history just before I exported the last time ... and export once more at higher resolution.
I hope this isn't too confusing!
Thanks much and I hope you can help.Pairodox wrote:
If I 'remove' a folder from the left column in 'library' am I removing the record of these keystrokes?
Yes, if you remove a folder (and its photos) from Lightroom, you are deleting the history of edits that you made, and also deleting any metadata applied to the photo. As I said, you do NOT want to do this. Once you import a photo into Lightroom, you keep it imported in Lightroom; you do not delete it (or its folder) from Lightroom.
I have been doing this and keepking archival copies of images on an external hard drive. I have not wanted to clutter my computer.
Used properly, Lightroom does not clutter your computer.
And in the future, how can I retain these histories without actually having the RAW files on my computer ... I would rather have them archivally stored on an external hard drive?
Don't put the RAW photos on the internal drive in the first place. When you import from your camera, put the RAW photos on the external HD. Not only is this fewer steps, but it meets your goal of keeping the RAW photos on the external HD.
but I've got 6 months of edits that I'm getting the feeling are gone ... not to be recovered.
Yes, you definitely need to make backups of BOTH your catalog file and photos, to a different hard disk than where the original is stored.
If you double-click on the existing backup catalog files, you may find the edit history of your photos. In which case, you might need to reconnect the photos in this backup catalog via this method: http://www.computer-darkroom.com/lr2_find_folder/find-folder.htm
Maybe you are looking for
-
Alv display for the 2nd time.
Hi everybody I have created a interactive alv report. when i am going for first display it is giving correct result whne i go for 2nd time it is not initilizing the grids the records are displayed twice or same record is displayed. i have check BCA
-
Problem In Creating DC In NWDS
Hi, I'm using NWDI for creating a portal application. I've created SC, DOMAIN, TRACK and imported the componets in NWDS. But when i'm going to create a DC from the Inactive DC view of <b>Development Configuration</b> perspective. it is not allowing m
-
Apps using larger font in my new iPhone 6
I just received my iPhone 6 this morning and I've noticed all my apps are opening in a larger more pixelated font. I tried resetting the phone but it's still in this large ugly font. what can I do to change it back to the correct font
-
i have a panel which is bigger than the main window's size. i want to add it onto the ScrollPane. but the scrollbar is not working. how do i refresh the scrollbar so that the scrollbar comes when the JPanel is attached onto it.
-
Do i need to drop index even when i drop data in data target
Hi , I am having a PC and i am dropping entire data in my data target. do i still need to add drop index to my process chain. Can any one tell me what extactly happens if i drop data in a data targets and what happend if i drop the index? which ta