0% found this document useful (0 votes)
17 views3 pages

METHOD Get - Carrier.

This method populates carrier information for a freight order. It retrieves carrier data from various tables matching criteria like location, shipping condition, and weight. If a match is found, it sets the primary and secondary carrier in the return parameters.

Uploaded by

pandu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views3 pages

METHOD Get - Carrier.

This method populates carrier information for a freight order. It retrieves carrier data from various tables matching criteria like location, shipping condition, and weight. If a match is found, it sets the primary and secondary carrier in the return parameters.

Uploaded by

pandu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

METHOD get_carrier.

*----------------------------------------------------------------------*
* DATE WRITTEN : 15/08/2023
* AUTHOR : Itika Mahapatra
* TYPE : Report
* WRICEF : SP-OP-303
* DESCRIPTION : Populate Carrier for Freight Order
*----------------------------------------------------------------------*
*DS4K901205 |15/03/2023|Itika M |Hari Sivala |MFG-PE-174
*----------------------------------------------------------------------*

DATA: lv_brgew TYPE vbap-brgew .


DATA: lr_vsbed TYPE RANGE OF tvarvc-low,
ls_vsbed LIKE LINE OF lr_vsbed.

SELECT vbak~vbeln , vbap~posnr, vbak~kunnr AS kunnr , vbap~brgew, vbap~gewei,


tvst~vstel, tvst~azone , sadrc~country AS scountry,
adrc~transpzone , ladrc~country AS lcountry , vbpa~kunnr AS
kunwe,vbap~vsbed_ana, vbak~vsbed AS vsbed ,
mara~tragr AS tragr, vbak~kunnr AS v_kunnr
FROM vbap
INNER JOIN mara
ON vbap~matnr = mara~matnr
INNER JOIN vbak
ON vbak~vbeln = vbap~vbeln
INNER JOIN tvst
ON vbap~vstel = tvst~vstel
INNER JOIN adrc AS sadrc
ON sadrc~addrnumber = tvst~adrnr
INNER JOIN vbpa
ON vbpa~vbeln = vbap~vbeln
INNER JOIN adrc AS ladrc
ON ladrc~addrnumber = vbpa~adrnr
AND vbpa~parvw = 'WE'
INNER JOIN adrc
ON vbpa~adrnr = adrc~addrnumber
INTO TABLE @DATA(lt_location)
WHERE vbap~vbeln = @iv_sales_order .

IF sy-subrc = 0 .

READ TABLE lt_location INTO DATA(ls_location) INDEX 1 .


SELECT * FROM zsal_ocm_carrier INTO TABLE @DATA(lt_carrier)
WHERE kunnr = @ls_location-kunnr
AND kunwe = @ls_location-kunwe.

SELECT * FROM zsal_ocm_carrier APPENDING TABLE @lt_carrier


WHERE kunwe = @ls_location-kunnr.

SELECT * FROM zsal_ocm_carrier APPENDING TABLE @lt_carrier


WHERE source_country = @ls_location-scountry
AND source_zone = @ls_location-azone
AND dest_country = @ls_location-lcountry
AND dest_zone = @ls_location-transpzone
AND kunwe = ' '
AND kunnr = ' '
AND shipping_condition = @ls_location-vsbed_ana .

* SORT lt_carrier DESCENDING BY source_country source_zone dest_country


dest_zone kunwe shipping_condition ship_type.
* DELETE ADJACENT DUPLICATES FROM lt_carrier COMPARING source_country
source_zone dest_country dest_zone kunwe shipping_condition
* ship_type.

CLEAR: lv_brgew .
LOOP AT lt_location INTO DATA(ls_loc).
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
input = ls_loc-brgew
unit_in = ls_loc-gewei
unit_out = 'LB'
IMPORTING
output = ls_loc-brgew.
lv_brgew = lv_brgew + ls_loc-brgew.
ENDLOOP.

IF lv_brgew GT 15000.
DATA(lv_wght) = 'FTL' .
ELSE .
lv_wght = 'LTL'.
ENDIF.

IF ls_location-vsbed NE '10' .
READ TABLE lt_carrier INTO DATA(ls_carrier) WITH KEY kunwe = ls_location-
kunwe kunnr = ls_location-kunnr.
IF sy-subrc = 0.
ev_primary_carrier = ls_carrier-primary_carrier.
ev_sec_carrier = ls_carrier-secondary_carrier.
ELSE.
IF ls_location-tragr = '0003' AND ls_location-vsbed NE '10'.
READ TABLE lt_carrier INTO ls_carrier WITH KEY source_country =
ls_location-scountry
source_zone =
ls_location-azone
dest_country =
ls_location-lcountry
dest_zone = ls_location-
transpzone
* kunnr = ls_location-
v_kunnr
* kunwe = ls_location-
kunnr
ship_type = lv_wght.
IF sy-subrc = 0.
ev_primary_carrier = ls_carrier-primary_carrier.
ev_sec_carrier = ls_carrier-secondary_carrier.
ENDIF.
ELSEIF ls_location-vsbed = '21' OR ls_location-vsbed = '22' OR
ls_location-vsbed = '41'.
READ TABLE lt_carrier INTO ls_carrier WITH KEY source_country =
ls_location-scountry
source_zone =
ls_location-azone
dest_country =
ls_location-lcountry
dest_zone = ls_location-
transpzone
* kunnr = ls_location-
v_kunnr
* kunwe = ls_location-
kunnr
shipping_condition =
ls_location-vsbed_ana
ship_type = lv_wght.
IF sy-subrc = 0.
ev_primary_carrier = ls_carrier-primary_carrier.
ev_sec_carrier = ls_carrier-secondary_carrier.
ENDIF.
ELSEIF ls_location-vsbed = '20' OR ls_location-vsbed = '40'.
READ TABLE lt_carrier INTO ls_carrier WITH KEY source_country =
ls_location-scountry
source_zone =
ls_location-azone
dest_country =
ls_location-lcountry
dest_zone = ls_location-
transpzone
shipping_condition =
ls_location-vsbed_ana
ship_type = lv_wght.
IF sy-subrc = 0.
ev_primary_carrier = ls_carrier-primary_carrier.
ev_sec_carrier = ls_carrier-secondary_carrier.
ENDIF.
ENDIF.
ENDIF .
ENDIF .
ENDIF .
ENDMETHOD.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy