12-20-2012 11:21 AM
Hello,
This is my BADI code.
METHOD /saptr/if_ex_vat_b~modify_forms.
break tlise.
DATA : p_itabbad TYPE /saptr/ty_vatbbad,
ls_itabbad TYPE /saptr/vatbbad.
DATA : wa_bseg TYPE bseg.
p_itabbad[] = itabbad[].
LOOP AT p_itabbad INTO ls_itabbad .
IF ls_itabbad-lifnr+0(2) = '45'.
SELECT SINGLE * FROM bseg INTO wa_bseg WHERE belnr EQ ls_itabbad-belnr
AND bschl EQ '25'
AND gjahr EQ ls_itabbad-budat+0(4).
IF sy-subrc EQ 0.
DELETE itabbad.
ENDIF.
ENDIF.
ENDLOOP.
itabbad[] = p_itabbad[].
ENDMETHOD.
When this code is running, I am receiving Table illegal statement error.
Because, it does not like
DELETE itabbad.
But I want to delete wrong record. So I used this code.
If you say, this code is wrong, how can I change the code ?
Best Regards
Tanju
12-20-2012 7:45 PM
Hi Tanju,
LOOP AT p_itabbad INTO ls_itabbad.
...
DELETE p_tabbad. " deletes current loop index
ENDLOOP.
Read through the DELETE itab - itab_line keyword documentation for more information.
Cheers,
Amy
12-20-2012 6:13 PM
12-20-2012 7:45 PM
Hi Tanju,
LOOP AT p_itabbad INTO ls_itabbad.
...
DELETE p_tabbad. " deletes current loop index
ENDLOOP.
Read through the DELETE itab - itab_line keyword documentation for more information.
Cheers,
Amy
12-21-2012 9:38 AM
Dear Amy and Patsy,
Thank You ver much for your answers.
I am really appreciated.
Best Regards
Tanju