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: 

work area may not be converted into number

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

kesavadas_thekkillath
Active Contributor

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.

4 REPLIES 4

bernat_loscos
Explorer
0 Kudos

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,

nabheetscn
Active Contributor
0 Kudos

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.

kesavadas_thekkillath
Active Contributor

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.

Former Member
0 Kudos

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!