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

header data and item data into same internal table

Former Member
0 Likes
916

Hi Experts,

I WANT TO KNOW THE LOGIC TO POPULATE HEADER DATA AND ITEM DATA INTO SAME INTERNAL TABLE AND AGAIN DOWNLOAD THE SAME TO EXCEL FILE .Output file should be displayed like this format

Header1 rectyp ,hdnum ,sbank ,bankl ,accnr , paytp , crda ,iso.

Item1 : rectyp ,valut ,cknum ,amount,bankl,accnr,pdate,bnktc.

Item2 : rectyp ,valut ,cknum ,amount,bankl,accnr,pdate,bnktc.

Header2: rectyp ,hdnum ,sbank ,bankl ,accnr , paytp , crda ,iso.

Item1 : rectyp ,valut ,cknum ,amount,bankl,accnr,pdate,bnktc.

Thanks

Moderator message: Please do not use all upper case in the future.

Edited by: Thomas Zloch on May 12, 2010 3:10 PM

6 REPLIES 6
Read only

Former Member
0 Likes
872

Hello,

If you could populate the internal table as such with your logic, you can directly use it to download instead of complicating the scenario with multiple calls to the download FM

Vikranth

Read only

0 Likes
872

Hi,

Header data is in t_header table

Item data is in t_item table

how can we display in XLS file like this

Header1 rectyp ,hdnum ,sbank ,bankl ,accnr , paytp , crda ,iso.

Item1 : rectyp ,valut ,cknum ,amount,bankl,accnr,pdate,bnktc.

Item2 : rectyp ,valut ,cknum ,amount,bankl,accnr,pdate,bnktc.

Header2: rectyp ,hdnum ,sbank ,bankl ,accnr , paytp , crda ,iso.

Item1 : rectyp ,valut ,cknum ,amount,bankl,accnr,pdate,bnktc.

Thanks

Read only

0 Likes
872

You could use text fields, adjusting the length of each field to the max length of either the header or item (whichever is greater for that field), and write to each field using left or right justification depending on what you need.

Read only

0 Likes
872

Is there any specific logic you are using to group the header and item records?

Read only

Former Member
0 Likes
872

hi,

for example there are 3 internal tables it_header, it_items and it_final.

here it_final having all the header and item fields

first populate the it_header, it_items data.

then

loop at it_items.

read table it_header key xyz_key = it_items-xyz_key.

if sy-subrc = 0.

here move all the header field to the it_final like below

it_final-x = it_header-x.

endif.

here move all the item fields to the it_final like below

it_final-x = it_itemsr-x.

append it_final.

clear it_final.

endloop.

NOW IT_FINAL WILL HAVE ALL THE HEADER AND ITEM DATA

Read only

Former Member
0 Likes
872

Hi,

for example we have 3 internal tables

1> it_header 2>it_items 3>it_final (which contains all the header and item fields)

once it_header it_items are filled

loop at it_items.

read table it_header with key xyz = it_item-xyz.

if sy-subrc = 0.

here move all the header fields to it_final like below.

it_final -xfield = it_header-xfield.

endif.

here move all the item fields to it_final like below.

it_final -yfield = it_item-yfield.

append it_final.

clear it_final.

endloop.

now header and item fileds will be fillled in it_item