lv_product = |{ gv_matnr_s ALPHA = OUT } |.
lv_product = |{ lv_product ALPHA = IN } |.
DATI: stringa_caratteri TIPO stringa.
DATA(text) = 'ABC'.
INTO TABLE @DATA(lt_stock)
FROM mard
UP TO 10 ROWS
ORDER BY PRIMARY KEY.
data gt_range_ekko TYPE RANGE OF EBELN.
FROM ekko
INTO TABLE @gt_range_ekko.
APPEND INITIAL LINE TO gt_output ASSIGNING <fs_output>.
IF <fs_output> IS ASSIGNED.
…
ENDLOOP.
matnr type mard-matnr,
werks type mard-werks,
lgort type mard-lgort,
labst type mard-labst,
END OF ty_mard.
DATA: lwa_stock TYPE ty_mard.
TRY.
lwa_stock = lt_stock[ 2 ].
CATCH cx_sy_itab_line_not_found.
ENDTRY.
equivale a :
READ TABLE lt_stock INDEX 2 into lwa_stock
READ TABLE lt_stock INTO DATA(lwa_stock)
WITH KEY matnr = '0003444334'.
INTO TABLE @DATA(lt_prest_wbe)
FROM zmm_prest_wbe
FOR ALL ENTRIES IN @lt_somma_tmp
WHERE zzasnum_mo = @lt_somma_tmp-service.
matnr type mard-matnr,
werks type mard-werks,
lgort type mard-lgort,
labst type mard-labst,
END OF ty_mard.
DATA: lwa_stock TYPE ty_mard.
lwa_stock-labst = 50.
MODIFY lt_stock FROM lwa_stock TRANSPORTING labst
WHERE labst = 0.
WRITE: / ' Record Trovato'.
else.
WRITE: / ' Record Non Trovato'.
endif.
equivale a :
READ TABLE lt_stock
WITH KEY matnr = '000000000010000001'
lgort = 'MACE'
TRANSPORTING NO FIELDS.
werks = 'WERK'
lgort = 'MAG1'
labst = 76
).
lv_numero type i.
lv_numero = 2.
lv_testo = SWITCH #( lv_numero
WHEN 1 THEN 'Primo'
WHEN 2 THEN 'Secondo'
WHEN 3 THEN 'Terzo'
ELSE 'Altro' ).
WRITE: / ' lv_testo=', lv_testo.
lv_numero TYPE i.
lv_numero = 2.
CLASS cx_cant_be DEFINITION INHERITING FROM cx_no_check.
ENDCLASS.
TRY.
lv_testo = COND #(
WHEN lv_numero < 10 THEN 'Numero minore di 10'
WHEN lv_numero >= 10 THEN 'Numero maggiore di 10'
ELSE
THROW cx_cant_be( ) ).
CATCH cx_cant_be.
ENDTRY.
WRITE: / ' lv_testo=', lv_testo.
Lettura Tabelle con Chiave
DATA: t_usr01_k TYPE TABLE OF usr01 WITH UNIQUE SORTED KEY key_bname
COMPONENTS bname.
*key_BNAME è il nome della chiave. Contiene un campo: BNAME.
DATA: ls_usr01_k LIKE LINE OF t_usr01_k.
SELECT *
INTO TABLE t_usr01_k
FROM usr01
ORDER BY bname.
TRY.
ls_usr01_k = t_usr01_k[ KEY key_bname COMPONENTS bname = 'EE98EE' ].
CATCH cx_sy_itab_line_not_found.
STOP.
ENDTRY.
USO DI SUBQUERY
SELECT ebeln, ebelp, matnr INTO TABLE @DATA(lt_venduto_a)
FROM ekpo WHERE ebeln = ( SELECT ebeln FROM ekko WHERE ebeln = @p_ebeln ).
Valorizzare una nuova tabella copiando alcuni campi di un altra tabella
DATA:
pt_item_change TYPE tt_bapimeoutitem.
*Mi valorizzo la struttra degli item con le posizioni da sbidonare
pt_item_change = VALUE #( FOR ls_ekpo IN gt_table_sbidonate
( item_no = ls_ekpo-pos_contr_cat
delete_ind = ls_ekpo-bidonato
)
).
Copiare alcuni campi da una tabella (con la clausola WHERE) in un altra
DATA:
pt_item_change TYPE tt_bapimeoutitem.
*Mi valorizzo la struttra degli item con le posizioni da sbidonare
pt_item_change = VALUE #( FOR ls_ekpo IN gt_table_sbidonate
WHERE ( delete_ind = 'X' )
( item_no = ls_ekpo-pos_contr_cat
delete_ind = ls_ekpo-bidonato
)
).
Inserisco nuovi record in una tabella
LOOP AT gt_table_ctrl INTO DATA(ls_ctrl).
APPEND VALUE #(
item_no = ls_ctrl-pos_contr_cat
material = ls_ctrl-mat_sap
net_price = ls_ctrl-prezzo_unit
price_unit = 1
orderpr_un = ls_ctrl-um_oda
acctasscat = gc_knttp_u
conv_num1 = 1
conv_den1 = ls_ctrl-conv_um " 1
)
TO pt_item_change.
ENDLOOP.
Passare dinamicamente una tabella ad una routine, ed eliminare dei record
DATA: t_ee_i0000 TYPE STANDARD TABLE OF
ZHR_SFI_P9040.
PERFORM cancella_dati_prima_go_live CHANGING t_ee_i0000[].
FORM cancella_dati_prima_go_live CHANGING pt_table_infotype TYPE table.
DATA: lv1_index TYPE sy-tabix,
lv_dt_go_live TYPE sy-datum
dref TYPE REF TO data,
ls_appo TYPE zhr_sfi_eedata_log.
* lv_where type string.
FIELD-SYMBOLS: <st_data> TYPE ANY.
check not pt_table_infotype is INITIAL.
CREATE DATA dref LIKE LINE OF pt_table_infotype .
ASSIGN dref->* TO <st_data> .
* clear: lv_where.
* CONCATENATE lv_where 'begda <= lv_dt_go_live' INTO lv_where
* SEPARATED BY space.
LOOP AT pt_table_infotype ASSIGNING <st_data>.
* WHERE (lv_where).
lv1_index = sy-tabix.
MOVE-CORRESPONDING <st_data> TO ls_appo.
IF ls_appo-begda <= lv_dt_go_live.
CLEAR: ls_eedata_log.
MOVE-CORRESPONDING <st_data> TO ls_eedata_log.
APPEND ls_eedata_log TO lt_eedata_log.
CLEAR ls_eedata_log.
DELETE pt_table_infotype INDEX lv1_index.
ENDIF.
ENDLOOP.
1. SAP EWM (Extended Warehouse Management)
3. SAP VIM (Vendor Invoice Management)
>>> RECENSIONI DEI LIBRI su Amazon Kindle <<<
Ebook: SAP MM: https://www.amazon.it/dp/B0C3MKD9BR#customerReviews
Ebook: SAP MII: https://www.amazon.it/dp/B0C4392MY9#customerReviews
Ebook: SAP VIM: https://www.amazon.it/dp/B0C6FBK8QN#customerReviews
Nessun commento:
Posta un commento