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

Header and Line Item

Hi,

I have one file which contains header info and line item info

The header record is identified with '0000' and line item record is identified with '1001' '1002' '1003 and so on.

I want to read all header records and put in 'ZHEADER' and read all line items and put in table 'ZLINEITEM'.

The file format is as follows:

xxxxx|0000|ref text|200804|

yyyyy|1001|free text|1500

yyyys|1002|free text|700

How this is done.

Regards,

Netra

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Apr 28, 2008 at 08:22 AM

    hi check this...

    report .

    tables:pa0008,pa0002 .

    types: begin of it ,

    pernr like pa0002-pernr,

    begda like pa0002-begda,

    endda like pa0002-endda,

    vorna like pa0002-vorna,

    end of it .

    types: begin of it1 ,

    pernr like pa0008-pernr,

    begda like pa0008-begda,

    endda like pa0008-endda,

    lga01 like pa0008-lga01,

    end of it1 .

    data:itab type standard table of it with header line,

    itab1 type standard table of it1 with header line,

    zheader type standard table of it with header line,

    zitem type standard table of it1 with header line.

    select-options:s_pernr for pa0002-pernr.

    select pernr

    begda

    endda

    vorna

    from pa0002

    into table itab

    where pernr in s_pernr .

    if not itab[] is initial.

    select pernr

    begda

    endda

    lga01

    from pa0008

    into table itab1

    for all entries in itab

    where pernr = itab-pernr.

    endif.

    loop at itab .

    if sy-tabix = 1.

    zheader-pernr = itab-pernr.

    zheader-vorna = itab-vorna.

    append zheader .

    endif.

    loop at itab1 where pernr = itab-pernr.

    zitem-pernr = itab1-pernr.

    zitem-lga01 = itab1-lga01.

    append zitem .

    endloop.

    endloop.

    loop at zheader.

    write:/ zheader-pernr,

    zheader-vorna.

    endloop.

    loop at zitem.

    write:/ zitem-pernr,

    zitem-lga01.

    endloop.

    regards,

    venkat

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      hi do like this...

      loop at itab .

      if itab-field1+0(1) = 'X'.

      zheader-field1 = itab-field1.

      append zheader .

      endif.

      loop at itab where field1 = itab-field1.

      zitem-field1 = itab-field1.

      append zitem.

      endloop.

      endloop.

      regards,

      venkat.

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.