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

Send PO script to Email

former_member221372
Participant
0 Likes
643

Hello All,

I copied standard script (MEDRUCK) to Z and created one Z-Program and these two are configured through NACE.I have used below logic to send to it Email and have done implicit enhancements also, but I am getting error in OPEN_FORM with exception error 3. While I checked it was coming at

where I gets error

call function 'GET_ARCHIVE_PARAMETERS'

          exporting  in_parameters  = arc_params

                     printer        = itcpp-tddest

                     no_dialog      = true

          importing  out_parameters = arc_params

          exceptions others = 1.

     if sy-subrc <> 0.

       message id sy-msgid type 'A' number sy-msgno

               with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4

               raising archive_error.

     endif.



So kindly suggets.



I implemented below logic

DATA: l_druvo LIKE t166k-druvo,

        l_nast  LIKE nast,

        aux_nast LIKE nast,

        l_from_memory,

        l_doc   TYPE meein_purchase_doc_print,

        ent_screen TYPE c,

        ent_retco TYPE i,

        toa_dara TYPE toa_dara,

        arc_params LIKE arc_params,

        aux_form LIKE tnapr-fonam.

  DATA: otf LIKE itcoo OCCURS 0 WITH HEADER LINE,

        lt_docs      TYPE TABLE OF docs,

        pdf_bytecount TYPE i,

        nom_archivo TYPE string.

  aux_form = 'ZMEDRUCK'.

  l_from_memory = c_true.

  SELECT *

    FROM nast

    INTO aux_nast

    UP TO 1 ROWS

    WHERE kappl = c_po     " Purchase Order

    AND   objky = t_datos-ebeln

    AND   aktiv = space

    ORDER BY erdat DESCENDING eruhr DESCENDING.

  ENDSELECT.

  aux_nast-sort1 = c_swp.

  CLEAR ent_screen.

  CLEAR ent_retco.

  IF aux_nast-aende EQ space.

    l_druvo = c_1.

  ELSE.

    l_druvo = c_2.

  ENDIF.

*  l_druvo = '2'.

  CALL FUNCTION 'ME_READ_PO_FOR_PRINTING'

    EXPORTING

      ix_nast        = aux_nast

      ix_screen      = ent_screen

    IMPORTING

      ex_retco       = ent_retco

      ex_nast        = l_nast

      doc            = l_doc

    CHANGING

      cx_druvo       = l_druvo

      cx_from_memory = l_from_memory.

  CHECK ent_retco EQ 0.

  CALL FUNCTION 'ME_PRINT_PO'

    EXPORTING

      ix_nast        = l_nast

      ix_druvo       = l_druvo

      doc            = l_doc

      ix_screen      = ent_screen

      ix_from_memory = l_from_memory

      ix_toa_dara    = toa_dara

      ix_arc_params  = arc_params

      ix_fonam       = aux_form                            

    IMPORTING

      ex_retco       = ent_retco.

  CLEAR otf.

  CALL FUNCTION 'READ_OTF_FROM_MEMORY'

    EXPORTING

      memory_key   = l_nast-objky  " PO Number

    TABLES

      otf          = otf

    EXCEPTIONS

      memory_empty = 1

      OTHERS       = 2.

  CALL FUNCTION 'CONVERT_OTF_2_PDF'

    IMPORTING

      bin_filesize           = pdf_bytecount

    TABLES

      otf                    = otf

      doctab_archive         = lt_docs

      lines                  = pdfout

    EXCEPTIONS

      err_conv_not_possible  = 1

      err_otf_mc_noendmarker = 2

      OTHERS                 = 3.

1 ACCEPTED SOLUTION
Read only

former_member221372
Participant
0 Likes
587

Issue got resolved.

Have to pass cx_from_memory = 'X'.

Regards,

Bharat

1 REPLY 1
Read only

former_member221372
Participant
0 Likes
588

Issue got resolved.

Have to pass cx_from_memory = 'X'.

Regards,

Bharat