Error while sending invoice automatically via email

0
777

Error while sending invoice automatically via email

There have been this case recently that, while sending invoice automatically via email, I got the following errors while seeing the error log for the output type. The configuration of communication strategy, SCOT and output types looks ok, but still the error persists.

Error while sending invoice automatically via email

The error says :

Please enter an address number
Communication type  cannot be used

This error is because of the print program (used in output type) the three fields listed were not populated.
addr_key-addrnumber, addr_key-persnumber, and addr_key-addr_type.

Below is the call function where these 3 fields need to be exported. Please try putting values in debug mode and it should work.

 

CALL FUNCTION ‘ADDR_GET_NEXT_COMM_TYPE
EXPORTING
strategy = nast-tcode
address_number = addr_key-addrnumber
person_number = addr_key-persnumber
IMPORTING
comm_type = lvs_comm_type
comm_values = lvs_comm_values

The values for the 3 fields are in addr_key table.

Lets see an example for the same, where different function module is used ( at the time of Billing).

vbco3-mandt = sy-mandt.
vbco3-spras = nast-spras.
vbco3-kunde = nast-parnr.
vbco3-parvw = nast-parvw.

CALL FUNCTION ‘RV_BILLING_PRINT_VIEW
EXPORTING
comwa                        = vbco3
IMPORTING
kopf                         = vbdkr
TABLES
pos                          = tvbdpr
EXCEPTIONS
terms_of_payment_not_in_t052 = 1
error_message                = 5
OTHERS                       = 4.
IF NOT sy-subrc IS INITIAL.
IF sy-subrc = 1.
syst-msgty = ‘I’.
PERFORM protocol_update.
ENDIF.
ENDIF.

* fill address key –> necessary for emails
ADDR_KEY-ADDRNUMBER = vbdkr-ADRNR.
ADDR_KEY-PERSNUMBER = vbdkr-ADRNP.
ADDR_KEY-ADDR_TYPE  = vbdkr-ADDRESS_TYPE.

 

 

LEAVE A REPLY