Application Development 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: 

LOOP AT

Former Member
0 Kudos
287

Hi,

I am having this requirement.I want to move the contents of xkomv which is a field symbol of type komv into an internal table i_xkomv which is also of type komv.Can any one please help me with the exact code

Thanks in advance

1 ACCEPTED SOLUTION

former_member217544
Active Contributor
0 Kudos
178

Hi,

If both the internal tables are of same structure then you can directly pass the contents like:

i_xkomv [ ] = xkomv [ ].

Regards,

Swarna Munukoti

Edited by: Swarna Munukoti on Jul 23, 2008 7:29 AM

7 REPLIES 7

former_member217544
Active Contributor
0 Kudos
179

Hi,

If both the internal tables are of same structure then you can directly pass the contents like:

i_xkomv [ ] = xkomv [ ].

Regards,

Swarna Munukoti

Edited by: Swarna Munukoti on Jul 23, 2008 7:29 AM

Former Member
0 Kudos
178

Hi,

Define a workarea of type komv.

move-corresponding <xkomv> into ws_komv.

append i_komv from ws_komv.

Regards,

Subramanian

former_member705122
Active Contributor
0 Kudos
178

Hi,

Assuming i_xkomv is an internal table with header line.

i_xkomv-komv = <xkomv>.
append i_xkomv.

Regards

Adil

Former Member
0 Kudos
178

Hi,

Check here:

TYPES: BEGIN OF TY_LINE,

MISHPACHA,

EMP_PERNR,

PRATY,

END OF TY_LINE.

DATA: ITAB1 TYPE STANDARD TABLE OF TY_LINE,

ITAB2 TYPE STANDARD TABLE OF TY_LINE,

ITAB3 TYPE STANDARD TABLE OF TY_LINE,

ITAB4 TYPE STANDARD TABLE OF TY_LINE,

ITAB5 TYPE STANDARD TABLE OF TY_LINE.

PERFORM FILL_TAB USING: 'ITAB1[]' 'A' 'B',

'ITAB2[]' 'C' 'D',

'ITAB3[]' 'E' 'F',

'ITAB4[]' 'G' 'H',

'ITAB5[]' 'I' 'L'.

PERFORM UPDATE_TAB USING: 'ITAB1[]' 'A' 'E',

'ITAB2[]' 'D' 'B',

'ITAB3[]' 'E' 'B',

'ITAB4[]' 'H' 'B',

'ITAB5[]' 'I' 'B'.

&----


*& Form FILL_TAB

&----


  • text

----


  • -->P_0041 text

  • -->P_LV_STR1 text

  • -->P_EMP_PERNR text

----


FORM FILL_TAB USING TABNAME

P_LV_STR1

P_EMP_PERNR.

FIELD-SYMBOLS: <TAB> TYPE TABLE.

DATA: WA TYPE TY_LINE.

ASSIGN (TABNAME) TO <TAB>.

WA-MISHPACHA = P_LV_STR1.

WA-EMP_PERNR = P_EMP_PERNR.

APPEND WA TO <TAB>.

ENDFORM. " FILL_TAB

&----


*& Form UPDATE_TAB

&----


  • text

----


  • -->P_TAB text

  • -->P_VALUE text

----


FORM UPDATE_TAB USING P_TAB

P_CHECK

P_VALUE.

FIELD-SYMBOLS: <TAB> TYPE TABLE,

<WA> TYPE ANY,

<FIELD> TYPE ANY.

ASSIGN (P_TAB) TO <TAB>.

LOOP AT <TAB> ASSIGNING <WA>.

ASSIGN COMPONENT 'EMP_PERNR' OF STRUCTURE <WA> TO <FIELD>.

CHECK <FIELD> = P_CHECK.

ASSIGN COMPONENT 'PRATY' OF STRUCTURE <WA> TO <FIELD>.

<FIELD> = P_VALUE.

ENDLOOP.

ENDFORM. " UPDATE_TAB

Regards,

Shiva Kumar

Former Member
0 Kudos
178

Hi,

try by taking a structure of komv type and then internal table of this type and do assignment as

i_xkomv[] = xkomv[].

With thanks & regards,

Sravani yendru.

Former Member
0 Kudos
178

Hi try like this...

DATA wa LIKE LINE OF itab1.

FIELD-SYMBOLS : <fs_komv> LIKE wa.

ASSIGN wa TO <fs_komv>.

LOOP AT itab1 INTO <fs_komv>.

APPEND <fs_revc> TO itab2.

ENDLOOP.

Edited by: venkat reddy on Jul 23, 2008 7:48 AM

Former Member
0 Kudos
178

hi shah kunal,

tables : komv, konv, konvd.

field-symbols : <xkomv> type komv.

data : i_xkomv like standard table of komv with header line.

data : wa_xkomv like komv.

start-of-selection.

*select single * into wa_xkomv from konv.*

assign wa_xkomv to <xkomv>.

append <xkomv> to i_xkomv.

loop at i_xkomv.

write i_xkomv-KNUMV.

endloop.

Please try this code for assigning a value from field symbol to internal table.

Reward points if helpfull.

Regards.

Ragu