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

Help - internal table

Former Member
0 Likes
541

Hi All,

The requirement is

1. To copy values of a field (zzbumtolb) from /bi0/pmaterial to an internal table.

zzbumtolb is a display attribute of 0material.

2. Use these values of zzbumtolb (i.e. from material master data) and copy it to a corresponding field (/bic/ybumtolb) in a structure. The code i have for the structure is:

data: l_s_data_in type /bic/cytest,

l_s_data_out type /bic/cztest.

TYPES: material TYPE STANDARD TABLE OF /BI0/PMATERIAL.

DATA: itab TYPE material.

loop at itab. -


> This is wrong

zzbumtolb = material-/bic/zzbumtolb. -


> This might be wrong too

endloop.

clear e_t_data_out.

loop at i_t_data_in into l_s_data_in.

move-corresponding l_s_data_in to l_s_data_out.

l_s_data_out-/bic/zbum_lb = material-/bic/zbum_lb. -


This is transaction data. What i intend to do is, for all materials in transaction data, i want to move all values of zzbumtolb in the internal table to zbum_lb in the transaction data.

insert l_s_data_out into table e_t_data_out.

endloop.

Please advise.

thanks

Message was edited by:

Sachin Guptha

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
512

Hi Sachin,

Try this:

data: l_s_data_in type /bic/cytest,

l_s_data_out type /bic/cztest.

TYPES: material TYPE STANDARD TABLE OF /BI0/PMATERIAL.

DATA: itab TYPE material <b>with header line</b>.

loop at <b>material</b>.

<b>itab-/bic/zzbumtolb = material-/bic/zzbumtolb.

append itab.

clear: itab, material.</b>

endloop.

clear e_t_data_out.

<b>l_s_data_out = i_t_data_in.</b>

e_t_data_out = l_s_data_out.

append e_t_data_out.

l_s_data_out, l_s_data_in are structures but not internal tables. Since you cannot use them with Loop at i_t_data_in, use about way to assign and move it to e_t_data_out and then insert using append statement.

Hope this will be of some help to you. Let me know, if you need any other details.

Regards,

Vivek

4 REPLIES 4
Read only

Former Member
0 Likes
513

Hi Sachin,

Try this:

data: l_s_data_in type /bic/cytest,

l_s_data_out type /bic/cztest.

TYPES: material TYPE STANDARD TABLE OF /BI0/PMATERIAL.

DATA: itab TYPE material <b>with header line</b>.

loop at <b>material</b>.

<b>itab-/bic/zzbumtolb = material-/bic/zzbumtolb.

append itab.

clear: itab, material.</b>

endloop.

clear e_t_data_out.

<b>l_s_data_out = i_t_data_in.</b>

e_t_data_out = l_s_data_out.

append e_t_data_out.

l_s_data_out, l_s_data_in are structures but not internal tables. Since you cannot use them with Loop at i_t_data_in, use about way to assign and move it to e_t_data_out and then insert using append statement.

Hope this will be of some help to you. Let me know, if you need any other details.

Regards,

Vivek

Read only

0 Likes
512

Hi Vivek,

Thanks for the response. In yourcode, the contents of material are getting copied to itab only. They are not getting copied to l_s_data_in or l_s_data_out or i_t_dta_in.

This is because i want the values from <b>zzbumtolb</b> filed of internal table itab<b></b> to be copied to <b>zbum_lb</b> field in l_s_data_out.

Thanks

Read only

0 Likes
512

Sachin,

I suggested changes by using what you have mentioned in first post. I don't see anything being assigned to l_s_data_out or i_t_data_in from material or itab. if you paste all your code, myself or some one can suggest you. so, when you say 'They are not getting copied to l_s_data_in or l_s_data_out or i_t_dta_in', do you want them to be filled in from itab or material? and if so, then they will have only one record as they are structures. So, you might as well declare them as internal tables and move all the records.

Hope i am not confusing you. But this is what i understood from you reply. I will be of glad to help you, if you paste your code.

Regards,

Vivek

Read only

0 Likes
512

Hi Vivek,

This code is not from a report if you are thinking so. This code is from a BADI. Actually, we are using a tool called infospoke to extract data from a BW object to a flat file if you are not aware of infospoke. The field zbum_lb is not available within the BW object. So, i enhanced the 2 structures of an infospoke (source structure & target structure) with this field. I am using BADI to populate the field. The only statements missing in the code is the method statements.

We are extracting transaction data into flat file. Material is a field in the transaction data. The field zzbumtolb is an attribute of Material. I want to populate values from zzbumtolb (i.e. attribute of material) to zbum_lb (i.e. tranasction data) for the corresponding materials. Hope i am clear. This is what i want ot achieve.

method IF_EX_OPENHUB_TRANSFORM~TRANSFORM.

data: l_s_data_in type /bic/cytest,

l_s_data_out type /bic/cztest.

TYPES: material TYPE STANDARD TABLE OF /BI0/PMATERIAL.

DATA: itab TYPE material.

loop at itab. -


> This is wrong

zzbumtolb = material-/bic/zzbumtolb. -


> This might be wrong too

endloop.

clear e_t_data_out.

loop at i_t_data_in into l_s_data_in.

move-corresponding l_s_data_in to l_s_data_out.

l_s_data_out-/bic/zbum_lb = material-/bic/zbum_lb. -


This is transaction data. What i intend to do is, for all materials in transaction data, i want to move all values of zzbumtolb in the internal table to zbum_lb in the transaction data.

insert l_s_data_out into table e_t_data_out.

endloop.

endmethod.

Thanks