2008 Mar 11 7:36 PM
hi guys,
i have a record as follows.
'5200ALLSTATE INSURANDIRECT DEPOSIT 2360719665CCDPAYABLES 080307 1053000210000001'.
as it is starting with '5' i should write the coding as if the record starts with '5' then i should pick the date which is at 70-75 position.can anybody provide me logic or coding for this.
for suitable answers reward points will b there.
very urgent.
2008 Mar 11 7:42 PM
Are you sure is always going to be at 70-75 positions?
That 'ALLSTATE INSURANDIRECT DEPOSIT ' looks like a variable string
If record(1) = '5'.
date = record(6)+69.
endif.
2008 Mar 11 7:42 PM
Are you sure is always going to be at 70-75 positions?
That 'ALLSTATE INSURANDIRECT DEPOSIT ' looks like a variable string
If record(1) = '5'.
date = record(6)+69.
endif.
2008 Mar 11 7:46 PM
hi ramiro,
thanx for ur reply first.
yes,
it is always at 70-750 position.
i will try this code.
2008 Mar 12 3:22 PM
romario,
the record which i told is in a file in 2nd row.so,this logic is not working for this.after reading ist row,it is coming out.
can u give the solution for this.
2008 Mar 12 3:40 PM
But is going to remain in the 70-75 position?
How are you reading the file? Are you using gui_download?
Can you post the code?
The solution remains the same, you only add a loop to the file table.
Loop at it_arch.
if it_arch(1) = '5'.
date = it_arch+69(6).
endif.
endloop.
2008 Mar 12 4:44 PM
Not exactly the same. It was:
If record(1) = '5'.
date = record(6)+69.
endif.
Your new code looks correct, but I waould avoid offsets. Future generations maintaining it would thank you.
Rob
2008 Mar 11 7:48 PM
Hello,
You could try something like this:
if l_yourrecord(1) = '5'.
l_date = l_yourrecord+69(6) .
endif.
Regards
Greg Kern
2008 Mar 11 7:49 PM
Hi, You can try this.
data: firts type c,
date(5) type c.
firts = <record>-field+0(1).
if ( first = '5' ).
date = <record>-field+69(5).
endif.
regards.
2008 Mar 11 8:05 PM
Have a look at this:
DATA f1(750) VALUE
'5200ALLSTATE INSURANDIRECT DEPOSIT 2360719665CCDPAYABLES 080307 1053000210000001'.
DATA: BEGIN OF f2,
a(1),
b(69),
date(6),
c(674),
END OF f2.
MOVE f1 TO f2.
IF f2-a = '5'.
WRITE: /001 f2-date.
ENDIF.
Rob
Edited by: Rob Burbank on Mar 11, 2008 4:14 PM
2008 Mar 12 10:11 AM
hello
i have a question the date field suppose to be 8 in length but your requiremnt is only 6 in lenth anyways to acheive the requirement you can follow the below code.
code..
DATA: T_tab TYPE MATCH_RESULT.
data:v_date type sy-datum.
Find first occurences of '5' in v_variable results t_tab.
if t_tab-offset EQ '1'.
v_date = v_variable+69(6).
endif.
2008 Mar 12 10:50 AM
srini
You will note in his data string, the date is in MMDDYY format and is likely from an outside source as from a bank. It may be necessary for him to compute the century to complete the YYYYMMDD format you are referring to.