cancel
Showing results for 
Search instead for 
Did you mean: 

Loading Multiple Flat File around 80+

Former Member
0 Kudos

Hi,

Loading multiple flat file in to BI system.

My issue: I got a scenerio of loading multiple i.e., 80+ flat file into BI system every month and my client want it to be done through process chain r automation with out manual intervention.

Can any one suggest me how can i achiev this one.

Regards,

Prabhakar.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Resolved by my self

Former Member
0 Kudos

how u resolved that issue

am facing same issue

could u please guide me.

Former Member
0 Kudos

Hi can you share the solution for this  as I have similar requirement to sreechakka at gmail.com .

thanks in advance.

Former Member
0 Kudos

Did u find the solution for this? If yes can you share to sreechakka@gmail.com.

thanks

0 Kudos

Hi,

I have the same issue. I have to load 60+ files with the filename sellin001.csv - sellin999.csv into SAP BW via InfoPackage into PSA. The quantity of files can change.

What is the best way and can anybody share the abap coding?

Many thanks in advance for your help

Best regards

Michael

Former Member
0 Kudos

Since the no. of files are not fixed, will suggest you to go for one IP for file. This will give you flexibility to add/delete any IP at any time in the proces chain.

Thanks...

Shambhu

Former Member
0 Kudos

Hi,

If i create one IP per file means, every month i need to customize the process chain also to include all these IP of those files.

Is any other process is there to acieve this, like if we keep all these file in a folder in sequential order and from that folder is it possible to upload those files in a sequential order as per sequence of files.

Suggest me the approach.

Regards,

Prabhakar.

former_member207028
Contributor
0 Kudos

Hi,

same InfoPackage can be used to load all the files and this IP can be assigned to process chain.

as experts given comments, in IP we have write ABAP code to load all fine in sequence.

ie for April files <Filename_04_1.csv>... <Filename_04_80.csv>

for May file <Filename_05_1.csv>... <Filename_05_80.csv>

after file name month and file should be in increasing format and after dec again jan and for no of files, if file not exist code should stop looping.

hope this helps

Regards

Daya Sagar

Former Member
0 Kudos

Hi Daya Sagar,

Thank Q very much for your feedback.

If possible can you send me some sample code relative to this for loading the multiple files through a single info package. it will be helpful for me if you send some reference code.

Regards

Prabhakar

Former Member
0 Kudos

Hi,

Can any one suggest me how to write this code in the infopackage routine to load multiple flat file at a time through infopackage.

Regards,

Prabhakar.

Former Member
0 Kudos

Hi All,

We have developed a logic to upload multiple flat file at a time i.e., .CSV file. Please find below is the logic regarding that routine.

*+ program filename_routine.

  • Global code

$$ begin of global - insert your declaration only below this line -

  • Enter here global variables and type declarations

  • as well as additional form routines, which you may call from the

  • main routine COMPUTE_FLAT_FILE_FILENAME below

data : v_filename type string.

data : v_foldername type string.

data : v_uploadfile type string.

data: v_download_file type string.

data : v_ext(4) type c.

data : v_FILE_EXISTS type c.

data : v_file type DXFILE-FILENAME.

data : v_count(3) type c.

data : v_length type i.

TYPES: BEGIN OF TY_file,

LINE(900),

END OF TY_file.

DATA: GIT_file TYPE TABLE OF TY_file.

$$ end of global - insert your declaration only before this line -

  • -------------------------------------------------------------------

form compute_flat_file_filename

using p_infopackage type rslogdpid

p_datasource type rsoltpsourcer

p_logsys type rsslogsys

changing p_filename type RSFILENM

p_subrc like sy-subrc.

$$ begin of routine - insert your code only below this line -

  • This routine will be called by the adapter,

  • when the infopackage is executed.

*

v_count = 1.

************************************************************************

*****************************************

*---- As per the folder location of the files & system we have to change

*the path fo the folder in the below variable i.e., 'c:\............

v_foldername =

'C:\Documents and Settings\Prabhakar-HP\Desktop\test\'.

*---- As per the Prefix of the files like 'CSI_01_..' we have change the

*prefix if required in the below variable i.e., 'CSI_01_..', IF REQUIRED

*OR IF WANT TO CHANGE THE PREFIX TO SOME OTHER.

v_filename = 'CSI_01_'.

************************************************************************

*****************************************

v_ext = '.csv'.

condense v_count.

concatenate v_foldername

v_filename

v_count

v_ext into v_uploadfile.

v_file = v_uploadfile.

CALL FUNCTION 'DX_FILE_EXISTENCE_CHECK'

EXPORTING

FILENAME = v_file

PC = 'X'

IMPORTING

FILE_EXISTS = v_FILE_EXISTS

EXCEPTIONS

RFC_ERROR = 1

FRONTEND_ERROR = 2

NO_AUTHORITY = 3

OTHERS = 4.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

while v_FILE_EXISTS = 'X'.

v_file = v_uploadfile.

CALL FUNCTION 'DX_FILE_EXISTENCE_CHECK'

EXPORTING

FILENAME = v_file

PC = 'X'

IMPORTING

FILE_EXISTS = v_FILE_EXISTS

EXCEPTIONS

RFC_ERROR = 1

FRONTEND_ERROR = 2

NO_AUTHORITY = 3

OTHERS = 4.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

if v_file_exists = 'X'.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = v_uploadfile

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = GIT_file

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.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

elseif sy-subrc = 0.

************************************************************************

************

**----- As per the REQUIRMENT, want to change the down loading file

*path means we have to change the path in the below variable i.e.,

*'c:\.......

v_download_file =

'C:\Documents and Settings\Prabhakar-HP\Desktop\test\satheesh.CSV'.

************************************************************************

*************

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = v_download_file

FILETYPE = 'ASC'

APPEND = 'X'

TABLES

DATA_TAB = git_file

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.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

refresh git_file.

ENDIF.

endif.

if v_file_exists = 'X'.

if p_subrc = 0.

v_count = v_count + 1.

condense v_count.

concatenate

v_foldername

v_filename

v_count

v_ext into v_uploadfile.

endif.

else.

endif.

endwhile.

v_uploadfile = v_download_file.

p_filename = v_uploadfile.

p_subrc = 0.

$$ end of routine - insert your code only before this line -

endform. +*

Reagrds,

Prabhakar.

mathew_muthalaly
Contributor
0 Kudos

Hi,

You can do that through process chains.

Take a look at this link:

http://help.sap.com/saphelp_nw04/helpdata/EN/8f/c08b3baaa59649e10000000a11402f/content.htm

You would need to think about upload file naming conventions etc.

In the infopackage there is a provision to create a routine for varying file names.

Best regards

Mathew.

Former Member
0 Kudos

Hi Mathew,

Here in this case the number of files will get varied month by month i.e., in one month number of flat file may be 80 and in the next month they may be 100 file of the same format.

how can we schedule all these number of file in a sequence, wether to create a single info package and to create a multiple info package for individual file to load data.

How to proceed in this case, please suggest me the approach.

Regards,

Prabhakar.