Function Module for Application Log(SLG1)
HI SapAll.
may i know what is the Function Module to read the data for Applicaiton Log (tcode-SLG1).
waiitng for your response.
regards.
Varma
Hi Danish.
running the program 'SBAL_DISPLAY' is similar to running the FM'APPL_LOG_DISPLAY' .However when i run any one of these i have to manually press the 'Execute button' to display the log(there is no option to save the log into spool or to get into some Internal table)
i have tried running the program 'SBAL_DISPLAY' by putting the Break point at the line ( CALL FUNCTION 'BAL_DSP_LOG_DISPLAY'
EXPORTING
i_t_log_handle = l_t_log_handle)
,while debugging the values are as below:
L_T_LOG_HANDLE : Sorted Table[1x1(44)]
1 ZoDNJw4vg3BX0000h1GOdm.
could you please help me in getting the log into spool wihtout having to press the execute button and without having to look at the Log.
regards.
Varma
Similar Messages
-
Equalent of F4_filename function module for application server file path
hi experts,
i am using cl_gui_frontend_services=>file_open_dialog
for bring file path dynamically for user, in front end.
same feature i want to give when i am trying upload file from application server.
kindly provide me function module or class method, which will do it.
thanks in advance
regards,
pavanHi,
Use FM F4_DXFILENAME_TOPRECURSION
Sample code here
report ztest.
data : filename like DXFIELDS-LONGPATH.
data : begin of itab occurs 0,
a(200) type c,
end of itab.
CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
EXPORTING
I_LOCATION_FLAG = 'A'
*I_SERVER = '?'
*I_PATH =
FILEMASK = '.*'
*FILEOPERATION = 'R'
IMPORTING
*O_LOCATION_FLAG =
*O_SERVER =
O_PATH = filename
*ABEND_FLAG =
EXCEPTIONS
RFC_ERROR = 1
ERROR_WITH_GUI = 2
OTHERS = 3
break-point.
open dataset filename for input in binary mode.
while sy-subrc = 0.
clear itab .
read dataset filename into itab.
append itab.
endwhile.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'd:\abc.txt'
FILETYPE = 'BIN'
TABLES
DATA_TAB = itab
Regards,
Satish -
FUNCTION MODULE FOR ERROR LOG IN BILLING OF SALES ORDER
Hello,
Is there any way through which I can access the error log generated while releasing billing through vfx3?
Is tehre any function module or table for the same?
Regards,
Krutikathe problem resolved myself.
-
Function Module for Incompletion Log in Sales Order
Hello All,
Can anybody provide me the function module when the sales order is incomplete due to Incompletion log.
Thanks,HI,
Use the functional module: RV_MISSING_DOCUMENT_DATA.
Goto SE37 and press F7, input the material/order number etc in the import data field VBCOM.
And then execute the module. By using this module we will get all the incomplete items in an order.
If you want list of incomplete orders, use V.02 transaction code.
Regards,
Satya. -
Function Module for putting Flat File into Application Server
Hi Pals,
what is the Function module for putting my flatfile into application server..
because i dont have authorizations to put my flatfile into application server directly..
I know one function mudule is there for that ...so, can you suggest me.. what is the function module... for that..
thanks.. and points will be assigned..
chittiHi,
well normally you use the method GUI_UPLOAD of class CL_GUI_FRONTEND_SERVICES to upload a file from your client pc. Then you use the abap statements open dataset, transfer and close dataset to put the file to the app-server.
kind regards
Siggi -
Function module for calculating sigma balance
Is there any function module available in SAP for calculating sigma balance.
Thanks
Gauravhi
ABAP_DOCU_DOWNLOAD Download ABAP documentation in HTML format.
APPL_LOG_DELETE With this function module you delete logs in the database according to specified selection conditions
APPL_LOG_DISPLAY With this function module you can analyze logs in the database.
APPL_LOG_DISPLAY_INTERN With this function module you can analyze logs in local memory, e.g. when you have only collected log records at runtime and do not want to write to the database.
APPL_LOG_INIT This function module checks whether the specified object or sub-object exists and deletes all existing associated data in local memory.
APPL_LOG_READ_DB With this function module you read the log data in the database for an object or sub-object according to specified selection conditions.
APPL_LOG_READ_INTERN With this function module you read all log data whose log class has at least the specified value, from local memory, for the specified object or sub-object.
APPL_LOG_SET_OBJECT With this function module, you create a new object or sub-object for writing in local memory. With a flag you can control whether the APPL_LOG_WRITE_... messages are written in local memory or are output on the screen.
APPL_LOG_WRITE_DB With this function module you write all data for the specified object or sub-object in local memory to the database. If the log for the object or sub-object in question is new, the log number is returned to the calling program.
APPL_LOG_WRITE_HEADER With this function module, you write the log header data in local memory.
APPL_LOG_WRITE_LOG_PARAMETERS With this function module, you write the name of the log parameters and the associated values for the specified object or sub-object in local memory. If this function module is called repeatedly for the same object or sub-object, the existing parameters are updated accordingly. If you do not specify an object or sub-object with the call, the most recently used is assumed.
APPL_LOG_WRITE_MESSAGE_PARAMS With this function module you write a single message, with parameters, in local memory. Otherwise the function module works like APPL_LOG_WRITE_SINGLE_MESSAGE.
APPL_LOG_WRITE_MESSAGES With this function module you write one or more messages, without parameters, in local memory.
APPL_LOG_WRITE_SINGLE_MESSAGE With this function module you write a single message, without parameters, in local memory. If no header entry has yet been written for the object or sub-object, it is created. If you do not specify an object or sub-object with the call, the most recently used is assumed.
ARFC_GET_TID will return the IP address of the terminal in hex.
BAL_CNTL_CREATE Create Control for log display
BAL_CNTL_FREE Release Control
BAL_CNTL_REFRESH Put new data in log display
BAL_DB_DELETE Delete logs from the database
BAL_DB_DEQUEUE Unlock log
BAL_DB_ENQUEUE Lock log
BAL_DB_LOAD Load logs from the database
BAL_DB_LOAD Load log(s)
BAL_DB_SAVE Save logs in the database
BAL_DB_SAVE Save log(s)
BAL_DB_SAVE_PREPARE Prepare save
BAL_DB_SEARCH Find logs in the database
BAL_DSP_LOG_DISPLAY Display messages in memory
BAL_DSP_LOG_DISPLAY Display Log
BAL_DSP_LOG_PARAMETERS Either output extended long text or call a callback routine (based on the data in BAL_S_LOG-PARAMS)
BAL_DSP_LOG_TECHNICAL_DATA Output all log header data
BAL_DSP_MSG_LONGTEXT Display message long text
BAL_DSP_MSG_PARAMETERS Either output extended long text or call a callback routine (based on the data in BAL_S_MSG-PARAMS)
BAL_DSP_MSG_TECHNICAL_DATA Output technical data of a message such as work area, error number, etc.
BAL_DSP_OUTPUT_FREE End output
BAL_DSP_OUTPUT_INIT Initialize output
BAL_DSP_OUTPUT_SET_DATA Set dataset to be displayed
BAL_DSP_PROFILE_DETLEVEL_GET Message hierarchy in DETLEVEL
BAL_DSP_PROFILE_NO_TREE_GET Display without tree (fullscreen)
BAL_DSP_PROFILE_POPUP_GET Display without tree (popup)
BAL_DSP_PROFILE_SINGLE_LOG_GET Standard profile (SLG1) for one log
BAL_DSP_PROFILE_STANDARD_GET Standard profile (SLG1) for a lot of logs
BAL_GLB_AUTHORIZATION_GET Assign authorization
BAL_GLB_AUTHORIZATION_RESET Reset authorization
BAL_GLB_CONFIG_GET Read configuration
BAL_GLB_CONFIG_SET Set configuration
BAL_GLB_MEMORY_EXPORT Put function group memory in ABAP-MEMORY
BAL_GLB_MEMORY_IMPORT Get function group memory from ABAP-MEMORY
BAL_GLB_MEMORY_REFRESH (Partially) reset global memory
BAL_GLB_MEMORY_REFRESH (Partially) initialize memory
BAL_GLB_MSG_CURRENT_HANDLE_GET Get current message handle
BAL_GLB_MSG_DEFAULTS_GET Get message defaults
BAL_GLB_SEARCH_LOG Find logs in memory
BAL_GLB_SEARCH_MSG Find messages in memory
BAL_LOG_CREATE Create log with header data
BAL_LOG_CREATE Create log with header data
BAL_LOG_DELETE Delete log (from database also at Save)
BAL_LOG_EXIST Check existence of a log in memory
BAL_LOG_HDR_CHANGE Change log header
BAL_LOG_HDR_CHECK Check log header data for consistency
BAL_LOG_HDR_READ Read log header and other data
BAL_LOG_MSG_ADD Put message in log
BAL_LOG_MSG_ADD Put message in log
BAL_LOG_MSG_CHANGE Change message
BAL_LOG_MSG_CHANGE Change message
BAL_LOG_MSG_CHECK Check message data for consistency
BAL_LOG_MSG_CUMULATE Add message cumulated
BAL_LOG_MSG_DELETE Delete message
BAL_LOG_MSG_DELETE Delete message
BAL_LOG_MSG_EXIST Check existence of a message in memory
BAL_LOG_MSG_READ Read message and other data
BAL_LOG_MSG_REPLACE Replace last message
BAL_LOG_REFRESH Delete log from memory
BAL_LOG_REFRESH Delete log from memory
BAL_MSG_DISPLAY_ABAP Output message as ABAP-MESSAGE
BAL_OBJECT_SELECT Read Application Log objects table record
BAL_OBJECT_SUBOBJECT Check whether object and subobject exist and the combination is allowed
BAL_SUBOBJECT_SELECT Read subobject table record
BP_EVENT_RAISE Trigger an event from ABAP/4 program
BP_JOBLOG_READ Fetch job log executions
CHANGEDOCUMENT_READ_HEADERS Get the change document header for a sales document, and put the results in an internal table.
Example:
CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
EXPORTING
objectclass = 'EINKBELEG'
objectid = l_objectid
username = space
TABLES
i_cdhdr = lt_cdhdr.
LOOP AT lt_cdhdr WHERE udate IN s_aedat.
CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'
EXPORTING
changenumber = lt_cdhdr-changenr
TABLES
editpos = lt_editpos.
LOOP AT lt_editpos WHERE fname = 'LOEKZ'
AND f_new = 'L'.
p_desc = text-r01. " Cancel Contract
ENDLOOP.
ENDLOOP.
CHANGEDOCUMENT_READ_POSITIONS Get the details of a change document, and store them in an internal table. This will tell you whether a field was changed, deleted, or updated.
Example:
CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
EXPORTING
objectclass = 'EINKBELEG'
objectid = l_objectid
username = space
TABLES
i_cdhdr = lt_cdhdr.
LOOP AT lt_cdhdr WHERE udate IN s_aedat.
CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'
EXPORTING
changenumber = lt_cdhdr-changenr
TABLES
editpos = lt_editpos.
LOOP AT lt_editpos WHERE fname = 'LOEKZ'
AND f_new = 'L'.
p_desc = text-r01. " Cancel Contract
ENDLOOP.
ENDLOOP.
CLAF_CLASSIFICATION_OF_OBJECTS Return all of the characteristics for a material
CLOI_PUT_SIGN_IN_FRONT Move the negative sign from the left hand side of a number, to the right hand side of the number. Note that The result will be left justified (like all character fields), not right justifed as numbers normally are.
CLPB_EXPORT Export a text table to the clipboard (on presentation server)
CLPB_IMPORT Import a Text Table from the Clipboard (on presentation server)
COMMIT_TEXT To load long text into SAP
CONVERSION_EXIT_ALPHA_INPUT converts any number into a string fill with zeroes, with the number at the extreme right
Example:
input = 123
output = 0000000000000...000000000000123
CONVERSION_EXIT_ALPHA_OUTPUT converts any number with zeroes right into a simple integer
Example:
input = 00000000000123
output = 123
CONVERT_ABAPSPOOLJOB_2_PDF convert abap spool output to PDF
CONVERT_OTF Convert SAP documents (SAPScript) to other types.
Example:
CALL FUNCTION "CONVERT_OTF"
EXPORTING FORMAT = "PDF"
IMPORTING BIN_FILESIZE = FILE_LEN
TABLES OTF = OTFDATA
LINES = PDFDATA
EXCEPTIONS ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
CONVERT_OTFSPOOLJOB_2_PDF converts a OTF spool to PDF (i.e. Sapscript document)
CONVERT_TO_FOREIGN_CURRENCY Convert local currency to foreign currency.
CONVERT_TO_LOCAL_CURRENCY Convert from foreign currency to local currency
DATE_CHECK_PLAUSIBILITY Check to see if a date is in a valid format for SAP. Works well when validating dates being passed in from other systems.
DATE_COMPUTE_DAY Returns a number indicating what day of the week the date falls on. Monday is returned as a 1, Tuesday as 2, etc.
DATE_GET_WEEK will return the week that a date is in.
DATE_IN_FUTURE Calculate a date N days in the future.
DAY_ATTRIBUTES_GET
Return useful information about a day. Will tell you the day of the week as a word (Tuesday), the day of the week (2 would be Tuedsay), whether the day is a holiday, and more.(provided by Francois Henrotte)
DOWNLOAD download a file to the presentation server (PC)
DYNP_VALUES_READ Read the values from a dynpro. This function can be used to read the values from a report's selection screen too (Another example).
DYNP_VALUES_UPDATE Similar to DYNP_VALUES_READ, this function will allow the updating of fields on a dynpro. Very useful when you want to change a field based on the value entered for another field.
ENQUE_SLEEP Wait a specified period of time before continuing processing.
ENQUEUE_ESFUNCTION Lock an abap program so that it cannot be executed.
Example:
Set the parameters as follows:
RELID = 'ZZ'
SRTF2 = 0
SRTF = (your report name)
Please note that you should not use SY-REPID to pass your report name to the function. The value of SY-REPID will change as it is being passed to the function module, and will no longer hold the value of the calling report.
EPS_GET_DIRECTORY_LISTING return a list of filenames from a local or network drive
EPS_GET_FILE_ATTRIBUTES Pass in a filename and a path, and will return attributes for the file
F4_DATE displays a calendar in a popup window and allows user to choose a date, or it can be displayed read only.
F4_IF_FIELD_VALUE_REQUEST Use values from a DDIC table to provide a list of possible values. TABNAME and FIELDNAME are required fields, and when MULTIPLE_CHOICE is selected, more than one value can be returned.
F4IF_INT_TABLE_VALUE_REQUEST F4 help that returns the values selected in an internal table. Very handy when programming your very own F4 help for a field.
Example:
data:
begin of t_values occurs 2,
value like kna1-begru,
end of t_values,
t_return like ddshretval occurs 0 with header line.
t_values = 'PAR*'.
append t_values.
t_values = 'UGG'.
append t_values.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'BEGRU'
value_org = 'S'
tables
value_tab = t_values
return_tab = t_return
exceptions
parameter_error = 1
no_values_found = 2
others = 3.
if sy-subrc = 0.
read table t_return index 1.
o_begru-low = t_return-fieldval.
if o_begru-low = 'PAR*'.
o_begru-option = 'CP'.
else.
o_begru-option = 'EQ'.
endif.
o_begru-sign = 'I'.
append o_begru to s_begru.
else.
o_begru = i_begru.
endif.
F4IF_SHLP_EXIT_EXAMPLE documents the different reasons to use a search help exit, and shows how it is done.
F4IP_INT_TABLE_VALUE_REQUEST This function does not exist in 4.6 and above. Use F4IF_INT_TABLE_VALUE_REQUEST instead.
FILENAME_GET popup to get a filename from a user, returns blank filename if user selects cancel
FORMAT_MESSAGE Takes a message id and number, and puts it into a variable. Works better than WRITE_MESSAGE, since some messages use $ as a place holder, and WRITE_MESSAGE does not accommadate that, it only replaces the ampersands (&) in the message.
FTP_COMMAND Execute a command on the FTP server
FTP_CONNECT Open a connection (and log in) to an FTP server
FTP_DISCONNECT Close the connection (and log off) the FTP server
FU CSAP_MAT_BOM_READ You can use this function module to display simple material BOMs. You cannot display BOM groups (for example, all variants of a variant BOM). as in transaction CS03. Current restrictions: You cannot display long texts. You cannot display sub-items. You cannot display classification data of BOM items for batches. You can only display one alternative or variant. You cannot enter an alternative for module CSAP_MAT_BOM_READ, so you always see alternative 01. The following example came from a posting on the SAP-R3-L mailing list.
Example:
data: begin of tstk2 occurs 0.
include structure stko_api02.
data: end of tstk2.
data: begin of tstp2 occurs 0.
include structure stpo_api02.
data: end of tstp2.
data: begin of tdep_data occurs 0.
include structure csdep_data.
data: end of tdep_data.
data: begin of tdep_descr occurs 0.
include structure csdep_descr.
data: end of tdep_descr.
data: begin of tdep_source occurs 0.
include structure csdep_source.
data: end of tdep_source.
data: begin of tdep_order occurs 0.
include structure csdep_order.
data: end of tdep_order.
data: begin of tdep_doc occurs 0.
include structure csdep_doc.
data: end of tdep_doc.
data: flg_warning like capiflag-flwarning.
call function 'CSAP_MAT_BOM_READ'
exporting
material = 'MAT100'
plant = '0001'
bom_usage = '1'
valid_from = '20.12.1996'
valid_to
importing
fl_warning = flg_warning
tables
t_stko = tstk2
t_stpo = tstp2
t_dep_data = tdep_data
t_dep_descr = tdep_descr
t_dep_source = tdep_source
t_dep_order = tdep_order
t_dep_doc = tdep_doc
exceptions
error = 1.
Function Group GRAP is now obsolete. SAP recommends using functions in function group SFES instead. Below is an overview of the changes.
G_SET_GET_ALL_VALUES Fetch values from a set.
GET_CURRENT_YEAR Get the current fiscal year.
Example:
CALL FUNCTION 'GET_CURRENT_YEAR'
EXPORTING
BUKRS = '1000' " Company Code
DATE = SY-DATUM " Date to find fiscal year for
IMPORTING
CURRM = w_currm " Current Fiscal Month
CURRY = w_curry " Current Fiscal Year
PREVM = w_prevm " Previous Fiscal Month
PREVY = w_prevy. " Previous Fiscal Year
GET_GLOBAL_SYMBOLS Returns a list of all tables, select options, texts, etc for a program. Even includes the text definitions for the selection screen
GET_INCLUDETAB Returns a list of all INCLUDES in a program
GET_JOB_RUNTIME_INFO
Get the current job number from a program. Also returns other useful info about the current job.
GUI_CREATE_DIRECTORY Create a directory on the presentation server
GUI_DELETE_FILE Replaces WS_FILE_DELETE. Delete a file on the presentation server
GUI_DOWNLOAD Replaces WS_DOWNLOAD. Download table from the app server to presentation server
GUI_EXEC Replaces WS_EXECUTE. Start a File or Program Asynchronously with WinExec
GUI_GET_DESKTOP_INFO Replaces WS_QUERY. Delivers Information About the Desktop (client)
GUI_REMOVE_DIRECTORY Delete a directory on the presentation server
GUI_RUN Start a File or Program Asynchronously with ShellExecute
GUI_UPLOAD Replaces WS_UPLOAD. Upoad file from presentation server to the app server
HELP_START Display help for a field. Useful for doing AT SELECTION SCREEN ON VALUE REQUEST for those fields that do not provide F4 help at the DDIC level.
HELP_VALUES_GET_WITH_TABLE Show a list of possible values for F4 popup help on selection screens. This function module pops up a screen that is just like all the other F4 helps, so it looks like the rest of the SAP system. Very useful for providing dropdowns on fields that do not have them predefined.
Example:
tables: t001w.
DATA: lc_werks LIKE t001w-werks,
ltab_fields LIKE help_value OCCURS 0 with header line,
BEGIN OF ltab_values OCCURS 0,
feld(40) TYPE c,
END OF ltab_values.
*-- Set up fields to retrieve data
ltab_fields-tabname = 'T001W'.
ltab_fields-fieldname = 'WERKS'.
ltab_fields-selectflag = 'X'.
APPEND ltab_fields.
ltab_fields-tabname = 'T001W'.
ltab_fields-fieldname = 'NAME1'.
ltab_fields-selectflag = space.
APPEND ltab_fields.
*-- Fill values
select * from t001w.
ltab_values-feld = t001w-werks.
append ltab_values.
ltab_values-feld = t001w-name1.
append ltab_values.
endselect.
CALL FUNCTION 'HELP_VALUES_GET_WITH_TABLE'
EXPORTING
fieldname = 'WERKS'
tabname = 'T001W'
title_in_values_list = 'Select a value'
IMPORTING
select_value = lc_werks
TABLES
fields = ltab_fields
valuetab = ltab_values
EXCEPTIONS
field_not_in_ddic = 01
more_then_one_selectfield = 02
no_selectfield = 03.
HOLIDAY_CHECK_AND_GET_INFO Useful for determining whether or not a date is a holiday. Give the function a date, and a holiday calendar, and you can determine if the date is a holiday by checking the parameter HOLIDAY_FOUND.
Example:
data: ld_date like scal-datum default sy-datum,
lc_holiday_cal_id like scal-hcalid default 'CA',
ltab_holiday_attributes like thol occurs 0 with header line,
lc_holiday_found like scal-indicator.
CALL FUNCTION 'HOLIDAY_CHECK_AND_GET_INFO'
EXPORTING
date = ld_date
holiday_calendar_id = lc_holiday_cal_id
WITH_HOLIDAY_ATTRIBUTES = 'X'
IMPORTING
HOLIDAY_FOUND = lc_holiday_found
tables
holiday_attributes = ltab_holiday_attributes
EXCEPTIONS
CALENDAR_BUFFER_NOT_LOADABLE = 1
DATE_AFTER_RANGE = 2
DATE_BEFORE_RANGE = 3
DATE_INVALID = 4
HOLIDAY_CALENDAR_ID_MISSING = 5
HOLIDAY_CALENDAR_NOT_FOUND = 6
OTHERS = 7.
if sy-subrc = 0 and
lc_holiday_found = 'X'.
write: / ld_date, 'is a holiday'.
else.
write: / ld_date, 'is not a holiday, or there was an error calling the function'.
endif.
HOLIDAY_GET Provides a table of all the holidays based upon a Factory Calendar &/ Holiday Calendar.
HR_DISPLAY_BASIC_LIST is an HR function, but can be used for any data. You pass it data, and column headers, and it provides a table control with the ability to manipulate the data, and send it to Word or Excel. Also see the additional documentation here.
HR_GET_LEAVE_DATA Get all leave information (includes leave entitlement, used holidays/paid out holidays)
HR_IE_NUM_PRSI_WEEKS Return the number of weeks between two dates.
HR_PAYROLL_PERIODS_GET
Get the payroll period for a particular date. (provided by Francois Henrotte)
Example:
DATA: IT_T549Q TYPE T549Q OCCURS 0 WITH HEADER LINE,
IT_ZL TYPE PC2BF OCCURS 0 WITH HEADER LINE.
W_BEGDA = '20010101'.
W_PERNR = '00000001'.
CALL FUNCTION 'HR_PAYROLL_PERIODS_GET'
EXPORTING
get_begda = w_begda
TABLES
get_periods = it_t549q
EXCEPTIONS
no_period_found = 1
no_valid_permo = 2.
CHECK sy-subrc = 0.
CALL FUNCTION 'HR_TIME_RESULTS_GET'
EXPORTING
get_pernr = w_pernr
get_pabrj = it_t549q-pabrj
get_pabrp = it_t549q-pabrp
TABLES
get_zl = it_zl
EXCEPTIONS
no_period_specified = 1
wrong_cluster_version = 2
no_read_authority = 3
cluster_archived = 4
technical_error = 5.
NOTE: it_zl-iftyp = 'A' absence
it_zl-iftyp = 'S' at work
HR_TIME_RESULTS_GET
Get the time results for a payroll period. (provided by Francois Henrotte)
Example:
DATA: IT_T549Q TYPE T549Q OCCURS 0 WITH HEADER LINE,
IT_ZL TYPE PC2BF OCCURS 0 WITH HEADER LINE.
W_BEGDA = '20010101'.
W_PERNR = '00000001'.
CALL FUNCTION 'HR_PAYROLL_PERIODS_GET'
EXPORTING
get_begda = w_begda
TABLES
get_periods = it_t549q
EXCEPTIONS
no_period_found = 1
no_valid_permo = 2.
CHECK sy-subrc = 0.
CALL FUNCTION 'HR_TIME_RESULTS_GET'
EXPORTING
get_pernr = w_pernr
get_pabrj = it_t549q-pabrj
get_pabrp = it_t549q-pabrp
TABLES
get_zl = it_zl
EXCEPTIONS
no_period_specified = 1
wrong_cluster_version = 2
no_read_authority = 3
cluster_archived = 4
technical_error = 5.
NOTE: it_zl-iftyp = 'A' absence
it_zl-iftyp = 'S' at work
INIT_TEXT To load long text into SAP
K_WERKS_OF_BUKRS_FIND Return a list of all plants for a given company code.
LIST_FROM_MEMORY Retrieves the output of a report from memory when the report was executed using SUBMIT... EXPORTING LIST TO MEMORY. See also WRITE_LIST.
LIST_TO_ASCII convert an ABAP report (displayed on screen) from OTF to ASCII format
MBEW_EXTEND
Get the stock position for the previous month. This displays the same info that you see in MM03.
MONTH_NAMES_GET It returns all the month and names in repective language.
MONTH_PLUS_DETERMINE Add or subtract months from a date. To subtract a month, enter a negative value for the 'months' parameter.
Example:
data: new_date type d.
CALL FUNCTION 'MONTH_PLUS_DETERMINE'
EXPORTING
months = -5 " Negative to subtract from old date, positive to add
olddate = sy-datum
IMPORTING
NEWDATE = new_date.
write: / new_date.
MS_EXCEL_OLE_STANDARD_OLE will build a file, and automatically start Excel
OTF_CONVERT wraps several other function modules. Will convert OTF to ASCII or PDF
POPUP_TO_CONFIRM_LOSS_OF_DATA Create a dialog box in which you make a question whether the user wishes to perform a processing step with loss of data.
POPUP_TO_CONFIRM_STEP Create a dialog box in which you make a question whether the user wishes to perform the step.
POPUP_TO_CONFIRM_WITH_MESSAGE Create a dialog box in which you inform the user about a specific decision point during an action.
POPUP_TO_CONFIRM_WITH_VALUE Create a dialog box in which you make a question whether the user wishes to perform a processing step with a particular object.
POPUP_TO_DECIDE Provide user with several choices as radio buttons
POPUP_TO_DECIDE_WITH_MESSAGE Create a dialog box in which you inform the user about a specific decision point via a diagnosis text.
POPUP_TO_DISPLAY_TEXT Create a dialog box in which you display a two line message
POPUP_TO_SELECT_MONTH Popup to choose a month
POPUP_WITH_TABLE_DISPLAY Provide a display of a table for user to select one, with the value of the table line returned when selected.
PRICING Return pricing conditions in an internal table. Use structure TCOMK for parameter COMM_HEAD_1, and structure TCOMP for parameter COMM_ITEM_1, and set CALCULATION_TYPE to B. The pricing conditions will be returned in XOMV. You must fill TCOMP, and TCOMK with the appropriate values before callling the function in order for it to work.
PROFILE_GET Read an Entry in an INI File on the frontend
PROFILE_SET Write an Entry in an INI File on the frontend
READ_TEXT To load long text into SAP
REGISTRY_GET Read an Entry from the Registry
REGISTRY_SET Set an entry in the Registry
RFC_ABAP_INSTALL_AND_RUN Runs an ABAP program that is stored in the table PROGRAM when the MODE = 'F'. Table WRITES contains the ouput of the program. Allows you to run a program without having the source code in the target system.
RH_GET_ACTIVE_WF_PLVAR Return the active HR Plan
RH_GET_DATE_DAYNAME return the day based on the date provied
RH_START_EXCEL_WITH_DATA starts Excel with the contents of an internal table. This function finds Excel in the desktop registry. It also uses a local PC working directory to save the file (that's what the 'W' value for data path flag does). Very transparent to user!
RH_STRUC_GET Returns all related org info
RHP0_POPUP_F4_SEARK
is a matchcode for any type of HR Planning object, including the possibility to fill the field that you want
Example:
Examples: search for any organizational structure
F4 = 'X'
PLVAR = '01'
OTYPE = 'O '
search for any persons
F4 = 'X'
PLVAR = '01'
OTYPE = 'P '
MULTI_SELECT = 'X' to allow multiple selection
EASY = 'X' for user-dependent matchcode
Unfortunately, the use of table BASE_OBJIDS is disabled, so you can't specify
a root for the hierarchy you display
RKD_WORD_WRAP Convert a long string or phrase into several lines.
RP_CALC_DATE_IN_INTERVAL Add/subtract years/months/days from a date
RP_LAST_DAY_OF_MONTHS Determine last day of month
RPY_DYNPRO_READ Read dynpro, including screen flow
RPY_TRANSACTION_READ Given a transaction, return the program and screen or given a program and screen, return the transactions that use the program and screen.
RS_COVERPAGE_SELECTIONS Returns an internal table that contains a formatted list of all the selection parameters entered for a report. Table is ready to print out.
RS_REFRESH_FROM_SELECTOPTIONS Get the current contents of selection screen
RS_SEND_MAIL_FOR_SPOOLLIST Send message from ABAP/4 program to SAPoffice.
RS_VARIANT_CONTENTS Returns the contents of the specified variant in a table.
RSPO_DOWNLOAD_SPOOLJOB Download the spool from a program to a file. Requires spool number.
RSPO_RETURN_ABAP_SPOOLJOB Fetch printer spool according to the spool number informed.
RZL_READ_DIR If the server name is left blank, it reads a directory from local presentation server, otherwise it reads the directory of the remote server
RZL_READ_DIR_LOCAL Read a directory on the Application Server
RZL_READ_FILE Read a file from the presentation server if no server name is given, or read file from remote server. Very useful to avoid authority checks that occur doing an OPEN DATASET. This function using a SAP C program to read the data.
RZL_SLEEP Hang the current application from 1 to 5 seconds.
RZL_SUBMIT Submit a remote report.
RZL_WRITE_FILE_LOCAL Saves table to the presentation server (not PC). Does not use OPEN DATASET, so it does not suffer from authority checks!
SAP_CONVERT_TO_XLS_FORMAT Convert data to Microsoft Excel format.
SAPGUI_PROGRESS_INDICATOR Display a progress bar on the SAP GUI, and give the user some idea of what is happening
SAVE_TEXT To load long text into SAP
SCROLLING_IN_TABLE If you are coding a module pool and using a table control, you can use this function SCROLLING_IN_TABLE to handle any scrolling. (provided by Paul Kjaer)
SD_DATETIME_DIFFERENCE Give the difference in Days and Time for 2 dates
SO_NEW_DOCUMENT_ATT_SEND_API1 Send a document as part of an email. The documentation is better than normal for this function, so please read it.
SO_SPLIT_FILE_AND_PATH Split a fully pathed filename into a filename and a path.
SO_SPOOL_READ Fetch printer spool according to the spool number informed. See also RSPO_RETURN_ABAP_SPOOLJOB
SO_WIND_SPOOL_LIST Browse printer spool numbers according to user informed.
SWD_HELP_F4_ORG_OBJECTS
HR Matchcode tailored for organizational units. Includes a button so that you can browse the hierarchy too.
SX_OBJECT_CONVERT_OTF_PDF Conversion From OTF to PDF (SAPScript conversion)
SX_OBJECT_CONVERT_OTF_PRT Conversion From OTF to Printer Format (SAPScript conversion)
SX_OBJECT_CONVERT_OTF_RAW Conversion From OTF to ASCII (SAPScript conversion)
SXPG_CALL_SYSTEM you can check the user's authorization for the specified command and run the command. The command runs on the host system on which the function module is executed. The function module is RFC capable. It can therefore be run on the host system at which a user happens to be active or on another designated host system at which an R/3 server is active.
SXPG_COMMAND_CHECK Check whether the user is authorized to execute the specified command on the target host system with the specified arguments.
SXPG_COMMAND_DEFINITION_GET Read the definition of a single external OS command from the R/3 System's database.
SXPG_COMMAND_EXECUTE Check a user's authorization to use a command, as in SXPG_COMMAND_CHECK. If the authorization check is successful, then execute the command on the target host system.
SXPG_COMMAND_LIST_GET Select a list of external OS command definitions.
TERMINAL_ID_GET Return the terminal id
TH_DELETE_USER Logoff a user. Similar results to using SM04.
TH_ENVIRONMENT Get the UNIX environment
TH_POPUP Display a popup system message on a specific users screen.
TH_REMOTE_TRANSACTION Run a transaction on a remote server. Optionally provide BDC data to be used in the transaction
TH_USER_INFO Give information about the current user (sessions, workstation logged in from, etc)
TH_USER_LIST Show which users are logged into an app server
TMP_GUI_DIRECTORY_LIST_FILES Retrieve all of the files and subdirectories on the Presentation Server (PC) for a given directory.
When a value other than * or . is used for the filter, you will not get any directories, unless they match your wildcard filter. For example, if you entered *.png, then only files and directories that end in png will be returned by the function.
Example:
data: lc_directory like bdschko16-target_dir value 'C:\TEMP\',
lc_filter(20) type c default '.'.
li_file_count type i,
li_dir_count type i,
ltab_dir_table like sdokpath occurs 0 with header line,
ltab_file_file_table like sdokpath occurs 0 with header line.
call function 'TMP_GUI_DIRECTORY_LIST_FILES'
exporting
directory = lc_directory
filter = lc_filter importing
file_count = li_file_count
dir_count = li_dir_count
tables
file_table = ltab_file_table
dir_table = ltab_dir_table
exceptions
cntl_error = 1
others = 2.
UNIT_CONVERSION_SIMPLE convert weights from one UOM to another.
UPLOAD upload a file to the presentation server (PC)
UPLOAD_FILES Will load one or more files from app or presentation server
WEEK_GET_FIRST_DAY For a given week (YYYYMM format), this function returns the date of the Monday of that week.
WRITE_LIST Useful for writing out the list contents that result from the function LIST_FROM_MEMORY.
WS_DOWNLOAD Save Internal Table as File on the Presentation Server
WS_EXCEL Start EXCEL on the PC
WS_EXECUTE execute a program on a windows PC
WS_FILE_DELETE Delete File at the Frontend
WS_FILENAME_GET Call File Selector
WS_MSG Create a dialog box in which you display an one line message
WS_UPLOAD Load Files from the Presentation Server to Internal ABAP Tables
WS_VOLUME_GET Get the label from a frontend device.
WWW_LIST_TO_HTML After running a report, call this function to convert the list output to HTML.
hope it will help you.
Regards,
Sreelatha gullapalli -
Hi all,
I need a function module for executing .bat file in application server.
Regards
Sathish Kumar K.CCALL FUNCTION 'SXPG_STEP_COMMAND_START'
EXPORTING
* TARGET =
* DESTINATION =
COMMANDNAME = 'ZCOPY'
ADDITIONAL_PARAMETERS = AD_PAR
OPERATINGSYSTEM = 'Windows NT'
STDINCNTL = 'R'
STDOUTCNTL = 'M'
STDERRCNTL = 'M'
TRACECNTL = '3'
TERMCNTL = 'C'
* TRACELEVEL = 0
* BATCH =
* LONG_PARAMS =
* JOBNAME =
* JOBCOUNT =
* STEPCOUNT =
* CONNCNTL = 'H'
* IMPORTING
* STRTSTAT =
* XPGID =
* CONVID =
* EXITSTAT =
* EXITCODE =
* PARAMS =
* LAST_PROC =
* LAST_HOST =
* LAST_PROC_NUM =
TABLES
LOG = LT_LOG
EXCEPTIONS
COMMAND_NOT_FOUND = 1
PARAMETER_EXPECTED = 2
PARAMETERS_TOO_LONG = 3
SECURITY_RISK = 4
WRONG_CHECK_CALL_INTERFACE = 5
NO_PERMISSION = 6
UNKNOWN_ERROR = 7
COMMUNICATION_ERROR = 8
SYSTEM_ERROR = 9
CANNOT_GET_RFC_DESTS = 10
JOB_UPDATE_FAILED = 11
JOB_DOES_NOT_EXIST = 12
OTHERS = 13 -
Standard BAPI or Function Module for FB01posting
Hi Experts,
My requirement is as follows.
Invoice details would be sent across from Middleware to SAP and for which I have developed a Custom Remote Enabled Function Module. The Function Module needs to post the data using FB01 Transaction.
I had planned for recording a BDC for FB01 and post the data, however, we are on the verge of getting upgraded from 4.7 to ECC 6.0. To avoid problems that we might face for change of screens in ECC 6.0, I would prefer using a BAPI or Function Module for FB01 posting, if available, instead of BDC.
Data coming from Middleware are as follows.
HEADER:
BKPF-BLDAT : Document Date
BKPF-BUDAT : Posting Date
BKPF-XBLNR: Reference (Invoice#)
BKPF-BLART : Document Type
BKPF-BUKRS : Company Code
BKPF-BKTXT : DocHeader Text
BKPF-WAERS : Currency
LINE ITEM:
BSEG-LIFNR : Vendor no
BSEG-WRBTR - Total amt -Debit/Credit -Vendor
BSEG-ZUONR : Assignment field
BSEG-EMPFB : Alternative Payee
BSEG-UZAWE : Payment Method Supplement
BSEG-ZTERM : Pmt terms
BSEG-KOSTL : Costcenter
BSEG-HKONT : GL AccountNumber
BSEG-WRBTR : Amount for GL
BSEG-SGTXT : Line item text
The Vendor Line Item would be one where as GL line items could me more than one.
Can any of you suggest me a standard BAPI or Func Mod?
Points will be awarded for valuable inputs.
Thanks to all!!!!You can use RFBIBL00 program for FB01 postings. Go through the program help on how to use this program.
This program requires a file to be on application server in a certain format.
You may also refer the program RFBIBLT0 on how the file format should be.
Hope this helps.
Thanks,
SKJ -
Function module for displaying the location
Hi,
Could anyone tell the Function module for displaying the location in our system without a file name while downloading, when the user press f4.
thanks* read the default pathname on application server
call function 'FILE_GET_NAME'
exporting
* CLIENT = SY-MANDT
logical_filename = lc_logical_filename_ftappl
operating_system = sy-opsys
* parameter_1 = ' '
* PARAMETER_2 = ' '
* USE_PRESENTATION_SERVER = ' '
* WITH_FILE_EXTENSION = ' '
* USE_BUFFER = ' '
importing
emergency_flag = l_emergency_flag
file_format = l_file_format
file_name = l_file_name_ftappl
exceptions
file_not_found = 1
others = 2. -
Function module for posting idoc
Hi,
For Inbound Idoc
In function module for posting the Idoc what should be given as the return_variable.Hi,
it depends on application.i have written some piece of code for my requiremnt.chek it,may be it will help u.
FORM idoc_status_ord_change
TABLES idoc_data STRUCTURE edidd
idoc_status STRUCTURE bdidocstat
r_variables STRUCTURE bdwfretvar
USING idoc_contrl LIKE edidc
value(retn_info) LIKE bapiret2
status LIKE bdidocstat-status
wf_result LIKE bdwf_param-result.
CLEAR idoc_status.
idoc_status-docnum = idoc_contrl-docnum.
idoc_status-msgty = retn_info-type.
idoc_status-msgid = retn_info-id.
idoc_status-msgno = retn_info-number.
idoc_status-appl_log = retn_info-log_no.
idoc_status-msgv1 = retn_info-message_v1.
idoc_status-msgv2 = retn_info-message_v2.
idoc_status-msgv3 = retn_info-message_v3.
idoc_status-msgv4 = retn_info-message_v4.
idoc_status-repid = sy-repid.
idoc_status-status = status.
APPEND idoc_status.
IF idoc_status-status = '51'.
wf_result = '99999'.
r_variables-wf_param = 'Error_IDOCs'.
r_variables-doc_number = idoc_contrl-docnum.
READ TABLE r_variables FROM r_variables.
IF sy-subrc <> 0.
APPEND r_variables.
ENDIF.
ELSEIF idoc_status-status = '53'.
CLEAR wf_result.
r_variables-wf_param = 'Processed_IDOCs'.
r_variables-doc_number = idoc_contrl-docnum.
READ TABLE r_variables FROM r_variables.
IF sy-subrc <> 0.
APPEND r_variables.
ENDIF.
ENDIF.
regards,
nagaraj -
Function Module for sending an Attachment
Not able to find the Function Module for sending an Attachment to the email ids.
Please help.Hi bala,
1. There is some trick involved in attachment
in the binary files.
2. I have made a program (and it works fantastic)
ONLY 6 LINES FOR EMAILING
BELIEVE ME
ITS A FANTASTIC PROGRAM.
IT WILL WORK LIKE OUTLOOK EXPRESS !
3. The user is provided with
a) file name
b) email address to send mail
and it sends ANY FILE (.xls,.pdf .xyz..)
Instantaneously !
4. Make two things first :
1. Include with the name : ZAMI_INCLFOR_MAIL
2. Report with the name : ZAM_TEMP147 (any name will do)
3. Activate both and execute (2)
4. After providing filename, email adress
5. Code for Include :
10.08.2005 Amit M - Created
Include For Mail (First Req F16)
Modification Log
Data
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
FORM
FORM ml_customize USING objname objdesc.
Clear Variables
CLEAR docdata.
REFRESH objpack.
CLEAR objpack.
REFRESH objhead.
REFRESH objtxt.
CLEAR objtxt.
REFRESH objbin.
CLEAR objbin.
REFRESH objhex.
CLEAR objhex.
REFRESH reclist.
CLEAR reclist.
REFRESH listobject.
CLEAR listobject.
CLEAR tab_lines.
CLEAR doc_size.
CLEAR att_type.
Set Variables
docdata-obj_name = objname.
docdata-obj_descr = objdesc.
ENDFORM. "ml_customize
FORM
FORM ml_addrecp USING preceiver prec_type.
CLEAR reclist.
reclist-receiver = preceiver.
reclist-rec_type = prec_type.
APPEND reclist.
ENDFORM. "ml_customize
FORM
FORM ml_addtxt USING ptxt.
CLEAR objtxt.
objtxt = ptxt.
APPEND objtxt.
ENDFORM. "ml_customize
FORM
FORM ml_prepare USING bypassmemory whatatt_type whatname.
IF bypassmemory = ''.
Fetch List From Memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'LIST_FROM_MEMORY'.
ENDIF.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
COMPRESSED_SIZE =
TABLES
in = listobject
out = objbin
EXCEPTIONS
OTHERS = 1
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
ENDIF.
Header Data
Already Done Thru FM
Main Text
Already Done Thru FM
Packing Info For Text Data
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'TXT'.
APPEND objpack.
Packing Info Attachment
att_type = whatatt_type..
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = whatname.
APPEND objpack.
Receiver List
Already done thru fm
ENDFORM. "ml_prepare
FORM
FORM ml_dosend.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel. 6.10
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
CONTENTS_HEX = objhex
OBJECT_PARA =
object_parb =
receivers = 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 'SO' TYPE 'S' NUMBER '023'
WITH docdata-obj_name.
ENDIF.
ENDFORM. "ml_customize
FORM
FORM ml_spooltopdf USING whatspoolid.
DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
Call Function
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = whatspoolid
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
OTHERS = 12.
Convert
PERFORM doconv TABLES pdf objbin.
ENDFORM. "ml_spooltopdf
FORM
FORM doconv TABLES
mypdf STRUCTURE tline
outbin STRUCTURE solisti1.
Data
DATA : pos TYPE i.
DATA : len TYPE i.
Loop And Put Data
LOOP AT mypdf.
pos = 255 - len.
IF pos > 134. "length of pdf_table
pos = 134.
ENDIF.
outbin+len = mypdf(pos).
len = len + pos.
IF len = 255. "length of out (contents_bin)
APPEND outbin.
CLEAR: outbin, len.
IF pos < 134.
outbin = mypdf+pos.
len = 134 - pos.
ENDIF.
ENDIF.
ENDLOOP.
IF len > 0.
APPEND outbin.
ENDIF.
ENDFORM. "doconv
CODE FOR PROGRAM
5.
REPORT zam_temp147 .
INCLUDE zami_inclfor_mail.
DATA
DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
DATA : file_name TYPE string.
data : path like PCFILE-PATH.
data : extension(5) type c.
data : name(100) type c.
SELECTION SCREEN
PARAMETERS : receiver TYPE somlreci1-receiver lower case.
PARAMETERS : p_file LIKE rlgrap-filename
OBLIGATORY.
AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CLEAR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM ml_customize USING 'Tst' 'Testing'.
PERFORM ml_addrecp USING receiver 'U'.
PERFORM upl.
PERFORM doconv TABLES itab objbin.
PERFORM ml_prepare USING 'X' extension name.
PERFORM ml_dosend.
SUBMIT rsconn01
WITH mode EQ 'INT'
AND RETURN.
FORM
FORM upl.
file_name = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_name
filetype = 'BIN'
TABLES
data_tab = itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
path = file_name.
CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = path
CHECK_DOS_FORMAT =
IMPORTING
DRIVE =
EXTENSION = extension
NAME = name
NAME_WITH_EXT =
PATH =
EXCEPTIONS
INVALID_DRIVE = 1
INVALID_EXTENSION = 2
INVALID_NAME = 3
INVALID_PATH = 4
OTHERS = 5
ENDFORM. "upl
regards,
amit m. -
Error in function module for inbound processingwhile testing from we19
hi,
I have developed a custom function module for processing inbound idoc for creating material using bdc...the problem is that when i am trying to test my idoc using we19 and calling my function module in debug mode an error is displayed showing 'interface for function module is incorrect' and also i am unable to see my function module in debugging mode.It is only displaying the error message...
I have given all the parameters necessary (import,export or tables) and found no error in the interface...I think the problem is appearing before my function module is being called....Also on seeing the short dump analysis I have seen that the error is in the form 'Idocs passed to application' which is not a part of the function module developed by me...
I am unable to understand why this error message is being displayed...
Please help me out of this..ya i know that ..But I wanted to create a simple one..moreover the problem is not with bdc....It is with the function module interface..
Also I want to ask a question that I had to define all the parameters (in the function module ) by data declaration statements in the function group top include..
If i dont do that say the first error is when i write loop at idoc_contrl ..idoc_contrl is not declared by a data statement..So IO had to write a data statement:
Idoc_contrl type table of edidc..I have seen that in other function modules (idoc inbound processing) no such data declaration is done.. -
Hi all,
Is there any Z function modules for OLE, which will download the data directly to Excel with 2 sheets.
Regards,
ShaliniHi Shalini Reddy
there is no FM but code is there... u can see...
*& Report YOLE_FOR_EXCEL
REPORT yole_for_excel.
*REPORT ZTEST_BYW.
OLE specific include file
INCLUDE ole2incl.
INCLUDE excel__c.
data definitions of OLE objects with type ole2_object
PARAMETERS: p_filenm(80) LOWER CASE OBLIGATORY
DEFAULT 'd:\temp\report_tsl.xls'.
DATA: g_tmp_workbook TYPE ole2_object.
DATA: g_tmp_worksheets TYPE ole2_object.
DATA: g_tmp_worksheet1 TYPE ole2_object.
DATA: g_tmp_worksheet2 TYPE ole2_object.
DATA: g_pc_template LIKE rcgfiletr-ftappl
VALUE 'd:\temp\mmr_rpt_tsl_tmp.xls'.
DATA: g_excel TYPE ole2_object.
DATA: g_workbooks TYPE ole2_object.
DATA: g_workbook TYPE ole2_object.
DATA: g_worksheets TYPE ole2_object.
DATA: g_worksheet TYPE ole2_object.
DATA: g_cell TYPE ole2_object.
DATA: g_cell1 TYPE ole2_object.
DATA: g_cell2 TYPE ole2_object.
DATA: g_cellrange TYPE ole2_object.
DATA: g_font TYPE ole2_object.
DATA: g_interior TYPE ole2_object.
DATA: g_borders TYPE ole2_object.
DATA: g_first_ws VALUE 'Y'.
DATA: g_row TYPE i.
DATA: g_col TYPE i.
definition of loop counter
DATA: i TYPE i VALUE '5'.
DATA: BEGIN OF t_sheet1 OCCURS 1,
col1(10),
col2(20),
END OF t_sheet1.
DATA: BEGIN OF t_sheet2 OCCURS 1,
col1(10),
col2(20),
END OF t_sheet2.
START-OF-SELECTION.
PERFORM prepare_data.
PERFORM download_to_excel.
END-OF-SELECTION.
call method of excel 'QUIT'.
it is now possible to leave the EXCEL application
remark: you have to go to the EXCEL application and answer the
popup dialog screen
*& Form PREPARE_DATA
FORM prepare_data.
t_sheet1-col1 = 'A1'.
t_sheet1-col2 = 'A2'.
APPEND t_sheet1.
t_sheet1-col1 = 'B1'.
t_sheet1-col2 = 'B2'.
APPEND t_sheet1.
t_sheet2-col1 = 'Y1'.
t_sheet2-col2 = 'Y2'.
APPEND t_sheet2.
t_sheet2-col1 = 'Z1'.
t_sheet2-col2 = 'Z2'.
APPEND t_sheet2.
ENDFORM. " PREPARE_DATA
*& Form DOWNLOAD_TO_EXCEL
FORM download_to_excel.
PERFORM open_excel.
PERFORM add_worksheet1.
PERFORM add_worksheet2.
PERFORM open_template_file.
PERFORM close_excel.
WRITE: / 'End of program'.
ENDFORM. " DOWNLOAD_TO_EXCEL
*& Form FILL_CELL
*& FORM routine, which fills the specified cell in the EXCEL sheet
*& with the given value
FORM fill_cell USING i_row TYPE i
i_col TYPE i
i_value
i_fontbold
i_digit
i_wraptext
i_horizon_align
i_vertical_align.
DATA: l_str TYPE string.
CALL METHOD OF g_excel 'CELLS' = g_cell
EXPORTING #1 = i_row
#2 = i_col.
SET PROPERTY OF g_cell 'VALUE' = i_value.
IF i_fontbold = 'X'.
GET PROPERTY OF g_cell 'Font' = g_font.
SET PROPERTY OF g_font 'Bold' = 1.
ENDIF.
IF NOT i_wraptext IS INITIAL.
SET PROPERTY OF g_cell 'WrapText' = 1.
ENDIF.
IF NOT i_horizon_align IS INITIAL.
IF i_horizon_align = 'L'.
SET PROPERTY OF g_cell 'HorizontalAlignment' = xlleft.
ELSEIF i_horizon_align = 'R'.
SET PROPERTY OF g_cell 'HorizontalAlignment' = xlright.
ELSEIF i_horizon_align = 'C'.
SET PROPERTY OF g_cell 'HorizontalAlignment' = xlcenter.
ENDIF.
ENDIF.
IF NOT i_vertical_align IS INITIAL.
IF i_vertical_align = 'T'.
SET PROPERTY OF g_cell 'VerticalAlignment' = xltop.
ELSEIF i_vertical_align = 'B'.
SET PROPERTY OF g_cell 'VerticalAlignment' = xlbottom.
ELSEIF i_vertical_align = 'C'.
SET PROPERTY OF g_cell 'VerticalAlignment' = xlcenter.
ENDIF.
ENDIF.
To set number format for cell
IF i_digit <> ''.
IF i_value IS INITIAL AND i_digit <> '%'.
SET PROPERTY OF g_cell 'VALUE' = ''.
ELSE.
Set number format for cell with number
IF i_digit = '1'.
SET PROPERTY OF g_cell 'NumberFormat' = '#,###.0 '.
ELSEIF i_digit = '2'.
SET PROPERTY OF g_cell 'NumberFormat' = '#,##0.00 '.
ELSEIF i_digit = '%'.
SET PROPERTY OF g_cell 'NumberFormat' = '#,##0.00% '.
ELSE.
SET PROPERTY OF g_cell 'NumberFormat' = '#,### '.
ENDIF.
ENDIF.
ENDIF.
ADD 1 TO i_col.
ENDFORM. "FILL_CELL
*& Form OPEN_EXCEL
FORM open_excel.
DATA: l_cnt TYPE i.
create object excel of OLE class 'EXCEL.APPLICATION'
CREATE OBJECT g_excel 'EXCEL.APPLICATION'.
CALL METHOD OF g_excel 'WORKBOOKS' = g_workbooks.
CALL METHOD OF g_workbooks 'ADD' = g_workbook.
GET PROPERTY OF g_workbook 'Worksheets' = g_worksheets.
GET PROPERTY OF g_excel 'ACTIVESHEET' = g_worksheet.
SET PROPERTY OF g_excel 'DISPLAYALERTS' = 0.
GET PROPERTY OF g_worksheets 'Count' = l_cnt.
l_cnt = l_cnt - 1.
Delete unwanted worksheets
DO l_cnt TIMES.
GET PROPERTY OF g_excel 'ACTIVESHEET' = g_worksheet.
CALL METHOD OF g_worksheet 'DELETE'.
ENDDO.
ENDFORM. " OPEN_EXCEL
*& Form CLOSE_EXCEL
FORM close_excel.
SET PROPERTY OF g_excel 'VISIBLE' = 1.
CALL METHOD OF g_workbook 'SAVEAS'
EXPORTING #1 = p_filenm.
quit Excel and free all OLE objects
call method of g_excel 'QUIT'.
FREE OBJECT g_interior.
FREE OBJECT g_borders.
FREE OBJECT g_font.
FREE OBJECT g_cell.
FREE OBJECT g_cell1.
FREE OBJECT g_cell2.
FREE OBJECT g_cellrange.
FREE OBJECT g_excel.
FREE OBJECT g_workbooks.
FREE OBJECT g_workbook.
FREE OBJECT g_worksheets.
FREE OBJECT g_worksheet.
ENDFORM. " CLOSE_EXCEL
*& Form ADD_WORKSHEET
FORM add_worksheet USING i_name.
Add new worksheet
IF g_first_ws <> 'N'.
g_first_ws = 'N'.
GET PROPERTY OF g_excel 'ACTIVESHEET' = g_worksheet.
ELSE.
CALL METHOD OF g_worksheets 'Add' = g_worksheet.
ENDIF.
SET PROPERTY OF g_worksheet 'NAME' = i_name.
g_row = 1.
g_col = 1.
ENDFORM. " ADD_WORKSHEET
*& Form ADD_WORKSHEET1
FORM add_worksheet1.
PERFORM add_worksheet USING 'Test 1'.
fill line in EXCEL sheet with headerlines of table columns
g_col = 1.
PERFORM fill_cell USING g_row g_col 'My First Worksheet' 'X' ''
PERFORM merge_cell USING g_row 1 g_row 4.
PERFORM set_border USING g_row 1 g_row 4 4 ''.
ADD 1 TO g_row.
g_col = 1.
PERFORM fill_cell USING g_row g_col 'ID'(001) 'X' '' '' '' ''.
PERFORM fill_cell USING g_row g_col 'Name'(002) 'X' '' '' '' ''.
PERFORM fill_cell USING g_row g_col 'Telephon'(003) 'X' '' '' '' ''.
PERFORM fill_cell USING g_row g_col 'Rabatt'(004) 'X' '' '' '' ''.
loop at customr table and print values into EXCEL sheet
ADD 1 TO g_row.
LOOP AT t_sheet1.
g_col = 1.
PERFORM fill_cell USING g_row g_col t_sheet1-col1 '' '' '' '' ''.
PERFORM fill_cell USING g_row g_col t_sheet1-col2 '' '' '' '' ''.
ADD 1 TO g_row.
ENDLOOP.
g_col = 4.
PERFORM set_border USING 1 1 g_row g_col '' 4.
ENDFORM. " ADD_WORKSHEET1
*& Form ADD_WORKSHEET2
FORM add_worksheet2.
PERFORM add_worksheet USING 'Test 2'.
fill line in EXCEL sheet with headerlines of table columns
g_col = 1.
PERFORM fill_cell USING g_row g_col 'My Second Worksheet' 'X' ''
PERFORM merge_cell USING g_row 1 g_row 4.
PERFORM set_border USING g_row 1 g_row 4 1 'X'.
PERFORM set_color USING g_row 1 g_row 4 'LT'.
ADD 1 TO g_row.
g_col = 1.
PERFORM fill_cell USING g_row g_col 'ID'(001) 'X' '' '' '' ''.
PERFORM fill_cell USING g_row g_col 'Name'(002) 'X' '' '' '' ''.
PERFORM fill_cell USING g_row g_col 'Telephon'(003) 'X' '' '' '' ''.
PERFORM fill_cell USING g_row g_col 'Rabatt'(004) 'X' '' '' '' ''.
loop at customr table and print values into EXCEL sheet
ADD 1 TO g_row.
LOOP AT t_sheet2.
g_col = 1.
PERFORM fill_cell USING g_row g_col t_sheet2-col1 '' '' '' '' ''.
PERFORM fill_cell USING g_row g_col t_sheet2-col2 '' '' '' '' ''.
ADD 1 TO g_row.
ENDLOOP.
g_col = 4.
PERFORM set_border USING 1 1 g_row g_col 2 'X'.
ADD 4 TO g_row.
g_col = 1.
PERFORM fill_cell USING g_row g_col 'This is a wrap text' 'X' ''
'X' 'C' 'T'.
PERFORM fill_cell USING g_row g_col 'Vertical - Bottom' 'X' ''
'' 'L' 'T'.
ADD 4 TO g_row.
g_col = 1.
PERFORM fill_cell USING g_row g_col 'Amount 1' 'X' '' '' '' ''.
PERFORM fill_cell USING g_row g_col '100.04' '' 'X' '' '' ''.
ADD 1 TO g_row.
g_col = 1.
PERFORM fill_cell USING g_row g_col 'Amount 2' 'X' '' '' '' ''.
PERFORM fill_cell USING g_row g_col '200.01' '' 'X' '' '' ''.
ADD 1 TO g_row.
g_col = 1.
PERFORM fill_cell USING g_row g_col 'Total' 'X' '' '' '' ''.
PERFORM fill_cell USING g_row g_col '=SUM(B13:B14)' 'X' 'X' '' '' ''.
PERFORM fill_cell USING g_row g_col '0.00' 'X' 'X' '' '' ''.
PERFORM copy_cell USING g_row 2 17 5 25 8.
ENDFORm. " ADD_WORKSHEET2
*& Form MERGE_CELL
FORM merge_cell USING i_row1 i_col1
i_row2 i_col2.
CALL METHOD OF g_excel 'Cells' = g_cell1
EXPORTING #1 = i_row1
#2 = i_col1.
CALL METHOD OF g_excel 'Cells' = g_cell2
EXPORTING #1 = i_row2
#2 = i_col2.
CALL METHOD OF g_excel 'Range' = g_cellrange
EXPORTING #1 = g_cell1
#2 = g_cell2.
CALL METHOD OF g_cellrange 'Merge'.
ENDFORM. " MERGE_CELL
*& Form SET_BORDER
FORM set_border USING i_row1 i_col1
i_row2 i_col2
i_thickness
i_allborders.
CALL METHOD OF g_excel 'Cells' = g_cell1
EXPORTING #1 = i_row1
#2 = i_col1.
CALL METHOD OF g_excel 'Cells' = g_cell2
EXPORTING #1 = i_row2
#2 = i_col2.
CALL METHOD OF g_excel 'Range' = g_cellrange
EXPORTING #1 = g_cell1
#2 = g_cell2.
IF i_allborders IS INITIAL.
CALL METHOD OF g_cellrange 'BorderAround'
EXPORTING #1 = 1 "Continuous line
#2 = i_thickness. "Thickness: 1 - Normal, 4 - Thick
ELSE.
GET PROPERTY OF g_cellrange 'Borders' = g_borders.
SET PROPERTY OF g_borders 'LineStyle' = '1'.
SET PROPERTY OF g_borders 'Weight' = i_thickness.
ENDIF.
ENDFORM. " SET_BORDER
*& Form SET_COLOR
FORM set_color USING i_row1 i_col1
i_row2 i_col2
i_color.
DATA: l_colorindex TYPE i.
CASE i_color.
WHEN 'BK'.
l_colorindex = 1. "Black
WHEN 'BR'.
l_colorindex = 53. "Brown
WHEN 'OG'.
l_colorindex = 52. "Olive Green
WHEN 'DG'.
l_colorindex = 51. "Dark Green
WHEN 'DT'.
l_colorindex = 49. "Dark Teal
WHEN 'DB'.
l_colorindex = 11. "Dark Blue
WHEN 'ID'.
l_colorindex = 55. "Indigo
WHEN 'G4'.
l_colorindex = 56. "Gray 80%
WHEN 'DR'.
l_colorindex = 9. "Dark Red
WHEN 'OR'.
l_colorindex = 46. "Orange
WHEN 'DY'.
l_colorindex = 12. "Dark Yellow
WHEN 'GR'.
l_colorindex = 10. "Green
WHEN 'TL'.
l_colorindex = 14. "Teal
WHEN 'BL'.
l_colorindex = 5. "Blue
WHEN 'BY'.
l_colorindex = 47. "Blue Gray
WHEN 'G3'.
l_colorindex = 16. "Gray 50%
WHEN 'RD'.
l_colorindex = 3. "Red
WHEN 'LO'.
l_colorindex = 45. "Light Orange
WHEN 'LI'.
l_colorindex = 43. "Lime
WHEN 'SG'.
l_colorindex = 50. "Sea Green
WHEN 'AQ'.
l_colorindex = 42. "Aqua
WHEN 'LB'.
l_colorindex = 41. "Light Blue
WHEN 'VL'.
l_colorindex = 13. "Violet
WHEN 'G2'.
l_colorindex = 48. "Gray 40%
WHEN 'PK'.
l_colorindex = 7. "Pink
WHEN 'GD'.
l_colorindex = 44. "Gold
WHEN 'YL'.
l_colorindex = 6. "Yellow
WHEN 'BG'.
l_colorindex = 4. "Bright Green
WHEN 'TQ'.
l_colorindex = 8. "Turquoise
WHEN 'SB'.
l_colorindex = 33. "Sky Blue
WHEN 'PL'.
l_colorindex = 54. "Plum
WHEN 'G1'.
l_colorindex = 15. "Gray 25%
WHEN 'RS'.
l_colorindex = 38. "Rose
WHEN 'TN'.
l_colorindex = 40. "Tan
WHEN 'LY'.
l_colorindex = 36. "Light Yellow
WHEN 'LG'.
l_colorindex = 35. "Light Green
WHEN 'LT'.
l_colorindex = 34. "Light Turquoise
WHEN 'PB'.
l_colorindex = 37. "Pale Blue
WHEN 'LV'.
l_colorindex = 39. "Lavender
WHEN 'WH'.
l_colorindex = 2. "White
WHEN OTHERS.
l_colorindex = 2. "White
ENDCASE.
CALL METHOD OF g_excel 'Cells' = g_cell1
EXPORTING #1 = i_row1
#2 = i_col1.
CALL METHOD OF g_excel 'Cells' = g_cell2
EXPORTING #1 = i_row2
#2 = i_col2.
CALL METHOD OF g_excel 'Range' = g_cellrange
EXPORTING #1 = g_cell1
#2 = g_cell2.
GET PROPERTY OF g_cellrange 'Interior' = g_interior.
SET PROPERTY OF g_interior 'ColorIndex' = l_colorindex.
ENDFORM. " SET_COLOR
*& Form COPY_CELL
FORM copy_cell USING i_crow i_ccol
i_prow1 i_pcol1
i_prow2 i_pcol2.
CALL METHOD OF g_excel 'Cells' = g_cell
EXPORTING #1 = i_crow
#2 = i_ccol.
CALL METHOD OF g_cell 'Copy'.
CALL METHOD OF g_excel 'Cells' = g_cell1
EXPORTING #1 = i_prow1
#2 = i_pcol1.
CALL METHOD OF g_excel 'Cells' = g_cell2
EXPORTING #1 = i_prow2
#2 = i_pcol2.
CALL METHOD OF g_excel 'Range' = g_cellrange
EXPORTING #1 = g_cell1
#2 = g_cell2.
CALL METHOD OF g_worksheet 'Paste'
EXPORTING #1 = g_cellrange.
ENDFORM. " COPY_CELL
*& Form OPEN_TEMPLATE_FILE
FORM open_template_file.
CALL METHOD OF g_workbooks 'Open' = g_tmp_workbook
EXPORTING #1 = g_pc_template
#2 = 2
#3 = 0
#4 = 1
#5 = 0
#6 = 0
#7 = 1.
CALL FUNCTION 'FLUSH'
EXCEPTIONS
OTHERS = 0.
GET PROPERTY OF g_tmp_workbook 'Worksheets' = g_tmp_worksheets.
GET PROPERTY OF g_tmp_worksheets 'Item' = g_tmp_worksheet1
exporting #1 = 1.
GET PROPERTY OF g_tmp_worksheets 'Item' = g_tmp_worksheet2
exporting #1 = 2.
CALL METHOD OF g_tmp_worksheet1 'Copy'
EXPORTING #1 = g_worksheet.
CALL METHOD OF g_tmp_worksheet2 'Copy'
EXPORTING #1 = g_worksheet.
call method of g_tmp_workbook 'Close'.
CALL FUNCTION 'FLUSH'
EXCEPTIONS
OTHERS = 0.
ENDFORM. " OPEN_TEMPLATE_FILE -
Overdue to transport Function Module for Backend Access
Hi all, I have problem when overdue to transport function module to next system (iView has transported to the next system). When i transport this function module,the application work (before there is message internal server error) but there is'nt any data that show in my table (before using this new function module, data show properly). One thing that make me more confused that when my application tested in previous system, the data show properly. Anyone can help me ? Thank you
Regards,
Satriahi
You just need to pass the value to the FM and FM will return the table with set of values now you need pass this table returned by FM to a internal table, for that you can just modify the internal table or append the internal table,
use below code for reference :
WHILE D1 LE D2.
CALL FUNCTION 'BAPI_AR_ACC_GETOPENITEMS'
EXPORTING
COMPANYCODE = PA_BUKRS
CUSTOMER = PA_KUN
KEYDATE = D1
NOTEDITEMS = 'X'
* SECINDEX = ' '
* IMPORTING
* RETURN =
TABLES
LINEITEMS = LT_ITMES.
ENDWHILE.
LOOP AT LT_ITMES INTO WA_ITMES.
MOVE WA_ITMES-CLEAR_DATE TO WA_BSID-AUGDT.
MOVE WA_ITMES-COMP_CODE TO WA_BSID-BUKRS.
MOVE WA_ITMES-FISC_YEAR TO WA_BSID-GJAHR.
MOVE WA_ITMES-REF_DOC_NO TO WA_BSID-XBLNR.
MOVE WA_ITMES-ALLOC_NMBR TO WA_BSID-ZUONR.
MOVE WA_ITMES-DOC_NO TO WA_BSID-BELNR.
APPEND WA_BSID TO IT_BSID.
ENDIF.
hope it helps. -
Functional module for automatic creation of pur requisition & pur order
hello,
what is the functional module for automatic creation of puchase requisition and automatic creation of purchase order which we will assign in action box in service order processing management.
please let me know as early as possible
regards,
rajesh kumar rajuHi,
Please check with following.
IDOC_INPUT_ACC_PURCHASE_REQUI
IDOC_INPUT_ACC_PURCHASE_ORDER
/ISDFPS/OR_PURCHASE_ORDER_CR
BS01_PURCHASE_DOCUMENT_CREATE
CO_MP_CREATE_PURCHASE_ORDER
Thanks & Regards
Sadhu Kishore
Maybe you are looking for
-
How to expire password for all users
I need to be able to expire the password for all users. This is to prevent access by any user until each one is released individually (administrator will set a new password and notify user). Please could someone give me any tips on how to expire all
-
Suggestions for a good monitor for mac pro
can someone suggest a good 4k monitor(preferably a 4k tv to be used) to attach with macpro and which are the accessories needed to make that operational
-
HT2729 how to sync my laptop music to my iphone
How do i sync my music from laptop to iphone 5? its in the music folder under iphone but where is the sync button? Thanks guys
-
Dear All i have written the program for send payslip through email and its working fine But problem is that i am not getting the correct format in PDF Regards Arun
-
How can I see Exchange Groups using a phone/tablet App?
Hey guys, Is there an App that allows me to View/Edit AD/Exchange Groups? Thanks