Use of Lines Of & BASE in VALUE- Internal Table

light111Use of Lines Of & BASE in VALUE- Internal Table


LINES OF – can be used to transfer specific line of the source ITAB into the target ITAB with VALUE construct.

Where as BASE can be used in addition with other internal table row to build up the target internal table. In such a case the row of the BASE internal table is transferred to the target internal table first and then the additional rows are inserted to the target internal table.

 

12

With simple VALUE construct  – lt_scarr1 contains 5 rows.

3

With LINES OF – lt_scarr2 contains same 5 rows as of  lt_scarr1.

4

With LINES OF and additional two rows – lt_scarr3 contains 7 rows.

5

With LINES OF specified from and to position and additional two rows – lt_scarr4 contains 5 rows.

6

With BASE  lt_scarr1 and additional 3  rows – lt_scarr4 contains 8 rows.

7

With BASE  lt_scarr1, LINES OF  lt_scarr1 and additional 3  rows – lt_scarr6 contains 13 rows.8


Code Snippet:

DATA(lt_scarr1VALUE scarr_tabmandt symandt  carrid ’11’ carrname ’11 Carrier’ currcode ‘EUR’ url ’11Carrier.com’ )
                                   mandt symandt  carrid ’22’ carrname ’22 Carrier’ currcode ‘EUR’ url ’22Carrier.com’ )
                                   mandt symandt  carrid ’33’ carrname ’33 Carrier’ currcode ‘EUR’ url ’33Carrier.com’ )
                                   mandt symandt  carrid ’44’ carrname ’44 Carrier’ currcode ‘EUR’ url ’44Carrier.com’ )
                                   mandt symandt  carrid ’55’ carrname ’55 Carrier’ currcode ‘EUR’ url ’55Carrier.com’ )  ).

DATA(lt_scarr2VALUE scarr_tabLINES OF lt_scarr1 )” Same as -> lt_scarr2 = lt_scarr1.

DATA(lt_scarr3VALUE scarr_tabLINES OF lt_scarr1 )
                                   mandt symandt  carrid ’66’ carrname ’66 Carrier’ currcode ‘EUR’ url ’66Carrier.com’ )
                                   mandt symandt  carrid ’77’ carrname ’77 Carrier’ currcode ‘EUR’ url ’77Carrier.com’ ).

DATA(lt_scarr4VALUE scarr_tabLINES OF lt_scarr1 FROM TO )
                                   mandt symandt  carrid ’66’ carrname ’66 Carrier’ currcode ‘EUR’ url ’66Carrier.com’ )
                                   mandt symandt  carrid ’77’ carrname ’77 Carrier’ currcode ‘EUR’ url ’77Carrier.com’ ).

* BASE is used to transfer the lines of LT_SCARR1 into LT_SCARR2 before other three lines are insterted
DATA(lt_scarr5VALUE scarr_tabBASE lt_scarr1
                                 mandt symandt  carrid ’66’ carrname ’66 Carrier’ currcode ‘EUR’ url ’66Carrier.com’ )
                                 mandt symandt  carrid ’77’ carrname ’77 Carrier’ currcode ‘EUR’ url ’77Carrier.com’ )
                                 mandt symandt  carrid ’88’ carrname ’88 Carrier’ currcode ‘EUR’ url ’88Carrier.com’ ).

DATA(lt_scarr6VALUE scarr_tabBASE lt_scarr1
                                 LINES OF lt_scarr1 )
                                 mandt symandt  carrid ’66’ carrname ’66 Carrier’ currcode ‘EUR’ url ’66Carrier.com’ )
                                 mandt symandt  carrid ’77’ carrname ’77 Carrier’ currcode ‘EUR’ url ’77Carrier.com’ )
                                 mandt symandt  carrid ’88’ carrname ’88 Carrier’ currcode ‘EUR’ url ’88Carrier.com’ ).


 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s