NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

REPORT z_vendor_migration.

* Data Declarations
DATA: lt_lfa1 TYPE TABLE OF lfa1,
lt_lfbk TYPE TABLE OF lfbk,
lt_lfm1 TYPE TABLE OF lfm1,
lt_lfm2 TYPE TABLE OF lfm2,
lt_lfb1 TYPE TABLE OF lfb1,
lt_lfb5 TYPE TABLE OF lfb5,
lt_adr6 TYPE TABLE OF adr6.

DATA: lv_filename TYPE string,
lv_path TYPE string,
lv_fullpath TYPE string,
lv_date TYPE d.

PARAMETERS: p_path TYPE rlgrap-filename OBLIGATORY.

START-OF-SELECTION.

* Validate and construct file path
lv_path = p_path.
lv_date = sy-datum.
lv_filename = 'Vendor_Master_' && lv_date && '.txt'.
CONCATENATE lv_path lv_filename INTO lv_fullpath.

* Extract Vendor Master Data
SELECT * INTO TABLE lt_lfa1 FROM lfa1.
SELECT * INTO TABLE lt_lfbk FROM lfbk.
SELECT * INTO TABLE lt_lfm1 FROM lfm1.
SELECT * INTO TABLE lt_lfm2 FROM lfm2.
SELECT * INTO TABLE lt_lfb1 FROM lfb1.
SELECT * INTO TABLE lt_lfb5 FROM lfb5.
SELECT * INTO TABLE lt_adr6 FROM adr6.

* Export data to file
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = lv_fullpath
filetype = 'ASC'
TABLES
data_tab = lt_lfa1
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.

IF sy-subrc = 0.
WRITE: / 'Vendor master data has been successfully exported to', lv_fullpath.
ELSE.
WRITE: / 'An error occurred while exporting vendor master data'.
ENDIF.

* Repeat above GUI_DOWNLOAD for each table, e.g., lt_lfbk, lt_lfm1, etc.

* Example for lt_lfbk:
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = lv_fullpath
filetype = 'ASC'
TABLES
data_tab = lt_lfbk
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.

IF sy-subrc = 0.
WRITE: / 'Vendor bank data has been successfully exported to', lv_fullpath.
ELSE.
WRITE: / 'An error occurred while exporting vendor bank data'.
ENDIF.

* Repeat this for each relevant table: lt_lfm1, lt_lfm2, lt_lfb1, lt_lfb5, lt_adr6
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.