Tuesday, November 22, 2011
at
1:20 AM
|
In SAP ABAP you can read file with open dataset,
The command used to read a file on the application server is as follows.
OPEN DATASET ... FOR INPUT
Please see example code below.
REPORT YSANTO_12 .
data: lv_fname(100),
  lv_msg like sy-msgv1.
data: begin of gi_data occurs 0,
      txt(255),
  end of gi_data.
lv_fname = '/home/data/data.txt'.
open dataset lv_fname for input message lv_msg in text mode encoding default.
if sy-subrc = 0.
  do.
  read dataset lv_fname into gi_data-txt.
  if sy-subrc <> 0.
    exit.
  endif.
  append gi_data.
  clear gi_data.
  enddo.
else.
  write 'File does not exist!'.
endif.
close dataset lv_fname.
Posted by
Shanto
Labels:
ABAP
Sunday, November 20, 2011
at
11:08 PM
|
Here is an example of how to FTP a file from the Application server to a remote server using standard SAP functions.
REPORT YSANTO_12 .
data: begin of gi_data occurs 0, line(132) type c, end of gi_data.
data: lv_password(20) type c, lv_key type i value 26101957, lv_pwd_len type I, lv_handle type I.
START-OF-SELECTION.
lv_password = 'password'.
describe field lv_password length lv_pwd_len in character mode.
call 'AB_RFC_X_SCRAMBLE_STRING' id 'SOURCE' field lv_password id 'KEY' field lv_key id 'SCR' field 'X' id 'DESTINATION' field lv_password id 'DSTLEN' field lv_pwd_len.
call function 'FTP_CONNECT' exporting user = 'userid' password = lv_password host = 'host' rfc_destination = 'SAPFTP' importing handle = lv_handle exceptions not_connected = 1 others = 2.
check sy-subrc = 0.
call function 'FTP_COMMAND' exporting handle = lv_handle command = 'dir' " for get file -> exe commnad 'asci' tables " then exe command 'get sourcefile targetfile'. data = gi_data exceptions tcpip_error = 1 command_error = 2 data_error = 3 others = 4.
call function 'FTP_DISCONNECT' exporting handle = lv_handle exceptions others = 1.
Posted by
Shanto
Labels:
ABAP,
ABAP Function
Friday, November 4, 2011
at
12:51 AM
|
What is Data Archiving? Data Archiving is a decongestion process used to delete large volume of data that is no longer needed from a database and storing same outside the database in a format that allows for data retrieval and analysis when need be. The emphasis here are on “deleting” and “storing”. It is common knowledge that if a database is left to grow unmaintained, there is a possibility of having performance bottlenecks and high database maintenance cost. Hence, one of the ways to maintain the database is to delete records that can be termed obsolete. The word “obsolete” is relative. For the archiving process to be complete, data has to be stored using a defined method.
How is data archived? The data archiving run follows a sequence of steps. A brief overview is provided below. 1. Creation of the archive file: During an archive run, the write program first creates archive files which initiates the reading process (from the database) and the consequent writing process (to the archive file)
2. Storage of the archive file: After successful run of step 1, the created archive files are stored. A number of methods can be leveraged to store an archive file. Archived files can be stored hierarchically, optically or manually. It is important to state that SAP does not recommend the manual storage of archive file. This is as a result of some standardization issues
3. Deletion of data: This step terminates the archive run. Before data is deleted from the database, the program first read the content of the archive file. It is after this task, that the program deletes the corresponding entry from the database.
Benefits of Data Archiving 1. Reduced Backup and Restore time 2. Reduced access time for tables 3. Reduced database administration cost 4. Reduced downtime for system upgrade 5. Reusability of data
Ref : http://it.toolbox.com/blogs/sap-library/introduction-to-sap-data-archiving-27976
Posted by
Shanto
Labels:
ABAP
Thursday, January 27, 2011
at
12:04 AM
|
Fungsi BAPI_TRIP_GET_DETAILS adalah untuk mengambil nilai yang ada di travel expense tcode PR05. data : t_framedata type table of bapitrmain with header line, t_receipts type table of bapitrvreo with header line, t_addinfo type table of bapitraddi with header line, t_amounts type table OF bapitrvsum with header line.
CALL FUNCTION 'BAPI_TRIP_GET_DETAILS' EXPORTING employeenumber = '151515' " <- Employee Number tripnumber = '15' " <- Trip Number language = sy-langu calculate_amounts = 'X' IMPORTING framedata = t_framedata TABLES receipts = t_receipts addinfo = t_addinfo amounts = t_amounts.
Posted by
Shanto
Labels:
ABAP Function
Wednesday, January 26, 2011
at
1:13 AM
|
Fungsi CURRENCY_AMOUNT_DISPLAY_TO_SAP adalah untuk menyimpan suatu nilai ke table sesuai dengan currency.
Contoh :
CALL FUNCTION 'CURRENCY_AMOUNT_DISPLAY_TO_SAP' EXPORTING currency = 'IDR' amount_display = 25 IMPORTING amount_internal = gd_intval " Hasil 0.2500 EXCEPTIONS internal_error = 1 others = 2.
Posted by
Shanto
Labels:
ABAP Function
Monday, January 24, 2011
at
9:27 PM
|
Fungsi MONTH_PLUS_DETERMINE adalah untuk menjumlahkan / mengurangkan bulan di dalam tanggal.
Contoh :
CALL FUNCTION 'MONTH_PLUS_DETERMINE' EXPORTING months = 2 olddate = '20080401' IMPORTING newdate = lv_date_new. " hasil -> 20080601
Posted by
Shanto
Labels:
ABAP Function
Fungsi Get Last Day of The Month adalah mengembalikan nilai tanggal terakhir.
Contoh :
CALL FUNCTION 'LAST_DAY_OF_MONTHS'
EXPORTING
day_in = '20080401'
IMPORTING
last_day_of_month = lv_last_day_of_month " hasil -> 20080430
EXCEPTIONS
day_in_no_date = 1
others = 2.
Posted by
Shanto
Labels:
ABAP Function
|
|