Tuesday, May 20, 2014

How to get VIA carrier/forwarder address by shipment number?

I just want to share simple topic for the others. This is simple query how to get address of VIA forwarder. You know, some shipments does not contain just receiving end address but are delivered by more than one leg. Sometime we need to pickup address of let's say middle forwarders and this is our case.

Open SQL


  DATA gv_address_via_carrier TYPE adrc.

  CLEAR gv_address_via_carrier.
  IF vttkvb-tknum IS NOT INITIAL" Shipment Number
    SELECT SINGLE *
    FROM vtpa
    INNER JOIN adrc
      ON vtpa~adrnr adrc~addrnumber
    INTO CORRESPONDING FIELDS OF gv_address_via_carrier
    WHERE vbeln  vttkvb-tknum
    AND   posnr '000000'
    AND   parvw  'SV'.
  ENDIF.

Of course in case of more than one VIA forwarder do not use SELECT SINGLE, but fill internal table with just SELECT clause.


SAP SCRIPT form


In my case address had to be displayed by some old fashion SAP script, by window of following content.

/: ADDRESS PARAGRAPH AS
/:  NAME     &GV_ADDRESS_VIA_CARRIER-NAME1&, &GV_ADDRESS_VIA_CARRIER-NAME2
/:  STREET   &GV_ADDRESS_VIA_CARRIER-STREET&
/:  CITY     &GV_ADDRESS_VIA_CARRIER-CITY1(29)&
/:  POSTCODE &GV_ADDRESS_VIA_CARRIER-POST_CODE1(10)&
/:  COUNTRY  &GV_ADDRESS_VIA_CARRIER-COUNTRY&
/:  REGION   &GV_ADDRESS_VIA_CARRIER-REGION&

/: ENDADDRESS


No comments:

Post a Comment