‎2006 Jun 26 5:44 AM
hello all,
i have the following string that i'm reading into my program:
122400724 XXXXXXXXXXXXXXXXXXXXXXXX20060623150029 000000000000001200000012000000000187140110
This is the header record.
i need to put it in the following format:
1234567890 20060623 H
'H' is the record indicator for header
The structure that i need to put it in is:
DATA:
BEGIN OF t_HEADER,
BANK_NUM(10) type n,
FILLER_1(10) type c,
DATE type sy-datum,
FILLER_2(10) type c,
REC_IND1(1) type c,
END OF t_HEADER.
Then I have the detail and trailer records for which i have the following structure.
DATA:
BEGIN OF t_DETAILS OCCURS 100,
BANKN(10) type n,
CHECT(10) type n,
ZALDT type sy-datum,
AMNT(10) type c,
REC_IND2(1) type c,
ZNME1(20) type c,
END OF t_DETAILS.
DATA:
BEGIN OF t_TRAILER,
FILLER_3(10) type c,
ITEM_COUNT(9) type c,
FILLER_4(1) type c,
ZALDT1 type sy-datum,
PPT_AMOUNT(10) type c,
PPT_REC_IND(1) type c,
END OF t_TRAILER.
For details I have the following data coming that i accordingly need to put in my format.
Details:
000990127847 000007440288 000007440288 xxx xxxxxxxx xxxxx xx 0000000000000120002006050100
There is no trailer record, I have to put in the data according to the structure defined above.
I also need to replace the bank_num in the header with bankn in details.
Your help will be highly appreciated.
Thanks.
Fred.
‎2006 Jun 26 12:32 PM
Hi Fred!
Just define some more structures for header and position, which match your incoming string. E.g. first filler in header has about 20 chars, then comes date+time field and so one. Then you can assign matching parts to your output structure, also some other replacements are possible.
header-date = string_header-datetime(8).Hope you got the idea,
Christian
‎2006 Jun 26 12:32 PM
Hi Fred!
Just define some more structures for header and position, which match your incoming string. E.g. first filler in header has about 20 chars, then comes date+time field and so one. Then you can assign matching parts to your output structure, also some other replacements are possible.
header-date = string_header-datetime(8).Hope you got the idea,
Christian
‎2006 Jun 26 4:12 PM
Hi,
In the header, the date is available immediately after the X's. So based on my structure, after the first string, i need to put 10 blank spaces, then shift the date replacing the X's and delete the trailing numbers after the date. After the date, i need to put 10 blank spaces again and put the record indicator 'H'.
Would i still be able to achieve this if my i make 2 diff. structures, one for original string and the other how i want it to be and then explicitly assigning the values i want. how would i deal with the blank spaces i need to put?
Thanks.
Fred.
‎2006 Jun 26 4:55 PM
Hi Fred!
Maybe you should more think in 'I take what I need' instead of shifting...
Space you can get, when you clear your target structure (or don't fill at all), an H you can assign hardcoded. Because of the structure definition, you will have the data in the right place (there is no shrinking, if you move values to fields of a structure - concatenate is only leaving one space (in earlier releases)).
So yes, you just can fill spaces and H by yourself.
Regards,
Christian