on 10-10-2006 10:22 AM
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
Hi Niten,
You can check out 0LOGSYS for an example of a transfer routine written in the INFOOBJECT.
R,
Adwin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.