Skip to Content
0
Former Member
Nov 24, 2011 at 01:55 PM

Z-Programm for Email of PO to Vendor

128 Views

Hello gurus,

I have following problem:

We want to use a Z-Transaction for printing POs. We want ot extend this program for sending emails to the customer with the PO. In the standard the system sents the email to the default email adress that is used in the vendor.

I have programmed a dynpro where the user can chose one of the emailadress from all the email adresses that are saved in the vendor. AND the user also can add a new emailadress.

Since I want to stick to the standard sap behavior in the mail sending process I decided to modify the adresse. and here is my problem:

The user chose one of the existing mail adresses from my checkbox. So this Emailadress is already stored in table ADR6. I now want to change the default flag from the old adress to the new adress. I do so by checking / unchecking the flags in the table and i store the flags back into the table ADR6 and make a commit.

the problem is. the values are changed in ADR6 but the system still shows the old emailadress as default. so i assume that there is a second table where I have to make changes. i hope somebody can help me on this.

here are some parts of my code:

" it_adr6 --> here i store all the email adresses
" smtp_addr_value  --> this is the listbox (the key is corresponding to ADR6-CONSNUMBER

     loop at it_adr6 ASSIGNING <ls_adr6>.
        if <ls_adr6>-FLGDEFAULT = 'X'.
          clear: <ls_adr6>-flgdefault.
        endif.
        if <ls_adr6>-CONSNUMBER = smtp_addr_value.
          <ls_adr6>-flgdefault = 'X'.
        endif.
     ENDLOOP.
     modify adr6 FROM TABLE it_adr6.
    
    commit work. 

thanks

Alex