Application Development and Automation 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: 
Read only

SO_NEW_DOCUMENT_SEND_API1 Error in QAS: X_ERROR

Former Member
0 Likes
3,784

Hello experts,

I am facing a requirement to generate an email on Usage Decision of user. I chose to do this using user exit: QEVA0010 and

Function Module: SO_NEW_DOCUMENT_SEND_API1. It works perfectly in my Dev system but when I transported the code to QAS, the FM started generating X_ERROR exception. I read that it is not advisable to to commit from within a user so I followed the below steps from:


SO_NEW_DOCUMENT_SEND_API1 not working | SCN


  • create a Z-FM to send the email.
  • Make the attribute of the FM to Update Module
  • Did not put X in the Commit_Work in FM SO_NEW_DOCUMENT_SEND_API1 .
  • Add "IN UPDATE TASK" when the Z-FM is called.

Again, this works perfectly fine in my dev landscape but raises the exception in my QAS. The system seems to be configured to send emails as a previously user exit implemented in CS02 is generating an email. I would be very grateful if you could guide me in the right direction as I have been stuck with this problem for quite some time now.

This is the call to SO_NEW_DOCUMENT_SEND_API1 within my z_fm:

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

       EXPORTING

        DOCUMENT_DATA                  = MAILDATA

        DOCUMENT_TYPE                  = 'RAW'

        "PUT_IN_OUTBOX                   = 'X'

        "COMMIT_WORK                      = 'X'

*       IMPORTING

*   SENT_TO_ALL                          =

*   NEW_OBJECT_ID                    =

     


     TABLES

      OBJECT_HEADER                    = MAILTXT1

      OBJECT_CONTENT                   = MAILTXT

*   CONTENTS_HEX                     =

*   OBJECT_PARA                      =

*   OBJECT_PARB                      =

      RECEIVERS                        = RECLIST

      EXCEPTIONS

    TOO_MANY_RECEIVERS               = 1

    DOCUMENT_NOT_SENT                = 2

    DOCUMENT_TYPE_NOT_EXIST          = 3

    OPERATION_NO_AUTHORIZATION       = 4

    PARAMETER_ERROR                  = 5

    X_ERROR                          = 6

    ENQUEUE_ERROR                    = 7

    OTHERS                           = 8

1 ACCEPTED SOLUTION
Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
2,641

+1 to Gaurav, stop using this FM.

However, since it worked in one environment and not in the other then it's not a far stretch to assume that the problem is not with ABAP code. Reach to your Basis admin and check if emails work in general. Also check that parameters for FM are correct and you can always use debugger to get more details.

Hello experts,

I am facing a requirement to generate an email on Usage Decision of user. I chose to do this using user exit: QEVA0010 and

Function Module: SO_NEW_DOCUMENT_SEND_API1. It works perfectly in my Dev system but when I transported the code to QAS, the FM started generating X_ERROR exception. I read that it is not advisable to to commit from within a user so I followed the below steps from:


SO_NEW_DOCUMENT_SEND_API1 not working | SCN


  • create a Z-FM to send the email.
  • Make the attribute of the FM to Update Module
  • Did not put X in the Commit_Work in FM SO_NEW_DOCUMENT_SEND_API1 .
  • Add "IN UPDATE TASK" when the Z-FM is called.

Again, this works perfectly fine in my dev landscape but raises the exception in my QAS. The system seems to be configured to send emails as a previously user exit implemented in CS02 is generating an email. I would be very grateful if you could guide me in the right direction as I have been stuck with this problem for quite some time now.

This is the call to SO_NEW_DOCUMENT_SEND_API1 within my z_fm:

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

       EXPORTING

        DOCUMENT_DATA                  = MAILDATA

        DOCUMENT_TYPE                  = 'RAW'

        "PUT_IN_OUTBOX                   = 'X'

        "COMMIT_WORK                      = 'X'

*       IMPORTING

*   SENT_TO_ALL                          =

*   NEW_OBJECT_ID                    =

     


     TABLES

      OBJECT_HEADER                    = MAILTXT1

      OBJECT_CONTENT                   = MAILTXT

*   CONTENTS_HEX                     =

*   OBJECT_PARA                      =

*   OBJECT_PARB                      =

      RECEIVERS                        = RECLIST

      EXCEPTIONS

    TOO_MANY_RECEIVERS               = 1

    DOCUMENT_NOT_SENT                = 2

    DOCUMENT_TYPE_NOT_EXIST          = 3

    OPERATION_NO_AUTHORIZATION       = 4

    PARAMETER_ERROR                  = 5

    X_ERROR                          = 6

    ENQUEUE_ERROR                    = 7

    OTHERS                           = 8

8 REPLIES 8
Read only

Former Member
0 Likes
2,641

Hi,

Have you tried using class CL_BCS, instead of FM SO_NEW_DOCUMENT_SEND_API1??

Read only

0 Likes
2,641

Yes I have and I faced the same issue.

As mentioned, there is a previous implementation for CS02 and this uses CL_BCS Class in a z-function module so I called this fm within my user exit and it worked fine on the dev system but in QAS, mail does not reach SOST.

Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
2,642

+1 to Gaurav, stop using this FM.

However, since it worked in one environment and not in the other then it's not a far stretch to assume that the problem is not with ABAP code. Reach to your Basis admin and check if emails work in general. Also check that parameters for FM are correct and you can always use debugger to get more details.

Read only

0 Likes
2,641

Anything a bit more specific would be really helpful. As stated before, mails are working in general but having tried CL_BCS gives the same output although it works fine in another user-exit in CS02 (I used the same z-fm that is already implemented for my trial).

What could be the basis issue? What should I look out for in debugging?

Read only

0 Likes
2,641

Dear Hashsham,,

i agree with Jelena, better to contact your Basis to fix the email setting for SAP, because you said, your program worked in DEV system.

Regards,

Yance

Read only

0 Likes
2,641

And while you're waiting for Basis, rewrite your program (again?) to use the CL_BCS classes. Why bother sticking with an obsolete FM that is always problematic.

Read only

0 Likes
2,641

Hashsham Maneri wrote:

What could be the basis issue? What should I look out for in debugging?

Sorry but it seems like now you want SCN to do not just your but also your Basis admin's job. I'm sure there are tons of SCN posts out there on 1001 possible email issue and you both have Google access, so figure it out.

Read only

0 Likes
2,641

It was not my intention to get mine or anyone else's job done at all but two programs are already sending emails in the QAS system so I am a bit confused with the issue. Anyways thank you for the input Jelena and everyone else for that matter. I have marked your answers as helpful.