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

internal table

Former Member
0 Likes
884

Hi to all,

I had a internal table with records like

f1 f2 f3 f4 f5 f6

-


123 45 rat ade 56 78

agh 34 67

wer 56 77

123 77 dog dhg 99 12

fields f1 f2 f3 are header fields and f4 f5 f6 are line items.

while uploading i need to process the header and line items.

i need to pass the header to one internal table and all the corressponding line items to another internal table

how to process them

with regards

satish

9 REPLIES 9
Read only

Former Member
0 Likes
863

Hi,

Use function GET_COMPONENT_LIST to read the structure of internal table.This will give u the list of the columns used in the internal table.

Use this list and then pass the information into different tables.

Just loop at the list, check if the column is a header or item and do the required processing.

Hope it helps.

Regards,

Himanshu

Read only

Former Member
0 Likes
863

Hi,

In header table keep the records first in one line.

and in Item table also keep the first key field in the header and other item fields, such that when we loop the Item under Header, that is the field to read the Item.

ie. header: f1 f2 f3

Item f1 i1 i2 i3 ... if f1 f2 f3 all are key fields then keep all of them in the item table. to read it in the loop.

regards,

Anji

Read only

Former Member
0 Likes
863

*Declate it_header table with fields f1 f2 f3

*Declare it_items table with fields f1 f4 f5 f6 so that f1 is the common field to relate them

loop at itab.
 move-corresponding itab to it_header.
 move-corresponding itab to it_items.
 append it_header.
 appen it_items.
endloop.

Read only

Former Member
0 Likes
863

satish,

Loop at main_itab.

move : f1 to itab_header-f1,

f2 to itab_header-f1,

f3 to itab_header-f1.

append itab_header.

clear itab_header.

    • Take the unique value column from header and move those recoreds to line

    • item internal table.Say f1 is unique.

move : f1 to itab_lineitem-f1,

f4 to itab_lineitem-f4,

f5 to itab_lineitem-f5,

f6 to itab_lineitem-f6.

append itab_lineitem.

clear itab_lineitem.

endloop.

don't forget to reward if useful..

Read only

Former Member
0 Likes
863

Hi,

1. If possible fetch values initially in two i tabs....

2. Assuming that f1 f2 f3 as key field i m suggesting floowing codes:

loop at itab.

if f1 is not initial and f2 id not initial and f3 id not initial.

append f1 f2 f3 into itab1 " which has first 3 fileds only

endif.

append f4 f5 f6 into itab2 "which has f4-f6 fileds.

endloop.

Hope your problem is solved.

Read only

Former Member
0 Likes
863

declare ihead with fields f1 f2 f3 and iitem with f4 f5 f6.

loop at itab.

if itab-f1 ne '' and itab-f2 ne '' and itabf3 ne ''.

move-corresponding itab to ihead.

append ihead.

endif.

move-corresponding itab to iitem.

append iitem.

endloop.

regards

shiba dutta

Read only

0 Likes
863

Hi ,

the internal table contains the data as

123 45 rat ade 56 78

-


-- --- agh 34 67

-


--- --- wer 56 77

123 77 dog dhg 99 12

with regards

satish

Read only

0 Likes
863

i assume that

123 45 rat ade 56 78

-


-- --- agh 34 67

-


--- --- wer 56 77

123 77 dog dhg 99 12

this will be data

so asper my code

in header table..

it will contain.

ade 56 78

agh 34 67

wer 56 77

dog dhg 99 12

regards

shiba dutta

123 77 dog

and item table it will contain

Read only

Former Member
0 Likes
863

Create two internal tables - i_header and i_item

i_header having fields f1,f2 and f3.

i_item having fields f4, f5, f6.

loop at itab.

move-corresponding itab to i_header.

move-corresponding itab to i_items.

append i_header.

appen i_items.

endloop.

Hope this answers your question