Application Development and Automation 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: 
Read only

To extract date from internal table

Former Member
0 Likes
881

Hi all,

I have an internal table 'tabl'.In this internal table the paths and names of all the pdf files in SAP directory are stored seperated by '/'.This table consists of a single field of type C.The name of the pdf file consists of the order no,organisation ,month and year of that file creation.

I have a requirement to extract the month and year from the name of the file.Can anyone suggest how to break the internal table to get the month and year.

Thank You.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
849

hi

you can use regular expressions for this

see

[https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/866072ca-0b01-0010-54b1-9c02a45ba8aa]

[http://help.sap.com/saphelp_erp2005/helpdata/en/42/9d6ceabb211d73e10000000a1553f6/content.htm]

bye bye

Hi all,

I have an internal table 'tabl'.In this internal table the paths and names of all the pdf files in SAP directory are stored seperated by '/'.This table consists of a single field of type C.The name of the pdf file consists of the order no,organisation ,month and year of that file creation.

I have a requirement to extract the month and year from the name of the file.Can anyone suggest how to break the internal table to get the month and year.

Thank You.

5 REPLIES 5
Read only

Former Member
0 Likes
850

hi

you can use regular expressions for this

see

[https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/866072ca-0b01-0010-54b1-9c02a45ba8aa]

[http://help.sap.com/saphelp_erp2005/helpdata/en/42/9d6ceabb211d73e10000000a1553f6/content.htm]

bye bye

Read only

Former Member
0 Likes
849

Hi Rohan,

You can use SPLIT command.

Hope it helps.

Reward if helpful.

Regards

Hemant Khemani

Read only

Former Member
0 Likes
849

Hi,

If your month and year format is MM and YY then firstly count the length of the whole string i.e your single record.

suppose length of the string is 10 and above date format i.e MM and YY then fetch last 4 characters from your string[just like sub string]. you will get month and year.

Read only

Former Member
0 Likes
849

hi rohan,

do like this ,

loop at itab into text.

SPLIT text AT '/' INTO: str1 str2 str3, ...

file = str1.

year = str2.

.

.

clear text.

endloop.

reward if useful,

regards,

chandu

Read only

Former Member
0 Likes
849

hi you can do in this way:

suppose file name is in name1. and value of this file can be in this format -


062008. blank is name of file 06 is month and 2008 is year.

to extract month and year do like :

data: month(2) , year(4).

data: len type i, tmp type i.

len = strlen(name1).

tmp = len - 6.

month = name1+tmp(2).

tmp = tmp + 2.

year = name1+tmp(4).

now you can use month and year.

reward if useful.