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
475

hi

all

I have to fill internal table like that.

Plnant - x1 eq y1

x2 eq y2

x3 eq y3

that means 1 st line only has plant in 1 st column and

for rest of the row 1 st coluumn is blank.

Thanks

4 REPLIES 4
Read only

Laxmana_Appana_
Active Contributor
0 Likes
449

Hi,

check this :

if your internal table(i_tab) contains two columns fld1 and fld2,then use below code.

i_tab-fld1 = 'Plant'.

append i_tab.

clear : i_tab-fld1.

itab-fld2 = 'x1 eq y1'

append i_tab.

clear : i_tab-fld1.

itab-fld2 = 'x2 eq y2'

append i_tab.

clear : i_tab-fld1.

itab-fld2 = 'x3 eq y3'

append i_tab.

Regards

Appana

Read only

dani_mn
Active Contributor
0 Likes
449

HI,

Fill your internal table normal with first field blank in all rows. and then at last. do this.

<b>

itab-field1 = 'Plant'.
MODIFY itab index 1 transporting field1.

</b>

Regards,

Wasim Ahmed

Read only

Former Member
0 Likes
449

Define a internal table. Loop at internal table such that first time it fills both columns and for rest it fills only second column

Data : Begin of Itab occurs 0

f1 type <data type>

f2 type <data type>

End of Itab.

Loop at itab.

case sy-tabix.

when 1

itab-f1= Plant.

itab-f2 = x1.

when 2

itab-f2 = x2.

when 3

itab-f2 = x3.

endcase.

append itab.

endloop.

Regards,

Amit

Message was edited by: amit bhadauria

Read only

Former Member
0 Likes
449

Hi Saurabh,

You can do this using 'Onchange of' and Endon. Statement in a loop which the values are filled into the Target Internal Table.

i.e, When the Plant Value Changes Assign it to the Field in the Target Internal Table and exit to the Main loop. then process i tagain and when it has the same Plant number the control is passed after endon.

Syntax:

ON CHANGE

Introduces a branch.

Syntax

ON CHANGE OF <f> [OR <f1> OR <f2>...].

Opens an ON control structure, concluded with ENDON. The statement block is executed whenever the contents of the field <f> or one of the other fields <fi> has changed since the statement was last executed.

Check this link too.

<a href="http://help.sap.com/saphelp_46c/helpdata/en/87/56d00722c011d2954a0000e8353423/content.htm">http://help.sap.com/saphelp_46c/helpdata/en/87/56d00722c011d2954a0000e8353423/content.htm</a>

Path BC ABAP Programming->APPENDIX->ABAP Statement Overview

Regards,

Prashanth