on 09-28-2011 2:11 PM
Hi I am creating Transport Vehicle resource by using BAPI_RSSRVSCMB_SAVEMULTI2
i am providing correct input table values and Vehicle is creating also, I have verified in T code "/scmtms/res01".
But from date,time and To date,time are not updating in transaction.
Can any one guid me.
AMIT
Hi,
I finally did it but not with the help of BAPI, After creation of vehicle resource by BAPI immediate I am doing it direct table update.
below is the loagic.
1.Read key from table /SAPAPO/RES_HEAD or /SAPAPO/RESKEY
2.Adjust date format
3.Get the resid generated for vehicle resource by BAPI.(16 digit GUID craetion)
4.Get objid (i.e ORGCENTRE) from table /SCMB/HRP5561 for external organisation id and role.
5.Fill int table (I gave name t_tms_head_modify of type /scmb/restmshd.)
6.finally MODIFY /scmb/restmshd FROM TABLE t_tms_head_modify.
Code:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Amit,
Can you please tell me how did you create records using the BAPI?
I am trying to do that but it fails.
I entered only the basic values in RESOURCE_HEAD. I compared it with creation of resource master screen and see that there are only few fields that are mandatory. Hence, I entered those.
Can you please tell what are the mandatory fields in the tables to create a single record in resource master.
Thanks and Regards,
Neha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Below is code segment.
REPORT z_veh_res.
"BAPI_RSSRVSCMB_SAVEMULTI2
TYPES: BEGIN OF
ty_s_resource_head.
INCLUDE STRUCTURE
bapiscmb0006reshead.
TYPES: END OF
ty_s_resource_head.
TYPES: BEGIN OF
ty_s_resource_head_x.
INCLUDE STRUCTURE
bapiscmb0006resheadx.
TYPES: END OF
ty_s_resource_head_x.
TYPES: BEGIN OF
ty_s_resource_text.
INCLUDE STRUCTURE
bapiscmb0006restext.
TYPES: END OF
ty_s_resource_text.
TYPES: BEGIN OF
ty_s_resource_text_x.
INCLUDE STRUCTURE
bapiscmb0006restextx.
TYPES: END OF
ty_s_resource_text_x.
TYPES: BEGIN OF
ty_s_resource_dim.
INCLUDE STRUCTURE
bapiscmb0006resdimdata.
TYPES: END OF
ty_s_resource_dim.
TYPES: BEGIN OF
ty_s_resource_dim_x.
INCLUDE STRUCTURE
bapiscmb0006resdimdatax.
TYPES: END OF
ty_s_resource_dim_x.
TYPES: BEGIN OF
ty_s_resource_dimrq.
INCLUDE STRUCTURE
bapiscmb0006resdimrqdata.
TYPES: END OF
ty_s_resource_dimrq.
TYPES: BEGIN OF
ty_s_resource_dimrq_x.
INCLUDE STRUCTURE bapiscmb0006resdimrqdatax.
TYPES: END OF
ty_s_resource_dimrq_x.
TYPES: BEGIN OF
ty_s_resource_tms_head.
INCLUDE STRUCTURE
bapiscmb0006restmshead2.
TYPES: END OF
ty_s_resource_tms_head.
TYPES: BEGIN OF
ty_s_resource_tms_head_x.
INCLUDE
STRUCTURE
bapiscmb0006restmshead2x.
TYPES: END OF
ty_s_resource_tms_head_x.
TYPES: BEGIN OF ty_s_resource_tms_alternid.
INCLUDE STRUCTURE
bapiscmb0006restmsaltid.
TYPES: END OF
ty_s_resource_tms_alternid.
TYPES: BEGIN OF
ty_s_resource_tms_alternid_x.
INCLUDE STRUCTURE
bapiscmb0006restmsaltidx.
TYPES: END OF
ty_s_resource_tms_alternid_x.
TYPES: BEGIN OF
ty_s_resource_tms_attequ.
INCLUDE STRUCTURE
bapiscmb0006restmsattequ.
TYPES: END OF
ty_s_resource_tms_attequ.
TYPES: BEGIN OF
ty_s_resource_tms_attequ_x.
INCLUDE STRUCTURE
bapiscmb0006restmsattequx.
TYPES: END OF
ty_s_resource_tms_attequ_x.
*types: BEGIN OF
ty_s_ET_RESOURCE_MAP.
* INCLUDE STRUCTURE BAPISCMB0006RESMAP.
*TYPES: END OF ty_s_ET_RESOURCE_MAP.
** input file structure
TYPES: BEGIN OF
ty_s_tvehicle,
resource TYPE
bapiscmb0006reshead-resource, " HEAD,Text,Dim,DIMRQ,TMS HEAD,ALTERNID,ATTEQU
location TYPE
bapiscmb0006reshead-location, " HEAD
org_id TYPE c,
resourcetype TYPE bapiscmb0006reshead-type, " HEAD
resourcecat TYPE bapiscmb0006reshead-restype, " HEAD
means_of_trp TYPE bapiscmb0006reshead-traty, " HEAD
time_zone TYPE
bapiscmb0006reshead-timezone, " HEAD
dimension TYPE
bapiscmb0006reshead-dimension, " HEAD
factcal TYPE
bapiscmb0006reshead-calendar, " HEAD
capacity TYPE
bapiscmb0006reshead-noindivres, " HEAD
unit
TYPE bapiscmb0006reshead-noindivres_unit, " HEAD
*Begin of I-709402
dim_vol TYPE
bapiscmb0006reshead-dimension, " HEAD
cap_vol TYPE
bapiscmb0006reshead-noindivres, " HEAD
unit_vol TYPE
bapiscmb0006reshead-noindivres_unit, " HEAD
*End of I-709402
actvariant TYPE bapiscmb0006reshead-version_active, " HEAD
res_short_text TYPE bapiscmb0006restext-res_short_text, " Text
finite_planning TYPE bapiscmb0006reshead-finite_planning, " HEAD
validdfrom(10) TYPE c, "type
BAPISCMB0006RESTMSHEAD2-VALIDDFROM, "TMS HEAD
validdto(10) TYPE c, "BAPISCMB0006RESTMSHEAD2-VALIDDTO, "TMS HEAD
validtfrom(8) TYPE c, " BAPISCMB0006RESTMSHEAD2-VALIDTFROM, "TMS HEAD
validtto(8) TYPE c, "
BAPISCMB0006RESTMSHEAD2-VALIDTTO, "TMS HEAD
ext_org_id TYPE bapiscmb0006restmshead2-ext_org_id, "TMS HEAD
ext_org_role TYPE
bapiscmb0006restmshead2-ext_org_role, "TMS HEAD
ownername TYPE
bapiscmb0006restmshead2-owner, "TMS HEAD
entitledname TYPE bapiscmb0006restmshead2-entitled, "TMS HEAD
inservicedate(10) TYPE c, " BAPISCMB0006RESTMSHEAD2-INSERVICEDATE, "TMS HEAD
platenumber TYPE bapiscmb0006restmshead2-platenumber, "TMS HEAD
platecountry TYPE bapiscmb0006restmshead2-platecountry, "TMS HEAD
minreqsealnr TYPE bapiscmb0006restmshead2-minreqseals, "TMS HEAD
END OF
ty_s_tvehicle.
TYPES: ty_t_resource_head TYPE ty_s_resource_head,
ty_t_resource_head_x TYPE ty_s_resource_head_x,
ty_t_resource_text TYPE ty_s_resource_text,
ty_t_resource_text_x TYPE ty_s_resource_text_x,
ty_t_resource_dim TYPE ty_s_resource_dim,
ty_t_resource_dim_x TYPE ty_s_resource_dim_x,
ty_t_resource_dimrq TYPE ty_s_resource_dimrq,
ty_t_resource_dimrq_x TYPE ty_s_resource_dimrq_x,
ty_t_resource_tms_head TYPE ty_s_resource_tms_head,
ty_t_resource_tms_head_x TYPE ty_s_resource_tms_head_x,
ty_t_resource_tms_alternid TYPE ty_s_resource_tms_alternid,
ty_t_resource_tms_alternid_x TYPE ty_s_resource_tms_alternid_x,
ty_t_resource_tms_attequ TYPE ty_s_resource_tms_attequ,
ty_t_resource_tms_attequ_x TYPE ty_s_resource_tms_attequ_x,
ty_t_tvehicle TYPE ty_s_tvehicle,
"ty_t_ET_RESOURCE_MAP type ty_s_ET_RESOURCE_MAP,
ty_t_return TYPE bapiret2.
DATA: t_resource_head TYPE STANDARD
TABLE OF ty_t_resource_head,
t_resource_head_x TYPE STANDARD TABLE
OF ty_t_resource_head_x,
t_resource_text TYPE STANDARD TABLE
OF ty_t_resource_text,
t_resource_text_x TYPE STANDARD TABLE
OF ty_t_resource_text_x,
t_resource_dim TYPE STANDARD TABLE
OF ty_t_resource_dim,
t_resource_dim_x TYPE STANDARD TABLE
OF ty_t_resource_dim_x,
t_resource_dimrq TYPE STANDARD TABLE
OF ty_t_resource_dimrq,
t_resource_dimrq_x TYPE STANDARD TABLE
OF ty_t_resource_dimrq_x,
t_resource_tms_head TYPE STANDARD TABLE
OF ty_t_resource_tms_head,
t_resource_tms_head_x TYPE STANDARD TABLE
OF ty_t_resource_tms_head_x,
t_resource_tms_alternid TYPE STANDARD TABLE
OF ty_t_resource_tms_alternid,
t_resource_tms_alternid_x TYPE STANDARD TABLE
OF
ty_t_resource_tms_alternid_x,
t_resource_tms_attequ TYPE STANDARD TABLE
OF ty_t_resource_tms_attequ,
t_resource_tms_attequ_x TYPE STANDARD TABLE
OF ty_t_resource_tms_attequ_x,
t_tvehicle TYPE STANDARD
TABLE OF ty_t_tvehicle,
"t_ET_RESOURCE_MAP type STANDARD TABLE OF
ty_t_ET_RESOURCE_MAP,
t_return TYPE STANDARD
TABLE OF ty_t_return.
DATA: wa_resource_head LIKE LINE
OF t_resource_head,
wa_resource_head_x LIKE LINE OF
t_resource_head_x,
wa_resource_text LIKE LINE OF
t_resource_text,
wa_resource_text_x LIKE LINE OF
t_resource_text_x,
wa_resource_dim LIKE LINE OF
t_resource_dim,
wa_resource_dim_x LIKE LINE OF
t_resource_dim_x,
wa_resource_dimrq LIKE LINE OF
t_resource_dimrq,
wa_resource_dimrq_x LIKE LINE OF
t_resource_dimrq_x,
wa_resource_tms_head LIKE LINE OF
t_resource_tms_head,
wa_resource_tms_head_x LIKE LINE OF
t_resource_tms_head_x,
wa_resource_tms_alternid LIKE LINE OF
t_resource_tms_alternid,
wa_resource_tms_alternid_x LIKE LINE OF
t_resource_tms_alternid_x,
wa_resource_tms_attequ LIKE LINE OF
t_resource_tms_attequ,
wa_resource_tms_attequ_x LIKE LINE OF
t_resource_tms_attequ_x,
wa_tvehicle LIKE LINE OF
t_tvehicle,
"wa_ET_RESOURCE_MAP like LINE OF t_ET_RESOURCE_MAP,
wa_return LIKE LINE
OF t_return.
DATA: l_file TYPE string,
oref TYPE REF
TO cx_root,
w_invalid TYPE c
VALUE ' '.
DATA: w_datedfrom(8) TYPE c,
w_datedto(8) TYPE
c,
w_datetfrom(6) TYPE
c,
w_datetto(6) TYPE
c,
" w_timetfrom(6) type c,
"w_timetto(6) type c,
w_inservicedate(8) TYPE c,
w_line_count TYPE i VALUE
0.
DATA: t_ttype LIKE STANDARD TABLE
OF /sapapo/trtype,
flag_date TYPE c
VALUE ' ',
flag_time TYPE c
VALUE ' ',
w_date_from TYPE sydatum,
w_date_to TYPE sydatum,
w_time_from TYPE syst-uzeit,
w_time_to TYPE syst-uzeit,
w_inservice_date TYPE sydatum.
DATA: c_restyp TYPE /sapapo/cres_resource_type VALUE '09',
c_rescat TYPE /sapapo/cres_restype
VALUE 'T'.
DATA: t_t006 LIKE STANDARD TABLE
OF t006.
DATA: w_loctype TYPE /sapapo/c_loctype.
DATA: w_dd(2) TYPE c,
w_mm(2) TYPE
c,
w_yyyy(4) TYPE
c,
w_hour(2) TYPE
c,
w_minute(2) TYPE
c,
w_second(2) TYPE
c.
DATA: p_commit TYPE
bapiscmb0006genfields-commit_control VALUE
'E'.
******* data declaration for
Explicit TMS data update ******
DATA: restyp TYPE /scmb/tmsrestype VALUE '09',
w_resuid TYPE /sapapo/res_head-resuid,
w_tempdate(14) TYPE c, "in char format
w_validfrom TYPE tzntstmps, " in date format
w_validto TYPE tzntstmps,
" in date format
w_guid TYPE /scmb/de_guid,
t_tms_head_modify TYPE STANDARD TABLE
OF /scmb/restmshd,
wa_tms_head_modify LIKE
LINE OF t_tms_head_modify,
w_objid TYPE hrobjid.
*&---------------------------------------------------------------------*
* selection screen
*&---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK
b1 WITH FRAME TITLE text-001.
PARAMETERS : p_tveh TYPE localfile DEFAULT 'O:.txt' OBLIGATORY,
p_logsys TYPE logsys DEFAULT 'F6PCLNT100',
"OBLIGATORY,
"p_commit type BAPI11201COMMCTRL DEFAULT 'E', " use
SPACE if dont want to commit
p_dsep TYPE c DEFAULT
'/'OBLIGATORY,
p_tsep TYPE c DEFAULT
':' OBLIGATORY,
p_extcom TYPE c DEFAULT
' '. " 2. External commit
"" p_appl type
BAPISCMB0006GENFIELDS-APPLICATION DEFAULT 'B'.
SELECTION-SCREEN END OF BLOCK
b1.
SELECTION-SCREEN BEGIN OF BLOCK
b2 WITH FRAME TITLE text-002.
PARAMETERS: p_tms TYPE c AS CHECKBOX DEFAULT '
'.
SELECTION-SCREEN END OF BLOCK
b2.
SELECTION-SCREEN BEGIN OF BLOCK
b3 WITH FRAME TITLE text-003.
PARAMETERS: p_test TYPE c AS CHECKBOX DEFAULT 'X',
p_proc_i TYPE c AS CHECKBOX DEFAULT '
'. " if checked means process all record, else process only
valid record.
SELECTION-SCREEN END OF BLOCK
b3.
*&---------------------------------------------------------------------*
* At selection-screen on
value-request
*&---------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST
FOR p_tveh.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
program_name = syst-repid
dynpro_number = syst-dynnr
field_name = 'P_TVEH'
CHANGING
file_name = p_tveh.
*&---------------------------------------------------------------------*
* start-of-selection
*&---------------------------------------------------------------------*
START-OF-SELECTION.
l_file = p_tveh.
TRY .
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_file
filetype = 'ASC'
has_field_separator =
cl_abap_char_utilities=>horizontal_tab
" 'X'
TABLES
data_tab = t_tvehicle[].
CATCH cx_sy_dyn_call_illegal_type
INTO oref.
WRITE😕 'Exception:
can not read Vehicle resource file'.
CATCH cx_root INTO
oref.
WRITE😕 'Vehicle
Resource Exception.'.
ENDTRY.
* fill the values from file data
to BAPI input int tables
WRITE😕 'Ouput Error
Log : '.
ULINE.
WRITE:/1 'File
Index', 11 '|', 12 'Msg Type',20 '|', 21
'MESSAGE'.
ULINE.
LOOP AT
t_tvehicle INTO wa_tvehicle.
CLEAR w_invalid.
PERFORM clear_all.
w_line_count = sy-tabix.
PERFORM date_format_spliter USING wa_tvehicle-validdfrom
CHANGING w_datedfrom.
PERFORM date_format_spliter USING wa_tvehicle-validdto
CHANGING w_datedto.
PERFORM time_format_splitter USING wa_tvehicle-validtfrom
CHANGING w_datetfrom.
PERFORM time_format_splitter USING wa_tvehicle-validtto
CHANGING w_datetto.
PERFORM date_format_spliter USING wa_tvehicle-inservicedate
CHANGING w_inservicedate.
TRANSLATE wa_tvehicle-ownername TO UPPER
CASE.
TRANSLATE wa_tvehicle-entitledname TO UPPER
CASE.
TRANSLATE wa_tvehicle-platecountry TO UPPER
CASE.
TRANSLATE wa_tvehicle-org_id TO UPPER CASE.
**Validations :-
"1 check for Resource type and Resource category.
TRANSLATE wa_tvehicle-resourcecat TO UPPER
CASE.
IF wa_tvehicle-resourcetype NE c_restyp .
WRITE:/1 w_line_count,11
'|',12 'E',20 '|',21
' Invalid resource type : ',
wa_tvehicle-resourcetype.
"CLEAR: wa_tvehicle.
"CONTINUE.
w_invalid = 'X'.
ENDIF.
IF wa_tvehicle-resourcecat NE c_rescat.
WRITE:/1 w_line_count,11
'|',12 'E',20 '|',21
' Invalid resource category :',wa_tvehicle-resourcecat.
"CLEAR: wa_tvehicle.
"CONTINUE.
w_invalid = 'X'.
ENDIF.
"2 Check for Non empty Resource.
TRANSLATE wa_tvehicle-resource TO UPPER
CASE.
IF wa_tvehicle-resource IS
INITIAL.
WRITE:/1 w_line_count,11
'|',12 'E',20 '|',21
'Enter value for Resource,
Resource must be non empty '.
"CLEAR wa_tvehicle.
"CONTINUE.
w_invalid = 'X'.
ENDIF.
"3 Factcal should not be empty.
TRANSLATE wa_tvehicle-factcal TO UPPER CASE.
IF wa_tvehicle-factcal IS
INITIAL.
WRITE:/1 w_line_count,11
'|',12 'E',20 '|',21
'Enter Factory calender for
resource num : ',wa_tvehicle-resource.
"CLEAR wa_tvehicle.
"CONTINUE.
w_invalid = 'X'.
ENDIF.
" 4.** If both the dimention is empty raise error.
TRANSLATE wa_tvehicle-dimension TO UPPER
CASE.
TRANSLATE wa_tvehicle-dim_vol TO UPPER CASE.
TRANSLATE wa_tvehicle-unit
TO UPPER CASE.
TRANSLATE wa_tvehicle-unit_vol TO UPPER
CASE.
IF wa_tvehicle-dimension EQ
space AND wa_tvehicle-dim_vol EQ space .
WRITE:/1 w_line_count,11
'|',12 'E',20 '|',21
'Both the Dimentions are empty,',
' Provide atleast one Dimension for resource num : ',wa_tvehicle-resource.
w_invalid = 'X'.
ELSEIF wa_tvehicle-dimension NE space.
"[a] Check if UNIT is empty it should not be empty if
dimention is there..
IF wa_tvehicle-unit
IS INITIAL.
WRITE:/1 w_line_count,11 '|',12 'E',20
'|',21 'Unit
is Empty for resource num : ',wa_tvehicle-resource.
w_invalid = 'X'.
ENDIF.
"[b] capacity should not be empty if dimention present
IF wa_tvehicle-capacity IS
INITIAL.
WRITE:/1 w_line_count,11 '|',12 'E',20
'|',21 'Capacity
is Empty for resource num : ',wa_tvehicle-resource.
w_invalid = 'X'.
ENDIF.
"[c] Dimention and unit should present in table T006 for
same row.
IF NOT
wa_tvehicle-dimension IS INITIAL AND NOT
wa_tvehicle-unit IS INITIAL.
SELECT msehi dimid
FROM t006
INTO CORRESPONDING FIELDS OF TABLE t_t006
WHERE msehi = wa_tvehicle-unit AND
dimid =
wa_tvehicle-dimension.
IF t_t006[] IS
INITIAL.
WRITE:/1 w_line_count,11 '|',12 'E',20
'|',21 '
Unit and Dimension combination not correct, check T006 table,Dim:',
wa_tvehicle-dimension ,' UNIT :', wa_tvehicle-unit, ' Res: ',wa_tvehicle-resource.
CLEAR: t_t006.
w_invalid = 'X'.
ENDIF.
REFRESH t_t006.
ENDIF.
ELSEIF wa_tvehicle-dim_vol NE space.
"[a] Check if UNIT is empty it should not be empty if
dimention is there..
IF wa_tvehicle-unit_vol IS
INITIAL.
WRITE:/1 w_line_count,11 '|',12 'E',20
'|',21 '
Second Unit is Empty for resource num : ',wa_tvehicle-resource.
w_invalid = 'X'.
ENDIF.
"[b] capacity should not be empty if dimention present
IF wa_tvehicle-cap_vol IS
INITIAL.
WRITE:/1 w_line_count,11 '|',12 'E',20
'|',21 '
Second Capacity is Empty for resource num : ',wa_tvehicle-resource.
w_invalid = 'X'.
ENDIF.
"[c] Dimention and unit should present in table T006 for
same row.
IF NOT
wa_tvehicle-dim_vol IS INITIAL AND NOT
wa_tvehicle-unit_vol IS INITIAL.
SELECT msehi dimid
FROM t006
INTO CORRESPONDING FIELDS OF TABLE t_t006
WHERE msehi = wa_tvehicle-unit_vol AND
dimid =
wa_tvehicle-dim_vol.
IF t_t006[] IS
INITIAL.
WRITE:/1 w_line_count,11 '|',12 'E',20
'|',21 'Second Unit and Dimension combination not correct,
check T006 table,Dim:',
wa_tvehicle-dim_vol ,'
UNIT:', wa_tvehicle-unit_vol , ' Res: ',wa_tvehicle-resource.
CLEAR: t_t006.
w_invalid = 'X'.
ENDIF.
REFRESH t_t006.
ENDIF.
ENDIF.
"6 Location check if available.
TRANSLATE
wa_tvehicle-location TO
UPPER CASE.
IF NOT
wa_tvehicle-location IS INITIAL.
SELECT loctype FROM
/sapapo/loc
INTO w_loctype
WHERE locno = wa_tvehicle-location.
ENDSELECT.
"IF w_loctype IS INITIAL.
IF sy-subrc NE 0.
WRITE:/1 w_line_count,11 '|',12 'E',20
'|',21 '
Invalid/empty Location : ', wa_tvehicle-location..
"CLEAR: wa_tvehicle.
" CLEAR: w_loctype.
" Never clear it here else BAPI will give error message 'Location
not found'
"CONTINUE.
w_invalid = 'X'.
ENDIF.
ENDIF.
"7 Mean of trans cheking mandatarily :
TRANSLATE wa_tvehicle-means_of_trp TO UPPER
CASE.
SELECT ttype FROM
/sapapo/trtype
INTO CORRESPONDING FIELDS
OF TABLE t_ttype
WHERE
ttype = wa_tvehicle-means_of_trp.
IF t_ttype[] IS INITIAL.
WRITE:/1 w_line_count,11
'|',12 'E',20 '|',21
'Invalid or empty Means of trans :
',wa_tvehicle-means_of_trp.
"CLEAR wa_tvehicle.
REFRESH t_ttype.
"CONTINUE.
w_invalid = 'X'.
ENDIF.
"8 Date validation:
PERFORM validate_date USING
w_datedfrom " in char format
w_date_from. " in date fromat
IF sy-subrc NE 0.
WRITE:/1 w_line_count,11
'|',12 'E',20 '|',21
' Invalid Valid from date : ',
wa_tvehicle-validdfrom.
flag_date = 'X'.
w_invalid = 'X'.
ENDIF.
PERFORM validate_date USING
w_datedto " in char format
w_date_to. " in date fromat
IF sy-subrc NE 0.
WRITE:/1 w_line_count,11
'|',12 'E',20 '|',21
' Invalid Valid to date : ',
wa_tvehicle-validdto.
flag_date = 'X'.
w_invalid = 'X'.
ENDIF.
IF flag_date EQ 'X'.
"CLEAR: wa_tvehicle.
CLEAR: w_date_from,w_date_to.
flag_date = ' '.
"CONTINUE.
ENDIF.
"9 time validation
PERFORM validate_time USING
w_datetfrom " in car format
w_time_from. " in time format
IF sy-subrc NE 0.
WRITE:/1 w_line_count,11
'|',12 'E',20 '|',21
' Invalid Valid from time : ',
wa_tvehicle-validtfrom.
flag_time = 'X'.
w_invalid = 'X'.
ENDIF.
PERFORM validate_time USING
w_datetto
w_time_to.
IF sy-subrc NE 0.
WRITE:/1 w_line_count,11
'|',12 'E',20 '|',21
' Invalid Valid to time : ',
wa_tvehicle-validtto.
flag_time = 'X'.
w_invalid = 'X'.
ENDIF.
IF flag_time EQ 'X'.
" CLEAR: wa_tvehicle.
CLEAR: w_time_from,w_time_to.
flag_date = ' '.
"CONTINUE.
ENDIF.
"10 validate both Inservice date .
PERFORM validate_date USING
w_inservicedate " in char format
w_inservice_date. " in date fromat
IF sy-subrc NE 0.
WRITE:/1 w_line_count,11
'|',12 'E',20 '|',21
' Invalid Valid Inservice date : ',
wa_tvehicle-inservicedate.
flag_date = 'X'.
w_invalid = 'X'.
ENDIF.
IF flag_date EQ 'X'.
"CLEAR: wa_tvehicle.
CLEAR:w_inservice_date.
flag_date = ' '.
"CONTINUE.
ENDIF.
"11 validate Ext org id if provided.
TRANSLATE wa_tvehicle-ext_org_id TO UPPER
CASE.
IF wa_tvehicle-ext_org_id NE ''.
"Get objid (i.e ORGCENTRE) from table /SCMB/HRP5561 for
external organisation id and role.
SELECT objid FROM
/scmb/hrp5561 INTO w_objid WHERE external_id =
wa_tvehicle-ext_org_id.
"otype = wa_tvehicle-EXT_ORG_ROLE.
ENDSELECT.
IF sy-subrc NE 0. " show error
WRITE:/1 w_line_count,11 '|',12 'E',20
'|',21 '
Invalid external org ID : ', wa_tvehicle-ext_org_id.
"CLEAR: wa_tvehicle,
"CLEAR: w_objid.
" Dont clear it here it is used further.
"CONTINUE.
w_invalid = 'X'.
ENDIF.
ENDIF.
** types: begin of ty_del.
** include structure /sapapo/res_head.
** types : end of ty_del.
**
data: t_del type STANDARD TABLE OF ty_del,
** wa_del type ty_del.
**
**
** IF p_del = 'X'.
**
** LOOP AT t_tvehicle into wa_tvehicle.
** select * from sapapo/res_head into wa_
** ENDLOOP.
** delete from /sapapo/res_head where
**
** ENDIF.
IF p_test NE 'X'. " used for checking all validation in input file prior
to insertion into Database.
PERFORM fill_resource_head.
PERFORM fill_resource_head_x.
PERFORM
fill_resource_text.
PERFORM fill_resource_text_x.
PERFORM fill_resource_dim.
PERFORM fill_resource_dim_x.
PERFORM fill_resource_dimrq.
PERFORM fill_resource_dimrq_x.
PERFORM fill_resource_tms_head.
PERFORM fill_resource_tms_head_x.
PERFORM fill_resource_tms_alternid.
PERFORM fill_resource_tms_alternid_x.
PERFORM fill_resource_tms_attequ.
PERFORM fill_resource_tms_attequ_x.
TRY.
IF p_proc_i EQ
'X'. " process all record whether invalid or valid.
PERFORM call_bapi. " Call BAPI here, it helps to trace
error line if error occurs.
ELSEIF w_invalid = 'X'. "
check whether record is invalid or not.
CLEAR w_invalid.
" If record is invalid
, don't process it.
CONTINUE.
ELSE.
" If record is valid
process it.
PERFORM call_bapi.
ENDIF.
CATCH cx_root INTO
oref .
WRITE😕'
Exception is some record(old value issue) line number :',w_line_count.
ENDTRY.
******* Separate commity control
logic (However for this Object BAPI is taking care)*****
IF p_extcom = 'X'. "
external commit required ??
COMMIT WORK
AND WAIT.
CALL FUNCTION
'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
* IMPORTING
*
RETURN =
.
ENDIF.
*********************************************
ENDIF.
CLEAR wa_tvehicle.
* clear: w_invalid,
* w_datedfrom,
* w_datedto,
* w_datetfrom,
* w_datetto,
* w_loctype,
* w_objid.
* REFRESH: t_ttype,
* t_t006.
** CLEAR: wa_resource_head,
** wa_resource_head_x,
** wa_resource_text,
** wa_resource_text_x,
** wa_resource_dim,
** wa_resource_dim_x,
** wa_resource_dimrq,
** wa_resource_dimrq_x,
** wa_resource_tms_head,
** wa_resource_tms_head_x,
** wa_resource_tms_alternid,
** wa_resource_tms_alternid_x,
** wa_resource_tms_attequ,
** wa_resource_tms_attequ_x,
** wa_return.
** REFRESH: t_resource_head,
** t_resource_head_x,
** t_resource_text,
** t_resource_text_x,
** t_resource_dim,
** t_resource_dim_x,
** t_resource_dimrq,
** t_resource_dimrq_x,
** t_resource_tms_head,
** t_resource_tms_head_x,
** t_resource_tms_alternid,
** t_resource_tms_alternid_x,
** t_resource_tms_attequ,
** t_resource_tms_attequ_x,
** t_return.
ENDLOOP.
*&---------------------------------------------------------------------*
*& Form
FILL_RESOURCE_HEAD
*&---------------------------------------------------------------------*
FORM fill_resource_head .
*RESUID
wa_resource_head-resource =
wa_tvehicle-resource.
wa_resource_head-restype =
wa_tvehicle-resourcecat.
wa_resource_head-location =
wa_tvehicle-location.
wa_resource_head-loctype = w_loctype. "
will not be in input file
wa_resource_head-calendar =
wa_tvehicle-factcal.
wa_resource_head-type =
wa_tvehicle-resourcetype.
wa_resource_head-dimension =
wa_tvehicle-dimension.
wa_resource_head-noindivres =
wa_tvehicle-capacity.
TRANSLATE wa_tvehicle-unit
TO UPPER CASE.
wa_resource_head-noindivres_unit = wa_tvehicle-unit.
wa_resource_head-version_active = wa_tvehicle-actvariant.
wa_resource_head-finite_planning =
wa_tvehicle-finite_planning.
wa_resource_head-timezone =
wa_tvehicle-time_zone.
wa_resource_head-traty =
wa_tvehicle-means_of_trp.
APPEND wa_resource_head TO
t_resource_head.
ENDFORM. " FILL_RESOURCE_HEAD
*&---------------------------------------------------------------------*
*& Form
FILL_RESOURCE_HEAD_X
*&---------------------------------------------------------------------*
FORM fill_resource_head_x .
*RESUID
IF wa_resource_head-resource IS NOT INITIAL.
wa_resource_head_x-resource =
wa_tvehicle-resource.
ENDIF.
IF wa_resource_head-restype IS NOT INITIAL.
wa_resource_head_x-restype = 'X'.
ENDIF.
IF wa_resource_head-location IS NOT INITIAL.
wa_resource_head_x-location = 'X'.
ENDIF.
IF wa_resource_head-loctype IS NOT INITIAL.
wa_resource_head_x-loctype = 'X'. " not in input file
ENDIF.
IF wa_resource_head-calendar
IS NOT INITIAL.
wa_resource_head_x-calendar = 'X'.
ENDIF.
IF wa_resource_head-type
IS NOT INITIAL.
wa_resource_head_x-type = 'X'.
ENDIF.
IF wa_resource_head-dimension IS NOT INITIAL.
wa_resource_head_x-dimension = 'X'.
ENDIF.
IF wa_resource_head-noindivres IS NOT
INITIAL.
wa_resource_head_x-noindivres = 'X'.
ENDIF.
IF wa_resource_head-noindivres_unit IS NOT
INITIAL.
wa_resource_head_x-noindivres_unit = 'X'.
ENDIF.
IF wa_resource_head-version_active IS NOT
INITIAL.
wa_resource_head_x-version_active = 'X'.
ENDIF.
IF wa_resource_head-finite_planning IS NOT
INITIAL.
wa_resource_head_x-finite_planning = 'X'.
ENDIF.
IF wa_resource_head-traty IS NOT INITIAL.
wa_resource_head_x-traty = 'X'.
ENDIF.
APPEND wa_resource_head_x TO t_resource_head_x.
ENDFORM. " FILL_RESOURCE_HEAD_X
*&---------------------------------------------------------------------*
*& Form
FILL_RESOURCE_TEXT
*&---------------------------------------------------------------------*
FORM fill_resource_text .
*RESUID
wa_resource_text-resource =
wa_tvehicle-resource.
wa_resource_text-langu = sy-langu.
*LANGU_ISO
wa_resource_text-res_short_text =
wa_tvehicle-res_short_text.
APPEND wa_resource_text TO
t_resource_text.
ENDFORM. " FILL_RESOURCE_TEXT
*&---------------------------------------------------------------------*
*& Form
FILL_RESOURCE_TEXT_X
*&---------------------------------------------------------------------*
FORM fill_resource_text_x .
*RESUID
IF wa_resource_text-resource IS NOT INITIAL.
wa_resource_text_x-resource = wa_tvehicle-resource.
ENDIF.
IF wa_resource_text-res_short_text IS NOT
INITIAL.
wa_resource_text_x-langu = sy-langu.
*LANGU_ISO
wa_resource_text_x-res_short_text = 'X'.
ENDIF.
APPEND wa_resource_text_x TO t_resource_text_x.
ENDFORM. " FILL_RESOURCE_TEXT_X
*&---------------------------------------------------------------------*
*& Form
FILL_RESOURCE_DIM
*&---------------------------------------------------------------------*
FORM fill_resource_dim .
IF wa_tvehicle-dimension NE
space AND wa_tvehicle-unit NE space AND
wa_tvehicle-capacity NE space
. " temporary code added.
wa_resource_dim-resource = wa_tvehicle-resource.
wa_resource_dim-dimension =
wa_tvehicle-dimension.
wa_resource_dim-noindivres_unit = wa_tvehicle-unit.
wa_resource_dim-noindivres =
wa_tvehicle-capacity.
APPEND wa_resource_dim TO
t_resource_dim.
ENDIF.
*Begin of I-709402
IF wa_tvehicle-dim_vol NE
space AND wa_tvehicle-unit_vol
NE space AND wa_tvehicle-cap_vol NE space .
wa_resource_dim-resource =
wa_tvehicle-resource.
wa_resource_dim-dimension =
wa_tvehicle-dim_vol.
wa_resource_dim-noindivres_unit = wa_tvehicle-unit_vol.
wa_resource_dim-noindivres =
wa_tvehicle-cap_vol.
APPEND wa_resource_dim TO
t_resource_dim.
ENDIF.
*end of I-709402
ENDFORM. " FILL_RESOURCE_DIM
*&---------------------------------------------------------------------*
*& Form
FILL_RESOURCE_DIM_X
*&---------------------------------------------------------------------*
FORM fill_resource_dim_x .
wa_resource_dim_x-resource = wa_tvehicle-resource.
wa_resource_dim_x-dimension = wa_tvehicle-dimension.
wa_resource_dim_x-noindivres_unit = 'X'.
wa_resource_dim_x-noindivres = 'X'.
APPEND wa_resource_dim_x TO
t_resource_dim_x.
*Begin of I-709402
IF wa_tvehicle-dim_vol NE
space AND wa_tvehicle-unit_vol
NE space AND wa_tvehicle-cap_vol NE space .
wa_resource_dim_x-resource = wa_tvehicle-resource.
wa_resource_dim_x-dimension = wa_tvehicle-dim_vol.
wa_resource_dim_x-noindivres_unit = 'X'.
wa_resource_dim_x-noindivres = 'X'.
APPEND wa_resource_dim_x TO
t_resource_dim_x.
ENDIF.
*end of I-709402
ENDFORM. " FILL_RESOURCE_DIM_X
*&---------------------------------------------------------------------*
*& Form
FILL_RESOURCE_DIMRQ
*&---------------------------------------------------------------------*
FORM fill_resource_dimrq .
wa_resource_dimrq-resource = wa_tvehicle-resource.
wa_resource_dimrq-dimension = wa_tvehicle-dimension.
wa_resource_dimrq-noindivres_unit = wa_tvehicle-unit.
wa_resource_dimrq-noindivres = wa_tvehicle-capacity.
APPEND wa_resource_dimrq TO
t_resource_dimrq.
ENDFORM. " FILL_RESOURCE_DIMRQ
*&---------------------------------------------------------------------*
*& Form
FILL_RESOURCE_DIMRQ_X
*&---------------------------------------------------------------------*
FORM fill_resource_dimrq_x .
wa_resource_dimrq_x-resource = wa_tvehicle-resource.
wa_resource_dimrq_x-dimension = wa_tvehicle-dimension.
wa_resource_dimrq_x-noindivres_unit = wa_tvehicle-unit.
wa_resource_dimrq_x-noindivres = 'X'.
APPEND wa_resource_dimrq_x TO t_resource_dimrq_x.
ENDFORM. " FILL_RESOURCE_DIMRQ_X
*&---------------------------------------------------------------------*
*& Form
FILL_RESOURCE_TMS_HEAD
*&---------------------------------------------------------------------*
FORM fill_resource_tms_head .
wa_resource_tms_head-resource = wa_tvehicle-resource.
wa_resource_tms_head-validdfrom = w_datedfrom.
wa_resource_tms_head-validtfrom = w_datetfrom.
wa_resource_tms_head-validdto = w_datedto.
wa_resource_tms_head-validtto = w_datetto.
wa_resource_tms_head-inservicedate = wa_tvehicle-inservicedate.
wa_resource_tms_head-owner = wa_tvehicle-ownername.
wa_resource_tms_head-entitled = wa_tvehicle-entitledname.
wa_resource_tms_head-platenumber = wa_tvehicle-platenumber.
wa_resource_tms_head-platecountry = wa_tvehicle-platecountry.
wa_resource_tms_head-minreqseals = wa_tvehicle-minreqsealnr.
wa_resource_tms_head-ext_org_id = wa_tvehicle-ext_org_id.
wa_resource_tms_head-ext_org_role = wa_tvehicle-ext_org_role.
APPEND wa_resource_tms_head TO t_resource_tms_head.
ENDFORM. " FILL_RESOURCE_TMS_HEAD
*&---------------------------------------------------------------------*
*& Form
FILL_RESOURCE_TMS_HEAD_X
*&---------------------------------------------------------------------*
FORM fill_resource_tms_head_x
.
wa_resource_tms_head_x-resource = wa_tvehicle-resource.
wa_resource_tms_head_x-validdfrom = 'X'.
wa_resource_tms_head_x-validtfrom = 'X'.
wa_resource_tms_head_x-validdto = 'X'.
wa_resource_tms_head_x-validtto = 'X'.
IF NOT
wa_resource_tms_head-inservicedate IS
INITIAL.
wa_resource_tms_head_x-inservicedate = 'X'.
ENDIF.
IF NOT
wa_resource_tms_head-owner IS INITIAL.
wa_resource_tms_head_x-owner = 'X'.
ENDIF.
IF NOT
wa_resource_tms_head-entitled IS
INITIAL.
wa_resource_tms_head_x-entitled = 'X'.
ENDIF.
IF NOT
wa_resource_tms_head-platenumber IS
INITIAL.
wa_resource_tms_head_x-platenumber = 'X'.
ENDIF.
IF NOT
wa_resource_tms_head-platecountry IS
INITIAL.
wa_resource_tms_head_x-platecountry = 'X'.
ENDIF.
IF NOT
wa_resource_tms_head-minreqseals IS
INITIAL.
wa_resource_tms_head_x-minreqseals = 'X'.
ENDIF.
IF NOT
wa_resource_tms_head-ext_org_id IS
INITIAL.
wa_resource_tms_head_x-ext_org_id = 'X'.
ENDIF.
IF NOT
wa_resource_tms_head-ext_org_role IS INITIAL.
wa_resource_tms_head_x-ext_org_role = 'X'.
ENDIF.
APPEND wa_resource_tms_head_x TO t_resource_tms_head_x.
ENDFORM. " FILL_RESOURCE_TMS_HEAD_X
*&---------------------------------------------------------------------*
*& Form
FILL_RESOURCE_TMS_ALTERNID
*&---------------------------------------------------------------------*
FORM
fill_resource_tms_alternid .
wa_resource_tms_alternid-resource = wa_tvehicle-resource.
APPEND wa_resource_tms_alternid TO t_resource_tms_alternid.
ENDFORM. " FILL_RESOURCE_TMS_ALTERNID
*&---------------------------------------------------------------------*
*& Form
FILL_RESOURCE_TMS_ALTERNID_X
*&---------------------------------------------------------------------*
FORM
fill_resource_tms_alternid_x .
wa_resource_tms_alternid_x-resource = wa_tvehicle-resource.
APPEND wa_resource_tms_alternid_x TO t_resource_tms_alternid_x.
ENDFORM. " FILL_RESOURCE_TMS_ALTERNID_X
*&---------------------------------------------------------------------*
*& Form
FILL_RESOURCE_TMS_ATTEQU
*&---------------------------------------------------------------------*
FORM fill_resource_tms_attequ
.
wa_resource_tms_attequ-resource = wa_tvehicle-resource.
APPEND wa_resource_tms_attequ TO t_resource_tms_attequ.
ENDFORM. " FILL_RESOURCE_TMS_ATTEQU
*&---------------------------------------------------------------------*
*& Form
FILL_RESOURCE_TMS_ATTEQU_X
*&---------------------------------------------------------------------*
FORM
fill_resource_tms_attequ_x .
wa_resource_tms_attequ_x-resource = wa_tvehicle-resource.
APPEND wa_resource_tms_attequ_x TO t_resource_tms_attequ_x.
ENDFORM. " FILL_RESOURCE_TMS_ATTEQU_X
*&---------------------------------------------------------------------*
*& Form
CALL_BAPI
*&---------------------------------------------------------------------*
FORM call_bapi .
TRY.
CALL FUNCTION 'BAPI_RSSRVSCMB_SAVEMULTI2'
EXPORTING "APPLICATION = p_appl
logical_system = p_logsys
commit_control = p_commit "'E'
TABLES
resource_head = t_resource_head
resource_head_x = t_resource_head_x
resource_text = t_resource_text
resource_text_x = t_resource_text_x
resource_dim = t_resource_dim
resource_dim_x = t_resource_dim_x
resource_dimrq = t_resource_dimrq
resource_dimrq_x = t_resource_dimrq_x
resource_tms_head = t_resource_tms_head[]
resource_tms_head_x = t_resource_tms_head_x[]
resource_tms_alternid = t_resource_tms_alternid
resource_tms_alternid_x =
t_resource_tms_alternid_x
resource_tms_attequ = t_resource_tms_attequ
resource_tms_attequ_x = t_resource_tms_attequ_x
"ET_RESOURCE_MAP = t_ET_RESOURCE_MAP
return
= t_return.
* Display Error if any.
LOOP AT t_return
INTO wa_return.
IF wa_return-type
NE 'I' AND
wa_return-type NE 'W' .
IF sy-tabix EQ
1.
WRITE:/1 w_line_count, 11 '|',
12 wa_return-type, 20 '|', 21
wa_return-message, 105 '(STD MSG)'. " ' Resource :', 120 wa_tvehicle-resource.
ELSE.
WRITE:/1 w_line_count, 11 '|',
12 wa_return-type, 20 '|',
21 wa_return-message, 105 '(STD
MSG)'. "' Resource :',
120 wa_tvehicle-resource.
ENDIF.
ENDIF.
CLEAR wa_return.
ENDLOOP.
REFRESH t_return.
CATCH cx_root INTO
oref.
WRITE😕 ' !!Can not create Vehicle resource for
resource :-', wa_resource_head-resource.
ENDTRY.
" Additional code to update Header info :
IF wa_return-type
NE 'I' AND
wa_return-type NE 'W' AND
p_tms EQ 'X'. "
if success.
PERFORM save_header_expl.
ENDIF.
ENDFORM. " CALL_BAPI
*&---------------------------------------------------------------------*
*& Form
DATE_FORMAT_SPLITER
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_WA_TVEHICLE_VALIDDFROM text
* <--P_W_DATEDFROM text
*----------------------------------------------------------------------*
FORM date_format_spliter USING p_wa_tvehicle_validdfrom
CHANGING p_w_datedfrom.
IF NOT
p_wa_tvehicle_validdfrom IS INITIAL.
SPLIT p_wa_tvehicle_validdfrom AT p_dsep INTO
w_mm w_dd w_yyyy.
IF strlen( w_mm
) NE 2.
CONCATENATE '0'
w_mm INTO w_mm.
ENDIF.
IF strlen( w_dd
) NE 2.
CONCATENATE '0'
w_dd INTO w_dd.
ENDIF.
p_w_datedfrom+0(4)
= w_yyyy.
p_w_datedfrom+4(2)
= w_mm.
p_w_datedfrom+6(2)
= w_dd.
ELSE.
CLEAR p_w_datedfrom.
ENDIF.
ENDFORM. " DATE_FORMAT_SPLITER
*&---------------------------------------------------------------------*
*& Form
TIME_FORMAT_SPLITTER
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_WA_TVEHICLE_VALIDTFROM text
* <--P_W_DATETFROM text
*----------------------------------------------------------------------*
FORM time_format_splitter USING p_wa_tvehicle_validtfrom
CHANGING p_w_datetfrom.
IF NOT
p_wa_tvehicle_validtfrom IS INITIAL.
SPLIT p_wa_tvehicle_validtfrom AT p_tsep INTO
w_hour w_minute w_second.
IF strlen(
w_hour ) NE 2.
CONCATENATE '0'
w_hour INTO w_hour.
ENDIF.
IF strlen(
w_minute ) NE 2.
CONCATENATE '0'
w_minute INTO w_minute.
ENDIF.
IF strlen(
w_second ) NE 2.
CONCATENATE '0'
w_second INTO w_second.
ENDIF.
p_w_datetfrom+0(2)
= w_hour.
p_w_datetfrom+2(2)
= w_minute.
p_w_datetfrom+4(2)
= w_second.
ELSE.
CLEAR p_w_datetfrom.
ENDIF.
ENDFORM. " TIME_FORMAT_SPLITTER
*&---------------------------------------------------------------------*
*& Form
VALIDATE_DATE
*&---------------------------------------------------------------------*
FORM validate_date USING p_w_datedfrom "
in char format
p_w_date_from. " in date format
sy-subrc = 0.
IF NOT
p_w_datedfrom IS INITIAL.
p_w_date_from = p_w_datedfrom.
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
date = p_w_date_from
EXCEPTIONS
plausibility_check_failed = 1
OTHERS
= 2.
ENDIF.
ENDFORM. " VALIDATE_DATE
*&---------------------------------------------------------------------*
*& Form
VALIDATE_TIME
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_W_DATETFROM text
* -->P_W_TIME_FROM text
*----------------------------------------------------------------------*
FORM validate_time USING p_w_datetfrom "
in char format
p_w_time_from. " in time format
sy-subrc = 0.
IF NOT
p_w_datetfrom IS INITIAL.
p_w_time_from =
p_w_datetfrom.
CALL FUNCTION 'TIME_CHECK_PLAUSIBILITY'
EXPORTING
time = p_w_time_from
EXCEPTIONS
plausibility_check_failed = 1
OTHERS = 2.
ENDIF.
ENDFORM. " VALIDATE_TIME
*&---------------------------------------------------------------------*
*& Form
SAVE_HEADER_EXPL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
*
--> p1 text
*
<-- p2 text
*----------------------------------------------------------------------*
FORM save_header_expl .
*1 *** Read key from table
/SAPAPO/RES_HEAD or /SAPAPO/RESKEY****
SELECT resuid FROM
/sapapo/res_head
INTO w_resuid
WHERE name = wa_tvehicle-resource.
ENDSELECT.
*2 *** Adjust date format
CONCATENATE w_datedfrom w_datetfrom INTO w_tempdate.
w_validfrom = w_tempdate. "
trandfer into correct format.
CONCATENATE w_datedto w_datetto INTO w_tempdate.
w_validto = w_tempdate. "
trandfer into correct format.
*3 *** Get the resid generated for
vehicle resource by BAPI.(16 digit GUID craetion)
SELECT tmsresuid FROM
/scmb/restmshd INTO w_guid WHERE resid = w_resuid. " check if already created
ENDSELECT.
IF sy-subrc NE 0.
w_guid = /sctm/cl_guid_convert=>get_guid_x16(
). " else create separately.
ENDIF.
*4 *** Get objid (i.e ORGCENTRE)
from table /SCMB/HRP5561 for external organisation id and role.
"already fetched in validation block
*5
Fill int table.
wa_tms_head_modify-resid =
w_resuid.
wa_tms_head_modify-name =
wa_tvehicle-resource. "wa_RESOURCE_TMS_HEAD-RESOURCE .
wa_tms_head_modify-restype =
restyp.
wa_tms_head_modify-tmsresuid =
w_guid.
wa_tms_head_modify-valid_from =
w_validfrom. "'20111013000000'.
"wa_RESOURCE_TMS_HEAD-VALIDDFROM.
wa_tms_head_modify-valid_to =
w_validto. "'20111013235959' .
"wa_RESOURCE_TMS_HEAD-VALIDDTO .
wa_tms_head_modify-inservicedate = w_inservicedate. "wa_RESOURCE_TMS_HEAD-INSERVICEDATE . " NEED DATE VALIDATION
wa_tms_head_modify-owner =
wa_tvehicle-ownername. "wa_RESOURCE_TMS_HEAD-OWNER
.
wa_tms_head_modify-entitled =
wa_tvehicle-entitledname. "wa_RESOURCE_TMS_HEAD-ENTITLED
.
wa_tms_head_modify-platenumber =
wa_tvehicle-platenumber. "wa_RESOURCE_TMS_HEAD-PLATENUMBER .
wa_tms_head_modify-platecountry =
wa_tvehicle-platecountry. "wa_RESOURCE_TMS_HEAD-PLATECOUNTRY .
wa_tms_head_modify-minreqseals =
wa_tvehicle-minreqsealnr.
wa_tms_head_modify-orgcentre =
w_objid. ""wa_tvehicle-EXT_ORG_ID.
APPEND wa_tms_head_modify TO t_tms_head_modify.
TRY.
IF NOT w_resuid IS INITIAL.
MODIFY /scmb/restmshd FROM TABLE
t_tms_head_modify.
ENDIF.
CATCH cx_root INTO
oref.
WRITE😕 'Exception:
Can not modify TMS information.'.
ENDTRY.
ENDFORM. " SAVE_HEADER_EXPL
*&---------------------------------------------------------------------*
*& Form
CLEAR_ALL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
*
--> p1 text
*
<-- p2 text
*----------------------------------------------------------------------*
FORM clear_all .
CLEAR: w_invalid,
w_datedfrom,
w_datedto,
w_datetfrom,
w_datetto,
w_loctype,
w_objid.
REFRESH: t_ttype,
t_t006.
CLEAR: wa_resource_head,
wa_resource_head_x,
wa_resource_text,
wa_resource_text_x,
wa_resource_dim,
wa_resource_dim_x,
wa_resource_dimrq,
wa_resource_dimrq_x,
wa_resource_tms_head,
wa_resource_tms_head_x,
wa_resource_tms_alternid,
wa_resource_tms_alternid_x,
wa_resource_tms_attequ,
wa_resource_tms_attequ_x,
wa_return.
REFRESH: t_resource_head,
t_resource_head_x,
t_resource_text,
t_resource_text_x,
t_resource_dim,
t_resource_dim_x,
t_resource_dimrq,
t_resource_dimrq_x,
t_resource_tms_head,
t_resource_tms_head_x,
t_resource_tms_alternid,
t_resource_tms_alternid_x,
t_resource_tms_attequ,
t_resource_tms_attequ_x,
t_return.
ENDFORM. " CLEAR_ALL
User | Count |
---|---|
9 | |
4 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.