TABLES: tvarv.
SELECT low FROM tvarvc WHERE name EQ 'EMAIL_DEST' INTO @data(wa_email-low).
ENDSELECT.
SELECT low FROM tvarvc WHERE name EQ 'EMAIL_SUBJ' INTO @data(wa_emailsubj-low).
ENDSELECT.
miércoles, 27 de noviembre de 2019
Ejempo de uso de SUM Sap Abap
DATA: C1 TYPE i, C2 TYPE i, total type i. SELECT SUM( field1 ) SUM( fiedl2 ) into ( c1 c2 )from tablename. total = c1 + c2.
Leer set de datos ABAP Sap
CALL FUNCTION 'G_SET_GET_ID_FROM_NAME'
EXPORTING
shortname = 'ZF1_FI_007'
IMPORTING
new_setid = lv_setid
EXCEPTIONS
no_set_found = 1
no_set_picked_from_popup = 2
wrong_class = 3
wrong_subclass = 4
table_field_not_found = 5
fields_dont_match = 6
set_is_empty = 7
formula_in_set = 8
set_is_dynamic = 9
OTHERS = 10.
CALL FUNCTION 'G_SET_FETCH'
EXPORTING
setnr = lv_setid
TABLES
formula_lines = lit_formula_lines
set_lines_basic = lit_set_lines_basic
set_lines_data = lit_set_lines_data
set_lines_multi = lit_set_lines_multi
set_lines_single = lit_set_lines_single
EXCEPTIONS
no_authority = 1
set_is_broken = 2
set_not_found = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
EXPORTING
shortname = 'ZF1_FI_007'
IMPORTING
new_setid = lv_setid
EXCEPTIONS
no_set_found = 1
no_set_picked_from_popup = 2
wrong_class = 3
wrong_subclass = 4
table_field_not_found = 5
fields_dont_match = 6
set_is_empty = 7
formula_in_set = 8
set_is_dynamic = 9
OTHERS = 10.
CALL FUNCTION 'G_SET_FETCH'
EXPORTING
setnr = lv_setid
TABLES
formula_lines = lit_formula_lines
set_lines_basic = lit_set_lines_basic
set_lines_data = lit_set_lines_data
set_lines_multi = lit_set_lines_multi
set_lines_single = lit_set_lines_single
EXCEPTIONS
no_authority = 1
set_is_broken = 2
set_not_found = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Ejemplos de declaraciones de tablas internas ABAP
TYPES: BEGIN OF t_ekko, ebeln TYPE ekpo-ebeln, ebelp TYPE ekpo-ebelp, statu TYPE ekpo-statu, aedat TYPE ekpo-aedat, matnr TYPE ekpo-matnr, menge TYPE ekpo-menge, meins TYPE ekpo-meins, netpr TYPE ekpo-netpr, peinh TYPE ekpo-peinh, CELLCOLOR TYPE LVC_T_SCOL, END OF t_ekko. DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0, wa_ekko TYPE t_ekko. select ebeln ebelp statu aedat matnr menge meins netpr peinh up to 10 rows from ekpo into CORRESPONDING FIELDS OF TABLE it_ekko.
select ebeln, ebelp, statu, aedat, matnr, menge, meins, netpr, peinh
up to 10 rows
from ekpo
into TABLE @DATA(it_ekko_new).
READ TABLE it_ekko_new INDEX 1 INTO DATA(wa_ekko_new2).
WRITE:/ wa_ekko_new2.
Ejemplo de modify en loop
loop at it_ekpo into wa_ekpo.
gd_tabix = sy-tabix.
wa_ekpo-netpr = '100'.
MODIFY it_ekpo INDEX gd_tabix FROM wa_ekpo.
endloop.
Usando la combianción de “AND” y “OR” en un select ABAP
Puedes usar el siguiente query:
También es posible usar el IN:
SELECT * FROM my_table WHERE condition 1 AND condition 2 AND ( id EQ '2' or id EQ '3' ).
Después de cada paréntesis debe ir un espacio:
También es posible usar el IN:
SELECT * FROM my_table WHERE condition 1 AND condition 2 AND EQ IN ('2', ‘3’ ).
Suscribirse a:
Entradas (Atom)