cancel
Showing results for 
Search instead for 
Did you mean: 

help in combining the fields in the internal table

Former Member
0 Kudos

hi folks,

thanks a lot yesterday for all your inputs I was able to make it work and data is getting stored into the internal table -BDATA .

I have awarded points for all. Taking it a step further, I need your help in this regard becoz I have done this before.

types: begin of structbdata,

fbuda(date) type jhtfp-fbuda,

vavtyp(code)type jhtfp-vavtyp,

aubel type jhtfp-aubel,

breite_s type jhamot-breite_s,

hoehe_s type jhamot-HOEHE_S,

end of structbdata.

Now, I have two fields of data one -fbuda(mm/dd/yyyy) need to convert it into 'mm/dd' and join ( in sense concatenate but i need some space between them becoz in the table they need to sit in the same field but as separate data not combined into one word) the data field value of vavtyp with it and pass the data into single field of another internal table. This internal table has other fields too. But this combined data go into one field . Here the number of records are many(130 may be).

Your help is widely appreciated and thanks in advance.

Santhosh

Accepted Solutions (0)

Answers (2)

Answers (2)

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi Santhosh,

If you want to combine two fields from an internal table to one field of another internal table,then you can do like this.

Here i_first is first internal table[two fields before merging] and w_first is first internal table's workarea.

i_second is second internal table[one field after merging] and w_second is second internal table's workarea.

Before that you should declare types for second internal table as below.Here merged is the field which contains the combined field values.For that you need to find the length of vavtyp.Suppose if it is 10,then your merge field should be 16.Because 5 for fbuda and one space as you mentioned and 10 for vavtyp.

types : begin of ty_second,

......

merged(16),

....

end of ty_second.

data : i_first type standard table of structbdata,

w_first type structbdata,

i_second type standard table of ty_second,

w_second type ty_second.

loop at i_first into w_first.

  • Here I assume that you are going to modify the second *internal table.While reading, the <b>field</b> I *mentioned here should be <b>key field</b> in table.In *case if it is having more records instead of read you *should use loop and change the modify statement *accordingly.

read table i_second into w_second

with key field = w_first-field.

if sy-subrc eq 0.

concatenate w_first-fbuda(5) w_first-vavtyp into w_second-merged separated by space.

modify table i_second from w_second transporting merged

where field =w_first-field.

endif.

....

endloop.

Hope this is clear.

PS: If your previous question is answered , close that thread.

Regards,

J.Jayanthi

krzysztof_konitz4
Contributor
0 Kudos

Hi,

I have no access to system now but you can try something like this:

CONCATENATE FBUDA(5) VAVTYP INTO SOMEFIELD SEPARATED BY SPACE.

Krzys

Former Member
0 Kudos

Thanks for your reply, but after concatenating i need to insert the data into one field of an internal table.

Actually what I am trying to achieve here is, I pull data (fbuda and vavtyp) two separate fields from a table into a internal table then I need to join these two datas in insert into another field of another internal table.I was able to concatenate the two values and read into a variable in the loop of the first internal table.

My question is how do you read this piece of data(combined data of the two fields) into another aspecific field of another internal table.

Your help is really appreciated...

thanks