ISU_M_EQUI_INSERT

rerkuy

Kayıtlı Üye
Katılım
18 Kas 2016
Mesajlar
23
Tepki puanı
14
Puanları
3
Yaş
34
Konum
Konya
You can find the sample program which creates an equipment in an ISU system.

DATA: lv_matnr TYPE mara-matnr,
lv_sernr TYPE equi-gernr,
lv_equnr TYPE equi-equnr,
ls_makt TYPE makt,
ls_etyp TYPE etyp,
ls_v_eger TYPE v_eger,
ls_egers TYPE egers ,
ls_egerh TYPE egerh ,
ls_clshead TYPE emg_clshead ,
lt_clsdata TYPE emg_clsdata ,
ls_clsdata TYPE api_ausp ,
lt_auto TYPE isumi_device_auto ,
ls_v_equi TYPE v_equi.

lv_matnr = 'MATERIAL1'.
lv_sernr = 'SERIAL1'.

SELECT SINGLE matnr
INTO lv_matnr
FROM mara
WHERE matnr = lv_matnr.
IF sy-subrc <> 0.
"Error:Material does not exit
EXIT.
ENDIF.

SELECT SINGLE equnr
FROM equi
INTO lv_equnr
WHERE matnr = lv_matnr
AND sernr = lv_sernr .
IF sy-subrc = 0.
"Error:Equipment created before
ENDIF.

SELECT SINGLE *
FROM makt
INTO CORRESPONDING FIELDS OF ls_makt
WHERE matnr = lv_matnr AND
spras = sy-langu.

SELECT SINGLE matnr wgruppe kombinat
FROM etyp
INTO CORRESPONDING FIELDS OF ls_etyp
WHERE matnr = lv_matnr.

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = lv_matnr
IMPORTING
output = lv_matnr
EXCEPTIONS
length_error = 1
OTHERS = 2.

CALL FUNCTION 'CONVERSION_EXIT_GERNR_INPUT'
EXPORTING
input = lv_sernr
IMPORTING
output = lv_sernr.

"Fill the table and view fields
ls_v_equi-eqasp = sy-langu .
ls_v_equi-eqtyp = 'I' ."ISU
ls_v_equi-baujj = sy-datum+0(4).
ls_v_equi-matnr = lv_matnr.
ls_v_equi-sernr = lv_sernr.
ls_v_equi-sparte = '01' .
ls_v_equi-datab = sy-datum .
ls_v_equi-spras = sy-langu .
ls_v_equi-eqktx = ls_makt-maktx .

ls_egers-besitz = '01' .
ls_egers-bgljahr = sy-datum+0(4) .

ls_egerh-bis = '99991231' .
ls_egerh-ab = ls_v_equi-datab .
ls_egerh-kombinat = ls_etyp-kombinat .
ls_egerh-zwgruppe = ls_etyp-zwgruppe .
ls_egerh-wgruppe = ls_etyp-wgruppe .
ls_egerh-lossdtgroup = ls_etyp-lossdtgroup .
ls_egerh-rating = ls_etyp-rating .

lt_auto-v_equi = ls_v_equi .
lt_auto-egers = ls_egers .
lt_auto-egerh = ls_egerh .

"Characteristics
ls_clshead-class = 'CLASS_IS2' .
ls_clshead-classtype = 'IS2' .

CLEAR ls_clsdata .
ls_clsdata-charact = 'CHARACT1' .
ls_clsdata-value = 'ChrValue' .
APPEND ls_clsdata TO lt_clsdata .

lt_auto-clsdata[] = lt_clsdata[] .
lt_auto-clshead = ls_clshead .

CALL FUNCTION 'ISU_M_EQUI_INSERT'
EXPORTING
x_conv = 'X'
x_indiv = 'X'
x_update = 'X'
x_direct = 'X'
x_commit = 'X'
CHANGING
x_auto = lt_auto
EXCEPTIONS
err_insert = 1
err_fuba = 2
OTHERS = 3.

IF sy-subrc = 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.

SELECT SINGLE equnr
FROM equi
INTO lv_equnr
WHERE matnr = lv_matnr
AND sernr = lv_sernr .

ELSE.
"Error:Equipment couldn't create
ENDIF.
 

kasparov

Kayıtlı Üye
Katılım
12 Eki 2018
Mesajlar
2
Tepki puanı
0
Puanları
1
Yaş
32
Kullandığınız SAP Modülleri
  1. SAP MM
  2. SAP PP
  3. SAP CO
  4. SAP FI
  5. SAP SD
  6. SAP HR
  7. SAP QM
  8. SAP LE
  9. SAP BW
  10. SAP PS
  11. SAP WM
  12. SAP ABAP
Katılım Bölgesi
  1. İstanbul
Yararlı.Teşekkürler
 
Üst