Common system variables:
SY-SUBRC execution status
SY-DATUM server date
SY-UZEIT server time
The number of SY-INDEX loops (do while)
Index of the inner table currently processed by the SY-TABIX
SY-LINSZ current report width
SY-UNAME Username
SY-TCODE current transaction code
SY-LANGU current login Language
SY-BATCH background program running
Number of the current screen of the SY-DYNNR
SY-LINCT current report length
SY-LSIND List index page
Index of a list on the SY-LISTI
Row number of the row selected in the SY-LILLI absolute list
SY-CUCOL screen, horizontal cursor position for Pai
SY-CUROW screen, Vertical cursor position for Pai
Current display page of The SY-CPAGE list
SY-STARO real line number
SY-LISEL selects the content of the row, Length: 255
SY-LINNO current row
SY-PAGNO current page number
Variable name of the SY-SLSET selection screen
SY-MSGID message, message class
SY-MSGTY message, Message Type
SY-MSGNO message, message number
SY-MSGV1 message, message variable 1
SY-MSGV2 message, message variable 2
SY-MSGV3 message, message variable 3
SY-MSGV4 message, message variable 4
SY-VLINE vertical line
SY-ULINE horizontal line
SY-ABCDE constant, A-Z alphabet
SY-UCOMM screen, Pai-triggered Function Code
Common system functions
21. Shift string: Left shift string. Length minus 1.
22 concatenate character merge
23. Split: Split the string.
24. Search: query string.
25. Replace: Replace the string.
26. Condense: Delete unnecessary spaces.
27. Translate: Convert the character format. For example, convert 'abc' to 'abc'
28. convert text: Create a sortable string.
29. Overlay: overlay another string with one string.
30. strlen: String Length.
31. Abs: Take the absolute value.
32. Cos, sin, and Tan: trigonometric function value.
33. ACOs, asin, and atan: inverse trigonometric function.
34. cosh, Sinh, And Tanh: hyperbolic functions.
35. Exp: power function of E.
36. Log: The base number is the logarithm of E.
37. log10: The base number is the logarithm of 10.
38. SQRT: square root.
39. Sign: return the parameter symbol.
40. trunc: return the integer part of the parameter.
41. frac: fractional part of the input parameter.
42. Ceil: return the smallest integer not less than the parameter.
43. Floor: return the smallest integer not greater than the Parameter
Ws_download: The method for downloading a table to a local file may be efficient without classes.
Rp_last_day_of_months: the last day of the month.
Unit_conversion_simple: unit conversion
Ws_filename_get: Method of calling open dialog
C14b_add_time: add time to a certain day of the year
Bapi_currency_conv_to_internal: Convert the currency to an internal storage value.
Bapi_currency_conv_to_external: Convert the currency to an external storage value.
Conversion_exit_alpha_output: removes all the first 0 digits.
Numeric_check: determines whether it is a number.
Spell_amount: converts a number into text
Tmp_gui_file_open_dialog
Alsm_excel_to_internal_table Excel Data to internal table
Cats_numeric_input_check: Numeric check
Sy-index: Number of times the unconditional loop is performed.
Sy-subrc: return value after system execution. If it is 0, it indicates success; otherwise, it indicates failure.
Sy-fdpos: Position of the substring in the source string.
Sy-uzeit: gets the system time.
Sy-Datum: gets the system date.
Shift string: Left-shift string. Length minus 1.
Concatenate: connection string.
Split: Split string.
Search: query string.
Replace: Replace the string.
Condense: Remove unnecessary spaces.
Translate: Convert the character format. For example, convert 'abc' to 'abc'
Convert text: Creates a sorted string.
Overlay: overwrites another string with one string.
Strlen: String Length.
ABS: obtains the absolute value.
Cos, sin, Tan: returns the trigonometric value.
ACOs, asin, and atan: inverse trigonometric function.
Cosh, Sinh, And Tanh: hyperbolic functions.
Exp: power function of E.
Log: base number is the logarithm of E.
Log10: The base number is the logarithm of 10.
SQRT: square root.
Sign: returns the parameter symbol.
Trunc: return the integer part of the parameter.
Frac: fractional part of the input parameter.
Ceil: return the smallest integer not less than the parameter.
Floor: return the minimum integer not greater than the parameter.
Function Name Description
Conversion_exit_alpha_input
Conversion_exit_alpha_output minus 0
Conversion_exit_matn1_input
Conversion_exit_matn1_output minus 0
Last_day_of_months
Co_sf_caufvd_get query Order title and project by ticket number
Send an email outside so_new_document_att_send_api1
View_maintenance_call
So_object_send external mail
Function Name
Conversion_exit_alpha_input
Function: Add 0 before the item number,
Instance:
Call function 'conversion _ exit_alpha_input '"add 0 before the item"
Exporting
Input = matnr_in
Importing
Output = matnr_out.
Note: 1) numbers must be filled with 0 in the table and will not be generated automatically. The primary number will be automatically filled with 0.
2) Only 'character type' can be used'
Conversion_exit_matn1_input
Function: Add 0 before the item number
Instance:
Call function 'conversion _ exit_matn1_input '"fill 0 before the part number"
Exporting
Input = matnr_in
Importing
Output = matnr_out
Exceptions
Length_error = 1
Others = 2.
Note: 1) numbers must be filled with 0 in the table and will not be generated automatically. The primary number will be automatically filled with 0.
2) It can only be used for number conversion.
Conversion_exit_alpha_output
Function: Go to 0 before the item number
Instance:
Call function 'conversion _ exit_alpha_output '"To go to 0 before the item number.
Exporting
Input = wa_ysy1-matnr
Importing
Output = wa_ysy1-matnr.
Note:
Conversion_exit_matn1_output
Function: Go to 0 before the item number
Instance:
Call function 'conversion _ exit_matn1_output'
Exporting
Input = t_afpo-matnr
Importing
Output = t_afpo-matnr
Exceptions
Others = 1.
Note:
Last_day_of_months
Function: query the last day of a specified date in the current month.
Call function 'last _ day_of_months'
Exporting
Day_in = f_date "the type of any day of the month must be D (to complete the date ##
Importing
Last_day_of_month = p_date "the type of the last day of the month must be d (complete date)
Exceptions
Day_in_no_date = 1
Others = 2.
Note:
Co_sf_caufvd_get
Function: Query order headers and projects by ticket number
Instance:
Data: wa_caufvd type caufvd.
Call function 'co _ sf_caufvd_get '"to get the order title and Project
Exporting
Aufnr_imp = aufnr
Importing
Caufvd_exp = wa_caufvd "Order header and project structure
Exceptions
Not_found = 1
Others = 2.
Note:
So_new_document_att_send_api1
Function: Send sapoffice: Send new document with attachments using RFC
Instance:
Form email_itab. "email content"
Write: 'number' to email_itab-line + 0 (3), "255 length text fields: Text"
'Accounting date' to email_itab-line + 3 (10 ),
Endform. "email_itab
Form reset_objpack.
It_packing_list-transf_bin = space. "flag will transfer the object's flag in binary form"
It_packing_list-head_start = 0. "header start line"
It_packing_list-head_num = 1. "Number of header rows"
It_packing_list-body_start = 1. "content start line"
It_packing_list-body_num = it_message_lines. "Number of content rows"
It_packing_list-doc_type = 'raw '. "information type"
Append it_packing_list.
Endform. "reset_objpack
Form reset_doc_chng.
Describe table email_itab lines it_message_lines.
Gd_doc_data-doc_size = it_message_lines * 255 + strlen (email_itab). "sapoffice document size"
Gd_doc_data-obj_langu = sy-Langu. "languages used to create documents"
Gd_doc_data-obj_name = 'saprpt '. "document, folder or allocation list name"
Gd_doc_data-obj_descr = 'email title'. "email title"
Gd_doc_data-sensitivty = 'F'. "Object: sensitivity (personal, functional,...) F: function"
Endform. "reset_doc_chng
Form reset_reclist.
Select zmaaddr
Into it_receivers-receiver
From ziebtemail.
It_receivers-rec_type = 'u'. "Internet address
Append it_receivers.
Clear it_receivers.
Endselect.
Endform. "reset_reclist
Data: gd_doc_data like sodocchgi1,
Gd_sent_all (1) type C,
It_message_lines type sy-tabix,
It_packing_list like sopcklsti1 occurs 0 with header line,
It_receivers like somlreci1 occurs 0 with header line.
Data: Begin of email_itab occurs 10.
Include structure soli.
Data: End of email_itab.
Perform email_itab. "tables output_tab.
Perform reset_doc_chng.
Perform reset_reclist.
Perform reset_objpack.
Call function 'so _ new_document_att_send_api1'
Exporting
Document_data = gd_doc_data "attributes of the new document"
Put_in_outbox = 'X': Move the document to outbox after sending
* Commit_work =''
* Importing
Sent_to_all = gd_sent_all "flag: document sent to all"
* New_object_id = ID of created object (not document !)
Tables
Packing_list = it_packing_list "sapoffice: Input object component description"
* Object_header =
* Contents_bin =
* Contents_txt =
* Contents_hex =
* Object_para =
* Object_parb =
Receivers = email_itab "sapoffice: Structure of the API Recipient List"
* 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.
Endif.
Note:
View_maintenance_call
Function: Call the maintenance view of a data table.
Instance:
Call function 'view _ maintenance_call'
Exporting
Action = 'U' "activity (display/maintenance/transmission )"
* Pai_number =''
* Generate_maint_tool_if_missing =''
* Show_selection_popup =''
View_name = 'ziebtemail' "Name of the View/table to be processed"
* No_warning_for_clientindep =''
* Rfc_destination_for_upgrade =''
* Client_for_upgrade =''
* Variant_for_selection =''
* Complex_selconds_used =''
* Check_ddic_mainflag =''
* Suppress_wa_popup =''
* Tables
* Dba_sellist =
* Excl_cua_funct =
* Exceptions
* Client_reference = 1
* Foreign_lock = 2
* Invalid_action = 3
* No_clientindependent_auth = 4
* No_database_function = 5
* No_editor_function = 6
* No_show_auth = 7
* No_tvdir_entry = 8
* No_upd_auth = 9
* Only_show_allowed = 10
* System_failure = 11
* Unknown_field_in_dba_sellist = 12
* View_not_found = 13
* Maintenance_prohibited = 14
* Others = 15
.
If sy-subrc <> 0.
* Message ID SY-MSGID type SY-MSGTY number SY-MSGNO
* With SY-MSGV1 SY-MSGV2 SY-MSGV3.
Endif.
Note:
So_object_send
Function: Send an external email.
Instance:
Report ztmail02.
Data: Begin of itab occurs 0,
Pernr like pa0001-pernr,
Ename like pa0001-ename,
End of itab.
Data: message_content like soli occurs 10 with header line,
Receiver_list like soos1 occurs 5 with header line,
Packing_list like soxpl occurs 2 with header line,
Listobject like abaplist occurs 10,
Compressed_attachment like soli occurs 100 with header line,
W_object_hd_change like sood1 occurl 100 with header line,
Compressed_size like sy-index.
Start-of-selection.
Select pernr ename
Into corresponding fields of table itab
From pa0001
Where pernr <50.
Loop at itab.
Write:/02 sy-vline, itab-pernr, 15 sy-vline, itab-ename, 50
Sy-vline.
Endloop.
* Receivers
Receiver_list-recextnam = 'shuchang @ gamil.com '. "direct external address as recipient"
Receiver_list-recesc = 'u'. "Description of recipient type; U Internet address"
Receiver_list-sndart = 'mail'. "output device; mail"
Receiver_list-sndpri = '1'. "Send: priority; 1 highest priority"
Append receiver_list.
* General Data
W_object_hd_change-objla = sy-Langu. "languages used to create documents"
W_object_hd_change-objnam = 'object name'. "Name of the document, folder, or allocation list"
W_object_hd_change-objsns = 'F'. "object: sensitivity (personal, functional,...)" F: Function
W_object_hd_change-objdes = 'message subobject'. "mail title"
Append w_object_hd_change.
* Content
Message_content-line = 'message content'. "sent content"
Append message_content.
Call function 'so _ object_send'
Exporting
Object_hd_change = w_object_hd_change "common header data"
Object_type = 'Raw' "object type"
Outbox_flag = 'X' flag: Move the document to outbox after sending
Owner = sy-uname "user responsible for transfer"
Tables
Objcont = message_content "sent content"
Receivers = receiver_list "receiving object attributes"
Att_cont = compressed_attachment.