07-02-2007 7:32 AM
hi,
i used one functional module ( ALSM_EXCEL_TO_INTERNAL_TABLE ) for upload time sheet data into internal table .. now i wanna to upload internal table data into cat2 t-code .. now what to do .. Is there any bapi or any function module for this? Please tell me shortly..
Regards,
Kumar
07-02-2007 12:43 PM
Hi,
there is a BAPI :
BAPI_CATIMESHEETMGR_INSERT
here below some code sample to help you
form ps_call_bapi2 using l_data type ty_data.
data : it_catsrecordins like bapicats1 occurs 0 with header line.
data : it_return like bapiret2 occurs 0 with header line.
it_catsrecordins-employeenumber = w_pernr.
it_catsrecordins-workdate = w_date.
it_catsrecordins-catshours = l_data-temps.
it_catsrecordins-network = l_data-aufnr.
it_catsrecordins-activity = l_data-vornr.
append it_catsrecordins.
clear it_catsrecordins.
call function 'BAPI_CATIMESHEETMGR_INSERT'
exporting
profile = c_profile
release_data = 'X'
tables
catsrecords_in = it_catsrecordins
return = it_return.
" !!! Petite particularité : si tout se passe bien, cette BAPI ne
"renvoie pas de message
loop at it_return.
perform set_message using zcl_message_transaction
it_return-number
it_return-message_v1
it_return-message_v2
it_return-message_v3
it_return-message_v4
it_return-type
it_return-id.
perform fill_protocol using l_data-sequence
it_return-number
it_return-message_v1
it_return-message_v2
it_return-message_v3
it_return-message_v4
it_return-type
it_return-id.
endloop.
"Voir si le résultat est ok ou non; si problème, générer dossier
loop at it_return where type = 'A' or type = 'E'.
endloop.
if sy-subrc = 0.
perform cats_call_cat22 using l_data ''
changing w_bdc_open.
else.
perform set_message using zcl_message_transaction
'016' '' '' '' '' 'S' 'LR'.
perform fill_protocol using l_data-sequence
'016' '' '' '' '' 'S' 'LR'.
endif.
endform. " ps_call_bapi2