01-07-2014 3:15 PM
Hi All
I need to delete internal table having company code NE BBP_CO_CODE(selection screen)
lo_el_node_selection->get_attribute(
Exporting
name = 'BBP_CO_CODE'
IMPORTING
value = lv_BBP_CO_CODE ).
LOOP at gt_alv INTO gs_alv.
DELETE gt_alv FROM gs_alv WHERE gs_alv-BBP_CO_CODE NE lv_BBP_CO_CODE.
ENDLOOP.
ERROR : gs_alv may not be converted into number.
Thanks
Vamsi
01-07-2014 6:47 PM
Not a good idea to delete the records inside the looping table.
This should be better.
LOOP at gt_alv INTO gs_alv.
if gs_alv-BBP_CO_CODE = lv_BBP_CO_CODE.
append gs_alv to lt_alv.
endif.
ENDLOOP.
gt_alv = lt_alv.
01-07-2014 3:23 PM
Hi,
You can try this code please.
LOOP at gt_alv INTO gs_alv.
DELETE gt_alv WHERE BBP_CO_CODE NE lv_BBP_CO_CODE.
ENDLOOP.
If you are in a loop, remember that sy-tabix is the indicator of the table index
Regards,
01-07-2014 5:56 PM
Simply do this
lo_el_node_selection->get_attribute(
Exporting
name = 'BBP_CO_CODE'
IMPORTING
value = lv_BBP_CO_CODE ).
DELETE gt_alv FROM gs_alv WHERE BBP_CO_CODE NE lv_BBP_CO_CODE.
01-07-2014 6:47 PM
Not a good idea to delete the records inside the looping table.
This should be better.
LOOP at gt_alv INTO gs_alv.
if gs_alv-BBP_CO_CODE = lv_BBP_CO_CODE.
append gs_alv to lt_alv.
endif.
ENDLOOP.
gt_alv = lt_alv.
01-07-2014 7:58 PM
Error message is regarding field type, which types have gs_alv-BBP_CO_CODE and lv_BBP_CO_CODE ? If it have different types maybe the system can´t compare.
Maybe you need to cast your variable.
Besides that, I agree that the best is delete like nabheet said.
Best regards!