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

Processing Boleto - Read PDF without ADS

Former Member
0 Likes
620

Hi,

We receive Boletos from different banks which comes to a mail group as a pdf attachment. We need to read the pdf file and get few values and update it in our SAP Invoices for further processing. We need a way to read PDF file and get appropriate values without usage of XI/PI and ADS connection. Could you please guide us with this. Thanks.

Regards,

SG

2 REPLIES 2
Read only

Former Member
0 Likes
530

Hi,

You can refer to class CL_GUI_PDFVIEWER. Call this class in background and it has a FIND_TEXT which you can use to find some text.

You can also refer to link

http://scn.sap.com/docs/DOC-10067

Hope this helps.

Thanks,

Tooshar Bendale

Read only

0 Likes
530

Hi,

Thanks for your reply. Can you further help me with this as i am new to OO ABAP. I have the pdf attachment in my SAP inbox. My code is like below.

*This fm will read the folder details in the sap inbox for the particular user id.

CALL FUNCTION 'SO_USER_READ_API1'

  EXPORTING

    prepare_for_folder_access = 'X'

  IMPORTING

    user_data                 = user_data

  EXCEPTIONS

    user_not_exist            = 1

    parameter_error           = 2

    x_error                   = 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.



*This fm will read the folder content present in the sap inbox folder.

CALL FUNCTION 'SO_FOLDER_READ_API1'

  EXPORTING

    folder_id                  = user_data-inboxfol

  TABLES

    folder_content             = folder_content

  EXCEPTIONS

    folder_not_exist           = 1

    operation_no_authorization = 2

    x_error                    = 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.



CLEAR wa_folder_content.

SORT folder_content BY obj_name obj_descr creat_date creat_time.



READ TABLE folder_content INTO wa_folder_content WITH KEY obj_descr = 'PDF BOLETO'.



IF NOT wa_folder_content IS INITIAL.



*This fm will read the attachment present in the mail.

  CALL FUNCTION 'SO_DOCUMENT_READ_API1'

    EXPORTING

      document_id                = wa_folder_content-doc_id

    TABLES

      attachment_list            = attachment_list

    EXCEPTIONS

      document_id_not_exist      = 1

      operation_no_authorization = 2

      x_error                    = 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.



*Passing the length of the attachment to a variable

  input_length = attachment_list-att_size.



*This fm will read the attachment and will give in the binary format.

  CALL FUNCTION 'SO_ATTACHMENT_READ_API1'

    EXPORTING

      attachment_id              = attachment_list-attach_id

    TABLES

      contents_hex               = contents_hex

    EXCEPTIONS

      attachment_not_exist       = 1

      operation_no_authorization = 2

      parameter_error            = 3

      x_error                    = 4

      enqueue_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.

Please help. Thanks a lot.