cancel
Showing results for 
Search instead for 
Did you mean: 

Transfer Routine

Former Member
0 Kudos

Can someone give me an example of a transfer routine which is written in the InfoObject

The object is 0BATCH which is a string of characters which in some cases I want to replace one of the characters. My problem is looking up the Batch Number itself. The details are:

1) I have a Batch Number and want to replace one of the characters in the Batch number and replace it with the # character

2) The character that I want to replace will be anything with an ASCII value less than 32

3) The ASCII code for # is 35

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Niten,

You can check out 0LOGSYS for an example of a transfer routine written in the INFOOBJECT.

R,

Adwin

Former Member
0 Kudos

Thanks guys will look at 0LOGSYS. In the meantime, AVR the code that you have provided what does LT mean and also rather than '#' how can I just put a hexadecimal number

Former Member
0 Kudos

OK I have looked at the suggested thread and have used it to help write the following, can someone help me solve the error and tidy up, thanks

The error is "E:Statement "RESULT" is not defined. Check your spelling. spelling."

The routine has been written in the transfer routine of 0BATCH

DATA: len type i,

off type i,

hex1 type x value '1',

hex2 type x value '32'.

Field-Symbols <fs> type any.

IF RESULT IS INITIAL and

IOBJ_NAME = '0BATCH'.

len = strlen( IOBJ_NAME ).

while off lt len.

assign IOBJ_NAME+off(1) to <fs> casting type x.

if <fs> le hex1 or <fs> ge hex2.

IOBJ_NAME+off(1) = ' '.

endif.

add 1 to off.

endwhile.

RESULT.

ENDIF.

RETURNCODE = 0.

Message was edited by: Niten Shah

edwin_harpino
Active Contributor
0 Kudos

hi Niten,

from that thread, try following code in infoobject transfer routine

(adjust the hexa range for ascii you want to replace)

data: len type i,

off type i,

hex1 type x value '1F',

hex2 type x value '80'.

field-symbols <fs> type any.

len = strlen( result ).

while off lt len.

assign result+off(1) to <fs> casting type x.

if <fs> le hex1 or <fs> ge hex2.

result+off(1) = '#'.

endif.

add 1 to off.

endwhile.

RETURNCODE = 0.

Former Member
0 Kudos

Thanks Edwin,

Have copied and pasted the suggested code, no syntax error. Just one question though the range of characters that I want to work with are slightly different. I am referring to the site http://www.lookuptables.com/

and my range is Hex values 1 to 32. For the 1 (low range) I have put space and than 1 i.e. ' 1' is this correct on makes know difference. I will carry out a load thereafter and check the values

Former Member
0 Kudos

Ok I have tried again and still encounter the same problem. What I have now done is as follows:

1) 0BATCH InfoObject I have placed the routine (below) as a transfer routine in the object

2) I have run the extractor 2LIS_03_BF, 0BATCH is 1:1 mapping in the transfer rules

3) The load fails because of Hex value 29

If anyone has any thoughts, possibly on what is missing i.e. code otherwise could you advise? Thanks

DATA: len TYPE i,

off TYPE i,

hex1 TYPE x VALUE ' 1',

hex2 TYPE x VALUE '32'.

Field-Symbols <fs> TYPE any.

len = Strlen( RESULT ).

WHILE off lt len.

ASSIGN RESULT+off(1) to <fs> CASTING TYPE x.

IF <fs> le hex1 or <fs> ge hex2.

RESULT+off(1) = ' '.

ENDIF.

add 1 to off.

ENDWHILE.

RETURNCODE = 0.

edwin_harpino
Active Contributor
0 Kudos

hi Niten,

you need < 32 only ?

DATA: len TYPE i,

off TYPE i,

<b>hex1 TYPE x VALUE '32'</b>.

Field-Symbols <fs> TYPE any.

len = Strlen( RESULT ).

WHILE off lt len.

ASSIGN RESULT+off(1) to <fs> CASTING TYPE x.

<b>IF <fs> LT hex1.</b>

........

LT = less than.

hope this helps.

Former Member
0 Kudos

Edwin,

Thanks for this, it has fixed the problem. Have awarded points but get an error, let me know if you do not get the points and I will try again

Answers (2)

Answers (2)

edwin_harpino
Active Contributor
0 Kudos

hi Niten,

check the logic in

hope this helps.

Former Member
0 Kudos

Hi,

Check the below code is of some use.

Data var1 type c.

var1 = TRAN_STRUCTURE-/bic/0batch.

If var1 LT '#'.

var1 = '#'.

Endif.

result = var1.

Hope this helps you.....