cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP routing in info package

Former Member
0 Kudos

Hi All,

I have a requirement where about 1000 document numbers are to be used in the info package. I can wite an abap routine at the info package. Since there are many documents numbers, can I create an info object and load the numbers in it and use a simple select on the info object and compare it with the document no inside the abap routine. Though I have the idea I have not done anything like this before. Does anyone know how I can use l_t_range internal table with many individual document numbers?

Example code will be appreciated.

Thanks,

Alex.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Alex,

I used the following code to upload from a TXT file to the infopackage selection criteria.

Note ": This does not work in Background as GUI UPLOAD does not work in background, so you will not be able to schedule it in a processchain.

***

data: l_idx like sy-tabix.

read table l_t_range with key

fieldname = 'MATERIAL'.

l_idx = sy-tabix.

*....

modify l_t_range index l_idx.

p_subrc = 0.

DATA s_line(18) TYPE N.

DATA t_line LIKE STANDARD TABLE OF s_line.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = 'C:\input2.txt'

filetype = 'ASC'

  • HAS_FIELD_SEPARATOR = ' '

  • HEADER_LENGTH = 0

read_by_line = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

data_tab = t_line

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.

ENDIF.

l_t_range-sign = 'I'.

l_t_range-option = 'EQ'.

LOOP AT t_line INTO s_line.

l_t_range-low = s_line.

IF sy-tabix = 1.

MODIFY l_t_range INDEX l_idx.

ELSE.

APPEND l_t_range.

ENDIF.

ENDLOOP.

If you already have the document numbers, I guess it is easier to load it from a text file instead of creating an Infoobj.

You might need to change the declaration to suit your requirement.

The following piece to be changed as required

DATA s_line(18) TYPE N.

DATA t_line LIKE STANDARD TABLE OF s_line.

***

Cheers,

Praveen.

Former Member
0 Kudos

Hi Praveen,

Thanks for the code. I am not trying to load those documents, but I want to filter only those document numbers from a R3 load. usually we put the selection parameters in the info package under selection parameter. Since I have many i would like to write a routine to read those document numbers and filter records from the load.

Let me know if I am not clear.

Thanks,

Alex.

Former Member
0 Kudos

Hi Alex,

The above code is used to do exactly that(If I have understood your requirement correctly ).

Instead of manually entering the Document numbers in the Infopackage selection criteria, you put the list of document numbers in INPUT.TXT file in C:\ in the following format.

00010103940

00029293020

00019938992

...

Then you put the code in the infopackage selection criteria for Document field using Abap routine 6.

When you run the infopackage, it would read the INPUT.TXT file from C: and add them to the selection criteria of the infopackage. This would filter the load from R3 and would only extract for the list of Documents you have given in the TXT file.

If I have completely misunderstood your requirement.....Apologies

Cheers,

Praveen.

Former Member
0 Kudos

Praveen,

I think I did not understand the code. You are right. Since in your case you put it in C: drive it cannot be loaded thru process chain. if you have the file in application server or in info object it will work fine even through process chain.

Thanks much.

Alex.

Former Member
0 Kudos

I beg to differ mate, the FM checks if we are on BATCH mode.

  • Batch mode is not supported

IF sy-batch = 'X'.

MESSAGE ID 'FES' TYPE 'E' NUMBER '002' RAISING NO_BATCH.

ENDIF.

Cheers,

Praveen.

Answers (0)