Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Needs to get the email of the vendor

Former Member
0 Kudos

Hi gurus,

I have created a custom program containing the function modules ME_READ_PO_FOR_PRINTING and ME_PRINT_PO. The NACE transaction has been changed to our custom program.

However, when running our custom program, errors occur. Saying that the email cannot be retrieved. Here is a sample of the error created

Green Light: Object 1234567890

Green Light: Output type: Test for multi user

Green Light: Processing log for program ZPROGRAM routine ENTRY

Yellow Light: <b>E-mail address incorrect or non-existent</b>

Anyone knows how to get the email address? Or what change should I do in order for me to get the email.

Thanks in advance.

Benedict

15 REPLIES 15

Former Member
0 Kudos

Use the below piece of code in your smartform:

data : lv_adrnr type kna1-adrnr,

lv_smtp_addr type adr6-smtp_addr.

*Select Address number from LFA1 table

Select single adrnr from lfa1 into lv_adrnr

where lifnr = lfa1-lifnr.

*Select Email-id from ADR6 table

Select single smtp_addr from ADR6 into

where ADDRNUMBER = lv_adrnr.

Pass lv_smtp_addr to the variable for email as used in the smartform.

This shud solve your problem. Reward if so.

Regards.

0 Kudos

Hi Minochehr Vania,

Thanks for the immediate response.

But I don't have any form to put that code into.

Are the FMs responsible for the email that is to be retrieved?

Thank you.

Benedict

0 Kudos

Benedict

You can put this code in the program from which you are passing the FMs.

0 Kudos

Hi Minochehr,

To whom will I pass the data? I can't find any variable or table regarding the email address.

Another FM needed perhaps? No?

Thank you.

Benedict

0 Kudos

Hi Benedict,

Since you have written your Z-program from which these FMs are called there is no need to put the code in the program.

This is contradictory to my earlier post but when I saw the FM ME_PRINT_PO, the inside the import parameter IX_NAST you have to pass a field ADRNR (vendor's address numer). Then the FM will itself pick up the data from the tables I had mentioned in my code.

Now the error you are getting is probably becase the vendor's email address is not maintained in the ADR6 (Email address master) table. To check this go to SE16 > ADR6 table with the ADRNR of the vendor obtained from LFA1. If the field SMTP_ADDR is empty in the ADR6 table that means the vendor email address is not configured in your SAP system.

0 Kudos

Hi Minochehr,

Thanks for the continuous response.

The table ADR6 has value. I am now debugging the whole program. I'm now in RSNAST00 program... tsk tsk tsk... almost 3 hrs debugging. But still cannot find where it should be putting the ADR6-SMTP_ADDR value.

Can you show me the code where it is retrieving the data?

Thank you.

Benedict

0 Kudos

Hi Minochehr,

I think I have found the solution. But have a new problem.

I found out that the NAST table has no value in the ADRNR field. I think it is causing the problem. That is why it is not getting the email address.

The new problem is that, how should the table NAST-ADRNR retrieve it's value.

Currently checking on how to put value in it. Have you encounter this one?

Thank you.

Benedict

0 Kudos

BTW...I'm using the RV_MESSAGES_INSERT and RV_MESSAGES_UPDATE FMs to update the NAST table.

0 Kudos

You can manually pass the value of the NAST-ADRNR using the IMPORT parameter of the FM ME_PRINT_PO.

Pass it to the parameter IX_NAST-ADRNR.

Once you give the FM ADRNR, it shud pick up the email address.

Luck.

PS: Please close this question and reward points if this is successful.

0 Kudos

I manged to put some data in the ADRNR field of the NAST table, but still not successful. It still says that there is no email address or it does not exist.

0 Kudos

anyone?

I just don't understand. Why is it that the data is in ADR6 table, but I can't find any ADR6 table declared or used in the program.

Former Member
0 Kudos

Hi,

Based on Vendor (Lifnr) write select query to retreive data from tables ADRC and ADR6.

Hope this info will help you.

Rewards points if useful.

With regards,

K K V

0 Kudos

Hi Kishore,

The problem is, I don't know where to put the code.

Are my FMs responsible for the email address? Or do I have to use another FM to get the email automatically?

Thank you.

Benedict

Former Member
0 Kudos

Hi Bebedict,

I found one function module 'ADDR_GET_NEXT_COMM_TYPE' in the function module 'ME_PRINT_PO' which retieve the adrnr.Which inturn used by another function module 'CONVERT_COMM_TYPE_DATA' to put the emailaddress into NAST.

So you can check(Debugging) if the parameter in 'ADDR_GET_NEXT_COMM_TYPE' that you are passing is correct or they are blank.Because the exception is generated by htis function module.

or can you check if there is any entry of ADRC-ADDRNUMBER for LFA1-ADRNR.

If there is one then check ADRC-FLAGCOMM6(Indicator: E-Mail Address(es) Maintained).If its not 'X' then you need to maintain it in ADR6 as<b> Minochehr Vania</b> has suggested.

Correct me if I am wrong.If you have already found the answer,I will appreciate if you could post it.

Thanks,

Sanujit

  • ... use stratagy to get communication type

CALL FUNCTION 'ADDR_GET_NEXT_COMM_TYPE'

EXPORTING

strategy = <b>nast-tcode</b>

address_number = <b>lfa1-adrnr</b>

IMPORTING

comm_type = lvs_comm_type

comm_values = lvs_comm_values

EXCEPTIONS

<b>address_not_exist = 1</b>

person_not_exist = 2

no_comm_type_found = 3

internal_error = 4

parameter_error = 5

OTHERS = 6.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • convert communication data

MOVE-CORRESPONDING nast TO intnast.

MOVE sy-repid TO xprogramm.

CALL FUNCTION 'CONVERT_COMM_TYPE_DATA'

EXPORTING

pi_comm_type = lvs_comm_type

pi_comm_values = lvs_comm_values

pi_country = lfa1-land1

pi_repid = xprogramm

pi_snast = intnast

IMPORTING

pe_itcpo = itcpo

pe_device = xdevice

pe_mail_recipient = lvs_recipient

pe_mail_sender = lvs_sender

EXCEPTIONS

comm_type_not_supported = 1

recipient_creation_failed = 2

sender_creation_failed = 3

OTHERS = 4.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

0 Kudos

Hi Sanujit,

Yes, it is in that FM that is giving the error message but I have created an enhancement to get the correct data.

Thanks everyone for your efforts. This problem is solved.

Benedict