Skip to Content
Former Member

# Problem in Update ITAB

Hi,

We have a scenario like this:

SO No.......Material...........Plant..........BILF Open Qty..........BILR open Qty

111111......ABC................BILR.............100.00....................100.00

222222......BCD................BILR.............200.00....................200.00

333333......CDE.................BILF.............300.00......................00.00

We want that where plant = BILR, then open qty should show in respective column. Now please look BILR open qty. 100 & 200 is showing in both columns. I want like this..

SO No.......Material...........Plant..........BILF Open Qty..........BILR open Qty

111111......ABC................BILR...............00.00....................100.00

222222......BCD................BILR...............00.00....................200.00

333333......CDE.................BILF.............300.00......................00.00

I think we are unable to clear the itab.

Please have a look on this code...

***********************************

SELECT vbeln posnr matnr werks omeng FROM vbbe INTO CORRESPONDING FIELDS OF TABLE itab WHERE vbeln IN vbeln AND matnr IN matnr.

IF sy-subrc <> 0.

MESSAGE 'DATA NOT FOUND.' TYPE 'I'(001).

ENDIF.

SORT itab BY vbeln .

LOOP AT itab.

SELECT single maktx FROM makt INTO itab-maktx WHERE matnr = itab-matnr.

IF itab-werks = 'BILR'.

SELECT SINGLE omeng FROM vbbe INTO itab-omeng1 WHERE vbeln = itab-vbeln AND matnr = itab-matnr AND werks = 'BILR'.

ELSE.

ENDIF.

MODIFY itab .

ENDLOOP .

***********************************

Regards,

##### Add comment
10|10000 characters needed characters exceeded

### 2 Answers

• Former Member
Posted on Sep 22, 2010 at 09:24 AM

Solved

##### Add comment
10|10000 characters needed characters exceeded
• Posted on Sep 22, 2010 at 09:25 AM

IF itab-werks = 'BILR'.

SELECT SINGLE omeng FROM vbbe INTO itab-omeng1 WHERE vbeln = itab-vbeln AND matnr = itab-matnr AND werks = 'BILR'.

Add one more column to itab.

clear itab-(field for BILF open item) .

MODIFY itab .

ENDIF.

##### Add comment
10|10000 characters needed characters exceeded