Monday, July 6, 2020

SAP EHS: How to select Dangerous Goods Data for Sales&Distribution Printouts

Depending on the setup of your ERP System  and the regional requirements, orders, deliveries and shipments in the Sales&Distribution module produce different kinds of printouts (delivery notes, shipment lists, bills of lading, etc. ).

Usually, those printouts contain Dangerous Goods Data, which is relevant for transport.
If the prinouts use the standard DG Data retrieval logic and your system has a standard DG Data maintenance & customizing, there is nothing to worry about.
The standard logic takes the material and the route from the SD document and determines the DG regulation for which the DG Data is retrieved.

These checks are specified in the customizing activity 'Assign DG Check Schema Determination Routines' per Sales Organisation.

There you can check which check schema is assigned.

You can check your printing settings in transaction NACE.



However, if the prinouts use customer specific data retrieval, z-logic, direct selects on the DGTMD and DGTM2 tables for every printout, then you might opt for a central, reusable solution to include in your retrieval code for all printouts.

The central function can use following logic available in standard function modules.

In this post I will focus on the deliveries:


  • Read the delivery item data using 'RV_DELIVERY_PRINT_VIEW'. Maybe this step is already there in the data retrieval logic.








  •  CALL FUNCTION 'DG56_GET_TRM_CNTRIES_DELV'
          EXPORTING
            e_vbdkl                 <s_vbdkl>
            i_nspras                iv_nspras
          TABLES
            e_tvbdpl                it_vbdpl
            e_rdgcountryreglang_tab lt_rdgcountryreglang
          EXCEPTIONS
            get_data_error          1
            OTHERS                  2.
        APPEND LINES OF lt_rdgcountryreglang TO lt_rdgcountryreglang_all.


      LOOP AT lt_rdgcountryreglang_all ASSIGNING <s_rdgcountryreglang>.
        CLEAR ls_rdgmdsel.
        ls_rdgmdsel-matnr  <s_rdgcountryreglang>-matnr.
        ls_rdgmdsel-lwdg   <s_rdgcountryreglang>-lwdg.
        ls_rdgmdsel-valdat sy-datum.
        APPEND ls_rdgmdsel TO lt_rdgmdsel.
      ENDLOOP.




  •       CALL FUNCTION 'HAZMAT_RECORD_READ_FROM_DB'
        EXPORTING
          i_flg_read_undeleted_only  abap_true
        TABLES
          i_rdgmdsel_tab             lt_rdgmdsel
          e_buftab                   lt_rdgma
        EXCEPTIONS
          no_records_found           1
          no_records_for_all_entries 2
          OTHERS                     3.



The same can be done for shipments using the standard module 'DG56_GET_TRM_CNTRIES_SHIP'
 or for orders.

The return structure RDGMA contains all print-relevant fields from the DGTMD and DGTM2 tables.

We can  easily and simply read the DG Data using standard functions according to the system customizing without writing any direct  select statements on DGTMD / DGTM2 tables.

This approach makes sure that you are selecting the correct DG Data for the SD Document.

For more information about DG Data, please check my
previos post.






2 comments:

  1. Hi Diana,
    do you know, that both function modules (DG56_GET_TRM_CNTRIES_SHIP and DG56_GET_TRM_CNTRIES_DELV)
    only read the mode of transports 01, 02 and 03?
    If you use 04, 05 or 06 these data are not selected!!!
    You can see this in Formroutine l_RDGCOUNTRYREGLANG_build
    at the end of both functionmodules.
    It's also described in the documentation of
    FM DG56_GET_TRM_CNTRIES_DELV (not equal sea).
    Best Regards
    Stefan

    ReplyDelete
  2. Hi Stefan,

    thanks a lot for commenting. Do you mean the RoRo (Roll on Roll off) checks?

    'Check roro-indicator when transport Mode ne Sea'.

    I have implemented this logic for a customer using sea and air cargo and it worked :).

    Unfortunately I don't have an access to the system to check the customizing and the enhancement implementations.

    Maybe you can give me a hint where in the function modules the modes of transport are restricted.

    Best Regards
    Diana

    ReplyDelete