Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8927

Unable to delete multiple HU's

$
0
0

Hi Everybody.

 

I try to delete multiple Hu's in a loop. No Matter what i do, it alwasys stops at the second HU.

The reason ist, it can't find the Second HU although it finds it after a restart.

If I go into 'HU_DELETE_HU', i can see that gt_xvekp is initial.

After some searching on Google i found that i need to use "HU_GET_HUS" to refresh gt_xvekp.

Unfortunately there is still the same error.

 

What should i do now?

 

Thanks,

 

Robin

 

 

CALL FUNCTION 'HU_GET_HUS'

     EXPORTING

       if_lock_hus = 'X'

       if_no_loop  = space

       if_more_hus = 'X' "C_CHARX

       it_hus      = lt_hu

     IMPORTING

       et_header   = lt_hu_header

       et_items    = lt_hu_items

     EXCEPTIONS

       hus_locked  = 1

       no_hu_found = 2

       fatal_error = 3

       OTHERS      = 4.

 

 

     FIELD-SYMBOLS: <ls_hu_item> LIKE LINE OF lt_hu_items,

                  <ls_imseg> TYPE imseg.

 

   LOOP AT lt_hu_items ASSIGNING <ls_hu_item> WHERE unvel IS INITIAL AND charg IS INITIAL.

 

     CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

       EXPORTING

         input  = <ls_hu_item>-venum

       IMPORTING

         output = lv_venum.

     IF sy-subrc <> 0.

* Implement suitable error handling here

     ENDIF.

 

     CALL FUNCTION 'HU_GET_HUS'.

     IF sy-subrc <> 0.

* Implement suitable error handling here

     ENDIF.

 

 

     CALL FUNCTION 'HU_DELETE_HU'

       EXPORTING

         if_venum = lv_venum.

     IF sy-subrc = 0.

       DELETE TABLE lt_hu_items FROM <ls_hu_item>.

       READ TABLE lt_hu_items INTO ls_hu_item WITH KEY unvel = lv_venum.

       IF sy-subrc = 0.

         DELETE TABLE lt_hu_items FROM ls_hu_item.

       ENDIF.

     ENDIF.

 

 

 

     COMMIT WORK AND WAIT.

 

     WAIT UP TO 1 SECONDS.

 

 

     CALL FUNCTION 'HU_POST'

       EXPORTING

         if_commit = 'X'.

 

   ENDLOOP.


Viewing all articles
Browse latest Browse all 8927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>