Skip to Content
avatar image
Former Member

urgent!!!!!!!!!!!1

hi all

i have a dynpro i have to add the following function to it

in the dynpro there are five fields after entering all the vaules and pressing save button a mail sud go to certain distribution list.

plz help me how i can send mail to certaion distribution list after preesing save button.

help me with the code

points ll be surely awarded for the help

anuj

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Aug 21, 2007 at 07:57 AM

    Hi Anuj

    Check thsi sample report.

    REPORT ZV_EMAIL_TEST .

    TABLES: KNA1.

    • data for send function

    DATA DOC_DATA LIKE SODOCCHGI1.

    DATA OBJECT_ID LIKE SOODK.

    DATA OBJCONT LIKE SOLI OCCURS 10 WITH HEADER LINE.

    DATA RECEIVER LIKE SOMLRECI1 OCCURS 1 WITH HEADER LINE.

    SELECT * FROM KNA1 WHERE ANRED LIKE 'C%'.

    WRITE:/ KNA1-KUNNR, KNA1-ANRED.

    • send data internal table

    CONCATENATE KNA1-KUNNR KNA1-ANRED

    INTO OBJCONT-LINE SEPARATED BY SPACE.

    APPEND OBJCONT.

    ENDSELECT.

    • insert receiver (sap name)

    REFRESH RECEIVER.

    CLEAR RECEIVER.

    MOVE: SY-UNAME TO RECEIVER-RECEIVER,

    'X' TO RECEIVER-EXPRESS,

    'U' TO RECEIVER-REC_TYPE.

    APPEND RECEIVER.

    • insert mail description

    WRITE 'Sending a mail through abap'

    TO DOC_DATA-OBJ_DESCR.

    CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

    EXPORTING

    DOCUMENT_DATA = DOC_DATA

    IMPORTING

    NEW_OBJECT_ID = OBJECT_ID

    TABLES

    OBJECT_CONTENT = OBJCONT

    RECEIVERS = RECEIVER

    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.

    write:/ 'Hi'.

    reward points to all helpful answers

    kiran.M

    Add comment
    10|10000 characters needed characters exceeded