How to send pages brochure as an email
I made a really nice Pages brochure and now I want to send it to clients in an email. I'd rather not have it there as a file... I'd rather they get the email and see the beautiful brochure, right there in the email. Is there a way to do this? I tried copy and paste but nothing is happening with that, the email stays empty.
Any ideas?
Thank you for your help.
Susan
Menu > File > Export > PDF > drag into your Mail message
PC users will not see it as part of their mail though they will see it as an attachment.
You can open the pdf in Preview .app and resave it as a .png or .jpeg file but this will make the text blurry.
Peter
Similar Messages
-
How do I send pages documents in my email to people who do not have pages? have pages?
How do I send Pages Documents in my email to people who do not have Pages?
Share > Send to Mail > PDF will create a suitable size attachment in a new message in Mail
-
How to send ALV Grid report to Email?
hai all,
How to send ALV Grid report to Email.
please its very urgent.....Hi,
when u run the Alv, u will button 'Mail Recepiant' in tool bar.When u click it and enter to new screen, go to the Recipient Tab(down) enter ur maild id and click 'Send' button on tool bar.
or.
if u want to send the Alv content to mail id thru prg, go thru the following code.
TABLES
TABLES: BSID. " Accounting: Secondary Index for Customers.
TYPE-POOLS
TYPE-POOLS: SLIS.
INTERNAL TABLES
Internal table to hold Customer data.
DATA: BEGIN OF TB_BSID OCCURS 0,
BUKRS LIKE BSID-BUKRS, " Company code
KUNNR LIKE BSID-KUNNR, " Customer number
AUGDT LIKE BSID-AUGDT, " Clearing Date
BLDAT LIKE BSID-BLDAT, " Doc date in document
SHKZG LIKE BSID-SHKZG, " Debit/credit indicator
DMBTR LIKE BSID-DMBTR, " Amount in local currency
ZFBDT LIKE BSID-ZFBDT, " Baseline date for due date calc
ZBD1T LIKE BSID-ZBD1T, " Cash discount days 1
ZBD2T LIKE BSID-ZBD2T, " Cash discount days 2
ZBD3T LIKE BSID-ZBD3T, " Net Payment Terms Period
REBZG LIKE BSID-REBZG, " No Of the Inv the Tran Belongs to
REBZT LIKE BSID-REBZT, " Follow-On Document Type
END OF TB_BSID.
Internal table to hold Open Items.
DATA: TB_BSID_OPEN LIKE TABLE OF TB_BSID WITH HEADER LINE.
Internal table to hold Cleared Items.
DATA: TB_BSAD_CLEAR LIKE TABLE OF TB_BSID WITH HEADER LINE.
Internal table to hold General Data in Customer Master
DATA: BEGIN OF TB_KNA1 OCCURS 0,
KUNNR LIKE KNA1-KUNNR, " Customer Number
NAME1 LIKE KNA1-NAME1, " Name Line 1
TELF1 LIKE KNA1-TELF1, " Telephone Number
ADRNR LIKE KNA1-ADRNR, " Address
END OF TB_KNA1.
Internal table to hold Customer Master (Company Code)
DATA: BEGIN OF TB_KNB1 OCCURS 0,
KUNNR LIKE KNB1-KUNNR, " Customer Number
BUKRS LIKE KNB1-BUKRS, " Company code
ERDAT LIKE KNB1-ERDAT, " Rec Created Date
ZAMIB LIKE KNB1-ZAMIB, " DMS Managed Indicator
END OF TB_KNB1.
Internal table to hold Final Output Data
DATA: BEGIN OF TB_FINAL OCCURS 0,
KUNNR LIKE KNA1-KUNNR, " Customer Number
NAME1 LIKE KNA1-NAME1, " Name Line 1
ADDRESS1(25) TYPE C, " Address line 1
ADDRESS2(25) TYPE C, " Address line 2
ADDRESS3(25) TYPE C, " Address line 3
ADDRESS4(25) TYPE C, " Address line 4
PHONE LIKE KNA1-TELF1, " Telephone Number
DAYS_SLOW(3) TYPE C, " Days Slow
LAST_DATE(8) TYPE C, " Date of Last Invoice
AVG(4) TYPE C, " Average Days to Pay
CURRENT(10) TYPE N, " Current
AVG_1_30(10) TYPE N, " 1-30 past due
AVG_31_60(10) TYPE N, " 31-60 past due
AVG_61_90(10) TYPE N, " 61-90 past due
AVG_90G(10) TYPE N, " 90+ past due
END OF TB_FINAL.
ALV Internal tables
DATA : TB_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV, " Field Catalog
TB_EVENTS TYPE SLIS_T_EVENT, " ALV Events
TB_COMMENTS TYPE SLIS_T_LISTHEADER. " Comment
Internal tables for the sending mail data
DATA: TB_OBJPACK TYPE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE,
TB_OBJHEAD TYPE SOLISTI1 OCCURS 1 WITH HEADER LINE,
TB_OBJTXT TYPE SOLISTI1 OCCURS 10 WITH HEADER LINE,
TB_RECLIST TYPE SOMLRECI1 OCCURS 5 WITH HEADER LINE,
TB_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
TB_DOC_CHNG TYPE SODOCCHGI1.
Internal table to get mail Receivers Address
DATA: TB_ZRECEIVE LIKE YSMTP_ADDRESS OCCURS 0 WITH HEADER LINE.
STRUCTURES
DATA: X_SADR TYPE SADR, " For Address
X_FIELDCAT TYPE SLIS_FIELDCAT_ALV, " For Field Catalog
X_LAYOUT TYPE SLIS_LAYOUT_ALV, " For Layout
X_EVENTS TYPE SLIS_ALV_EVENT, " For Events
X_COMMENTS TYPE SLIS_LISTHEADER, " For Comments
X_ADDR1_SEL LIKE ADDR1_SEL, " For Address
WA_FAEDE TYPE FAEDE. " For FAEDE struct
VARIABLES
DATA: G_REPID LIKE SY-REPID, " Prog ID
G_DAYS_SLOW(3) TYPE N, " Days Slow
G_OPEN TYPE I, " Counter
G_AVG(4) TYPE C, " Avg Days
G_COUNT TYPE I, " Counter
G_TITLE TYPE SOLISTI1-LINE, " Description
G_TAB_LINES TYPE SY-TABIX, " Internal data count
G_REC_COUNT TYPE I, " Total records
G_CURR_BAL TYPE N, " Account balance
G_FILE_NAME LIKE EDI_PATH-PTHNAM. " Output File Name
CONSTANTS
CONSTANTS: C_D TYPE C VALUE 'D', " Account type
C_X TYPE C VALUE 'X', " Check Value
C_0(4) TYPE N VALUE '0.00', " Constant for char
C_1(2) TYPE C VALUE '01', " Posting key const
C_H TYPE C VALUE 'H', " For Commenet-Type
C_TXT(3) TYPE N VALUE 'TXT', " File type
C_RAW(3) TYPE C VALUE 'RAW', " File type
C_DELIMITER TYPE X VALUE '09', " ASCII CODE LINE
C_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
C_INTERFACE TYPE YWFSALOFFICNOTIF-INTERFACE_ID VALUE 'AP',
C_FILENAME(20) TYPE N VALUE 'TEXT.TXT'," File name
C_TITLE(30) TYPE N VALUE 'Z21614_DB_CREDIT_AGENCY',
C_Z001 TYPE RF035-RASID VALUE 'Z001'." Net 30/60/90/120/150
SELECTION SCREEN.
Selection Screen for Selection Criteria.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-T01.
SELECT-OPTIONS: S_BUKRS FOR BSID-BUKRS OBLIGATORY, " Company Code
S_BLDAT FOR BSID-BLDAT," OBLIGATORY, " Doc Date
S_KUNNR FOR BSID-KUNNR, " Cust No
S_ZUONR FOR BSID-ZUONR. " Assignment
PARAMETERS: P_GRACE(2) TYPE N OBLIGATORY, " Grace Days
P_ZAMIB LIKE KNB1-ZAMIB AS CHECKBOX. " DMS Indicator
SELECTION-SCREEN END OF BLOCK B1.
Selection Screen for Output Options.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-T02.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 01.
PARAMETERS: P_REPORT RADIOBUTTON GROUP R1. " Report Only
SELECTION-SCREEN COMMENT 5(25) TEXT-016.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 01.
PARAMETERS: P_DOWN RADIOBUTTON GROUP R1. " Dwnld to Unix
SELECTION-SCREEN COMMENT 5(25) TEXT-017.
SELECTION-SCREEN POSITION 30.
PARAMETERS: P_FILE LIKE FILENAME-FILEINTERN DEFAULT
'Z21614_DB_CREDIT_AGENCY'. " File Name
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B2.
Selection Screen for E-mail.
SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-T03.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 01.
PARAMETERS: P_EMAIL AS CHECKBOX. " E-mail
SELECTION-SCREEN COMMENT 5(25) TEXT-018.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B3.
INITIALIZATION
INITIALIZATION.
G_REPID = SY-REPID.
AT SELECTION SCREEN. *
AT SELECTION-SCREEN.
Validation of selection screen entries
perform validate_data.
START-OF-SELECTION
START-OF-SELECTION.
Select Data from Customer Master (Company Code)
PERFORM SELECT_KNB1.
Select Custmer Open Items.
PERFORM SELECT_CUSTOMER_OPEN_ITEMS.
Select Custmer Cleared Items.
PERFORM SELECT_CUSTOMER_CLEARED_ITEMS.
Select General Data in Customer Master
PERFORM SELECT_KNA1.
Populate Final Output Data.
PERFORM POPULATE_TB_FINAL.
End of selection *
END-OF-SELECTION.
If both display report and send email is checked
IF P_REPORT = C_X AND P_EMAIL = C_X.
MESSAGE E999 WITH
'Select One Among Report Only & Send E-mail'(023).
When Radiobutton for Email or if the program is run background
ELSEIF ( P_EMAIL = C_X OR SY-BATCH = C_X ).
To send the mail
PERFORM SEND_EMAIL.
ELSEIF P_REPORT = C_X .
To display the Final Output data using ALV's
PERFORM DISPLAY_ALV_REPORT.
ENDIF.
Transfering data to file when downloading to Unix
IF P_DOWN = C_X.
IF G_REC_COUNT IS INITIAL.
MESSAGE I999 WITH
'No Records Found For Selection Criteria'(024).
EXIT.
ELSE.
IF NOT G_FILE_NAME IS INITIAL.
Trasefering data to file
PERFORM TRANSFER_DATA_FILE.
Interface Audit report
PERFORM WRITE_REPORT.
ENDIF.
ENDIF.
ENDIF.
F O R M S
*& Form VALIDATE_DATA
Validating selection-screen entries
FORM VALIDATE_DATA.
Local variables
DATA : L_BUKRS LIKE BSEG-BUKRS, " For Company Code
L_KUNNR LIKE BSEG-KUNNR. " For Customer Number
Validate the Company code.
SELECT SINGLE BUKRS
INTO L_BUKRS
FROM T001
WHERE BUKRS IN S_BUKRS.
IF SY-SUBRC <> 0.
MESSAGE E999 WITH 'Enter valid Company Code'(025).
ENDIF.
Validate the Customer number
IF NOT S_KUNNR[] IS INITIAL.
SELECT SINGLE KUNNR
INTO L_KUNNR
FROM KNA1
WHERE KUNNR IN S_KUNNR.
IF SY-SUBRC <> 0.
MESSAGE E999 WITH 'Enter valid Customer Number'(026).
ENDIF.
ENDIF.
ENDFORM. " VALIDATE_DATA
*& Form SELECT_KNB1
Select Data from Customer Master (Company Code)
FORM SELECT_KNB1 .
CLEAR: TB_KNB1,
TB_KNB1[].
SELECT KUNNR
BUKRS
ERDAT
ZAMIB
FROM KNB1
INTO TABLE TB_KNB1
WHERE BUKRS IN S_BUKRS
AND KUNNR IN S_KUNNR.
IF SY-SUBRC = 0.
Sort TB_KNB1 by Customer no & Rec Created Date
SORT TB_KNB1 BY KUNNR ERDAT DESCENDING.
ENDIF.
ENDFORM. " SELECT_KNB1
*& Form SELECT_CUSTOMER_OPEN_ITEMS
Select Custmer Open Items.
FORM SELECT_CUSTOMER_OPEN_ITEMS .
CLEAR: TB_BSID,
TB_BSID[].
SELECT A~BUKRS
B~KUNNR
B~AUGDT
B~BLDAT
B~SHKZG
B~DMBTR
B~ZFBDT
B~ZBD1T
B~ZBD2T
B~ZBD3T
B~REBZG
B~REBZT
INTO TABLE TB_BSID
FROM BKPF AS A JOIN BSID AS B
ON ABUKRS = BBUKRS
AND ABELNR = BBELNR
AND AGJAHR = BGJAHR
WHERE A~BUKRS IN S_BUKRS
AND A~BLDAT IN S_BLDAT
AND B~KUNNR IN S_KUNNR
AND B~ZUONR IN S_ZUONR
AND B~BSCHL = C_1.
IF SY-SUBRC = 0.
DMS Managed Indicator = X.
IF P_ZAMIB = C_X.
LOOP AT TB_KNB1 WHERE ZAMIB = SPACE.
DELETE TB_BSID WHERE BUKRS = TB_KNB1-BUKRS
AND KUNNR = TB_KNB1-KUNNR.
ENDLOOP.
ENDIF.
Transfering Open Items from TB_BSID to TB_BSID_OPEN
TB_BSID_OPEN[] = TB_BSID[].
ENDIF.
ENDFORM. " SELECT_CUSTOMER_OPEN_ITEMS
*& Form SELECT_CUSTOMER_CLEARED_ITEMS
Select Custmer Cleared Items.
FORM SELECT_CUSTOMER_CLEARED_ITEMS .
CLEAR: TB_BSAD_CLEAR,
TB_BSAD_CLEAR[].
SELECT A~BUKRS
B~KUNNR
B~AUGDT
B~BLDAT
B~SHKZG
B~DMBTR
B~ZFBDT
B~ZBD1T
B~ZBD2T
B~ZBD3T
B~REBZG
B~REBZT
INTO TABLE TB_BSAD_CLEAR
FROM BKPF AS A JOIN BSAD AS B
ON ABUKRS = BBUKRS
AND ABELNR = BBELNR
AND AGJAHR = BGJAHR
WHERE A~BUKRS IN S_BUKRS
AND A~BLDAT IN S_BLDAT
AND B~KUNNR IN S_KUNNR
AND B~ZUONR IN S_ZUONR
AND B~BSCHL = C_1.
IF SY-SUBRC = 0.
DMS Managed Indicator = X.
IF P_ZAMIB = C_X.
LOOP AT TB_KNB1 WHERE ZAMIB = SPACE.
DELETE TB_BSID WHERE BUKRS = TB_KNB1-BUKRS
AND KUNNR = TB_KNB1-KUNNR.
ENDLOOP.
ENDIF.
Sort TB_BSID_CLEAR by Customer number
SORT TB_BSAD_CLEAR BY KUNNR.
ENDIF.
Append lines of TB_BSID_CLEAR to table TB_BSID
APPEND LINES OF TB_BSAD_CLEAR TO TB_BSID.
Sort TB_BSID by Cust num AND Doc date in document
SORT TB_BSID BY KUNNR BLDAT.
ENDFORM. " SELECT_CUSTOMER_CLEARED_ITEMS
*& Form SELECT_KNA1
Select General Data in Customer Master
FORM SELECT_KNA1.
CLEAR: TB_KNA1,
TB_KNA1[].
SELECT KUNNR
NAME1
TELF1
ADRNR
INTO TABLE TB_KNA1
FROM KNA1
WHERE KUNNR IN S_KUNNR.
IF SY-SUBRC <> 0.
ENDIF.
ENDFORM. " SELECT_KNA1
*& Form POPULATE_TB_FINAL
Populate Final Output Data.
FORM POPULATE_TB_FINAL.
Local variable
DATA: L_DAYS_SLOW(3) TYPE N. " Days Slow
CLEAR: TB_FINAL,
TB_FINAL[].
LOOP AT TB_KNA1.
Move-corresponding TB_KNA1 to TB_FINAL.
TB_FINAL-KUNNR = TB_KNA1-KUNNR. " Customer Number
TB_FINAL-NAME1 = TB_KNA1-NAME1. " Name Line 1
TB_FINAL-PHONE = TB_KNA1-TELF1. " Telephone Number
To get Customer Address.
PERFORM GET_CUSTOMER_ADDRESS.
To get Date of Last Invoice.
READ TABLE TB_BSID WITH KEY KUNNR = TB_KNA1-KUNNR.
IF SY-SUBRC = 0.
TB_FINAL-LAST_DATE = TB_BSID-BLDAT.
ENDIF.
To get past due and current details.
PERFORM GET_PAST_DUE_CURRENT.
To get Days Slow.
CLEAR WA_FAEDE .
LOOP AT TB_BSID_OPEN WHERE KUNNR = TB_KNA1-KUNNR.
WA_FAEDE-SHKZG = TB_BSID-SHKZG.
WA_FAEDE-ZFBDT = TB_BSID-ZFBDT.
WA_FAEDE-ZBD1T = TB_BSID-ZBD1T.
WA_FAEDE-ZBD2T = TB_BSID-ZBD2T.
WA_FAEDE-ZBD3T = TB_BSID-ZBD3T.
WA_FAEDE-REBZG = TB_BSID-REBZG.
WA_FAEDE-REBZT = TB_BSID-REBZT.
WA_FAEDE-KOART = C_D.
To Determine Due Date.
CALL FUNCTION 'DETERMINE_DUE_DATE'
EXPORTING
I_FAEDE = WA_FAEDE
IMPORTING
E_FAEDE = WA_FAEDE
EXCEPTIONS
ACCOUNT_TYPE_NOT_SUPPORTED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
CLEAR WA_FAEDE.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR: L_DAYS_SLOW.
L_DAYS_SLOW = SY-DATUM - WA_FAEDE-NETDT - P_GRACE.
G_DAYS_SLOW = G_DAYS_SLOW + ABS( L_DAYS_SLOW ).
G_OPEN = G_OPEN + 1.
ENDLOOP.
IF G_OPEN IS INITIAL.
TB_FINAL-DAYS_SLOW = G_DAYS_SLOW / G_OPEN. " Days Slow
ENDIF.
To get Average days to Pay.
PERFORM GET_AVG_DAYS_PAY.
Calculating total records .
G_REC_COUNT = G_REC_COUNT + 1.
APPEND TB_FINAL.
CLEAR TB_FINAL.
ENDLOOP.
Current account balance.
G_CURR_BAL = TB_FINAL-CURRENT + TB_FINAL-AVG_1_30 +
TB_FINAL-AVG_31_60 +
TB_FINAL-AVG_61_90 +
TB_FINAL-AVG_90G .
ENDFORM. " POPULATE_TB_FINAL
*& Form GET_PAST_DUE_CURRENT
To get past due and current details.
FORM GET_PAST_DUE_CURRENT.
Local Varaibles.
DATA: L_RF035_SFAE1 TYPE RF035-SFAE1,
L_RF035_SFAE2 TYPE RF035-SFAE2,
L_RF035_SFAE3 TYPE RF035-SFAE3,
L_RF035_SFAE4 TYPE RF035-SFAE4,
L_RF035_SFAE5 TYPE RF035-SFAE5,
L_RF035_SFAE6 TYPE RF035-SFAE6,
L_RF035_SFAEL TYPE RF035-SFAEL,
L_RF035_SNFA1 TYPE RF035-SNFA1,
L_RF035_SNFA2 TYPE RF035-SNFA2,
L_RF035_SNFA3 TYPE RF035-SNFA3,
L_RF035_SNFA4 TYPE RF035-SNFA4,
L_RF035_SNFA5 TYPE RF035-SNFA5,
L_RF035_SNFA6 TYPE RF035-SNFA6,
L_RF035_SNFAE TYPE RF035-SNFAE.
LOOP AT TB_KNB1 WHERE KUNNR = TB_KNA1-KUNNR.
CALL FUNCTION 'CUSTOMER_DUE_DATE_ANALYSIS'
EXPORTING
BUKRS = TB_KNB1-BUKRS
KKBER = ' '
KUNNR = TB_KNB1-KUNNR
RASID = C_Z001
IMPORTING
SFAE1 = L_RF035_SFAE1
SFAE2 = L_RF035_SFAE2
SFAE3 = L_RF035_SFAE3
SFAE4 = L_RF035_SFAE4
SFAE5 = L_RF035_SFAE5
SFAE6 = L_RF035_SFAE6
SFAEL = L_RF035_SFAEL
SNFA1 = L_RF035_SNFA1
SNFA2 = L_RF035_SNFA2
SNFA3 = L_RF035_SNFA3
SNFA4 = L_RF035_SNFA4
SNFA5 = L_RF035_SNFA5
SNFA6 = L_RF035_SNFA6
SNFAE = L_RF035_SNFAE
EXCEPTIONS
INVALID_RASTER = 1
NO_OPEN_ITEMS = 2
OTHERS = 3
IF SY-SUBRC = 0.
TB_FINAL-AVG_1_30 = TB_FINAL-AVG_1_30 + L_RF035_SFAE1.
TB_FINAL-AVG_31_60 = TB_FINAL-AVG_31_60 + L_RF035_SFAE2.
TB_FINAL-AVG_61_90 = TB_FINAL-AVG_61_90 + L_RF035_SFAE3.
TB_FINAL-AVG_90G = TB_FINAL-AVG_90G + L_RF035_SFAE4
+ L_RF035_SFAE5
+ L_RF035_SFAE6.
TB_FINAL-CURRENT = TB_FINAL-CURRENT + L_RF035_SNFAE.
ELSE.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
ENDFORM. " GET_PAST_DUE_CURRENT
*& Form GET_CUSTOMER_ADDRESS
To get Customer Address.
FORM GET_CUSTOMER_ADDRESS.
X_ADDR1_SEL-ADDRNUMBER = TB_KNA1-ADRNR.
CALL FUNCTION 'ADDR_GET'
EXPORTING
ADDRESS_SELECTION = X_ADDR1_SEL
IMPORTING
SADR = X_SADR
EXCEPTIONS
PARAMETER_ERROR = 1
ADDRESS_NOT_EXIST = 2
VERSION_NOT_EXIST = 3
INTERNAL_ERROR = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ADDRESS LINE 1.
TB_FINAL-ADDRESS1 = X_SADR-STRAS.
ADDRESS LINE 2.
CONCATENATE X_SADR-PFACH 'CODE' X_SADR-PSTL2 INTO TB_FINAL-ADDRESS2
SEPARATED BY SPACE.
ADDRESS LINE 3.
CONCATENATE X_SADR-ORT01 X_SADR-ORT02 ',' X_SADR-REGIO X_SADR-PSTLZ
INTO TB_FINAL-ADDRESS3 SEPARATED BY SPACE.
ADDRESS LINE 4.
TB_FINAL-ADDRESS4 = X_SADR-LAND1.
ENDFORM. " GET_CUSTOMER_ADDRESS
*& Form GET_AVG_DAYS_PAY
To get Average days to Pay.
FORM GET_AVG_DAYS_PAY.
*Local variable
DATA: L_DAYS TYPE N . " Number of Days
LOOP AT TB_BSAD_CLEAR WHERE KUNNR = TB_KNA1-KUNNR.
L_DAYS = TB_BSAD_CLEAR-AUGDT - TB_BSAD_CLEAR-BLDAT.
G_AVG = G_AVG + L_DAYS.
G_COUNT = G_COUNT + 1.
ENDLOOP.
IF NOT G_COUNT IS INITIAL.
TB_FINAL-AVG = G_AVG / G_COUNT. " Average days to Pay.
ENDIF.
ENDFORM. " GET_AVG_DAYS_PAY
*& Form DISPLAY_ALV_REPORT
text
FORM DISPLAY_ALV_REPORT.
For Populating Field Catalog.
PERFORM RPT_BUILD_FIELDCATLOG.
For Modifying Field Catalog.
PERFORM RPT_MODIFY_FIELDCATLOG.
For TOP_OF_PAGE Event.
PERFORM RPT_GET_EVENTS.
For Displaying Output in Grid Format.
PERFORM RPT_GRID_DISPLAY.
ENDFORM. " DISPLAY_ALV_REPORT
*& Form RPT_BUILD_FIELDCATLOG
text
FORM RPT_BUILD_FIELDCATLOG.
To build the Field Catlog.
DATA : L_TABNAME TYPE SLIS_TABNAME. " Table Name
L_TABNAME = 'TB_FINAL'.
REFRESH : TB_FIELDCAT.
CLEAR : TB_FIELDCAT.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = G_REPID
I_INTERNAL_TABNAME = L_TABNAME
I_INCLNAME = G_REPID
CHANGING
CT_FIELDCAT = TB_FIELDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " RPT_BUILD_FIELDCATLOG
*& Form RPT_MODIFY_FIELDCATLOG
text
FORM RPT_MODIFY_FIELDCATLOG.
Getting the Header Text for the Coloumns
DATA : L_TABIX LIKE SY-TABIX, " Index
L_DDICTXT TYPE C VALUE 'L'. " Flag
Getting the Header Text for the Coloumns
LOOP AT TB_FIELDCAT INTO X_FIELDCAT.
CLEAR L_TABIX.
L_TABIX = SY-TABIX.
CASE X_FIELDCAT-FIELDNAME.
WHEN 'KUNNR'. " Customer Number
X_FIELDCAT-SELTEXT_L = 'Customer Number'(001).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'NAME1'. " Name Line 1
X_FIELDCAT-SELTEXT_L = 'Name'(002).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'ADDRESS1'. " Address line 1
X_FIELDCAT-SELTEXT_L = 'Address 1'(003).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'ADDRESS2'. " Address line 2
X_FIELDCAT-SELTEXT_L = 'Address 2'(004).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'ADDRESS3'. " Address line 3
X_FIELDCAT-SELTEXT_L = 'Address 3'(005).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'ADDRESS4'. " Address line 4
X_FIELDCAT-SELTEXT_L = 'Address 4'(006).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'PHONE'. " Telephone Number
X_FIELDCAT-SELTEXT_L = 'Telephone Number'(007).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'DAYS_SLOW'. " Days Slow
X_FIELDCAT-SELTEXT_L = 'Days Slow'(008).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'LAST_DATE'. " Date of Last Invoice
X_FIELDCAT-SELTEXT_L = 'Date of Last Invoice'(009).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'AVG'. " Average Days to Pay
X_FIELDCAT-SELTEXT_L = 'Average Days to Pay'(010).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'CURRENT'. " Current
X_FIELDCAT-SELTEXT_L = 'Aging Category 1'(011).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'AVG_1_30'. " 1-30 past due
X_FIELDCAT-SELTEXT_L = 'Aging Category 2'(012).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'AVG_31_60'. " 31-60 past due
X_FIELDCAT-SELTEXT_L = 'Aging Category 3'(013).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'AVG_61_90'. " 61-90 past due
X_FIELDCAT-SELTEXT_L = 'Aging Category 4'(014).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'AVG_90G'. " 90+ past due
X_FIELDCAT-SELTEXT_L = 'Aging Category 5'(015).
X_FIELDCAT-DDICTXT = L_DDICTXT.
ENDCASE.
MODIFY TB_FIELDCAT FROM X_FIELDCAT INDEX L_TABIX.
ENDLOOP.
ENDFORM. " RPT_MODIFY_FIELDCATLOG
*& Form RPT_GET_EVENTS
text
FORM RPT_GET_EVENTS.
DATA : L_TABIX TYPE SY-TABIX. " Index
CLEAR : TB_EVENTS,
TB_EVENTS[].
To get the events from this function module
for ALV display
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = TB_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE I999 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Modifing Top of Page event
READ TABLE TB_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO X_EVENTS.
IF SY-SUBRC = 0.
CLEAR L_TABIX.
L_TABIX = SY-TABIX.
X_EVENTS-FORM = C_TOP_OF_PAGE.
MODIFY TB_EVENTS FROM X_EVENTS INDEX L_TABIX.
CLEAR X_EVENTS.
ENDIF.
ENDFORM. " RPT_GET_EVENTS
*& Form TOP_OF_PAGE
Top Of Page for the ALV format
FORM TOP_OF_PAGE.
REFRESH TB_COMMENTS.
For heading
CLEAR X_COMMENTS.
X_COMMENTS-TYP = C_H.
X_COMMENTS-INFO = 'D&B Credit Agency Interface'(019).
APPEND X_COMMENTS TO TB_COMMENTS.
This module outputs formatted simple header information at TOP-OF-PAGE
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = TB_COMMENTS.
ENDFORM. " TOP_OF_PAGE
*& Form RPT_GRID_DISPLAY
text
FORM RPT_GRID_DISPLAY.
Layout Settings
CLEAR X_LAYOUT.
X_LAYOUT-ZEBRA = 'X'.
X_LAYOUT-COLWIDTH_OPTIMIZE = C_X.
X_LAYOUT-NO_COLHEAD = SPACE.
To Display the Output in ALV Format
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_REPID
IS_LAYOUT = X_LAYOUT
IT_FIELDCAT = TB_FIELDCAT
IT_EVENTS = TB_EVENTS
TABLES
T_OUTTAB = TB_FINAL
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. " RPT_GRID_DISPLAY
*& Form SEND_EMAIL
text
--> p1 text
<-- p2 text
FORM SEND_EMAIL.
Prepare the mail
PERFORM SEND_MAIL USING C_INTERFACE.
Sending the mail to Receivers
PERFORM SENDING_MAIL.
ENDFORM. " SEND_EMAIL
*& Form SEND_MAIL
Sending the Mail
FORM SEND_MAIL USING P_C_INTERFACE TYPE YWFSALOFFICNOTIF-INTERFACE_ID.
Populating Report name
G_TITLE = C_TITLE.
PERFORM POPULATE_EMAIL_REF_DATA USING G_TITLE.
IF NOT G_REC_COUNT IS INITIAL.
To populate the data to table tb_objbin
PERFORM POPULATE_DATA_OBJBIN.
To get the attached file for the mail
CLEAR G_TAB_LINES.
DESCRIBE TABLE TB_OBJBIN LINES G_TAB_LINES.
TB_OBJHEAD = C_FILENAME.
APPEND TB_OBJHEAD.
CLEAR TB_OBJHEAD.
Creation of the entry for the mail
TB_OBJPACK-TRANSF_BIN = C_X.
TB_OBJPACK-HEAD_START = C_1.
TB_OBJPACK-HEAD_NUM = C_1.
TB_OBJPACK-BODY_START = C_1.
TB_OBJPACK-BODY_NUM = G_TAB_LINES.
TB_OBJPACK-DOC_TYPE = C_TXT.
TB_OBJPACK-OBJ_NAME = G_REPID.
TB_OBJPACK-OBJ_DESCR = 'Interface Audit Report'(020).
TB_OBJPACK-DOC_SIZE = G_TAB_LINES * 255.
APPEND TB_OBJPACK.
ENDIF.
ENDFORM. " SEND_MAIL
*& Form SENDING_MAIL
FORM SENDING_MAIL.
Function Module to send mail along with attached file
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = TB_DOC_CHNG
TABLES
PACKING_LIST = TB_OBJPACK
OBJECT_HEADER = TB_OBJHEAD
CONTENTS_BIN = TB_OBJBIN
CONTENTS_TXT = TB_OBJTXT
RECEIVERS = TB_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.
CASE SY-SUBRC.
WHEN 0.
MESSAGE S999 WITH 'Mail has been sucessfully sent'(029).
WHEN 1.
MESSAGE S999 WITH 'Too Many Parameters'(030).
WHEN 2.
MESSAGE S999 WITH 'Doc Could Not Be Sent'(031).
WHEN 4.
MESSAGE S999 WITH 'No Authority To Send'(032).
WHEN 99.
MESSAGE S999 WITH 'Error While Sending'(033).
ENDCASE.
ENDFORM. " SENDING_MAIL
*& Form POPULATE_EMAIL_REF_DATA
Poplulating the body of the mail
FORM POPULATE_EMAIL_REF_DATA USING TEXT TYPE SOLISTI1-LINE.
Setting up Mail Subject
TB_DOC_CHNG-OBJ_DESCR = 'Interface Audit Report'(020).
Populating body of the mail
TB_OBJTXT-LINE = 'Interface Audit Report'(020).
APPEND TB_OBJTXT.
CLEAR: TB_OBJTXT.
DESCRIBE TABLE TB_OBJTXT LINES G_TAB_LINES.
READ TABLE TB_OBJTXT INDEX G_TAB_LINES.
*To determine the document size
TB_DOC_CHNG-DOC_SIZE = ( G_TAB_LINES - 1 ) * 255 + STRLEN( TB_OBJTXT ).
Creation of the entry for the Mail Contents
CLEAR TB_OBJPACK-TRANSF_BIN.
TB_OBJPACK-HEAD_START = C_1.
TB_OBJPACK-HEAD_NUM = C_0.
TB_OBJPACK-BODY_START = C_1.
TB_OBJPACK-BODY_NUM = G_TAB_LINES.
TB_OBJPACK-DOC_TYPE = C_RAW.
APPEND TB_OBJPACK.
ENDFORM. " POPULATE_EMAIL_REF_DATA
*& Form POPULATE_DATA_OBJBIN
Populating table for file attachment -
How to send multiple customer statements by email using RFKORD11 program.
Hi All,
How to send multiple customer statements by email using RFKORD11 program. Is it possible?
As of now we copied the stanadard program and sending the customer statements by email, one by one.
if i execute the z program it will show the customer statement and send mail option.
if i click send mail it will send that customer statement to the corresponding customer.
then again i need to click back, it will show next customer statement and click on send mail.
Pl guide me, if any one worked on this program.
thanks in advance.
Regards,
MaheshTry execute the program in the background to see if that helps.
-
How to send multiple customer statements by email using RFKORD11
Hi All,
How to send multiple customer statements by email using RFKORD11 program.
As of now we copied the stanadard program and sending the customer statements by email, one by one.
if i execute the z program it will show the customer statement and send mail option.
if i click send mail it will send that customer statement to the corresponding customer.
then again i need to click back, it will show next customer statement and click on send mail.
Pl guide me, if any one worked on this program.
Regards,
MaheshHi .
You first need to copy that program to Z and make the changes in it. Can you convert sapscript to smartform?
then you can write a logic to send mail in the loop.
to send the pdf file
https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/mailsendthroughoutputcontrols
Regards,
Madhuri
Edited by: madhuri sonawane on Jun 10, 2009 4:20 PM -
Any idea how to send a downloaded document by email?
Any idea how to send a downloaded document by email from a MacBook Pro?
Solution may be found if you search in the "More Like This" section over in the right column.
-
How to send a SmartForm output as Email to external id?
I want the Smartform output to email to extrenal email-id.
I don't want the Smartform output as any kind of attachment, but the Smartform output needs to be shown on the main email body. Can anyone pls. help me out?First, thanks for your responses.
I haven't found the demo program 'BCS_EXAMPLE_6' in SAP 4.7. But then I got it in SAP 5.0 version. But this program only describes how to send Form output as PDF attachment with email. But this is well-known and I haven't asked for this. I want the Smartform output within the mail-body without attachment.
The weblog at "/people/pavan.bayyapu/blog/2005/08/30/sending-html-email-from-sap-crmerp seems a more logical one, though I have already tried it out. Here the html page creation and graphics load -- everything is going right. But this HTML page is being delivered as an Attachment within the email. The normal HTML Email is not coming. I think this technique wouldn't work with all mailing tools. Here in the weblog, Pavan has shown the example with Microsoft Outlook. But I have tested with Lotus Notes and Yahoo. And In both cases, the mail is coming with attached HTML file (in .mht format), but not as a notmal html mail without attachments. -
How to send short messages to specified email id
Hi,
I want to send alert messages to specified email id. For eg. i want send short message to my mail id [email protected] How to do this using labview. If you have any VIs, pls pass it to me. Thanks for replying to my earlier mails, shutdown.vi is working properly here.
Regards
Shivakumar SinghShivakumar,
Some thoughts:
I wanted to make sure you knew that you didn't have to change the SMTP Server name just to send e-mail to a Yahoo e-mail address. You can stick with your corporate SMTP server and send e-mail to any valid address, assuming your company firewall isn't configured to block e-mail to addresses outside the company.
If you changed the SMTP server name because you are now trying to send the e-mail from somewhere that doesn't have access to your corporate SMTP server, then there are several issues. First, any public SMTP server that doesn't require user authentication will instead do something else (like look at your IP address) to determine whether or not it will allow you to send the e-mail. Otherwise, spammers would saturate the server with SMTP requests for as long as it remained available.
Assuming you're trying to use a server that will allow you to use it, are you sure you got the right server name? You should double-check that.
Finally, it may be that your SMTP server requires user authentication. Yahoo's public ones certainly do; see the Yahoo Help Page on this (http://help.yahoo.com/help/us/mail/pop/pop-11.html). If this is the case, you may be able to use some alternative VIs created by Rolf Kalbermatter to get the job done, though you should be aware that it could be dangerous to do so. See this thread.
Regards,
John -
How to send meeting invites using Exchange Email Account
Does anybody know how to send meeting invitations using the 3.0 software update?
My corporate email is set up with an Exchange ActiveSync account, but I can't figure out how to send meeting invites?
Is it a function solely of the iPhone 3.0 OS, or is it dependent on the Exchange setup.
Any insight would be appreciated.
DavidThat is what I was afraid of...the good thing is that is the only feature (besides battery life) that I miss from my Blackberry. Thanks.
-
How To send SAP SCRIPT AS an email.
Hi,
Any one knows how to send sap script output to users in the form of an email.
Is there any other way to send it apart from sending the script output to spool and converting the spool to PDF and send that PDF to user?
It would it helpful for me if u can let me know any peace of code as an example for the same.
Message was edited by: NarasimhaHi,
This may be too late but here is a really easy way
Here is a snippet of code that will help you out.
You can use the OPEN_FORM of the SAPscript to have a device type of MAIL instead of PRINTER
Form OPEN_FORM
Open SAPscript form to send to user
FORM OPEN_FORM .
*--- Set recipient
GW_COMM_VALUES-ADSMTP-SMTP_ADDR = '[email protected]'.
*--- Set NAST details as these will not currently be set....
CLEAR GW_SNAST.
GW_SNAST-ANZAL = 1.
GW_TITLE = 'Mail Header Title'.
MOVE GW_TITLE TO GW_SNAST-TDCOVTITLE.
*--- Set sender and recipient details
CALL FUNCTION 'CONVERT_COMM_TYPE_DATA'
EXPORTING
PI_COMM_TYPE = 'INT'
PI_COMM_VALUES = GW_COMM_VALUES
PI_REPID = SY-REPID
PI_SNAST = GW_SNAST
PI_MAIL_SENDER = SY-UNAME
IMPORTING
PE_ITCPO = GW_ITCPO
PE_MAIL_RECIPIENT = GW_RECIPIENT
PE_MAIL_SENDER = GW_SENDER
EXCEPTIONS
COMM_TYPE_NOT_SUPPORTED = 1
RECIPIENT_CREATION_FAILED = 2
SENDER_CREATION_FAILED = 3
OTHERS = 4.
*--- Open SAPscript in MAIL mode for e-mailing
CALL FUNCTION 'OPEN_FORM'
EXPORTING
DEVICE = 'MAIL'
DIALOG = 'X'
FORM = SapScript Form Name
LANGUAGE = SY-LANGU
OPTIONS = GW_ITCPO
MAIL_SENDER = GW_SENDER
MAIL_RECIPIENT = GW_RECIPIENT
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
CODEPAGE = 11
OTHERS = 12.
When you have finished your SAPscript and call function CLOSE_FORM make sure you do a COMMI WORK after the call of this function.
You should then see the mail created in SOST.
Kind regards
Colin -
How to send a csv file by email in SSIS
Hi,
I need to create a SSIS package which creates a csv from sql table and send the same file by email. I have created the package but it thorws error saying the file does not exist in the send email task. For the first time the file will not be present but
the send email task expects the file to be present when executing itself. How to solve this issue?
PreethaIn Execution taks
/*you should map the shared folder to a drive letter*/
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'My Name',
@recipients = '[email protected]',
@subject = 'Error Log Count',
@file_attachments=N'F:\Testing.txt'
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
How to send file as attachment in Email in Oracle UCM
Hi All,
I have created a simple html form which executes my custom service( internally calls java method) to send a email "forms data" to the user. I need to send file as attchment in email so how i can do it in oracle ucm.Currently i am using intradoc api.I am using a jquery plugin for sending forms data including uploaded file.
function which i am using in java for sending emails:-
InternetFunctions.sendMailTo(emailStr, "MyMail", subject, this.m_service);
I have set method="post" and enctype="multipart/form-data" in the form
So plz help to provide a solution to send a file as attchment in email
Thanks,
user9018217From what I remember, there isn't an "out of the box" solution since InternetFunctions only provides some basic email functions (try decompiling the class to see what's available).
Here's the link for the original Stellent 10gR3 sample components: http://www.oracle.com/technetwork/middleware/content-management/index-092832.html. Take a look at the AcmeMail component within the HowTo Components sample. It shows how to create a custom idcservice that sends basic emails. You can use that as a baseline for creating your own email service and then use something like JavaMail to implement attachments. That's what I did.
Good luck, and please award points as necessary. -
How to send a SMARTFORM as an email ?
Hello,
How can we send a smart form as an email?
Please explain with an exmaple.
ANy proper explonation will be appreciated...
Have a great day!
Thanks & Regards,
Krishna ChaitanyaHi Krishna,
When you pass the values to the Smartform by using the Function Module name of the Smartform, it will return you thr OTF format of the Smartform in the Importing Parameter 'job_output_info'. The following code will help you regarding the mail sending part:
If you still need help, Please let me know.If helpfull reward me points.*
TYPES: BEGIN OF tp_lips,
vbeln LIKE lips-vbeln,
posnr LIKE lips-posnr,
matnr LIKE lips-matnr,
lfimg LIKE lips-lfimg,
vgbel LIKE lips-vgbel,
vgpos LIKE lips-vgpos,
uecha LIKE lips-uecha,
END OF tp_lips,
BEGIN OF tp_vbap,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
matnr LIKE vbap-matnr,
kbmeng LIKE vbap-kbmeng,
werks LIKE vbap-werks,
END OF tp_vbap,
BEGIN OF tp_lips_tmp ,
uecha LIKE lips-uecha,
vbeln LIKE lips-vbeln,
posnr LIKE lips-posnr,
matnr LIKE lips-matnr,
lfimg LIKE lips-lfimg,
vgbel LIKE lips-vgbel,
vgpos LIKE lips-vgpos,
END OF tp_lips_tmp,
BEGIN OF tp_lips_split ,
uecha LIKE lips-uecha,
vbeln LIKE lips-vbeln,
posnr LIKE lips-posnr,
matnr LIKE lips-matnr,
lfimg LIKE lips-lfimg,
vgbel LIKE lips-vgbel,
vgpos LIKE lips-vgpos,
END OF tp_lips_split.
CONSTANTS : c_5(1) TYPE c VALUE '5',
c_otf(3) TYPE c VALUE 'OTF',
c_printer(7) TYPE c VALUE 'PRINTER',
c_x(1) TYPE c VALUE 'X',
c_pdf(3) TYPE c VALUE 'PDF',
c_o(1) TYPE c VALUE 'O',
c_mail(5) TYPE c VALUE 'EMAIL' ,
c_e TYPE so_escape VALUE 'E',
c_int TYPE tddevice VALUE 'INT' ,
c_ext(3) TYPE c VALUE 'EXT',
c_raw(3) TYPE c VALUE 'RAW',
c_b LIKE soos1-recesc VALUE 'B'.
DATA: ls_print_data_to_read TYPE ledlv_print_data_to_read.
DATA: ls_dlv_delnote TYPE ledlv_delnote.
DATA: lf_fm_name TYPE rs38l_fnam.
DATA: ls_control_param TYPE ssfctrlop.
DATA: ls_composer_param TYPE ssfcompop.
DATA: ls_recipient TYPE swotobjid.
DATA: ls_sender TYPE swotobjid.
DATA: lf_formname TYPE tdsfname.
DATA: ls_addr_key LIKE addr_key.
DATA: l_w_object_hd_change TYPE sood1,
l_w_header LIKE sood1-objdes.
*--Binary Data
DATA: BEGIN OF l_t_solix OCCURS 0.
INCLUDE STRUCTURE solix.
DATA: END OF l_t_solix.
*--Content to be mailed
DATA: BEGIN OF l_t_objcont OCCURS 0.
INCLUDE STRUCTURE soli.
DATA: END OF l_t_objcont.
*--PDF Data
DATA: BEGIN OF l_t_htline OCCURS 10.
INCLUDE STRUCTURE tline.
DATA: END OF l_t_htline.
DATA: BEGIN OF l_t_object_hd_change.
INCLUDE STRUCTURE sood1.
DATA: END OF l_t_object_hd_change.
*-- Recipient table with send attributes
DATA: BEGIN OF l_t_receivers OCCURS 0.
INCLUDE STRUCTURE soos1.
DATA: END OF l_t_receivers.
DATA: BEGIN OF l_t_objhead OCCURS 0.
INCLUDE STRUCTURE soli.
DATA: END OF l_t_objhead.
DATA: l_t_lips TYPE tp_lips OCCURS 0 WITH HEADER LINE,
l_t_vbap TYPE tp_vbap OCCURS 0 WITH HEADER LINE,
l_t_lips_tmp TYPE tp_lips_tmp OCCURS 0 WITH HEADER LINE,
l_t_lips_split TYPE tp_lips_split OCCURS 0 WITH HEADER LINE.
DATA : l_v_document_number TYPE likp-vbeln,
l_t_ssfcrespd TYPE ssfcrespd,
l_t_ssfcrescl TYPE ssfcrescl,
l_t_ssfcresop TYPE ssfcresop,
l_v_adrnr TYPE kna1-adrnr,
l_v_ls_address TYPE szadr_addr1_complete,
w_ls_adsmtpline TYPE szadr_adsmtp_line,
l_v_mail LIKE adr6-smtp_addr,
l_t_otf LIKE itcoo OCCURS 0,
l_v_hformat(10) TYPE c,
l_v_ld_binfile TYPE xstring,
l_v_doc_size TYPE i,
l_v_i TYPE i,
l_v_n TYPE i,
l_v_hkora(50) TYPE c,
w_soli TYPE soli,
w_solix TYPE solix,
l_v_var1(46) TYPE c ,
l_v_linecount TYPE p,
l_v_sent_to_all LIKE sonv-flag,
l_v_document_type LIKE soodk-objtp,
l_v_horiginator LIKE soos1-recextnam ,
l_w_lips TYPE tp_lips,
l_w_vbap TYPE tp_vbap,
l_v_avl_date TYPE erdat,
l_f_oos_status TYPE flag,
l_lfimg LIKE lips-lfimg.
l_v_document_number = nast-objky.
*--To get the smartform name
lf_formname = tnapr-sform.
*-- Determine print data
PERFORM set_print_data_to_read USING lf_formname
CHANGING ls_print_data_to_read
cf_retcode.
IF cf_retcode = 0.
*--select print data
PERFORM get_data USING ls_print_data_to_read
CHANGING ls_addr_key
ls_dlv_delnote
cf_retcode.
ENDIF.
*-- Begin of Insertion AG2K946177 Scan - Avail date
CLEAR: l_t_lips,
l_t_vbap.
*-- Get the items from the delivery table
SELECT vbeln posnr matnr lfimg vgbel vgpos uecha FROM lips INTO TABLE l_t_lips
WHERE vbeln = nast-objky.
IF sy-subrc = 0.
IF NOT l_t_lips[] IS INITIAL.
*-- Get the items from the order table
SELECT vbeln posnr matnr kbmeng werks FROM vbap INTO TABLE l_t_vbap
FOR ALL ENTRIES IN l_t_lips
WHERE vbeln = l_t_lips-vgbel AND
posnr = l_t_lips-vgpos.
IF sy-subrc = 0.
LOOP AT l_t_lips.
MOVE l_t_lips-vbeln TO l_t_lips_tmp-vbeln.
MOVE l_t_lips-posnr TO l_t_lips_tmp-posnr.
MOVE l_t_lips-matnr TO l_t_lips_tmp-matnr.
MOVE l_t_lips-lfimg TO l_t_lips_tmp-lfimg.
MOVE l_t_lips-vgbel TO l_t_lips_tmp-vgbel.
MOVE l_t_lips-vgpos TO l_t_lips_tmp-vgpos.
MOVE l_t_lips-uecha TO l_t_lips_tmp-uecha.
APPEND l_t_lips_tmp.
CLEAR l_t_lips_tmp.
ENDLOOP.
LOOP AT l_t_lips INTO l_w_lips where uecha is INITIAL.
CLEAR: l_lfimg.
LOOP AT l_t_lips_tmp WHERE uecha = l_w_lips-posnr.
MOVE l_t_lips_tmp-vbeln TO l_t_lips_split-vbeln.
MOVE l_t_lips_tmp-uecha TO l_t_lips_split-uecha.
MOVE l_t_lips_tmp-posnr TO l_t_lips_split-posnr.
MOVE l_t_lips_tmp-matnr TO l_t_lips_split-matnr.
MOVE l_t_lips_tmp-vgbel TO l_t_lips_split-vgbel.
MOVE l_t_lips_tmp-vgpos TO l_t_lips_split-vgpos.
l_lfimg = l_lfimg + l_t_lips_tmp-lfimg.
AT END OF uecha.
l_t_lips_split-lfimg = l_lfimg.
APPEND l_t_lips_split.
CLEAR l_t_lips_split.
ENDAT.
ENDLOOP.
READ TABLE l_t_lips_split WITH KEY uecha = l_w_lips-posnr.
IF sy-subrc = 0 .
READ TABLE l_t_vbap INTO l_w_vbap WITH KEY vbeln = l_w_lips-vgbel
posnr = l_w_lips-vgpos.
IF sy-subrc = 0.
IF l_t_lips_split-lfimg LT l_w_vbap-kbmeng.
SELECT SINGLE avl_dat FROM /mars/ou_avl_dat INTO l_v_avl_date
WHERE werks = l_w_vbap-werks AND
matnr = l_w_vbap-matnr.
IF sy-subrc = 0.
IF l_v_avl_date IS INITIAL OR l_v_avl_date < sy-datum.
l_f_oos_status = c_x.
t_objcont-line = l_w_vbap-matnr.
APPEND t_objcont.
CLEAR t_objcont.
ENDIF.
ELSE.
l_f_oos_status = c_x.
t_objcont-line = l_w_vbap-matnr.
APPEND t_objcont.
CLEAR t_objcont.
ENDIF.
ENDIF.
ENDIF.
ELSE.
READ TABLE l_t_vbap INTO l_w_vbap WITH KEY vbeln = l_w_lips-vgbel
posnr = l_w_lips-vgpos.
IF sy-subrc = 0.
IF l_t_lips-lfimg LT l_w_vbap-kbmeng.
SELECT SINGLE avl_dat FROM /mars/ou_avl_dat INTO l_v_avl_date
WHERE werks = l_w_vbap-werks AND
matnr = l_w_vbap-matnr.
IF sy-subrc = 0.
IF l_v_avl_date IS INITIAL OR l_v_avl_date < sy-datum.
l_f_oos_status = c_x.
t_objcont-line = l_w_vbap-matnr.
APPEND t_objcont.
CLEAR t_objcont.
ENDIF.
ELSE.
l_f_oos_status = c_x.
t_objcont-line = l_w_vbap-matnr.
APPEND t_objcont.
CLEAR t_objcont.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
IF l_f_oos_status NE c_x.
*-- End of Insertion AG2K946177 Scan - Avail date
*-- Begin of Insertion AG2K942430 Delivery Note
IF cf_retcode = 0.
IF nast-nacha NE c_5.
*-- End of Insertion AG2K942430 Delivery Note
PERFORM set_print_param USING ls_addr_key
CHANGING ls_control_param
ls_composer_param
ls_recipient
ls_sender
cf_retcode.
ls_control_param-no_dialog = space .
*-- Begin of Insertion AG2K942430 Delivery Note
ELSEIF nast-nacha EQ c_5.
SELECT SINGLE adrnr FROM kna1 INTO l_v_adrnr WHERE kunnr = nast-parnr.
IF sy-subrc = 0.
CLEAR l_v_ls_address.
-- To get the address Details
CALL FUNCTION 'ADDR_GET_COMPLETE'
EXPORTING
addrnumber = l_v_adrnr
IMPORTING
addr1_complete = l_v_ls_address
EXCEPTIONS
OTHERS = 5.
IF sy-subrc = 0.
LOOP AT l_v_ls_address-adsmtp_tab INTO w_ls_adsmtpline
WHERE date_from <= sy-datlo.
IF ( NOT w_ls_adsmtpline-adsmtp-smtp_addr IS INITIAL ).
*--Email Address
l_v_mail = w_ls_adsmtpline-adsmtp-smtp_addr.
ENDIF.
ENDLOOP.
ENDIF.
*--To fill the control paramters for Email
IF NOT l_v_mail IS INITIAL AND nast-nacha EQ c_5.
ls_control_param-device = c_printer.
ls_control_param-no_dialog = c_x.
ls_control_param-langu = sy-langu.
ls_control_param-preview = space.
ls_control_param-getotf = c_x.
*--Setting LS_COMPOSER_PARAM values
ls_composer_param-tddest = nast-ldest.
ls_composer_param-tdimmed = space.
ls_composer_param-tdnoprev = c_x.
ls_composer_param-faxformat = c_otf.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
*-- End of Insertion AG2K942430 Delivery Note
IF cf_retcode = 0.
*-- Determine smartform function module for delivery note
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = lf_formname
IMPORTING
fm_name = lf_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
*-- Error handling
cf_retcode = sy-subrc.
PERFORM protocol_update.
ENDIF.
ENDIF.
IF cf_retcode = 0.
*-- Call smartform delivery note
CALL FUNCTION lf_fm_name
EXPORTING
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = ls_control_param
mail_recipient = ls_recipient
mail_sender = ls_sender
output_options = ls_composer_param
user_settings = space
is_dlv_delnote = ls_dlv_delnote
is_nast = nast
*-- Begin of Insertion AG2K942430 Delivery Note
IMPORTING
document_output_info = l_t_ssfcrespd
job_output_info = l_t_ssfcrescl
job_output_options = l_t_ssfcresop
*-- End of Insertion AG2K942430 Delivery Note
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
*-- Error handling
cf_retcode = sy-subrc.
PERFORM protocol_update.
*-- Get SmartForm protocol and store it in the NAST protocoll
PERFORM add_smfrm_prot.
ENDIF.
ENDIF.
*-- Begin of Insertion AG2K942430 Delivery Note
IF nast-nacha EQ c_5.
IF NOT l_t_ssfcrescl-otfdata[] IS INITIAL .
MOVE l_t_ssfcrescl-otfdata[] TO l_t_otf[].
ENDIF.
IF NOT l_t_otf[] IS INITIAL.
IF l_v_hformat IS INITIAL.
l_v_hformat = c_pdf.
ENDIF.
CLEAR l_t_htline.
REFRESH l_t_htline.
*-- Convert OTF Data to PDF Data
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = l_v_hformat
IMPORTING
bin_filesize = l_v_doc_size
bin_file = l_v_ld_binfile
TABLES
otf = l_t_otf
lines = l_t_htline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc = 0.
CLEAR l_t_solix.
REFRESH l_t_solix.
CLEAR l_t_objcont.
REFRESH l_t_objcont.
l_v_i = 0.
l_v_n = XSTRLEN( l_v_ld_binfile ).
WHILE l_v_i < l_v_n.
l_t_solix-line = l_v_ld_binfile+l_v_i.
APPEND l_t_solix.
CLEAR l_t_solix.
l_v_i = l_v_i + 255.
ENDWHILE.
FIELD-SYMBOLS: <ptr_hex> TYPE solix.
LOOP AT l_t_solix INTO w_solix.
CLEAR w_soli.
ASSIGN w_soli TO <ptr_hex> CASTING.
MOVE w_solix TO <ptr_hex>.
APPEND w_soli TO l_t_objcont.
ENDLOOP.
IF l_v_hformat = c_pdf.
*--Do nothing
ELSE.
CLEAR l_t_objcont.
REFRESH l_t_objcont.
LOOP AT l_t_htline.
l_t_objcont = l_t_htline.
APPEND l_t_objcont.
CLEAR l_t_htline.
ENDLOOP.
ENDIF.
ENDIF.
*--To Suppress zero's
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = l_v_document_number
IMPORTING
output = l_v_document_number.
CONCATENATE text-001 l_v_document_number INTO l_v_var1 SEPARATED BY space.
l_v_hkora = l_v_var1.
CLEAR l_t_object_hd_change.
l_t_object_hd_change-objnam = c_mail.
l_t_object_hd_change-objdes = l_v_hkora.
l_t_object_hd_change-objla = sy-langu.
l_t_object_hd_change-objsns = c_o.
l_t_object_hd_change-objlen = l_v_doc_size .
IF l_v_hformat = c_pdf.
l_t_object_hd_change-file_ext = c_pdf.
ENDIF.
CLEAR l_t_receivers.
REFRESH l_t_receivers.
l_t_receivers-recextnam = l_v_mail.
l_t_receivers-recesc = c_e.
l_t_receivers-sndart = c_int.
APPEND l_t_receivers.
CLEAR l_t_receivers.
DESCRIBE TABLE l_t_objcont LINES l_v_linecount.
CLEAR l_t_objhead.
REFRESH l_t_objhead.
IF l_v_hformat = c_pdf.
l_v_document_type = c_ext.
ELSE.
l_v_document_type = c_raw.
l_t_objhead = l_v_linecount.
APPEND l_t_objhead.
CLEAR l_t_objhead.
ENDIF.
l_v_horiginator = sy-uname.
*--Sending the PDF data as Email attachment
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = l_t_object_hd_change
object_type = l_v_document_type
originator = l_v_horiginator
originator_type = c_b
IMPORTING
sent_to_all = l_v_sent_to_all
TABLES
objcont = l_t_objcont
objhead = l_t_objhead
receivers = l_t_receivers
EXCEPTIONS
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
folder_not_exist = 4
folder_no_authorization = 5
forwarder_not_exist = 6
note_not_exist = 7
object_not_exist = 8
object_not_sent = 9
object_no_authorization = 10
object_type_not_exist = 11
operation_no_authorization = 12
owner_not_exist = 13
parameter_error = 14
substitute_not_active = 15
substitute_not_defined = 16
system_failure = 17
too_much_receivers = 18
user_not_exist = 19
originator_not_exist = 20
x_error = 21
OTHERS = 22.
IF sy-subrc = 0.
COMMIT WORK AND WAIT.
ENDIF.
ENDIF.
ENDIF.
*-- End of Insertion AG2K942430 Delivery Note
*-- Begin of Insertion AG2K946177 Scan - Avail date
ELSE.
*-- Get the details for sending the email
PERFORM get_details TABLES t_objparb
t_receivers
CHANGING v_obj_type
v_owner
v_sender
w_object_hd_change.
*-- Sending Email
PERFORM send_email.
ENDIF.
*-- End of Insertion AG2K946177 Scan - Avail date
ENDFORM. "PROCESSING
*-- Begin of Insertion AG2K946177 Scan - Avail date
*& Form get_details
Get details for Sending Email
-->P_T_OBJPARB Parameter for Dialog Modules
-->P_T_RECEIVERS recipient with attributes
<--P_V_OBJ_TYPE Code for document class
<--P_V_OWNER Owner
<--P_V_SENDER Sender
<--P_W_OBJECT_HD_CHANGE object definition, change attributes
FORM get_details TABLES p_t_objparb STRUCTURE t_objparb
p_t_receivers STRUCTURE t_receivers
CHANGING p_v_obj_type
p_v_owner
p_v_sender
p_w_object_hd_change.
CONSTANTS: c_colon(1) TYPE c VALUE ':'.
DATA:
*-- To Get the Entry from ZZOURULE
BEGIN OF l_w_zzourule,
zzvalue1_1 LIKE zzourule-zzvalue1_1,
zzvalue2_1 LIKE zzourule-zzvalue2_1,
zzvalue3_1 LIKE zzourule-zzvalue3_1,
END OF l_w_zzourule,
*-- To get the entry from sofd
BEGIN OF l_w_sofd,
foltp LIKE sofd-foltp,
folyr LIKE sofd-folyr,
folno LIKE sofd-folno,
END OF l_w_sofd,
*-- To get the entry from sofm
BEGIN OF l_w_sofm,
foltp LIKE sofm-foltp,
folyr LIKE sofm-folyr,
folno LIKE sofm-folno,
doctp LIKE sofm-doctp,
docyr LIKE sofm-docyr,
docno LIKE sofm-docno,
END OF l_w_sofm,
BEGIN OF l_w_swotobjid,
logsys LIKE swotobjid-logsys,
objtype LIKE swotobjid-objtype,
objkey LIKE swotobjid-objkey,
END OF l_w_swotobjid.
DATA: l_w_header LIKE sood1-objdes.
*-- Fill exporting parameters of FM SO_OBJECT_SEND
CONCATENATE text-004 nast-objky c_colon text-002 INTO l_w_header SEPARATED BY space.
l_w_header = text-002.
w_object_hd_change-objla = sy-langu.
w_object_hd_change-objnam = c_notify.
w_object_hd_change-objdes = l_w_header.
v_obj_type = c_raw.
v_owner = sy-uname.
v_sender = sy-uname.
t_objparb-name = c_wi_id.
APPEND t_objparb.
CLEAR t_objparb.
t_objparb-name = text-003.
t_objparb-value = sy-datum.
APPEND t_objparb.
CLEAR t_objparb.
*-- Get the folder Name from the ZZOURULE table
SELECT zzvalue1_1 zzvalue2_1 zzvalue3_1
FROM zzourule INTO l_w_zzourule UP TO 1 ROWS
WHERE zzprog = sy-repid AND
zzdata = c_oos.
ENDSELECT.
IF sy-subrc = 0.
SELECT foltp folyr folno
FROM sofd INTO l_w_sofd UP TO 1 ROWS
WHERE objnam = l_w_zzourule-zzvalue1_1 AND
folrg = c_q.
ENDSELECT.
IF sy-subrc = 0.
SELECT foltp folyr folno doctp docyr docno
FROM sofm INTO l_w_sofm UP TO 1 ROWS
WHERE doctp = l_w_sofd-foltp AND
docyr = l_w_sofd-folyr AND
docno = l_w_sofd-folno.
ENDSELECT.
IF sy-subrc = 0.
CLEAR t_receivers.
MOVE l_w_zzourule-zzvalue1_1 TO t_receivers-recnam.
*-- C means Shared distribution List
MOVE c_c TO t_receivers-recesc.
APPEND t_receivers.
CLEAR t_receivers.
l_w_swotobjid-logsys = l_w_zzourule-zzvalue2_1.
l_w_swotobjid-objtype = l_w_zzourule-zzvalue3_1.
CONCATENATE l_w_sofm-foltp
l_w_sofm-folyr
l_w_sofm-folno
l_w_sofm-doctp
l_w_sofm-docyr
l_w_sofm-docno INTO l_w_swotobjid-objkey.
t_receivers-recextnam = l_w_swotobjid.
*-- J means external Object
MOVE c_j TO t_receivers-recesc.
APPEND t_receivers.
CLEAR t_receivers.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " get_details
*& Form send_email
Sending Email
FORM send_email .
*-- Email send to the receipent maintained in the shared folder
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = w_object_hd_change
object_type = v_obj_type
owner = v_owner
sender = v_sender
IMPORTING
object_id_new = w_object_id_new
sent_to_all = v_sent_to_all
TABLES
objcont = t_objcont
objhead = t_objhead
objparb = t_objparb
receivers = t_receivers
EXCEPTIONS
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
folder_not_exist = 4
folder_no_authorization = 5
forwarder_not_exist = 6
note_not_exist = 7
object_not_exist = 8
object_not_sent = 9
object_no_authorization = 10
object_type_not_exist = 11
operation_no_authorization = 12
owner_not_exist = 13
parameter_error = 14
substitute_not_active = 15
substitute_not_defined = 16
system_failure = 17
too_much_receivers = 18
user_not_exist = 19
x_error = 20
OTHERS = 21.
ENDFORM. " send_email
*-- End of Insertion AG2K946177 Scan - Avail date -
How to send Smartform and Script in email?
hi myself Devendra,
i ve some queries....regarding the Script and Smartform.
1- Can any body tell me how to send Script as well as Smartform layout in mail output.
I ve created script and smartform for the PO confirmation.
2- If i want to send both script and smartform layout of the PO, whenever created,automatically to the Vendor,then what i ve to do.Hey,
REPORT zemail_gm.
*********Variable Declarations *****************************
DATA: gv_form_name TYPE rs38l_fnam, " Used to store the function module generated by Smartform
gv_bin_filesize TYPE i, " Store the file size
gv_pos TYPE i,
gv_len TYPE i,
gv_tab_lines TYPE i.
********Constants *******************************************
Data : gc_text(11) type c value 'Form Output',
gc_tst(3) type c value 'TST',
gc_testing(7) type c value 'Testing'.
*********Work Area Declarations *****************************
DATA: gs_docdata TYPE sodocchgi1, " Data of an object which can be changed
gs_ctrlop TYPE ssfctrlop, " Smart Forms: Control structure
gs_outopt TYPE ssfcompop, " SAP Smart Forms: Smart Composer (transfer) options
gs_otfdata TYPE ssfcrescl, " Smart Forms: Return value at end of form printing
gs_reclist TYPE somlreci1, " SAPoffice: Structure of the API Recipient List
gs_pdf_tab TYPE tline, " Workarea for SAP Script Text Lines
gs_objbin TYPE solisti1, " SAPoffice: Single List with Column Length 255
gs_objpack TYPE sopcklsti1. " SAPoffice: Description of Imported Object Components
*********Internal tables Declarations *****************************
DATA: gt_reclist TYPE TABLE OF somlreci1, " SAPoffice: Structure of the API Recipient List
gt_pdf_tab TYPE TABLE OF tline, " SAPscript: Text Lines
gt_otf TYPE TABLE OF itcoo, " OTF Structure
gt_objbin TYPE TABLE OF solisti1, " SAPoffice: Single List with Column Length 255
gt_objpack TYPE TABLE OF sopcklsti1. " SAPoffice: Description of Imported Object Components
CLEAR : gv_form_name,
gs_ctrlop,
gs_outopt,
gs_otfdata,
gv_bin_filesize,
gv_pos,
gv_len,
gv_tab_lines.
START-OF-SELECTION.
Generate Function Module name
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZPDF_G'
IMPORTING
fm_name = gv_form_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Assigning values to Form Control Structure and Form Composer
gs_ctrlop-getotf = 'X'.
gs_ctrlop-no_dialog = 'X'.
gs_outopt-tdnoprev = 'X'.
Getting the OTFDATA
CALL FUNCTION gv_form_name
EXPORTING
control_parameters = gs_ctrlop
output_options = gs_outopt
user_settings = 'X'
IMPORTING
job_output_info = gs_otfdata
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Assigning the OTFDATA to OTF Structure table
CLEAR gt_otf.
gt_otf] = gs_otfdata-otfdata[.
Convert the OTF DATA to SAP Script Text lines
CLEAR gt_pdf_tab.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = gv_bin_filesize
TABLES
otf = gt_otf
lines = gt_pdf_tab
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Assigning the Description of the object sent in the mail
CLEAR gs_docdata.
gs_docdata-obj_name = gc_tst.
gs_docdata-obj_descr = gc_testing.
Assigning the email id to Structure of the API Recipient List table
CLEAR : gt_reclist, gs_reclist.
gs_reclist-receiver = '<give the mail id of the receiver'.
gs_reclist-rec_type = 'U'.
APPEND gs_reclist TO gt_reclist.
Passing the SAP Script text lines to SAPoffice: Single List with Column Length 255 table
CLEAR : gs_objbin, gs_pdf_tab.
LOOP AT gt_pdf_tab INTO gs_pdf_tab.
gv_pos = 255 - gv_len.
IF gv_pos > 134. "length of pdf_table
gv_pos = 134.
ENDIF.
gs_objbin+gv_len = gs_pdf_tab(gv_pos).
gv_len = gv_len + gv_pos.
IF gv_len = 255. "length of out (contents_bin)
APPEND gs_objbin TO gt_objbin.
CLEAR: gs_objbin, gv_len.
IF gv_pos < 134.
gs_objbin = gs_pdf_tab+gv_pos.
gv_len = 134 - gv_pos.
ENDIF.
ENDIF.
ENDLOOP.
IF gv_len > 0.
APPEND gs_objbin TO gt_objbin.
ENDIF.
Filling the details in SAPoffice: Description of Imported Object Components table
DESCRIBE TABLE gt_objbin LINES gv_tab_lines.
CLEAR gs_objbin.
READ TABLE gt_objbin INTO gs_objbin INDEX gv_tab_lines.
IF sy-subrc = 0.
gs_objpack-doc_size = ( gv_tab_lines - 1 ) * 255 + STRLEN( gs_objbin ).
gs_objpack-transf_bin = 'X'.
gs_objpack-head_start = 1.
gs_objpack-head_num = 0.
gs_objpack-body_start = 1.
gs_objpack-body_num = gv_tab_lines.
gs_objpack-doc_type = 'PDF'.
gs_objpack-obj_name = 'ATTACHMENT'.
gs_objpack-obj_descr = 'test'.
APPEND gs_objpack TO gt_objpack.
ENDIF.
Sending the Form Output in the PDF format to email
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = gs_docdata
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = gt_objpack
contents_bin = gt_objbin
receivers = gt_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.
ELSE.
WRITE 'Sent Successfully'.
ENDIF.
SUBMIT rsconn01
WITH mode EQ 'INT'
AND RETURN.
END-OF-SELECTION.Regards,
Midhun Abraham
Edited by: Midhun Abraham on Oct 12, 2008 4:06 AM -
How to send the Layout as an email..?
Hi,
I have a layout. How to send the output of the layout as an email..? Is it something that needs to be done in the layout(SE71) or do we need to write any coding in the print program..? I mean, calling any function module kind of things.
Or do we need to maintain some settings in SE71 itself..?
Please provide your inputs. Thanks in advance.
Thanks & Regards,
Paddu.hi,
if u want to send the layout, n the other person also need to open it in se71 only, then simply download ur layout, send that file in email. then the other person can upload it n can open in se71.
to download the layout, just execute the program RSTXSCRP, there give ur script name, then it downloads.
hope this may slove ur problem.
reward if helpful.
Maybe you are looking for
-
TS1369 iPod Classic suddenly not being recognized in iTunes on MacBook Pro
I just got a new MacBook Pro a few weeks ago, and have had no issues connecting my iPod Classic to it via iTunes. Yesterday, however, my iPod stopped registering in iTunes. I checked in the System Reports on my MacBook, and I can see that the USB Hub
-
Why can't I create a ringtone from my music on iTunes?
I have just been looking at the instructions for making a 30 second ring tone from my music collection. The option doesn't seem available to me and the advice states 'Ringtones are only available for purchase from the U.S. iTunes Store.' So if I'm ba
-
Hi gurus this is my post in sdn. i am sending one scenario can anyone sugest me in detail company wants to launch new product . so company wants to give 2 % discount for first 100 customers. so how wil i configure regards, uttam
-
Calling a html page deployed in weblogic server using RequestDispatcher
Hi All, I want to call a HTML page from a java page using requestdispatcher. The whole application is deployed in Weblogic server.I have used the below syntax to call the page from any machine.. ServletContext sc = getServletContext(); RequestDi
-
I am using Photoshop as external editor but can't use all the filters
Hi, I have just started using Aperture and have set-up photoshop CS2 as the external editor. I'm trying to add film grain to some of my images using the artistic filters. If I open one of my RAW (EOS 5D) images in Bridge once open in CS2 all the filt