How to save ALV list and send listoutput as email in background process
Can anyone tell me if an ALV list report could be saved as LIST using 'LIST_TO_MEMORY' and then by using 'LIST_FROM_MEMORY' we need to read the list. If so How?
I don't want to use 'Submit....exporting list to memory and return' as then I have to trigger my program twice.
Finally with one program itself i want to get the listoutput and send the list output as an email to the customer in background.
I have gone through the forums and could see many of them facing the same problem, but could not find the solution in the forums.
Waiting for a reply
Santhoshi
if you want to send mail with the same data as you display in ALV, you can use the same internal table,which you sent to ALV_LIST_DISPLAY function module.
take the email ids from the user on the selection-screen & use the below code to send mail to them.
call this FORM F_SEND_MAIL before you called the ALV function module.
FORM F_SEND_MAIL .
CLEAR WA_RECLIST.
REFRESH IT_RECLIST.
*-popualate email ids
*--Receipient 1
this receipient can be select-option from the selection screen. or can be hardcoded as below.
WA_RECLIST-RECEIVER = '[email protected]'.
WA_RECLIST-REC_TYPE = C_U.
WA_RECLIST-EXPRESS = C_X.
*--append receiver table
APPEND WA_RECLIST TO IT_RECLIST.
CLEAR : WA_RECLIST.
*--Receipient 2
WA_RECLIST-RECEIVER = '[email protected]'.
WA_RECLIST-REC_TYPE = C_U.
WA_RECLIST-EXPRESS = C_X.
*-append receiver table
APPEND WA_RECLIST TO IT_RECLIST.
CLEAR : WA_RECLIST.
*--populate document attributes
CLEAR: X_DOC_CHNG.
X_DOC_CHNG-OBJ_NAME = 'HEADING'.
CONCATENATE 'Japan BOL details for the delivery#'(003)
V_VBELN
INTO X_DOC_CHNG-OBJ_DESCR SEPARATED BY SPACE.
*-populate body text
CONCATENATE 'Japan BOL details for the Delivery#'(003)
CONCATENATE TEXT-003
V_VBELN
',is attached'
INTO WA_OBJTXT SEPARATED BY SPACE.
APPEND WA_OBJTXT TO IT_OBJTXT.
*---- Append Date and Time into Body of email.
MOVE 'File is generated on'(004) TO V_INFO.
V_TIME = SY-UZEIT.
WRITE : SY-UZEIT TO V_TIME USING EDIT MASK '__:__:__'.
CONCATENATE V_TIME+0(2)
V_TIME+2(2)
V_TIME+4(2)
INTO
V_TIME2 SEPARATED BY ':'.
WRITE : sy-datum MM/DD/YYYY TO lv_date .
CONCATENATE SY-DATUM+4(2)
SY-DATUM+6(2)
SY-DATUM+0(4)
INTO V_DATE.
CONCATENATE V_INFO
V_DATE
'At'
V_TIME2
INTO V_INFO
SEPARATED BY SPACE.
WA_OBJTXT = V_INFO.
APPEND WA_OBJTXT TO IT_OBJTXT.
*-document size
CLEAR : V_TABLE_LINES.
DESCRIBE TABLE IT_OBJTXT LINES V_TABLE_LINES.
READ TABLE IT_OBJTXT INTO WA_OBJTXT INDEX V_TABLE_LINES.
X_DOC_CHNG-DOC_SIZE =
( V_TABLE_LINES - 1 ) * 255 + STRLEN( WA_OBJTXT ).
*-populate packing list for body text
CLEAR IT_OBJPACK-TRANSF_BIN.
WA_OBJPACK-HEAD_START = 1.
WA_OBJPACK-HEAD_NUM = 0.
WA_OBJPACK-BODY_START = 1.
WA_OBJPACK-BODY_NUM = V_TABLE_LINES.
WA_OBJPACK-DOC_TYPE = 'RAW'.
APPEND WA_OBJPACK TO IT_OBJPACK.
CLEAR WA_OBJPACK.
*--for attachment
*--add Internal table lines here, as attachment.
*--IT_FINAL IS THE internal table which you used to display the result as ALV output
loop at IT_FINAL.
CONCATENATE IT_FINAL-FIELD1
IT_FINAL-FIELD2
*--AND SO ON
INTO WA_OBJBIN.
APPEND WA_OBJBIN TO IT_OBJBIN.
CLEAR WA_OBJBIN.
ENDLOOP.
*-get total no.of lines of Object table(attachment)
CLEAR : V_TABLE_LINES.
DESCRIBE TABLE IT_OBJBIN LINES V_TABLE_LINES.
*-populate object header
CONCATENATE 'Delivery#'(005)
V_VBELN
SY-DATUM
V_TIME
INTO
WA_OBJHEAD SEPARATED BY SPACE.
APPEND WA_OBJHEAD TO IT_OBJHEAD.
CLEAR WA_OBJHEAD.
*-packing list for attachment
WA_OBJPACK-TRANSF_BIN = C_X.
WA_OBJPACK-HEAD_START = 1.
WA_OBJPACK-HEAD_NUM = 1.
WA_OBJPACK-BODY_START = 1.
WA_OBJPACK-BODY_NUM = V_TABLE_LINES .
WA_OBJPACK-DOC_TYPE = 'CSV' .
WA_OBJPACK-DOC_TYPE = 'RAW' .
WA_OBJPACK-OBJ_NAME = 'POTR'.
CONCATENATE 'Delivery details for '(005)
CONCATENATE TEXT-005
V_VBELN
SY-DATUM
V_TIME
'.CSV'
INTO
WA_OBJPACK-OBJ_DESCR SEPARATED BY SPACE.
BREAK-POINT.
WA_OBJPACK-DOC_SIZE = V_TABLE_LINES * 255.
APPEND WA_OBJPACK TO IT_OBJPACK.
CLEAR WA_OBJPACK.
*-Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = X_DOC_CHNG
PUT_IN_OUTBOX = C_X
COMMIT_WORK = C_X
TABLES
PACKING_LIST = IT_OBJPACK
OBJECT_HEADER = IT_OBJHEAD
CONTENTS_BIN = IT_OBJBIN
CONTENTS_TXT = IT_OBJTXT
RECEIVERS = IT_RECLIST
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.
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. " F_SEND_MAIL
Regards
srikanth
added comments
Message was edited by: Srikanth Kidambi
Similar Messages
-
How to get SCOM alerts and send single summary email of one's that have breached.
Hi,
I'm trying to create a runbook which does as the title suggests, ie I want to get the 'Active' alerts from the console which have breached our SLA, which is No Critical or Warning alerts in resolution state of New for more than 24 hrs, and emails this list
to an internal Distribution List of all the potential service owners. Its just intended as a daily email to poke the relevant people not to ignore the console alerts :-)
I'm able to Get Alerts OK, but from there I'm having diffs. I have been given a powershell (as I'm no good at Powershell myself) which does the filtering to get the relevant breached alerts, but when I pass output to other activities and ultimately
to the create/send email, I end up only able to get multiple emails, one be alert which matches the filtering from powershell. I have appended to a file to check that I can write the alert properties line by line, but for example if Ive 4 alerts then
I end up with 4 emails - I want one email with each alert detail (severity, Alert name, path,resolutionstate, Days/hrs in breach, Service Owner (custom Field 3) etc). I have toyed with flattening the output with line breaks and/or commas at various points
along the activity chain to ftry force a single iteration of te send email but this just messes the format to the point of not being useful.
So was wondering if anyone could advise if this is possible, esp if able to do it using the standard activities along with SCOM IP - I'm sure doing it all in powershell it a possible answer but I'm not proficient to do it - unless someone can provide
said script! :-)
Another possibility which has crossed my mind is to possible query the OpsMgr DB directly using the Alert ID from Get Alert but haven't tried tht yet. I think I' stuggling to understand the basic of how the data is passed from activities esp using
the 'flatten outpout method.. My current runbook has the fllowing activities:
GetAlert -> Run .Net (powershell for filtering for breaced alerts) -> AppendFile (to Check the alert output) -> Create/Send Email(to send summary email). What happens is if I have say 4 Breached emails in Console, when I run tester I
see GetAlert runs Once detail shows it has found 4 alerts), then each activity up the chain runs 4 times so that finally I end up with 4 emails.
If anyone has any suggestions it would be much appreciated - I can provide any more details/upload pic of current runbook if it helps...
Thanks...Hi thanks for the suggestion. I've tried playing around with the runbook using the Junction activity infront of the sendmail. It doesnt appear to do anyting in itself (unless I'm not using it correctly). The only way I can get the email
to only send once is if I flatten the output from the returned data behaviour - this works if I flatten at the Get Alert stage without the Junction activity or if I use the junction an flatten it then the email fires once.
However the problem with this is that each field for each alert is written vertically, so if I have 3 alerts returning 3 pieces of returned data I get:
<Alert1 datafield1>
<Alert2 datafield1>
<Alert3 datafield1>
<Alert1 datafield2>
<Alert2 datafield2>
<Alert3 datafield2>
<Alert1 datafield3>
<Alert2 datafield3>
<Alert3 datafield3>
wereas I wan the dat to appear in horizonally with each alert details on each row as like when written to a file, ie
<Alert1 datafield1> <Alert1 Datafield2> <Alert1 DataField3>
<Alert2 datafield1> <Alert2 Datafield2> <Alert2 DataField3>
<Alert3 datafield1> <Alert3 Datafield2> <Alert3 DataField3>
Without the use of flatten, the email which fires once for each alert has the data displayed correctly. So essentially what I'm hoping to get is all returned alert details one per line/row in the body of the email...
If theres any easy way to do it withing the orchestrator activities would be great. Otherwise it looks like I might have to try find a powershell or SQL script to pull back alert data. Cheers... -
How to create a variant and execute a Z-program in background
Hello,
I have created a specific transaction to update relationships between partners (BP).
For this i have create a screen painter, but as the run time is long i want to execute the program in background.
How to save a variant and to execute the report in background ?
Thanks in advance
ChristopheHi,
Please go to your z-transaction.
Enter your selection criteria. & click on save button to save your your selection criteria as a variant.
Now go to tcode SM36 to shedule your program with saved variant.
Regards,
Narendra -
How to save a list template and make use of it in another website as webpart ?
How to save a list template and make use of it in another website as webpart ?
1. Save As "List A" as .STP
2. Go to another website, in the document workspace I try to Add webpart -> Browse -> Upload the STP file, but after that the List A webpart still doesn't appear.
Any clue which part went wrong?Hi,
firstly you need to upload the .STP file to a list solution gallery of the site and then you can add the list (under custom name) to the webpage
see here for how to-
http://office.microsoft.com/en-us/sharepoint-server-help/copy-or-move-a-list-by-using-a-list-template-HA101782479.aspx
Hope this helps!
Ram - SharePoint Architect
Blog - SharePointDeveloper.in
Please vote or mark your question answered, if my reply helps you -
How do I create, and send a group email on my iPhone?
How do I create, and send a group email from my iPhone 4?
How to send group email without additional APP
Just spent an hour on ichat. Long and short....can't send group email. The group name appears in the TO: line, but if you click on the group name, only the first email address is blue..the rest are black and will not get the email. We tired using the CC and BC lines...same result.
However here is one solution:
I sent one email with each of the group (we are only 9 ) in the TO: line. I included my primary email. When it came to the iphone, i moved it to one of the subfolders. (Each account you may have has a list of the inbox at the top and Account at the bottom. ... that is where you can access the subfolder)
I moved the email with all names to that subfolder. I can then, open it ...do a relpy to all and just change the message and subject line. It is cumbersome, but it does work. I really think Apple, a company committed to ease of use, needs to review this flaw. I suspect it may be a bandwidth economy .... and i feel the pain of the providers...but you did create the beast. -
How are people finding me and sending requests,is ...
again how are strangers finding me and sending friend requests. is there somewhere they go like a master contact list of all skype customers
kol wrote:
again how are strangers finding me and sending friend requests. is there somewhere they go like a master contact list of all skype customers
no such thing. unfortunately, scammers and spammers are extremely resourceful people.
IF YOU FOUND OUR POST USEFUL THEN PLEASE GIVE "KUDOS". IF IT HELPED TO FIX YOUR ISSUE PLEASE MARK IT AS A "SOLUTION" TO HELP OTHERS. THANKS!
ALTERNATIVE SKYPE DOWNLOAD LINKS | HOW TO RECORD SKYPE VIDEO CALLS | HOW TO HANDLE SUSPICIOS CALLS AND MESSAGES
SEE MORE TIPS, TRICKS, TUTORIALS AND UPDATES in
| skypefordummies.blogspot.com | -
How to join two lists and display the results in datasheet view.?
hello,
i have two lists that i would like to join, i know a method that has been described in the link below
http://www.codeproject.com/Articles/194252/How-to-Link-Two-Lists-and-Create-a-Combined-Ciew-i
however, here the data view is only limited to 30 rows and my resultant list is huge. I would like to know if there is a possibility to view the resultant list in a data sheet view ?I don't believe you can use the OOTB Datasheet view when joining lists. However, you should be able to increase your limit from 30 items to as many as you need (that doesn't trip the threshold set in Central Admin).
Dimitri Ayrapetov (MCSE: SharePoint) -
I received a message on my iPhone 4 that has a video attached to it. I "saved video" but don't know where. How do I find it and send it to mi MacBook Air?
It would have saved to your camera roll. Connect the phone to your Air via a USB cable and then run Image Capture which is located either in your Utilities folder or Other folder, depending on what version of Mac OS X your are running. You will then see all the photos and videos stored on your iPhone and can then download them.
-
Convert SAP spoolOR list to excel and send as an email attachment
Hello All Masterminds ,
Iu2019ve developed a utility, in which users has to maintain one u201CZu201D view where they can give any report name, type of attachment (PDF, XLS, TXT) and sender email addresses.u201DNote: thing to remember here is Iu2019m creating XLS,TXT,PDF format dynamicallyu201D
It is working fine for PDF. Iu2019m submitting the program and creating spool and converting it to PDF and sending to their emails as an attachment. It looks fantastic. When Iu2019m doing the same thing for XLS it is showing messy output, I tried many functions and search lots of unanswered, unfinished SDN posts. I almost tried every single clue given in these posts but no luck. Email part is working fine using classes ( l_document = cl_document_bcs=>create_document , l_document->add_attachment , l_send_request->set_document( l_document ).,cl_sapuser_bcs=>create( l_uname ).,l_send_request->add_recipient, l_send_request->set_send_immediately( '' ). ) .
My real deal is to create a beautiful XLS out put. I also tried FMs LIST_FROM_MEMORY and LIST_TO_ASCI but no-luck. I thought instead of spool if I use u201CSubmit EXPORTING LIST TO MEMORY u201C option may be It works but BIG NO
Iu2019m sure some genius out there has done something like his , I ain`t genius that is why I am stuck Please guys throw me some bones . As I said, I am able to do most of the things. I need some magic code /answer which turns my messy, ugly unformatted excel sheet attachment to beautiful u201Cpiece of art u201CExcel output.
Here are the FMs I tried so far with different combinations.
CALL FUNCTION 'LIST_FROM_MEMORY'
CALL FUNCTION 'LIST_TO_ASCI'
CALL FUNCTION 'GUI_DOWNLOAD'
CALL FUNCTION 'RSPO_DOWNLOAD_SPOOLJOB'
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
CALL FUNCTION 'CONVERT_OTF'
CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
And logic like to get rid of things getting in Asci tables
cl_abap_char_utilities=>newline.
cl_abap_char_utilities=>horizontal_tab
cl_abap_char_utilities=>VERTICAL_TAB
cl_abap_char_utilities=>cr_lf
FIELD-SYMBOLS: <lfs_table>, " Internal table structure
<lfs_con>. " Field Content
DATA: l_text TYPE char1024. " Text content for mail attachment
DATA: l_con(50) TYPE c. " Field Content in character format
Columns to be tab delimeted
LOOP AT FINAL ASSIGNING <lfs_table>.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE <lfs_table>
TO <lfs_con>.
IF sy-subrc NE 0.
CONCATENATE c_cr l_text INTO l_text.
APPEND l_text TO i_attach.
EXIT.
ELSE.
CLEAR: l_con.
MOVE <lfs_con> TO l_con.
CONDENSE l_con.
IF sy-index = 1.
CLEAR: l_text.
MOVE l_con TO l_text.
ELSE.
CONCATENATE l_text l_con INTO l_text
SEPARATED BY c_tab.
ENDIF.
ENDIF.
ENDDO.
ENDLOOP.
Posts : https://forums.sdn.sap.com/click.jspa?searchID=14756211&messageID=4401940
https://forums.sdn.sap.com/click.jspa?searchID=14756211&messageID=4796657
https://forums.sdn.sap.com/search.jspa?threadID=&q=convertspoolintoexcelformatforsendingmail&objID=c42&dateRange=all&numResults=30&rankBy=10001
Will appreciate your help and time.
Thanks,
Saquib KhanHi,
i send excel-att like this.
REPORT Z_EMAIL_CL_BCS MESSAGE-ID ZZ.
More examples here BCS_EXAMPLE_* with se38
DATA: SEND_REQUEST TYPE REF TO CL_BCS.
DATA: SUBJECT TYPE SO_OBJ_DES.
DATA: ATT_TYPE TYPE SOODK-OBJTP.
DATA: IT_TEXT TYPE BCSY_TEXT.
DATA: WA_TEXT LIKE SOLI.
DATA: IT_BIN TYPE SOLIX_TAB.
DATA: WA_BIN TYPE SOLIX.
DATA: DOCUMENT TYPE REF TO CL_DOCUMENT_BCS.
DATA: SENDER TYPE REF TO CL_SAPUSER_BCS.
DATA: RECIPIENT TYPE REF TO IF_RECIPIENT_BCS.
DATA: BCS_EXCEPTION TYPE REF TO CX_BCS.
DATA: SENT_TO_ALL TYPE OS_BOOLEAN.
Bytes der Datei
DATA: IT_LENGHT TYPE SO_OBJ_LEN.
DATA: N10(10) TYPE N.
CONSTANTS: CON_NEWL TYPE ABAP_CHAR1 VALUE CL_ABAP_CHAR_UTILITIES=>NEWLINE,
CON_TAB TYPE ABAP_CHAR1 VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
CONSTANTS: CON_NEWL TYPE X VALUE '0D', "OK for non Unicode
CON_TAB TYPE X VALUE '09'. "OK for non Unicode
START-OF-SELECTION.
PERFORM MAIN.
END-OF-SELECTION.
FORM MAIN.
TRY.
-------- create persistent send request ------------------------
SEND_REQUEST = CL_BCS=>CREATE_PERSISTENT( ).
PERFORM HEAD_CONT.
PERFORM XLS_ATT.
add document to send request
CALL METHOD SEND_REQUEST->SET_DOCUMENT( DOCUMENT ).
--------- set sender -------------------------------------------
SENDER = CL_SAPUSER_BCS=>CREATE( SY-UNAME ).
CALL METHOD SEND_REQUEST->SET_SENDER
EXPORTING
I_SENDER = SENDER.
--------- set recipent -----------------------------------------
RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS(
'the email adress' ).
add recipient with its respective attributes to send request
CALL METHOD SEND_REQUEST->ADD_RECIPIENT
EXPORTING
I_RECIPIENT = RECIPIENT
I_EXPRESS = 'X'.
RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS(
'the email adress 2' ).
add recipient with its respective attributes to send request
CALL METHOD SEND_REQUEST->ADD_RECIPIENT
EXPORTING
I_RECIPIENT = RECIPIENT
I_EXPRESS = 'X'.
---------- send document ---------------------------------------
CALL METHOD SEND_REQUEST->SEND(
EXPORTING
I_WITH_ERROR_SCREEN = 'X'
RECEIVING
RESULT = SENT_TO_ALL ).
COMMIT WORK.
CATCH CX_BCS INTO BCS_EXCEPTION.
WRITE: 'Fehler aufgetreten.'(001).
WRITE: 'Fehlertyp:'(002), BCS_EXCEPTION->ERROR_TYPE.
EXIT.
ENDTRY.
ENDFORM. "main
FORM HEAD_CONT.
CLEAR: IT_TEXT[], WA_TEXT, SUBJECT.
ATT_TYPE = 'RAW'.
CONCATENATE 'Betreffzeile am' SY-DATUM 'um' SY-UZEIT
INTO SUBJECT SEPARATED BY SPACE.
WA_TEXT = 'Hello!'.
APPEND WA_TEXT TO IT_TEXT.
WA_TEXT = 'dieses ist eine Testmail'.
APPEND WA_TEXT TO IT_TEXT.
WA_TEXT = 'Gruß'.
APPEND WA_TEXT TO IT_TEXT.
DESCRIBE TABLE IT_TEXT LINES N10.
N10 = ( N10 - 1 ) * 255 + STRLEN( WA_TEXT ).
IT_LENGHT = N10.
DOCUMENT = CL_DOCUMENT_BCS=>CREATE_DOCUMENT(
I_TYPE = ATT_TYPE
I_TEXT = IT_TEXT
I_LENGTH = IT_LENGHT
I_SUBJECT = SUBJECT ).
ENDFORM. "HEAD_CONT
FORM XLS_ATT.
DATA: BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR,
MTART LIKE MARA-MTART,
MATKL LIKE MARA-MATKL,
BRGEW LIKE MARA-BRGEW,
END OF ITAB.
DATA: BRGEW(18).
CLEAR: IT_BIN[], WA_BIN, SUBJECT.
SELECT MATNR MTART MATKL BRGEW INTO TABLE ITAB FROM MARA UP TO 10 ROWS.
CONCATENATE 'Material' CON_TAB
'Materialart' CON_TAB
'Warengruppe' CON_TAB
'Bruttogewicht' CON_NEWL
INTO WA_BIN.
APPEND WA_BIN TO IT_BIN.
LOOP AT ITAB.
WRITE ITAB-BRGEW TO BRGEW.
CONCATENATE ITAB-MATNR CON_TAB
ITAB-MTART CON_TAB
ITAB-MATKL CON_TAB
BRGEW CON_NEWL
INTO WA_BIN.
APPEND WA_BIN TO IT_BIN.
ENDLOOP.
ATT_TYPE = 'XLS'.
SUBJECT = 'My XLS attachment'.
DESCRIBE TABLE IT_BIN LINES N10.
N10 = ( N10 - 1 ) * 255 + STRLEN( WA_BIN ).
IT_LENGHT = N10.
CALL METHOD DOCUMENT->ADD_ATTACHMENT
EXPORTING
I_ATTACHMENT_TYPE = ATT_TYPE
I_ATT_CONTENT_HEX = IT_BIN
I_ATTACHMENT_SIZE = IT_LENGHT
I_ATTACHMENT_SUBJECT = SUBJECT.
ENDFORM. "XLS_ATT
Perhaps it helps.
regards, Dieter -
How to convert sap script to pdf and send it as email attachment
hi,
my requirement is to convert a standard sales order form to pdf and send it as email attachment. get me some sample code for the same
thanks in advanceHi
See this sample code and after that use the fun module to send the mail
SO_NEW_DOCUMENT_ATT_SEND_API1
REPORT zzz_jaytest .
Types Declaration
TYPES : BEGIN OF ty_pa0001,
pernr TYPE pa0001-pernr,
bukrs TYPE pa0001-bukrs,
werks TYPE pa0001-werks,
END OF ty_pa0001.
Internal Table Declaration
DATA : i_pa0001 TYPE STANDARD TABLE OF ty_pa0001, "For pa0001 Details
i_otf TYPE STANDARD TABLE OF itcoo, "For OTF data
i_content_txt TYPE soli_tab, "Content
i_content_bin TYPE solix_tab, "Content
i_objhead TYPE soli_tab,
Work Area Declaration
w_pa0001 TYPE ty_pa0001, "For pa0001 Details
w_res TYPE itcpp, "SAPscript output
"parameters
w_otf TYPE itcoo, "For OTF
w_pdf TYPE solisti1, "For PDF
w_transfer_bin TYPE sx_boolean, "Content
w_options TYPE itcpo, "SAPscript output
"interface
Variable Declaration
v_len_in TYPE so_obj_len,
v_size TYPE i.
Constants Declaration
CONSTANTS : c_x TYPE c VALUE 'X', "X
c_locl(4) TYPE c VALUE 'LOCL', "Local Printer
c_otf TYPE sx_format VALUE 'OTF', "OTF
c_pdf TYPE sx_format VALUE 'PDF', "PDF
c_printer TYPE sx_devtype VALUE 'PRINTER', "PRINTER
c_bin TYPE char10 VALUE 'BIN', "BIN
c_name TYPE string VALUE 'C:\ZZZ_JAYTEST.PDF',"Downloading
"File Name
c_form(11) TYPE c VALUE 'ZZZ_JAYTEST'. "Form Name
START-OF-SELECTION.
Selecting the records from pa0001
SELECT pernr bukrs werks FROM pa0001
INTO TABLE i_pa0001 UP TO 10 ROWS.
Setting the options
w_options-tdcopies = 1 ."Number of copies
w_options-tdnoprev = c_x."No print preview
w_options-tdgetotf = c_x."Return of OTF table
w_options-tddest = c_locl."Spool: Output device
Opening the form
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = c_form
device = c_printer
language = sy-langu
OPTIONS = w_options
IMPORTING
RESULT = w_res.
LOOP AT i_pa0001 INTO w_pa0001.
Writting into the form
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'MAIN'
window = 'MAIN'.
ENDLOOP.
Closing the form
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = w_res
TABLES
otfdata = i_otf
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 2
send_error = 3
spool_error = 4
codepage = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Converting OTF data to single line
LOOP AT i_otf INTO w_otf.
CONCATENATE w_otf-tdprintcom w_otf-tdprintpar
INTO w_pdf.
APPEND w_pdf TO i_content_txt.
ENDLOOP.
Converting to PDF Format
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
EXPORTING
format_src = c_otf
format_dst = c_pdf
devtype = c_printer
CHANGING
transfer_bin = w_transfer_bin
content_txt = i_content_txt
content_bin = i_content_bin
objhead = i_objhead
len = v_len_in
EXCEPTIONS
err_conv_failed = 1
OTHERS = 2.
v_size = v_len_in.
Downloading the PDF File
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = v_size
filename = c_name
filetype = c_bin
TABLES
data_tab = i_content_bin.
If you r using this function module check it once....
call function 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
others = 4.
Fehlerhandling
if sy-subrc <> 0.
endif.
or u can use the standard program RSTXPDFT4 to download the script into PDF format onto a particular location
follow this link for sample program.
http://searchsap.techtarget.com/tip/0,289483,sid21_gci1121833,00.html
check...
How to send smart form via email
/people/pavan.bayyapu/blog/2005/08/30/sending-html-email-from-sap-crmerp
Regards
Anji -
How to save a game and then load
My final project of BSCS (Bachelor of Science in Computer Science) is a Multiplayer online Board game...Distributed Ludo...
This project is in its final steps and I�m facing some difficulties.
I do not know how to save the game and load it again. Can anybody guide me to the process?Saving a game is just persisting the data required for the game.
Loading a game means reading the saved data and setting the attributes of the game (and player and ...) to start exactly the point where it was saved.
So the steps to save are
1. Identify the data necessary for retaining the same state when needed.
2. Decide the data file format and structure.
3. Get the snapshot of necessary attributes
4. Save the data using APIs
Steps to load are
1. Read the data using APIs.
2. Set the game attributes.
3. Update the model and view accordingly.
Hope this helps. -
I don't have owner's phone number, how to get previous owner's Apple ID(email address) and send him a email let him remove the device from the account
There is no way for anyone on this forum to assist you. Apple will also not assist you. If you purchased the device thru ebay, file a claim. If you purchased it some other way, I'm sorry. there is nothing anyone can do to help you.
-
To convert Smart Form output to PDF format and send it via email.
Hi Friends,
Could any one please tell me, how to convert the Smart Forms output to PDF format and send it via email to customer. If any one have the code, kindly mail me to [email protected]
Thanks & Regards,
JohnRefer the links -
how to convert smartform into pdf and send through mail
Smartform as PDF attachment to a mail.
smartform pdf and mail
smartform to pdf to mail
Regrads,
Amit
Reward all helpful replies. -
ALV List only 80 Columns when runinning as background job
Hello Guys,
I have a Problem with an ALV List.
We use the FM REUSE_ALV_HIERSEQ_LIST_DISPLAY for a Document Journal.
When I run it in foreground it works fine. But when I view the spool in background the list makes a break at excactly 80 signs, but the line size should be about 120.
In the report the Line-Size is set correctly, even the print parameters seem to be ok. We are running it with X_65_255.
I saw that there are some SAP Notes to this topic, but on our release (SAP_BASIS 700) the notes are already implemented.
Has anyone a solution to this topic?
Thanks and regards
RolandTry this.
[ALV List only 80 Columns when running in background job|https://forums.sdn.sap.com/click.jspa?searchID=25735042&messageID=5686003] -
To convert Sap Script output to PDF format and send it via email.
Hi Friends,
Could any one please tell me, how to convert the Sap Script output to PDF format and send it via email. If any one have the code, kindly mail me to [email protected]
Thanks & Regards,
JohnPlese check this sample code from other thread.
REPORT zzz_jaytest .
Types Declaration
TYPES : BEGIN OF ty_pa0001,
pernr TYPE pa0001-pernr,
bukrs TYPE pa0001-bukrs,
werks TYPE pa0001-werks,
END OF ty_pa0001.
Internal Table Declaration
DATA : i_pa0001 TYPE STANDARD TABLE OF ty_pa0001, "For pa0001 Details
i_otf TYPE STANDARD TABLE OF itcoo, "For OTF data
i_content_txt TYPE soli_tab, "Content
i_content_bin TYPE solix_tab, "Content
i_objhead TYPE soli_tab,
Work Area Declaration
w_pa0001 TYPE ty_pa0001, "For pa0001 Details
w_res TYPE itcpp, "SAPscript output
"parameters
w_otf TYPE itcoo, "For OTF
w_pdf TYPE solisti1, "For PDF
w_transfer_bin TYPE sx_boolean, "Content
w_options TYPE itcpo, "SAPscript output
"interface
Variable Declaration
v_len_in TYPE so_obj_len,
v_size TYPE i.
Constants Declaration
CONSTANTS : c_x TYPE c VALUE 'X', "X
c_locl(4) TYPE c VALUE 'LOCL', "Local Printer
c_otf TYPE sx_format VALUE 'OTF', "OTF
c_pdf TYPE sx_format VALUE 'PDF', "PDF
c_printer TYPE sx_devtype VALUE 'PRINTER', "PRINTER
c_bin TYPE char10 VALUE 'BIN', "BIN
c_name TYPE string VALUE 'C:\ZZZ_JAYTEST.PDF',"Downloading
"File Name
c_form(11) TYPE c VALUE 'ZZZ_JAYTEST'. "Form Name
START-OF-SELECTION.
Selecting the records from pa0001
SELECT pernr bukrs werks FROM pa0001
INTO TABLE i_pa0001 UP TO 10 ROWS.
Setting the options
w_options-tdcopies = 1 ."Number of copies
w_options-tdnoprev = c_x."No print preview
w_options-tdgetotf = c_x."Return of OTF table
w_options-tddest = c_locl."Spool: Output device
Opening the form
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = c_form
device = c_printer
language = sy-langu
OPTIONS = w_options
IMPORTING
RESULT = w_res.
LOOP AT i_pa0001 INTO w_pa0001.
Writting into the form
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'MAIN'
window = 'MAIN'.
ENDLOOP.
Closing the form
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = w_res
TABLES
otfdata = i_otf
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 2
send_error = 3
spool_error = 4
codepage = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Converting OTF data to single line
LOOP AT i_otf INTO w_otf.
CONCATENATE w_otf-tdprintcom w_otf-tdprintpar
INTO w_pdf.
APPEND w_pdf TO i_content_txt.
ENDLOOP.
Converting to PDF Format
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
EXPORTING
format_src = c_otf
format_dst = c_pdf
devtype = c_printer
CHANGING
transfer_bin = w_transfer_bin
content_txt = i_content_txt
content_bin = i_content_bin
objhead = i_objhead
len = v_len_in
EXCEPTIONS
err_conv_failed = 1
OTHERS = 2.
v_size = v_len_in.
Downloading the PDF File
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = v_size
filename = c_name
filetype = c_bin
TABLES
data_tab = i_content_bin.
The extension is put the it_mailpack-obj_name parameter of 'SO_NEW_DOCUMENT_ATT_SEND_API1'.
Maybe you are looking for
-
"Error 1002097 Unable to Load database" while starting an Essbase App.
Hello Essbase Experts, I am getting below error while starting an Essbase Application: "Error 1002097 Unable to Load database" Below is an extract from the Essbase Application Log: [2012-04-04T14:14:03.816-19:14] [RPA] [ESM-6] [ERROR] [32][] [ecid:13
-
I'm trying to download the Apps Quip or Evernote in my iPad 3, but the following message appears when I try it: "This App Requires iOS 7.0 or Later". The first time that I tried to do it, I had an older version of iOs (older than iOs 7.0). Then, I ha
-
ResultSet loop back to first record
I have an Access table : products I have a total of 7 products. When I use rs.next(), it will scroll for each record until the last record. How do I make it go back to the first record after it hit the last record ? I hv tried rs.first() and rs.last(
-
Co-workers using CS3, I'm getting CS4. File incompatibilities?
I work with two graphic artists that use CS3. I will most likely be purchasing a new iMac this weekend and I'm assuming that I will only have CS4 available to buy unless I look for CS3 on ebay or something. Will there be many file incompatibilities i
-
Multiple Portal Instances and Cookie Names
i have three portal instances (3.0.7) under the same database 8.1.7 on NT. for example: portal30 + portal30_sso myportal + myportal_sso testportal + testportal_sso actually i cannot work on more than one portal at the same time. so, each time i want