Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to get the record which is at 70-75 position

Former Member
0 Kudos
217

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
174

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.

10 REPLIES 10

Former Member
0 Kudos
175

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.

0 Kudos
174

hi ramiro,

thanx for ur reply first.

yes,

it is always at 70-750 position.

i will try this code.

0 Kudos
174

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.

0 Kudos
174

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.

0 Kudos
174

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

Former Member
0 Kudos
174

Hello,

You could try something like this:

if l_yourrecord(1) = '5'.

l_date = l_yourrecord+69(6) .

endif.

Regards

Greg Kern

Former Member
0 Kudos
174

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.

Former Member
0 Kudos
174

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

0 Kudos
174

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.

0 Kudos
174

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.