Skip to Content
-1
Sep 23 at 05:06 AM

Finding Min value in an table using SY-TABIX variable.

47 Views

Hi Team,

I have a requirement where i want to find the min value( combination of both date and time) based on a transaction number using sy-tabix variable. Any input will be greatly appreciated. Below is the pseudo code, i am using to get the max value.

current output

image.png

Expected output for Min value :

image.png

lv_tabix_temp  = 1.
SORT RESULT_PACKAGE BY /bic/tnr       ASCENDING
                       /bic/zerdat    ASCENDING
                       /bic/zerzetims ASCENDING.
 LOOP AT RESULT_PACKAGE ASSIGNING <result_fields>. 
 lv_tabix = sy-tabix.
     LOOP AT RESULT_PACKAGE INTO wa_result_package FROM
                lv_tabix_temp WHERE /bic/zrpa_tnr = <result_fields>-/bic/zrpa_tnr.               
                lv_tabix_temp = sy-tabix.
    ENDLOOP.
        IF lv_tabix = lv_tabix_temp.
            <result_fields>-/bic/flag = 'X'.        
        ENDIF.
ENDLOOP.

Attachments

image.png (3.1 kB)
image.png (3.3 kB)