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: 

Provide Logic

Former Member
0 Kudos

Hi all,

I am getting two columns in my final internal table itab , Objectcode and ObjectNO. For one objectcode there are around eight to nine objectno product

So all was displaying in different line item , uptill know it's fine .

now I have to add two more fields to the itab, from some other Database table where there is Objectcode is there and the same line item for Qty, But no ObjectNo. now i have sorted itab and have to assign these Qty and slab to this sorted itab sequentially . pls help and provide your valuable suggestions.

thanks in advance,

Regards,

Vivek

1 ACCEPTED SOLUTION

Former Member
0 Kudos

ITAB1

objcode

objno

lineitem

New_Qty --->.

New_Slab--->.

.

ITAB2.

objcode

lineitem

Qty

slab

SELECT objcode

lineitem

Qty

Slap

FROM <Your table>

INTO TABLE ITAB2

FOR ALL ENTRIES IN ITAB1

WHERE objcode = ITAB1-objcode

AND lineitem = ITAB1-lineitem.

LOOP AT ITAB2.

READ TABLE ITAB1 WITH KEY objcode = ITAB1-objcode

lineitem = ITAB1-lineitem.

IF SY-SUBRC IS INITIAIL.

MOVE: ITAB2-QTY TO ITAB1-QTY,

ITAB2-SLAP ITAB1-SLAP.

MODIFY ITAB1 TRANSPORTING QTY slap INDEX sy-tabix.

ENDIF.

ENDLOOP.

Regards,

A.Singh

1 REPLY 1

Former Member
0 Kudos

ITAB1

objcode

objno

lineitem

New_Qty --->.

New_Slab--->.

.

ITAB2.

objcode

lineitem

Qty

slab

SELECT objcode

lineitem

Qty

Slap

FROM <Your table>

INTO TABLE ITAB2

FOR ALL ENTRIES IN ITAB1

WHERE objcode = ITAB1-objcode

AND lineitem = ITAB1-lineitem.

LOOP AT ITAB2.

READ TABLE ITAB1 WITH KEY objcode = ITAB1-objcode

lineitem = ITAB1-lineitem.

IF SY-SUBRC IS INITIAIL.

MOVE: ITAB2-QTY TO ITAB1-QTY,

ITAB2-SLAP ITAB1-SLAP.

MODIFY ITAB1 TRANSPORTING QTY slap INDEX sy-tabix.

ENDIF.

ENDLOOP.

Regards,

A.Singh