*&---------------------------------------------------------------------
*& Form SET_JOB
*&---------------------------------------------------------------------
* text
*----------------------------------------------------------------------
* -->P_L_ID_PROCESO text
* -->P_L_ROW_INIT text
* -->P_L_ROW_LAST text
* <--P_<FS_PROCESO>_E_JOB_NAME text
*----------------------------------------------------------------------
FORM set_job USING p_id_proceso
p_i_row_init
p_i_row_last
CHANGING p_ie_subrc
p_ie_job_name TYPE btcjob
p_ie_jobcount TYPE btcjobcnt.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = p_ie_job_name
IMPORTING
jobcount = p_ie_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc EQ 0.
SUBMIT zf1_pr_ep_r_report_dinamicjobs VIA JOB p_ie_job_name
NUMBER p_ie_jobcount
USING SELECTION-SCREEN 1000
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
IMMEDIATELY 'X'
WITH p_taskid EQ p_id_proceso
WITH p_jobnam EQ p_ie_job_name
WITH p_jobcon EQ p_ie_jobcount
WITH p_rini EQ p_i_row_init
WITH p_rlas EQ p_i_row_last
WITH p_fikrs EQ p_fikrs
WITH p_gjahr EQ p_gjahr
WITH p_versi EQ p_versi
WITH p_ptype EQ p_ptype
WITH p_consol EQ p_consol
WITH p_ltext EQ p_ltext
AND RETURN.
IF sy-subrc EQ 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = p_ie_jobcount
jobname = p_ie_job_name
strtimmed = 'X'
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
invalid_target = 8
OTHERS = 9.
IF sy-subrc NE 0.
p_ie_subrc = 4.
ENDIF.
ELSE.
p_ie_subrc = 4.
ENDIF.
ELSE.
p_ie_subrc = 4.
ENDIF.
ENDFORM.
Consulta Sap
Articulos y codigo Sap Abap
jueves, 9 de enero de 2020
miércoles, 27 de noviembre de 2019
Uso de tabla tvarvc para variables Sap Abap
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.
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.
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’ ).
domingo, 27 de diciembre de 2015
Remover caracteres cadena de texto Abap
REPLACE ALL OCCURRENCES OF SUBSTRING '-' IN gs_xml_cmpra_det-idprov WITH ''.
REPLACE ALL OCCURRENCES OF SUBSTRING '.' IN gs_xml_cmpra_det-idprov WITH ''.
Suscribirse a:
Entradas (Atom)