cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP in InfoPackage

Former Member
0 Kudos

Hi Gurus,

Has someone a simple ABAP code for InfoPackage from Flat File for:

1) Create Routine for name of the file (Tab External Data).

2) Subsequent Process (Tab Schedule).

Thnaks in advance.

Riccardo.

Accepted Solutions (0)

Answers (1)

Answers (1)

edwin_harpino
Active Contributor
0 Kudos

hi Riccardo,

not sure understand your question correctly

attached sample code to upload with selection from file.

info for file etc stored in table RSLDPSEL

hope this helps.

data: debug_flag(1),

l_idx like sy-tabix,

begin of it_kunnr occurs 0,

kunnr(10),

end of it_kunnr.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = 'c:\upload\customer'

FILETYPE = 'ASC'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = it_kunnr

EXCEPTIONS

CONVERSION_ERROR = 1

FILE_OPEN_ERROR = 2

FILE_READ_ERROR = 3

INVALID_TABLE_WIDTH = 4

INVALID_TYPE = 5

NO_BATCH = 6

UNKNOWN_ERROR = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

OTHERS = 10.

*do.

  • if debug_flag = 'X'.

  • exit.

  • endif.

*enddo.

read table l_t_range with key

fieldname = 'KUNNR'.

l_idx = sy-tabix.

*....

DELETE l_t_range

WHERE iobjnm = '0CUSTOMER'

and fieldname = 'KUNNR'.

L_t_RANGE-SIGN = 'I'.

L_t_RANGE-OPTION = 'EQ'.

loop at it_kunnr.

L_t_RANGE-LOW = it_kunnr-kunnr.

append l_t_range.

endloop.

modify l_t_range index l_idx.

p_subrc = 0.

Former Member
0 Kudos

Hi A.H.P.

Thank for your answer.

Another related question:

I' ve in directory a list of Flat File named "customer_aaaammgg" and I want to upload the last file on the base of the date. Is it possible from the routine in InfoPackage make this selection ?

And if it is possible would you please send me the code ?

Thanks in advance.

Riccardo.

Former Member
0 Kudos

Hi,

guess that's not possible if al the file have the same name, what about renaming or deleting the files you'll not load ?

/manfred

Former Member
0 Kudos

Hi Manfred,

the name of the file is not the same, I have the name composed by customer (fixed) and date in which the file was produdeced ("customer_aaaammgg").

In this case you can help me ?

Thanks.

Riccardo.

Former Member
0 Kudos

Hi,

try to create a logical filename where the physical filename is defined as customer-<YEAR><MONTH><DAY>.txt.

/manfred