Ansicht
Dokumentation

/SAPAPO/TR_TRMH_GET - Read Routine for Means of Transport (with Hierarchies)

/SAPAPO/TR_TRMH_GET - Read Routine for Means of Transport (with Hierarchies)

PERFORM Short Reference   BAL Application Log Documentation  
This documentation is copyright by SAP AG.
SAP E-Book

Functionality

This function module is used to read and create means of transport entries for transportation lanes within the location hierarchy. For this, TRM entries are generated from templates; both entries that exist in the database and those that were generated at runtime are returned.

The function module is called using the model, a hierarchy assigned to the model, and start and destination location. TRM entries are then read for the start and destinations specified. Suitable entries that exist in the database are selected or TRM entries are generated according to the hierarchy. The TRM entries that come directly from the database or that are generated by the function module are returned in table e_trm_tab. In addition, the start and destination location of the transportation lane and the start and end location of the template in table e_trmparent_tab are returned (that is, the inheritance relationship from template and returned entry).

This function module is currently used mainly by TP/VS to generate means of transport entries for customers within tranportation zones and to create corresponding entries between distribtion centers and customers in a transportation zone.

The hierarchy must be in the model.

Restriction: Only one hierarchy can be used.

Read logic of function module:

For the start and destination locations given in the call, all superoridinate locations are read for the hierarchy specified (using function module /sapapo/modelrelh_get_parent.). The TRM entries for the model specified are them read from the database from the total amount of locations (these entries are stored in table l_trm_tab).

Then, means of transport entries are generated for each combination of the original start and destination location, according to the following logic:

Representation of the sequence in which TRM entries are searched for and selected. The hierarchy assignments are represented by dotted lines.

Location A <---- Location C <---- Location E

Location B <---- Location D <---- Location F

(1),,Location A --> Location B

(2),,Location A --> Location D

(3),,Location A --> Location F

(4),,Location C --> Location B

(5),,Location E --> Location B

(6),,Location C --> Location D

(7),,Location C --> Location F

(8),,Location E --> Location D

(9),,Location E --> Location F

TRM entries are to be read from start location A to destination location B:

  1. A check is made whether (at least) one TRM entry (independent of the means of transport ttype) exists between A and B in the model specified. For this, the keys locfr, locto, and trname (without ttype) are checked. If a TRM entry exists between A and B, all means of transport entries between A and B are returned. Suitable TRM entries are selected from the internal l_trm_tab table through step-by-step reading from the first entry found until the search key (that is, locfr, locto, trname) no longer agrees.
  2. If a suitable direct TRM entry is not found between A and B, destination location B is used as a starting point for a search in the location hierarchy for the superordinate location; that is, the father of B (for example, location D). There is then a search for the connection of A and D as in the first step for TRM entries. If suitable entries are found (for example, those with (2) marked entries), the locfr and locto fields of the (DB) entries found (for example, A and D) are replaced by the given values for locfr and locto (A and B). The transportation duration and distance are also adjusted (see below). If a suitable entry is also not found from the specified start location A to the father of destination location B (that is, location D), the search continues in the hierarchy for superordinate locations with regard to the destination location (location F...) until relevant entries are found (for example, (3)) or no more superordinate locations are found (no more father locations for location F).
  3. If no suitable TRM entries are found after the second step, start location A is now used as the basis for searching in superordinate (start) locations (locations C and D). This search is for TRM entries for target location B in the same way as in step 2 (search for entries (4) and (5)). Entries are selected if found.
  4. If suitable entries are also not selected in step 3, a search is made at the level of the superordinate locations (the fathers of the start and destination locations). If they exist, the search is now made on the basis of these locations (locations C and D in the example) recursively as in steps 1 to 3. That is, TRM entries are first searched for in the sequence (6), (7), (8) and, if found, they are returned before the search from (9) begins.
  5. The search for suitable TRM entries terminates either when suitable TRM entries are found or when no more father locations are found for the start and destination locations specified.

Calculation of transportation distances and durations for inherited TRM entries:

For inherited TRM entries, the transportation distance (field DIST) and the transportation duration DURAT) are not adopted directly. Instead, they are adjusted for the new locatiosn. This happens if the distance or duration is not fixed. For example, a means of transport entry is searched for between start location A and destination location B and a TRM entry is found as a template between locations C and D. The duration and distance generated for entries A and B from the entries for C and D are calculated from the maintained value of the template and the relationship of the (estimated) geographic distance.





Parameters

E_TRMC_TAB
E_TRMRELH_TAB
E_TRM_TAB
IV_BUFFER
IV_CALLER_CARRSEL
IV_DIRECT_IGS_ACCESS
I_AGGTPL_FLG
I_DTLTPL_FLG
I_LOCFRNO_RTAB
I_LOCFR_TAB
I_LOCTONO_RTAB
I_LOCTO_TAB
I_MODEL_FLD
I_RELID_FLD
I_TRMID_TAB
I_TTYPE_TAB
I_VALFR_FLD
I_VALTO_FLD
I_VDREL_LOCFR
I_VERSID_FLD

Exceptions

NOT_QUALIFIED
REL_NOT_IN_MODEL

Function Group

APO/SAPLOO_TR_READ

General Data in Customer Master   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.

Length: 6537 Date: 20240329 Time: 082619     sap01-206 ( 149 ms )