Me podrian ayudar a plantear este ALV de manera diferente Saludos y muchas gracias de antemano.
De que manera diferente podria plantear este ALV soy nuevo en Sap …de antemano muchas Gracias.
FORM f_ocupagreg .
*Definiendo variables locales calcular porcentaje.
DATA : lv_porc1(8) TYPE i,
lv_porc2(8) TYPE i,
lv_porc3(8) TYPE i,
lv_porc4(8) TYPE i
LOOP AT gt_sflight_ocup INTO gs_sflight_ocup.
IF gs_sflight_ocup-porc_ocup < 25.
lv_porc1 = lv_porc1 + 1.
ELSEIF gs_sflight_ocup-porc_ocup > 25
AND gs_sflight_ocup-porc_ocup < 50.
lv_porc2 = lv_porc2 + 1.
ELSEIF gs_sflight_ocup-porc_ocup > 50
AND gs_sflight_ocup-porc_ocup < 75.
lv_porc3 = lv_porc3 + 1.
ELSEIF gs_sflight_ocup-porc_ocup > 75
AND gs_sflight_ocup-porc_ocup < 100.
lv_porc4 = lv_porc4 + 1.
ENDIF.
ENDLOOP.
CLEAR: gs_sflight_porc-por_ocup.
gs_sflight_porc-por_ocup = '0% - 25%'.
gs_sflight_porc-por_cant = lv_porc1.
APPEND gs_sflight_porc TO gt_porcvuelos[].
CLEAR:gs_sflight_porc-por_ocup.
gs_sflight_porc-por_ocup = '25% - 50%'.
gs_sflight_porc-por_cant = lv_porc2.
APPEND gs_sflight_porc TO gt_porcvuelos[].
CLEAR:gs_sflight_porc-por_ocup.
gs_sflight_porc-por_ocup = '50% - 75%'.
gs_sflight_porc-por_cant = lv_porc3.
APPEND gs_sflight_porc TO gt_porcvuelos[].
CLEAR:gs_sflight_porc-por_ocup.
gs_sflight_porc-por_ocup = '75% - 100%'.
gs_sflight_porc-por_cant = lv_porc4.
APPEND gs_sflight_porc TO gt_porcvuelos[].
ENDFORM.
FORM f_mostalv .
*Datos del Catalago para el ALV.
CLEAR gs_fieldcat.
gs_fieldcat-fieldname = 'POR_OCUP'. "Nombre del campo".
gs_fieldcat-seltext_m = '% Ocup.'. "Descripci%u00F3n media".
gs_fieldcat-seltext_s = '% Ocupacion..'. "Descripci%u00F3n corta".
APPEND gs_fieldcat TO gt_fieldcat.
CLEAR gs_fieldcat.
CLEAR gs_fieldcat.
gs_fieldcat-fieldname = 'POR_CANT'.
gs_fieldcat-seltext_m = 'Cantidad Vuelos.'.
gs_fieldcat-seltext_s = 'C. Vuelos.'.
APPEND gs_fieldcat TO gt_fieldcat.
CLEAR gs_fieldcat.
*Layout a Rayas.
CLEAR gs_layout.
gs_layout-zebra = 'X'.
gs_layout-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
TABLES
t_outtab = gt_porcvuelos[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM.