Ansicht
Dokumentation

EXIT_SAPLV56F_011 - Shipment Processing: Activities for Setting a Status, Time 1

EXIT_SAPLV56F_011 - Shipment Processing: Activities for Setting a Status, Time 1

Vendor Master (General Section)   CPI1466 during Backup  
This documentation is copyright by SAP AG.
SAP E-Book

Functionality

This function module lets you implement your own actions that you want carried out whenever a status is set in the transport header.

The system calls the function module in transport maintenance (Create transpor, VT01, or Change transport, VT02) when the status is changed in the transport header.

At that time different function modules are called up, depending on which button is pressed:
'SD_SHIPMENT_STATUS_PLANNED' if status is "Planned"
'SD_SHIPMENT_STATUS_REGISTRATED' if status is "Registered"
'SD_SHIPMENT_STATUS_LOAD_END' if status is "Loading end"
'SD_SHIPMENT_STATUS_LOAD_START' if status is "Loading start"
'SD_SHIPMENT_STATUS_COMPLETION' if status is "Shipment completion"
'SD_SHIPMENT_STATUS_SHIPM_END' if status is "Shipment end"
'SD_SHIPMENT_STATUS_SHIPM_START' if status is "Shipment start"

Each of those function modules calls this function module when the status changes from " " (blank) to "X" or vice versa.

The function module is called at point 1, AFTER the standard checks (such as the authorization check for changing the status) and BEFORE the actual standard activities (copying delivery data from the deliveries to the shipment if the status is "Planned"). Consequently, this point in time is suited for carrying out other checks, such as whether the activity can or should be carried out. It can also be used to carry out certain activities that are not dependent on the status that is currently being set.

In contrast to this, see the customer function 'EXIT_SAPLV56F_0012': This function module is called AFTER the standard activities. Thus it can be used to manipulate the results of the standard.

The IMPORT parameter I_STATUS determines the status for which this customer function was called:
I_STATUS = '1' if status is "Planned"
I_STATUS = '2' if status is "Registered"
I_STATUS = '3' if status is "Loading end"
I_STATUS = '4' if status is "Loading start"
I_STATUS = '5' if status is "Shipment completed"
I_STATUS = '6' if status is "Shipment end"
I_STATUS = '7' if status is "Shipment start"

It makes sense to react differently in this user exit depending on this value. Also, the reaction should depend on whether the status was set or deselected. This information can be taken from work area C_XVTTK, which contains the old value for the status. This query can be programmed as follows in the user exit:

CASE I_STATUS.
* Status 'Planned'
WHEN '1'.
IF C_XVTTK-STDIS IS INITIAL. "Status is set
....
ELSE. "Status is undone
....
ENDIF.

* Status 'Registered'
WHEN '2'.
IF C_XVTTK-STREG IS INITIAL. "Status is set
....
ELSE. "Status is undone
....
ENDIF.

* Status 'Loading start'
WHEN '3'.
IF C_XVTTK-STLBG IS INITIAL. "Status is set
....
ELSE. "Status is undone
....
ENDIF.

* Status 'Loading end'
WHEN '4'.
IF C_XVTTK-STLAD IS INITIAL. "Status is set
....
ELSE. "Status is undone
....
ENDIF.

* Status 'Shipment completion'
WHEN '5'.
IF C_XVTTK-STABF IS INITIAL. "Status is set
....
ELSE. "Status is undone
....
ENDIF.

* Status 'Shipment start'
WHEN '6'.
IF C_XVTTK-STTBG IS INITIAL. "Status is set
....
ELSE. "Status is undone
....
ENDIF.

* Status 'Shipment end'
WHEN '7'.
IF C_XVTTK-STTEN IS INITIAL. "Status is set
....
ELSE. "Status is undone
....
ENDIF.

ENDCASE.

If this function module returns a SY-SUBRC <> 0, the relevant status is not changed. In this case the exception 'ERROR' should be triggered.

Example

Example 1:
When the status "Shipment completion" is set, the status "Planned" should also be set (can be realized by calling function module 'SD_SHIPMENT_STATUS_PLANNED').
CAUTION!
In this case, the function module is called twice, because it is also processed in function module 'SD_SHIPMENT_STATUS_PLANNED'. The CASE command accesses a different routine, but you should be careful with global variables.

Example 2:
When the status "Shipment end" is set, the system should send a certain message to the delivery, such as to report that the goods recipient has received the goods. (This can be realized by calling function module 'SD_ALL_MESSAGES_FOR_SHIPMENTS').
CAUTION:
In Customizing for the shipment types, you can define which messages should be sent when the status "Shipment completion" is set.

Example 3:
The status "Planned" cannot be undone once the shipment has begun, because the truck has already left the shipping point and no changes to the schedule can be made anymore.

This requirement can be realized as follows:


data:
l_rg_kscv2 like msg2 occurs 0 with header line,
l_rg_tknum like range_c10 occurs 0 with header line.


case i_status.
when '1'.
IF NOT C_XVTTK-STDIS IS INITIAL. "Status will be reset
IF NOT C_XVTTK-STTBG IS INITIAL OR
NOT C_XVTTK-STTEN IS INITIAL.
* Status 'shipment start' or 'shipment end' is already set
message id 'VW' type 'E' number '001'
with 'Impossible !' raising error.
ENDIF.
ENDIF.
when '2'.
when '3'.
when '4'.
when '5'.
* if completion status is set, set also status 'planned'
IF C_XVTTK-STABF IS INITIAL.
call function 'SD_SHIPMENT_STATUS_PLANNED'
exporting
i_tvtk = i_tvtk
i_new_status = 'X'
i_new_status_date = i_new_status_date
i_new_status_time = i_new_status_time
* I_DESTINATION =
* I_DEPARTURE =
opt_dialog = opt_dialog
* importing
* e_serv_agent_from_delivery =
* e_route_from_delivery =
* e_leg_determination_done =
tables
c_xvttp = c_xvttp
c_yvttp = c_yvttp
c_xvtts = c_xvtts
c_yvtts = c_yvtts
c_xvtsp = c_xvtsp
c_yvtsp = c_yvtsp
c_xvbpa = c_xvbpa
c_yvbpa = c_yvbpa
c_xvbadr = c_xvbadr
i_xtrlk = i_xtrlk
i_xtrlp = i_xtrlp
* I_DEPARTURE_SEQUENCE =
changing
c_xvttk = c_xvttk
exceptions
wrong_shipment_type = 1
copy_of_delivery_data_failed = 2
leg_determination_failed = 3
time_invalid = 4
date_invalid = 5
others = 6.
endif.
when '6'.
when '7'.
* if status 'shipment End' is set, the issue output
IF C_XVTTK-STTEN IS INITIAL.
* create range with shipment number
clear l_rg_tknum.
l_rg_tknum-sign = 'I'.
l_rg_tknum-option = 'EQ'.
l_rg_tknum-low = c_xvttk-tknum.
append l_rg_tknum.
* create range with wanted message type
clear l_rg_kscv2.
l_rg_kscv2-sign = 'I'.
l_rg_kscv2-option = 'EQ'.
l_rg_kscv2-low = 'XXXX'.
append l_rg_kscv2.
* output
call function 'SD_ALL_MESSAGES_FOR_SHIPMENTS'
exporting
* pm_dpabf = l_pm_dpabf
* PM_TPLST = ' '
* PM_PARVW = ' '
* PM_PARNR = ' '
* PM_TRAN = ' '
* PM_NACV7 = ' '
* PM_WHVV7 = ' '
* PM_VERST = ' '
* PM_NAV6T = ' '
* PM_WHV6T = ' '
pm_lief = 'X'
* PM_NACV2 = ' '
* PM_WHVV2 = ' '
* pm_versl = ' '
* pm_nav6l = ' '
* PM_WHV6L = ' '
* PM_FAKT = ' '
* PM_NACV3 = ' '
* PM_WHVV3 = ' '
nodialog = 'X'
tables
rg_tknum = l_rg_tknum
* RG_KSCV7 =
* RG_KSV6T =
rg_kscv2 = l_rg_kscv2
* RG_KSV6L =
* RG_KSCV3 =
exceptions
no_messages_exist = 1
invalid_shipment_ranges = 2
partnerrole_missing = 3
others = 4.
endif.
endcase.

Notes

Further information





Parameters

C_XVBADR
C_XVBPA
C_XVTSP
C_XVTTK
C_XVTTK_WA
C_XVTTP
C_XVTTS
C_YVBADR
C_YVBPA
C_YVTSP
C_YVTTK
C_YVTTP
C_YVTTS
I_NEW_STATUS_DATE
I_NEW_STATUS_TIME
I_STATUS
I_TVTK
I_XTRLK
I_XTRLP
OPT_DIALOG

Exceptions

ERROR

Function Group

XV56

TXBHW - Original Tax Base Amount in Local Currency   ROGBILLS - Synchronize billing plans  
This documentation is copyright by SAP AG.

Length: 11007 Date: 20240523 Time: 083756     sap01-206 ( 105 ms )