Wednesday, October 24, 2012 at 1:41 AM | 0 comments
Here is a sample MONTH_PLUS_DETERMINE


Please see example code below.

data : lv_newdate type sy-datum.

call function 'MONTH_PLUS_DETERMINE'
  exporting
    months = 1
    olddate = '20120101'
  importing
    newdate = lv_newdate.

write : lv_newdate. " output -> 20120201
Posted by Shanto Labels:
Sunday, October 21, 2012 at 9:00 PM | 0 comments
Here is a sample t-sql code to send email from SQL Server


Please see example code below.

declare @From varchar(4000)
declare @To varchar(4000)
declare @Subject varchar(4000)
declare @Body varchar(4000)
declare @Attachment varchar(4000)
Declare @iMsg int
Declare @hr int
Declare @source varchar(255)
Declare @description varchar(500)
Declare @output varchar(1000)
Declare @mailserver varchar(255)
set @From = 'from@gmail.com'
set @To = 'to@gmail.com'
set @Subject = 'testing'
set @Body = 'test'
SELECT @mailserver = 'mail.gmail.com'
EXEC @hr = sp_OACreate 'CDO.Message', @iMsg OUT
EXEC @hr = sp_OASetProperty @iMsg, 'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/sendusing").Value','2'
EXEC @hr = sp_OASetProperty @iMsg, 'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/smtpserver").Value', @mailserver
EXEC @hr = sp_OAMethod @iMsg, 'Configuration.Fields.Update', null

EXEC @hr = sp_OASetProperty @iMsg, 'To', @To
EXEC @hr = sp_OASetProperty @iMsg, 'From', @From
EXEC @hr = sp_OASetProperty @iMsg, 'Subject', @Subject

IF @Attachment IS NOT NULL
BEGIN
EXEC @hr = sp_OAMethod @iMsg, 'AddAttachment', null, @Attachment
END

EXEC @hr = sp_OASetProperty @iMsg, 'TextBody', @Body
EXEC @hr = sp_OAMethod @iMsg, 'Send', NULL

IF @hr <>0
select @hr
BEGIN
EXEC @hr = sp_OAGetErrorInfo NULL, @source OUT, @description OUT
IF @hr = 0
BEGIN
SELECT @output = ' Source: ' + @source
PRINT @output
SELECT @output = ' Description: ' + @description
PRINT @output
END ELSE
BEGIN
PRINT ' sp_OAGetErrorInfo failed.'
RETURN
END
END
EXEC @hr = sp_OADestroy @iMsg

Posted by Shanto Labels:
From Release 4.0 the previously 1-character language key has 2-characters as in ISO Code 639. For example, English is now 'EN' insead of 'E', Hebrew is 'HE' instead of 'B' and Korean is 'KO' instead of '3'. Script :

data : lv_output(1).

call function 'CONVERSION_EXIT_ISOLA_INPUT'
exporting
    input = 'ID'     " ID -> Indonesia
importing
    output = lv_output.


write lv_output.
Posted by Shanto Labels: ,
Sunday, March 4, 2012 at 7:07 PM | 0 comments
Sometimes we need to change the printer spool into default, we can use tcode su01 or su10.

Please see capture below.

Posted by Shanto Labels: