2
« en: 11 de Diciembre de 2013, 12:19:37 pm »
Hola si a eso es a lo que me referia, gracias!. Soy nueva en esto de abap y cuando me hablas de flag entiendo a lo que te refieres pero no se como aplicarlo, podrias pasarme un ejemplo de codigo?, igualmente tampoco me toma el color, si te paso mi ejercicio (es del minisap) podrias chequear donde esta el error? gracias!.
TYPES: BEGIN OF ty_aerolinea,
carrid LIKE sbook-carrid,
connid LIKE sbook-connid,
fldate LIKE sbook-fldate,
customid LIKE sbook-customid,
custtype LIKE sbook-custtype,
name LIKE scustom-name,
city LIKE scustom-city,
country LIKE scustom-country,
price LIKE sflight-price,
currency LIKE sflight-currency,
latitude LIKE sgeocity-latitude,
longitude LIKE sgeocity-longitude,
descuento TYPE f,
colorcillo(4) TYPE c,
END OF ty_aerolinea.
TYPES: BEGIN OF ty_vuelo,
customid LIKE sbook-customid,
price LIKE sflight-price,
currency LIKE sflight-currency,
latitude LIKE sgeocity-latitude,
longitude LIKE sgeocity-longitude,
descuento TYPE f,
city LIKE scustom-city,
country LIKE scustom-country,
END OF ty_vuelo.
DATA: gs_aerolinea TYPE ty_aerolinea.
TYPES: gt_aerolinea_type TYPE STANDARD TABLE OF ty_aerolinea.
DATA: gt_aerolinea TYPE gt_aerolinea_type.
DATA: gt_catalogo TYPE slis_t_fieldcat_alv,
gs_fieldcat TYPE slis_fieldcat_alv,
gs_layout TYPE slis_layout_alv,
g_repid LIKE sy-repid.
*---------------------------------------------------------------------*
* FORM catalogo *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM catalogo.
gs_layout-info_fieldname = 'COLORCILLO'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = g_repid
* I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = 'USER_COMMAND'
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
is_layout = gs_layout
it_fieldcat = gt_catalogo
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
i_save = 'A'
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IT_ALV_GRAPHICS =
* IT_ADD_FIELDCAT =
* IT_HYPERLINK =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = gt_aerolinea
EXCEPTIONS
program_error = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
* FORM user_command *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> R_UCOMM *
* --> RS_SELFIELD *
*---------------------------------------------------------------------*
*Nro de Cliente sbook-customid
* Precio sflight-price
* Moneda sflight-currency
* Latitud sgeocity-latitude*
* Longitud sgeocity-longitud
* Porcentaje de *Descuento 10% o 20%
*Solamente cuando haga click en ciudad o país hago el reporte de precio
*añadiéndole el campo nro cliente y al volver hacia atrás a la tabla
*anterior la fila que selecciono el cliente la pinto de amarillo.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: ls_vuelo TYPE ty_vuelo.
TYPES: lt_vuelo_type TYPE STANDARD TABLE OF ty_vuelo.
DATA: lt_vuelo TYPE lt_vuelo_type.
DATA: lt_fieldcat TYPE slis_t_fieldcat_alv,
ls_fieldcat TYPE slis_fieldcat_alv,
ls_layout TYPE slis_layout_alv.
READ TABLE gt_aerolinea INDEX rs_selfield-tabindex INTO gs_aerolinea.
gs_aerolinea-colorcillo = 'C311'.
MODIFY gt_aerolinea FROM gs_aerolinea INDEX rs_selfield-tabindex
TRANSPORTING colorcillo .
* rs_selfield-refresh = abap_true.
* rs_selfield-refresh = 'X'.
* rs_selfield-col_stable = 'X'.
* rs_selfield-row_stable = 'X'.
*Nro de Cliente sbook-customid
* Precio sflight-price
* Moneda sflight-currency
* Latitud sgeocity-latitude*
* Longitud sgeocity-longitud
* Porcentaje de *Descuento 10% o 20%
MOVE: gs_aerolinea-customid TO ls_vuelo-customid,
gs_aerolinea-price TO ls_vuelo-price, gs_aerolinea-currency TO
ls_vuelo-currency, gs_aerolinea-latitude TO ls_vuelo-latitude,
gs_aerolinea-longitude TO ls_vuelo-longitude, gs_aerolinea-descuento TO
ls_vuelo-descuento, gs_aerolinea-city TO ls_vuelo-city,
gs_aerolinea-country TO ls_vuelo-country.
APPEND ls_vuelo TO lt_vuelo.
*numcli LIKE sbook-customid,
* precio LIKE sflight-price,
* CURRENCY LIKE SFLIGHT-CURRENCY
* latitud LIKE sgeocity-latitude,
* longitude LIKE sgeocity-longitude,
* descuento TYPE f,
* city LIKE scustom-city,
* country LIKE scustom-country,
IF rs_selfield-fieldname = 'CITY' OR rs_selfield-fieldname = 'COUNTRY'.
ls_fieldcat-fieldname = 'CUSTOMID'.
ls_fieldcat-ref_tabname = 'SBOOK'.
APPEND ls_fieldcat TO lt_fieldcat. CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'PRICE'.
ls_fieldcat-ref_tabname = 'SFLIGHT'.
APPEND ls_fieldcat TO lt_fieldcat. CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'CURRENCY'.
ls_fieldcat-ref_tabname = 'SFLIGHT'.
APPEND ls_fieldcat TO lt_fieldcat. CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'LATITUDE'.
ls_fieldcat-ref_tabname = 'SGEOCITY'.
APPEND ls_fieldcat TO lt_fieldcat. CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'LONGITUDE'.
ls_fieldcat-ref_tabname = 'SGEOCITY'.
APPEND ls_fieldcat TO lt_fieldcat. CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'DESCUENTO'.
ls_fieldcat-ref_tabname = 'GT_AEROLINEA'.
ls_fieldcat-datatype = 'FLOAT'.
ls_fieldcat-outputlen = '20'.
ls_fieldcat-seltext_l = 'DESCUENTO'.
APPEND ls_fieldcat TO lt_fieldcat. CLEAR ls_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = g_repid
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT = 'COLORCILLO'
it_fieldcat = lt_fieldcat
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 2
* I_SCREEN_START_LINE = 2
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IT_ALV_GRAPHICS =
* IT_ADD_FIELDCAT =
* IT_HYPERLINK =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = lt_vuelo
EXCEPTIONS
program_error = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CLEAR lt_vuelo.
ENDIF.
ENDFORM.