Report Output Data To itab.
Dear SAP Gurus,
I do have requirement to get the output data of <i>H99CWTR0</i> in to my custom report , after that i do need to apply some logic on the output data. So, Here i am using Submit.. EXPORTING list TO MEMORY , after that i used LIST_FROM_MEMORY. It is getting the output of the H99CWTR0, but not the output data. Any ideas how to get the output data into my internal tables.
The follwoing FM's i have tried .
"LIST_FROM_MEMORY;LIST_TO_TXT;LIST_TO_ASCI;WWW_HTML_FROM_LISTOBJECT" .But with all these FM's i am able to get output of the report but not the outputdata .
Many Thanks in Advance,
Raghav
SUBMIT ztest
WITH s_vbeln = p_vbeln
WITH s_posnr = p_posnr
WITH p_create = 'X'
EXPORTING LIST TO MEMORY
AND RETURN.
after that
DATA:it_list LIKE abaplist OCCURS 0.
DATA:BEGIN OF it_asc OCCURS 0,
txt(100),
END OF it_asc.
*-Get the report output from memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = it_list
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc = 0.
*-Get the report output from memory in ascii format
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = it_asc
listobject = it_list
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
LOOP AT it_asc.
IF sy-tabix > 2.
WRITE:/ it_asc-txt.
ENDIF.
ENDLOOP.
ELSE.
WRITE:/ p_vbeln, p_posnr, 'No data found for selection'.
ENDIF.
it_list will have data, so you can split and populate itab.
Thanks
vjay
Similar Messages
-
Hi Abaper,
I have a requirment to display range of date in report output . I have fixed output to 7 days.
when ever i input date range 7 days its display fine but when i input 3 days the report output date is display upto 3 is fine but in 5th to 7th column date should not display correct format.
below is my code.
date = p_date-low.
wa_date-dat = date.
APPEND wa_date TO it_date.
CLEAR wa_date.
IF date LT p_date-high.
date1 = p_date-low + 1.
wa_date-dat = date1.
APPEND wa_date TO it_date.
CLEAR wa_date.
ENDIF.
IF date1 LT p_date-high.
date2 = date1 + 1.
wa_date-dat = date2.
APPEND wa_date TO it_date.
CLEAR wa_date.
ENDIF.
IF date2 LT p_date-high.
date3 = date2 + 1.
wa_date-dat = date3.
APPEND wa_date TO it_date.
CLEAR wa_date.
ENDIF.
IF date3 LT p_date-high.
date4 = date3 + 1.
wa_date-dat = date4.
APPEND wa_date TO it_date.
CLEAR wa_date.
ENDIF.
IF date4 LT p_date-high.
date5 = date4 + 1.
wa_date-dat = date5.
APPEND wa_date TO it_date.
CLEAR wa_date.
ENDIF.
IF date5 LT p_date-high.
date6 = date5 + 1.
wa_date-dat = date6.
APPEND wa_date TO it_date.
CLEAR wa_date.
ENDIF.
Can any one help me on this issue.
Thanks in Advance.
Thanks & Regards,
AmitHi Amit,
pls see the code below:
date = p_date-low.
wa_date-dat = date.
APPEND wa_date TO it_date.
CLEAR wa_date.
IF date LT p_date-high AND date is not initial.
date1 = p_date-low + 1.
wa_date-dat = date1.
APPEND wa_date TO it_date.
CLEAR wa_date.
ENDIF.
IF date1 LT p_date-high AND date1 is not initial.
date2 = date1 + 1.
wa_date-dat = date2.
APPEND wa_date TO it_date.
CLEAR wa_date.
ENDIF.
IF date2 LT p_date-high AND date2 is not initial.
date3 = date2 + 1.
wa_date-dat = date3.
APPEND wa_date TO it_date.
CLEAR wa_date.
ENDIF.
IF date3 LT p_date-high.
date4 = date3 + 1.
wa_date-dat = date4.
APPEND wa_date TO it_date.
CLEAR wa_date.
ENDIF.
Pls add the condition also in ur check for all the IF conditions..and just see if it works...
Keerthi -
Hello,
I want generate the report with XML, so i can parse the XML data for my local system uses the business data.
Is it possible to create the report in the ByDesign which will generate the report output data in XML file.
Any idea will great.
Thanks,
Viral.Hi,
how did you export the report?
If I open a report (open in web browser, not in Excel) and press "Export to Microsoft Excel", I get a XML file which includes the data values as well. I must not log in to the system in Excel that`s only needed if I open the report directly in excel.
Best regards,
Andreas -
Altering report output - pre-rendering
Hi there
Due to circumstances beyond our control (I'm not going into it at this point), I am required to alter report output data prior to it being rendered.
This is semi-possible using JavaScript.
However, as succesful as the JavaScript is, it isn't run when, for example, the report is downloaded to Excel ... this means our users are shown the correct version of the data in the web template, but if they choose to download to Excel, get another (incorrect) version.
Is there not something else I could be doing to manipulate this data ... previous systems had the table interface class, where I could write ABAP code to manipulate the data, but that's not available in 2004s.
I was wondering if there aren't some Java areas that I can try poking around in, or is there absolutely no way to achieve this.
Please don't come back and tell me to change the query ... we have sat with SAP and they acknowledge a fault on their side which makes the data incorrect.
Cheers,
AndrewIt seems that these error messages MOD_OC4J_0184 etc are associated with some sort of timeout.
My problem finally solved - see my comments at:
Re: FOP
I would like to see the PDF format using FOP docs made clearer that 2 http servers are involved in this process, one serving htmldb pages and the other oc4j stuff.
Is it possible to do the PDF format using FOP with only the htmldb http server??
Cheers
KIM -
Display date prompt in crystal report output
Hi There,
In my report output the values entered in date prompt(range) is not displayed.
I've prompt that is created on document created on field. The properties of prompt are
Posting date...... date.........static values
value field : ERDAT.....
value options:
optional prompt: false
allow custom values: true
allow multiple values : false
allow discrete values: false
allow range values: trueHi Raj,
I believe you're trying to display the start date and the end date of the date range parameter.
Create a formula called 'start':
Minimum(?Postingdate) //This formula extracts the start date from the date parameter
Similarly, create another formula called 'end':
Maximum(?Postingdate) //This extracts the end date
Place these formulae on the desired report section.
P.S: You may even do this in a single formula.
Hope this helps!
-Abhilash -
Best Practice for report output of CRM Notes field data
My company has a requirement to produce a report with variable output, based upon a keyword search of our CRM Request Notes data. Example: The business wants a report return of all Service Requests where the Notes field contains the word "pay" or "payee" or "payment". As part of the report output, the business wants to freely select the output fields meant to accompany the notes data. Can anyone please advise to SAP's Best Practice for meeting a report requirement such as this. Is a custom ABAP application built? Does data get moved to BW for Reporting (how are notes handles)? Is data moved to separate system?
Hi David,
I would leave your query
"Am I doing something wrong and did I miss something that would prevent this problem?"
to the experts/ gurus out here on this forum.
From my end, you can follow
TOP 10 EXCEL TIPS FOR SUCCESS
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/204c3259-edb2-2b10-4a84-a754c9e1aea8
Please follow the Xcelsius Best Practices at
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a084a11c-6564-2b10-79ac-cc1eb3f017ac
In order to reduce the size of xlf and swf files follow
http://myxcelsius.com/2009/03/18/reduce-the-size-of-your-xlf-and-swf-files/
Hope this helps to certain extent.
Regards
Nikhil -
How to print long raw text data in report output in single line?
Hi All,
I have a requirement where I need to print raw comma separated text data in the report output which end user will open in excel and can sort as required. I can not directly generate excel output.
Now there is huge set of data and each row from the report query should be get printed on single line, It should not get printed on the next line.
I tried to extending the report with 240 characters but still there are some text data which is getting printed on the next line.
Please share your view if someone has any solution on this issue.
Thanks in Advance.
ArunMake the report even wider. By default a report layout can be 10 pages wide. If you need more, change the "Max. Horizontal Body Pages" property, and extend your layout too.
IMHO, I wouldn't even use Reports to create a csv file. Utl_file or an sqlplus script that spools to a file are better options I think. -
How to get the output data of Standard drill down report into z-program?
HI every one,
I want to get the output data of drill down report into z-program.
Actually,if the output is only one, I can get into z-program,
But, Here the report consists 3 alv outputs. when double clicking function happens, it will direct to another alv output.
Those, all the outputs of report i want to get into z-program.
PLease , give reply as early as possible.
Thank u in advance,
karthikHI,
When i download,only one output i will get.
But,if i double-click the particular record it will show another output. I want that output also.
Like that,when i double-click particular record, it will show some other alv ouput based on record,
i wanted all those outputs.
If i copy the code, whether i face any problems? -
Hi to all
In my report i am giving a date format like dd-mm-yyyy in a selection screen but in output of the report i am getting yyyy-mm-dd , i have cheacked all the setting in control panel ,and system date is dd-mm-yyyy only
kindly suggest me wt should i do to get dd-mm-yyyy format in report output.
ThanksHi,
Check this thread
https://forums.sdn.sap.com/click.jspa?searchID=5217881&messageID=3336239
Regards
Prakash -
Adding/Enabling Totals & Subtotals Button in ALV Report Output
Hi Guys,
I would like to know , how to add / enable Totals & Subtotals Button on the application tool bar in alv report output.
Regards,
Kishanok so here i am sending my code....its also interactive...
and in second list i am displaying quantity....
*& Report ZINT_ALV
REPORT zint_alv.
TYPE-POOLS:slis.
TABLES:mara,
makt,
mseg.
DATA:BEGIN OF itab OCCURS 0,
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
END OF itab.
DATA:BEGIN OF itab1 OCCURS 0,
mblnr LIKE mseg-mblnr,
menge LIKE mseg-menge,
meins LIKE mseg-meins,
werks LIKE mseg-werks,
END OF itab1.
DATA:fcat TYPE slis_t_fieldcat_alv,
fcat1 TYPE slis_t_fieldcat_alv,
eve TYPE slis_t_event,
eve1 TYPE slis_t_event.
DATA:t_mat LIKE mara-matnr,
s_mat LIKE mara-matnr,
g_repid LIKE sy-repid.
SELECTION-SCREEN:BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:mat FOR mara-matnr OBLIGATORY.
SELECTION-SCREEN:END OF BLOCK blk1.
INITIALIZATION.
PERFORM build_fcat USING fcat.
PERFORM build_eve.
START-OF-SELECTION.
PERFORM get_data.
PERFORM dis_data.
*& Form build_fcat
text
-->T_FCAT text
FORM build_fcat USING t_fcat TYPE slis_t_fieldcat_alv.
DATA:wa_fcat TYPE slis_fieldcat_alv.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MATNR'.
wa_fcat-ref_fieldname = 'MATNR'.
wa_fcat-ref_tabname = 'MARA'.
wa_fcat-seltext_m = 'Material'.
wa_fcat-input = ' '.
wa_fcat-edit = 'X'.
wa_fcat-input = 'X'.
APPEND wa_fcat TO t_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MAKTX'.
wa_fcat-seltext_m = 'Description'.
APPEND wa_fcat TO t_fcat.
CLEAR wa_fcat.
ENDFORM. "build_fcat
*& Form build_eve
text
FORM build_eve.
DATA:t_eve TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = eve
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.
ENDFORM. "build_eve
*& Form get_data
text
FORM get_data.
SELECT maramatnr maktmaktx INTO CORRESPONDING FIELDS OF TABLE itab
FROM mara INNER JOIN makt
ON maramatnr = maktmatnr
WHERE mara~matnr IN mat.
ENDFORM. "get_data
*& Form dis_data
text
FORM dis_data.
g_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid "'ZINT_ALV'
i_callback_user_command = 'USER_COMMAND'
i_grid_title = 'Interactive ALV'
it_fieldcat = fcat
it_events = eve
TABLES
t_outtab = itab
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. "dis_data
*& Form user_command
text
-->U_COM text
FORM user_command USING u_com LIKE sy-ucomm sel_field TYPE slis_selfield.
CLEAR fcat1.
CASE u_com.
WHEN '&IC1'.
READ TABLE itab INDEX sel_field-tabindex.
IF sel_field-fieldname = 'MATNR'.
IF sy-subrc = 0.
t_mat = itab-matnr.
PERFORM build_cat1 USING fcat1.
PERFORM build_eve1.
PERFORM get_data1.
PERFORM dis_data1.
ENDIF.
ENDIF.
SET PARAMETER ID 'MAT' FIELD t_mat.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
ENDCASE.
ENDFORM. "user_command
*& Form build_fcat1
text
-->T_FCAT1 text
FORM build_cat1 USING t_fcat1 TYPE slis_t_fieldcat_alv.
DATA:wa_fcat1 TYPE slis_fieldcat_alv.
wa_fcat1-tabname = 'ITAB1'.
wa_fcat1-fieldname = 'MBLNR'.
wa_fcat1-seltext_m = 'Material Doc.'.
APPEND wa_fcat1 TO t_fcat1.
CLEAR wa_fcat1.
wa_fcat1-tabname = 'ITAB1'.
wa_fcat1-fieldname = 'MENGE'.
wa_fcat1-seltext_m = 'Quantity'.
APPEND wa_fcat1 TO t_fcat1.
CLEAR wa_fcat1.
wa_fcat1-tabname = 'ITAB1'.
wa_fcat1-fieldname = 'MEINS'.
wa_fcat1-seltext_m = 'UOM'.
APPEND wa_fcat1 TO t_fcat1.
CLEAR wa_fcat1.
wa_fcat1-tabname = 'ITAB1'.
wa_fcat1-fieldname = 'WERKS'.
wa_fcat1-seltext_m = 'Plant'.
APPEND wa_fcat1 TO t_fcat1.
CLEAR wa_fcat1.
ENDFORM. "build_fcat1
*& Form build_eve1
text
FORM build_eve1.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = eve1
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.
ENDFORM. "build_eve1
*& Form get_data1
text
FORM get_data1.
SELECT mblnr menge meins werks FROM mseg
INTO CORRESPONDING FIELDS OF TABLE itab1
WHERE matnr = t_mat.
ENDFORM. "get_data1
*& Form dis_data1
text
FORM dis_data1.
g_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid "'ZINT_ALV'
i_callback_user_command = 'USER_COMMAND1'
it_fieldcat = fcat1
it_events = eve1
TABLES
t_outtab = itab1
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. "dis_data1 -
How to download data from itab to Excel sheet..
Hi sap Experts,
I develop one report to download data from itab to excel sheet.I done it perfectly.
My doubt is in the excel sheet i need to put headings. and also at last i need to display total no.of Records.
Please help me how to do this.
Thanks in Advance....
Thanks and Regards
Siri.......................u can either use GUI_DOWNLOAD or the method below...just give a try
DATA:WK_string TYPE STRING.
DATA:Wk_EXT(4) TYPE C value '.xls'.
DATA:WK_path TYPE STRING.
DATA:wk_file_name type string.
data:wk_records type sy-tfill.
wk_file_name = 'Downloaded'.
describe table itab lines wk_records.
LOOP AT ITAB.
at first.
**Provide path
concatenate 'C:\' wk_file_name Wk_EXT into wk_path.
open dataset WK_path for output in text mode encoding default.
if sy-subrc 0.
write:'ERROR while opening dataset !!!!!!'.
EXIT.
endif.
CONDENSE wk_path.
**Heading Part
concatenate 'Part No' 'Description'
into wk_string separated by cl_abap_char_utilities=>horizontal_tab.
endat.
**Data ITAB
CONCATENATE ITAB-MATNR itab-maktx into wk_string
separated by cl_abap_char_utilities=>horizontal_tab.
transfer wk_string to WK_path.
at last.
clear wk_string.
Concatenate 'Records Passed:' wk_string into wk_string.
transfer wk_string to WK_path.
close dataset WK_path.
endat.
endloop. -
Hi Experts,
Can you give an example program on mailing ALV report output to any ID.
Thanks in advance.
Regards,
RamHi ram
Here i'm posting u sample code try to execute it. It will convert all the data in the related tables to excel format and transfer it to respective mail id
*& Report ZTESTMAIL *
REPORT ZTESTMAIL .
tables: ekko.
parameters: p_email type somlreci1-receiver default
'[email protected]'.
types: begin of t_ekpo,
ebeln type ekpo-ebeln,
ebelp type ekpo-ebelp,
aedat type ekpo-aedat,
matnr type ekpo-matnr,
end of t_ekpo.
data: it_ekpo type standard table of t_ekpo initial size 0,
wa_ekpo type t_ekpo.
types: begin of t_charekpo,
ebeln(10) type c,
ebelp(5) type c,
aedat(8) type c,
matnr(18) type c,
end of t_charekpo.
data: wa_charekpo type t_charekpo.
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.
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.
t_object_header = 'Text.xls'. append t_object_header.
*START_OF_SELECTION
start-of-selection.
* Retrieve sample data from table ekpo
perform data_retrieval.
* Populate table with detaisl to be entered into .xls file
perform build_xls_data_table.
*END-OF-SELECTION
end-of-selection.
* Populate message body text
perform populate_email_message_body.
* Send file by email as .xls speadsheet
perform send_file_as_email_attachment
tables it_message
it_attach
using p_email
'Example .xls documnet attachment'
'XLS'
'filename'
changing gd_error
gd_reciever.
* Instructs mail send program for SAPCONNECT to send email(rsconn01)
perform initiate_mail_execute_program.
*& Form DATA_RETRIEVAL
* Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select ebeln ebelp aedat matnr
up to 10 rows
from ekpo
into table it_ekpo.
endform. " DATA_RETRIEVAL
*& Form BUILD_XLS_DATA_TABLE
* Build data table for .xls document
form build_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 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
into it_attach separated by con_tab.
concatenate con_cret it_attach into it_attach.
append it_attach.
loop at it_ekpo into wa_charekpo.
concatenate wa_charekpo-ebeln wa_charekpo-ebelp
wa_charekpo-aedat wa_charekpo-matnr
into it_attach separated by con_tab.
concatenate con_cret it_attach into it_attach.
append it_attach.
endloop.
endform. " BUILD_XLS_DATA_TABLE
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
* Send email
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
object_header = t_object_header
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.
*& 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 ekpo records'.
append it_message.
endform. " POPULATE_EMAIL_MESSAGE_BODY
*PARAMETERS: psubject(40) type c default 'Testing',
*p_email(40) type c default '[email protected]'. "use ur email id
*data: it_packing_list like sopcklsti1 occurs 0 with header line,
*it_contents like solisti1 occurs 0 with header line,
*it_receivers like somlreci1 occurs 0 with header line,
*it_attachment like solisti1 occurs 0 with header line,
*gd_cnt type i,
*gd_sent_all(1) type c,
*gd_doc_data like sodocchgi1,
*gd_error type sy-subrc.
*data: it_message type standard table of SOLISTI1 initial size 0
*with header line.
**START-OF-SELECTION.
*START-OF-SELECTION.
*Perform populate_message_table.
**Send email message, although is not sent from SAP until mail send
**program has been executed(rsconn01)
*PERFORM send_email_message.
**Instructs mail send program for SAPCONNECT to send email(rsconn01)
*perform initiate_mail_execute_program.
**& Form POPULATE_MESSAGE_TABLE
** Adds text to email text table
*form populate_message_table.
*Append 'Line1' to it_message.
*Append 'Line2' to it_message.
*Append 'Line3' to it_message.
*Append 'Test- 1' to it_message.
*endform. " POPULATE_MESSAGE_TABLE
**& Form SEND_EMAIL_MESSAGE
** Send email message
*form send_email_message.
** Fill the document data.
*gd_doc_data-doc_size = 1.
** DATA: TAB_LINES LIKE sy-tabix.
** DESCRIBE TABLE it_message LINES TAB_LINES.
** READ TABLE it_message INDEX TAB_LINES.
** gd_doc_data-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( it_message )
** Populate the subject/generic message attributes
*gd_doc_data-obj_langu = sy-langu.
*gd_doc_data-obj_name = 'SAPRPT'.
*gd_doc_data-obj_descr = psubject.
*gd_doc_data-sensitivty = 'F'.
** Describe the body of the message
** Information about structure of data tables
*clear it_packing_list.
*refresh it_packing_list.
*it_packing_list-transf_bin = space.
*it_packing_list-head_start = 1.
*it_packing_list-head_num = 0.
*it_packing_list-body_start = 1.
*describe table it_message lines it_packing_list-body_num.
*it_packing_list-doc_type = 'RAW'.
*append it_packing_list.
** Add the recipients email address
*clear it_receivers.
*refresh it_receivers.
*it_receivers-receiver = p_email.
*it_receivers-rec_type = 'U'.
** it_receivers-com_type = 'INT'.
** it_receivers-notif_del = 'X'.
** it_receivers-notif_ndel = 'X'.
*append it_receivers.
** Call the FM to post the message to SAPMAIL
*call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
*exporting
*document_data = gd_doc_data
*put_in_outbox = 'X'
*importing
*sent_to_all = gd_sent_all
*tables
*packing_list = it_packing_list
*contents_txt = it_message
*receivers = it_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.
** Store function module return code
*gd_error = sy-subrc.
** Get it_receivers return code
*loop at it_receivers.
*endloop.
*endform. " SEND_EMAIL_MESSAGE
**& Form INITIATE_MAIL_EXECUTE_PROGRAM
** Instructs mail send program for SAPCONNECT to send email.
*form initiate_mail_execute_program.
*wait up to 2 seconds.
*if gd_error eq 0.
*submit rsconn01 with mode = 'INT'
*with output = 'X'
*and return.
*endif.
*endform. " INITIATE_MAIL_EXECUTE_PROGRAM
Rewards if helpfull
Regards
Pavan -
REPORT output to possible files formats
Hi Folks
How can we tranasfer a REPORT output to any file like( .XLS, .XML, or to anyother possible file). Can u give all the possible file procedures.
Thanks in advance.
I wont forget to reward points.
Regards,
RamHi Ram,
Use can very well use the function module 'GUI_DOWNLOAD'.
The below code clarifies your doubt as how to mention the path in the selection screen.
tables: mara.
data: itab type standard table of mara.
select-options: s_matnr for mara-matnr.
parameters: filename like rlgrap-filename default 'C:\materail_details.xls'. " download filename
start-of-selection.
select *
from mara
into table itab
where matnr in s_matnr.
perform file_download.
*& Form file_download
text
--> p1 text
<-- p2 text
form file_download .
data: filename1 type string.
filename1 = filename.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = filename1
FILETYPE = 'DAT'
tables
data_tab = itab
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
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. " file_download
Here C:\material_details.xls is the path to save your file. In the same way you can save a text file also.
Hope this clarifies your doubt.
Regards
Sayee -
How to write report output into table
Hi,
I want to get data out from report "RSPARAM" which list all system profile parameters my requirement is that i need to write output of this report to table so can anyone please tell me how should achieve this?
is there any FM which read report as parameters and write into table?
thanks in advance.
john.Looks like the program you are calling(rsparam) is just calling another report, RSPFPAR. Let's just call that one directly. Here is an updated version of the program.
This will also put the first 3 columns in a internal table. This should show you what you need to do.
report zrich_0003 .
data: begin of listout occurs 0,
line(1024) type c,
end of listout.
data: begin of itab occurs 0,
column1(100) type c,
column2(100) type c,
column3(100) type c,
therest(100) type c,
end of itab.
* Submit the report and export list to memory
submit rspfpar exporting list to memory
and return.
* Get list from memory and convert to ascii
perform retrieve_list_from_memory tables listout.
loop at listout.
if sy-tabix => 7.
clear itab.
split listout+1(500) at '|' into itab-column1 itab-column2
itab-column3 itab-therest.
append itab.
endif.
endloop.
loop at itab.
write:/ itab-column1, itab-column2, itab-column3.
endloop.
* RETRIEVE_LIST_FROM_MEMORY
form retrieve_list_from_memory tables reportlines.
data: list like abaplist occurs 0 with header line.
data: txtlines(1024) type c occurs 0 with header line.
clear list. refresh list.
clear reportlines. refresh reportlines.
call function 'LIST_FROM_MEMORY'
tables
listobject = list
exceptions
not_found = 1
others = 2.
check sy-subrc = 0.
call function 'LIST_TO_ASCI'
tables
listobject = list
listasci = txtlines
exceptions
empty_list = 1
list_index_invalid = 2
others = 3.
check sy-subrc = 0.
reportlines[] = txtlines[].
call function 'LIST_FREE_MEMORY'.
endform.
Regards,
Rich Heilman -
Query regarding calling T-code MIGO from ALV report output
Dear friends,
I have to call MIGO transaction from my ALV report output. Now problem is that I have to set the value 'display' In the first header field, 'Material Document' in 2nd header field when MIGO is called from the report output. Morever there is no parameter ID for these two fields. So how to set the values w/o using parameter ids.
Regards,
RishiHi,
Try this coding,
FORM DISPLAY.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = AK_LAYOUT
IT_FIELDCAT = AK_FIELDCAT
TABLES
T_OUTTAB = ITAB.
ENDFORM. " DISPLAY
*& Form EVENT
FORM EVENT USING P_AK_EVENT TYPE SLIS_T_EVENT.
DATA : AK_EVENT1 TYPE SLIS_ALV_EVENT.
AK_EVENT1-NAME = 'USER_COMMAND'.
AK_EVENT1-FORM = 'USER_COMMAND'.
APPEND AK_EVENT1 TO P_AK_EVENT.
ENDFORM. " EVENT
*& Form USER_COMMAND
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
IF R_UCOMM = '&IC1'.
" AND SY-LSIND = '1'.
READ TABLE ITAB INDEX RS_SELFIELD-TABINDEX.
SET PARAMETER ID 'AUN' FIELD ITAB-BUDAT.
CALL TRANSACTION 'MIGO' AND SKIP FIRST SCREEN.
ENDIF.
ENDFORM. " USER_COMMAND
Regards,
Nikhil.
Maybe you are looking for
-
If I press the home button it says ipad not set up then gives me the option to continue I press that and am back to a screen which says joining other network, can't press anything on that. It's been like it for about half an hour now. help.
-
Can't get fields values of SRM PO at R/3 PO
Dear all. I am very muddle that: <b>How to</b> transport SRM web-page PO field value [such as sourcing type, tracking NO. Item category,Vendor text at item level] to Backend R/3 PO? I can see these 4 fields value on web-page SRM PO. but I can't find
-
Wrong Work center picking up Time sheet
Hi Scenario is as follows: Earlier Employee has HR assignment to one Work center 1 -WC1 Later, Employee was Assigned to Work center 2- WC2 Problem: When booking time sheet in CAT2 , for service order, WC1 was picking up, even though in Service order
-
Which is better Ipod Shuffle or Ipod Touch in terms of everything.
-
Installing Both Oracle 10g and oracleXE on the same computer
Hi, Good Morning to ALL, Can any of you tell me whether we can Install both the Oracle10g Version and OracleXE on the same computer. In my work computer, I have oracle and Toad installed. Now I wanna install OracleXE and Oracle SQL Developer to do so