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
567

hi,

there is one fuction module from standard program.

CALL FUNCTION '/SAPTRX/EVENT_MGR_FILL_TABCONT'

EXPORTING

tabledef1 = 'GENERAL_HEADER_DATA'

tabledef2 = 'HU_HEADER'

tabledef3 = 'HU_ITEM'

tabledef4 = 'HU_HISTORY_ENTRIES'

opt_init_container = 'X'

TABLES

table1 = ls_general_data

table2 = it_header

table3 = it_items

table4 = it_history

CHANGING

table_container = datacontainer.

i want to create another internal table some field from

it_header and it_item how to crate it ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
542

Declare another internal table that have your required fields i.e. some from IT_HEADER & some from IT_ITEMS.

Loop at it_header.
  read table it_item with key f1 = it_header-f1.
  if sy-subrc = 0.
     v_tabix = sy-tabix.
     loop at it_item index sy-tabix.
        if it_item-f1 <> it_header-f1.
          exit.
        endif.
        it_final-f1 = it_hedaer-f1.
        it_final-f2 = it_item-f2.
        append it_final.  
     endloop.
  endif.
endloop.

4 REPLIES 4
Read only

Former Member
0 Likes
542

Hi,

The new table should have some fields that are common to both tables.

The logic to use is:

loop at header table

loop at detail table where field = header-field

move-corresponding header to newtable

move-corresponding detail to newtable

append newtable

clear newtable

endloop

endloop.

Read only

Former Member
0 Likes
543

Declare another internal table that have your required fields i.e. some from IT_HEADER & some from IT_ITEMS.

Loop at it_header.
  read table it_item with key f1 = it_header-f1.
  if sy-subrc = 0.
     v_tabix = sy-tabix.
     loop at it_item index sy-tabix.
        if it_item-f1 <> it_header-f1.
          exit.
        endif.
        it_final-f1 = it_hedaer-f1.
        it_final-f2 = it_item-f2.
        append it_final.  
     endloop.
  endif.
endloop.

Read only

Former Member
0 Likes
542

Hi,

DATA : BEGIN OF it_details OCCURS 0,

Declare all your hearder and line items fields here.

END OF it_details.

If lot of fields are there

Read only

Former Member
0 Likes
542

thanks richa