например, что-то в таком духе...:
Code:
define hr_read_infotype.
call function 'HR_READ_INFOTYPE'
exporting
tclas = 'A'
pernr = &1
infty = &2
begda = &3
endda = &4
tables
infty_tab = &5
exceptions
infty_not_found = 1
others = 2.
if sy-subrc = 0.
read table &5 into &6 index 1.
endif.
end-of-definition.
form create_action using outtab type t_outtab
changing ok.
data: lt_0008 type standard table of p0008 with header line.
data: lga(15) type c value 'P0008-LGA**',
bet(15) type c value 'P0008-BET**',
anz(15) type c value 'P0008-ANZ**',
ein(15) type c value 'P0008-EIN**',
opk(15) type c value 'P0008-OPK**',
ind(15) type c value 'P0008-IND**',
n2(2) type n.
field-symbols: <lga> type lgart,
<bet> type pad_amt7s,
<anz> type anzhl,
<ein> type pt_zeinh,
<ind> type indbw,
<opk> type opken.
data: proposed_values type standard table of pprop with header line.
data: return type bapireturn.
data: hr_return like hrhrmm_msg.
data: mod_keys type standard table of pskey with header line.
data: cbtr(13) type c,
canz(13) type c.
define set_field_value.
proposed_values-infty = &1.
proposed_values-fname = &2.
proposed_values-fval = &3.
append proposed_values.
end-of-definition.
define convert_curr_to_string.
write &1 to &2.
translate &2 using ', '.
condense &2 no-gaps.
end-of-definition.
* Инфотип 0000
set_field_value: '0000' 'P0000-PERNR' outtab-pernr, " Таб.Номер
'0000' 'P0000-BEGDA' outtab-begda, " Дата начала
'0000' 'P0000-MASSN' outtab-massn, " Номер мероприятия
'0000' 'P0000-MASSG' outtab-massg. " Причина мероприятия
* Инфотип 0008
clear: lt_0008, lt_0008[].
hr_read_infotype outtab-pernr '0008' outtab-begda outtab-begda lt_0008 p0008.
if p0008 is not initial.
set_field_value: '0008' 'P0008-PERNR' outtab-pernr, " Таб.Номер
'0008' 'P0008-BEGDA' outtab-begda, " Дата начала
'0008' 'P0008-ENDDA' p0008-endda,
'0008' 'P0008-PREAS' '01',
'0008' 'P0008-TRFAR' p0008-trfar,
'0008' 'P0008-TRFGB' p0008-trfgb,
'0008' 'P0008-TRFGR' outtab-trfgr,
'0008' 'P0008-TRFST' '1'.
do wage_count times.
n2 = sy-index.
move: n2 to lga+9(2),
n2 to bet+9(2),
n2 to anz+9(2),
n2 to ein+9(2),
n2 to opk+9(2),
n2 to ind+9(2).
assign: (lga) to <lga>,
(bet) to <bet>,
(anz) to <anz>,
(ein) to <ein>,
(opk) to <opk>,
(ind) to <ind>.
if <lga> = outtab-lgart.
<bet> = outtab-betrg.
<ind> = space.
endif.
convert_curr_to_string: <bet> cbtr,
<anz> canz.
set_field_value: '0008' lga <lga>,
'0008' bet cbtr,
'0008' anz canz,
'0008' ein <ein>,
'0008' ind <ind>,
'0008' opk <opk>.
enddo.
endif.
* Инфотип 0016
set_field_value: '0016' 'P0016-BEGDA' outtab-begda,
'0016' 'P0016-ENDDA' dend,
'0016' 'P0016-CTNUM' outtab-ctnum,
'0016' 'P0016-CTBEG' outtab-ctbeg.
call function 'HR_PSBUFFER_INITIALIZE'.
call function 'HR_MAINTAIN_MASTERDATA'
exporting
pernr = outtab-pernr
massn = p_massn " Вид мероприятия
begda = outtab-begda " Дата мероприятия
importing
return = return
hr_return = hr_return
tables
proposed_values = proposed_values
modified_keys = mod_keys.
if return is not initial.
ok = space.
if hr_return is not initial.
append hr_return to gt_msg.
else.
move: outtab-pernr to gt_msg-pernr,
return-type to gt_msg-msgty,
return-code(2) to gt_msg-msgid,
return-code+2(3) to gt_msg-msgno,
return-message_v1 to gt_msg-msgv1,
return-message_v1 to gt_msg-msgv1,
return-message_v1 to gt_msg-msgv1,
return-message_v1 to gt_msg-msgv1.
insert gt_msg into table gt_msg.
endif.
else.
ok = 'X'.
endif. " return is initial.
endform. " CREATE_ACTION