DATA: l_timestamp TYPE timestamp,
l_timestamp1 TYPE timestamp,
l_string TYPE string,
lv_string1 TYPE string,
lv_string2 TYPE string,
l_timestring(14) TYPE n,
ls_header TYPE thead,
ls_new_text TYPE itclh,
ls_rsm_attr TYPE udm_rsm_attr,
ls_rsm_attributes TYPE bdm_rsm_attr.
ls_rsm_attributes = is_rsm_attributes.
* Authority check for creation of RSM
DATA:l_error TYPE string.
AUTHORITY-CHECK OBJECT 'F_UDM_SGMT'
ID 'ACTVT' FIELD '28'
ID 'UDM_SGMNT' FIELD ls_rsm_attributes-coll_segment.
IF sy-subrc <> 0.
IF i_qualifier = c_nts.
MESSAGE e023(zudm_resubmission) INTO l_error.
ELSE.
MESSAGE e003(zudm_resubmission) INTO l_error.
ENDIF.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
type = sy-msgty
cl = sy-msgid
number = sy-msgno
IMPORTING
return = return.
RETURN.
ENDIF.
* Check on resubmission date. Resubmission date can't be < today's date
IF ls_rsm_attributes-rsm_date < sy-datlo.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
type = 'E'
cl = 'UDM_RESUBMISSION'
number = '004'
IMPORTING
return = return.
MESSAGE e004(zudm_resubmission).
RETURN.
ENDIF.
* Save the notes
IF NOT it_note[] IS INITIAL.
* Get the timestamp and concatenate it with the GUID of rsm to use it
* as the TDNAME for the note
GET TIME STAMP FIELD l_timestamp.
CONVERT TIME STAMP l_timestamp TIME ZONE 'UTC '
INTO DATE ls_header-tdfdate
TIME ls_header-tdftime.
UNPACK l_timestamp TO l_timestring.
CONCATENATE i_rsm_guid l_timestring INTO ls_header-tdname.
ls_header-tdid = '0001'.
ls_header-tdspras = sy-langu.
* User name is filled with the collection specialist name
ls_header-tdfuser = i_coll_specialist.
ls_header-tdobject = 'UDM_RSM'.
ls_new_text-header = ls_header.
ls_new_text-lines[] = it_note[].
ls_header-tdluser = i_coll_specialist.
ls_header-tdldate = ls_header-tdfdate.
ls_header-tdltime = ls_header-tdftime.
* Add the protocol line to the notes of the resubmission
PERFORM add_prot_line USING ls_header
CHANGING ls_new_text-lines.
* Get the protocol line into the export parameter
READ TABLE ls_new_text-lines INDEX 1 INTO es_note_prot_line.
* Save the notes
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
header = ls_new_text-header
insert = 'X'
TABLES
lines = ls_new_text-lines
EXCEPTIONS
id = 1
language = 2
name = 3
object = 4
OTHERS = 5.
IF sy-subrc <> 0.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
type = sy-msgty
cl = sy-msgid
number = sy-msgno
par1 = sy-msgv1
par2 = sy-msgv2
par3 = sy-msgv3
par4 = sy-msgv4
IMPORTING
return = return.
RETURN.
ENDIF.
ENDIF.
* Prepare the structure with the attributes of RSM
GET TIME STAMP FIELD l_timestamp.
MOVE created_at to l_timestamp1.
ls_rsm_attr-rsm_guid = i_rsm_guid.
ls_rsm_attr-customer = ls_rsm_attributes-customer.
ls_rsm_attr-coll_segment = ls_rsm_attributes-coll_segment.
ls_rsm_attr-rsm_date = ls_rsm_attributes-rsm_date.
ls_rsm_attr-rsm_time = ls_rsm_attributes-rsm_time.
ls_rsm_attr-rsm_xbypass = ls_rsm_attributes-rsm_xbypass.
ls_rsm_attr-rsm_reason = ls_rsm_attributes-rsm_reason.
ls_rsm_attr-rsm_status = '0'.
ls_rsm_attr-created_by = i_coll_specialist.
* ls_rsm_attr-created_at = l_timestamp.
ls_rsm_attr-created_at = l_timestamp1. "created_at.
ls_rsm_attr-changed_by = i_coll_specialist.
ls_rsm_attr-changed_at = l_timestamp.
ls_rsm_attr-objtype = ls_rsm_attributes-objtype.
ls_rsm_attr-objkey = ls_rsm_attributes-objkey.
ls_rsm_attr-rsm_attch_count = ls_rsm_attributes-rsm_attch_count.
gs_rsm_attr = ls_rsm_attr.
CALL FUNCTION 'COMMIT_TEXT'
EXPORTING
savemode_direct = ''.
CALL FUNCTION 'UDM_RSM_CREATE_UPDATE' IN UPDATE TASK
EXPORTING
is_rsm_attr = gs_rsm_attr.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
2 | |
2 |