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.
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‘
strategy = nast-tcode
address_number = addr_key-addrnumber
person_number = addr_key-persnumber
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‘
comwa = vbco3
kopf = vbdkr
pos = tvbdpr
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’.
* fill address key –> necessary for emails
ADDR_KEY-ADDRNUMBER = vbdkr-ADRNR.
ADDR_KEY-PERSNUMBER = vbdkr-ADRNP.
ADDR_KEY-ADDR_TYPE = vbdkr-ADDRESS_TYPE.