Document context functions

This section lists the functions that can be used in a context of a concrete document. Choose the according object class for instantiation based on the document type:

Document type

Class to use

Billing document

/AEB/CL_AES_PB_INV_DECL_BC

Purchase document

/AEB/CL_AES_PB_PD_DECL_BC

Delivery document

/AEB/CL_AES_PB_SDV_DECL_BC

Shipment document

/AEB/CL_AES_PB_SHP_DECL_BC

Incoming invoice

/AEB/CL_AES_PB_II_DECL_BC

Freight order

/AE1/CL_AES_PB_FRO_DECL_BC

Material document

/AEB/CL_AES_PB_MD_DECL_BC

Querying customs declarations data

You can use the function get_declarations to query all associated customs declarations for a document that have already been synchronized.
It can be applied for all customs declarations generated via the International Customs Integration Engine (ICI).

DATA:
  inv_decl_bc           TYPE REF TO /aeb/cl_aes_pb_inv_decl_bc,
  exception             TYPE REF TO /aeb/cx_aes_pb_get_decl_sc,
  result_do             TYPE REF TO /aeb/cl_aes_pb_get_decl_res_do,
  declaration_dos       TYPE /aeb/aes_if_aes_pb_decl_dos,
  declaration_do        TYPE REF TO /aeb/if_aes_pb_declaration_do,
  error_text            TYPE string,
  document_no           TYPE /aeb/aes_pb_doc_no VALUE '90017468',
  mrn_nv                TYPE REF TO /aeb/cl_01_char_35_nv,
  mrn                   TYPE string.

inv_decl_bc = /aeb/cl_aes_pb_inv_decl_bc=>new_for(
    im_doc_no = document_no ).

TRY.
    result_do = inv_decl_bc->get_declarations( ).
    declaration_dos = result_do->get_ici_declarations( ).
    LOOP AT declaration_dos INTO declaration_do.
      mrn_nv = declaration_do->get_customs_registration_numbe( ).
      mrn = mrn_nv->v.
*     do something with MRN
    ENDLOOP.
  CATCH /aeb/cx_aes_pb_get_decl_sc INTO exception.
    error_text = exception->if_message~get_text( ).
*   react to errors
ENDTRY.

Marking documents as printed

When handling customs documents, it can be rqeuired that you want to print them in an individual way which the standard solution doesn't support. In this case you want to tell the standard application that you have printed the document yourself or rather mark the document as printed. To do this, use the class /AEB/CL_AES_PB_DOC_STA_BC with the method MARK_DOCUMENT_AS_PRINTED.