Skip to Content
author's profile photo Former Member
Former Member

Find occurences in every line of itab

Hi,

I had a csv file like this :

SPEC;STD;TC;;01/08/08;08/08/08;15/08/08;22/08/08;29/08/08

AAA;BBB;CC;DD;40.5;50.2;10.3

EEE;FFF;GG;HH;;;18.3;15.6;25.6

...

I put this into itab, it came out like this :

SPEC-STD-TC- -Date1-Date2-Date3-Date4-Date5

SPEC-STD-TC- -01/08/08-08/08/08-15/08/08-22/08/08-29/08/08

AAA-BBB-A1-DD-40.5-50.2-10.3

EEE-FFF-B1-HH- - -18.3-15.6-25.6

Line 1 is table header and line 2 data header.

What I have to do is to find the begining and end date of each line where there is a quantity.

For example :

Line 2 of itab -> A1 begins from 01/08/08 and ends at 15/08/08.

Line 3 of itab -> B1 begins from 15/08/08 and ends at 29/08/08.

So I need to make a another table with these informations.

Can anyone help me?

Thanks!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 11, 2008 at 08:53 AM

    Hi,

    You can do it as follows:

    Declare an internal table as"

    DATA:

    BEGIN OF ITAB2 OCCURS 0,

    LINE(30) TYPE C,

    END OF ITAB2.

    LOOP AT ITAB1.

    IF ITAB1-QTY IS NOT INITIAL.

    W_DATE1 = ITAB1-BEGIN_DATE.

    W_DATE2 = ITAB1-END_DATE.

    A1 begins from 01/08/08 and ends at 15/08/08.

    CONCATENATE ITAB1-A1 'begins from' W_DATE1 'and ends at' W_DATE2 INTO ITAB2-LINE.

    APPEND ITAB2.

    CLEAR ITAB2.

    ENDLOOP.

    Hope this helps you the basic logic creation.

    Regards,

    Rama chary.Pammi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 11, 2008 at 10:16 AM

    Hi,

    Thanks for ur answer!

    U said :

    LOOP AT ITAB1.

    IF ITAB1-QTY IS NOT INITIAL.

    W_DATE1 = ITAB1-BEGIN_DATE.

    W_DATE2 = ITAB1-END_DATE.

    I wanted to apply ur suggestion but itab1 doesn't have fields like QTY or BEGIN_DATE and END_DATE.

    These datas are uploaded into my internal table.

    My internal table has header which contains name like date01 date02 date03...

    Any other suggestion?

    Thanks!

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.