Skip to Content
avatar image
Former Member

FM PIGFARMDATA falls with a System Failure error

Hi everyone,

I have a develop in SAP that generates PDF sales checks (by smartforms) and lets print them after they're stamped. At execution time, if it's a first time generated pdf, the program extracts all the data it needs to generate a QR format and then it sends this data to a Google's url which returns the QR picture in bitmap code.

This QR's bitmap code it's sends to the FM PIGFARMDATA (with IGS_RFC_DEST and farm_type IMGCONV) which transforms this into a bitmap picture and stores it in the SE78 (that's because the pdf can be generated many times and it's better save the picture instead of generate it all the time).

Then, the smartforms calls this QR and it's shown in a print preview.

The problem is that in some cases the FM PIGFARMDATA sends a System Failure error and doesn't generate the QR picture and this causes that print preview sends a graphics error, but a few minutes later (some times it took at least one hour) the FM PIGFARMDATA generates the QR picture when it supposed the process should be at the moment.

I have been reading about the trace configurations in the ST01 but it doesn't work for me.

Please help.


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Jul 24, 2017 at 12:58 PM

    I thought it was Google but the service returns correctly the data,

    This is the part where I send the data from the sales check to Google's service

    FUNCTION zsd_cfdi_qr.
    *"*"Interfase local
    *"      ENQUEUE_FAILED
    *Variables Locales
      DATA : lv_str_length TYPE i.
      DATA : lv_url TYPE string.
      DATA : ltt_mime TYPE  w3mimetabtype.
      DATA : lv_content TYPE xstring.
      DATA : lo_http_client TYPE REF TO if_http_client.
    * DATA : ls_hex_tab1 TYPE TABLE OF ty_binary WITH HEADER LINE.
      DATA: lv_image_name TYPE stxbitmaps-tdname.
      CONSTANTS: lc_chart TYPE char100 VALUE '|1&chl=' ##NO_TEXT.
    * QR Code Process
    *Arma el url del QRCODE
      CONCATENATE lc_chart i_qrcode INTO lv_url.
    *Crea el url apartir del parámetro de entrada
      CALL METHOD cl_http_client=>create_by_url
          url                = lv_url
          client             = lo_http_client
          argument_not_found = 1
          plugin_not_active  = 2
          internal_error     = 3
          OTHERS             = 4.
      IF sy-subrc = 0.
    *Manda los parámetros
           EXCEPTIONS http_communication_failure = 1
                      http_invalid_state         = 2
                      http_processing_failed     = 3
                      http_invalid_timeout       = 4
                      OTHERS                     = 5 ).
        IF sy-subrc EQ 0.
    *Recibe el QRCODE
          EXCEPTIONS http_communication_failure = 1
                     http_invalid_state         = 2
                     http_processing_failed     = 3
                     OTHERS                     = 4 ).
          IF sy-subrc EQ 0.
    *Recibe los datos
            lv_content = lo_http_client->response->get_data( ).
            lo_http_client->close( ).
            lv_str_length = xstrlen( lv_content ).
                c_xstring = lv_content
                i_length  = lv_str_length
                c_t_mime  = ltt_mime.
    *Asigna el nombre de la Imagen
            lv_image_name = i_name_image.
    *Convierte los datos a la Imagen Dentro de SAP
            zi_qrcode	= i_qrcode.
            zi_name_image	= lv_image_name.
            PERFORM convert_image USING    ltt_mime
            RAISE error_generation.
    * QR Code Process

    And this is the part I send the received data to the perform that converts it in a bitmap picture

    *&      Form  CONVERT_IMAGE
    *       text
    *      -->P_LTT_MIME  text
    *      -->P_LV_IMAGE_NAME  text
    FORM convert_image  USING p_mime TYPE w3mimetabtype
                              p_name TYPE stxbitmaps-tdname.
    *Declaración de Variables Locales
      DATA: lo_igs_image_converter TYPE REF TO cl_igs_image_converter.
      DATA: lv_content_length TYPE  i.
      DATA: ltt_blob     TYPE w3mimetabtype,
            lv_blob_size TYPE w3param-cont_len ##NEEDED,
            lv_blob_type TYPE w3param-cont_type  ##NEEDED.
      DATA: lv_name       TYPE stxbitmaps-tdname,
            lv_object     TYPE stxbitmaps-tdobject,
            lv_id         TYPE stxbitmaps-tdid,
            lv_btype      TYPE stxbitmaps-tdbtype,
            lv_resident   TYPE stxbitmaps-resident,
            lv_autoheight TYPE stxbitmaps-autoheight,
            lv_bmcomp     TYPE stxbitmaps-bmcomp,
            lv_resolution TYPE stxbitmaps-resolution,
            lv_extension  TYPE rlgrap-filename,
            lv_docid      TYPE stxbitmaps-docid.
    *Crea el Objeto del QRCODE
      CREATE OBJECT lo_igs_image_converter .
      lo_igs_image_converter->input  = text-002. "'image/png'.
      lo_igs_image_converter->output = text-003. "'image/bmp'.
    *  lo_igs_image_converter->output = text-004. "'image/tif'.
      lo_igs_image_converter->width  = gc_width.
      lo_igs_image_converter->height = gc_height.
    *Crea la Imagen
      CALL METHOD lo_igs_image_converter->set_image
          blob      = p_mime
          blob_size = lv_content_length.
      CALL METHOD lo_igs_image_converter->execute
          communication_error = 1
          internal_error      = 2
          external_error      = 3
          OTHERS              = 4.
      IF sy-subrc = 0.
        CALL METHOD lo_igs_image_converter->get_image
            blob      = ltt_blob
            blob_size = lv_blob_size
            blob_type = lv_blob_type.
    *Sube la Imagen a la Se78
      lv_name       = p_name.
      lv_object     = gc_graphics.
      lv_id         = gc_bmap.
      lv_btype      = gc_bmon.
      lv_resident   = ' '.
      lv_autoheight = 'X'.
      lv_bmcomp     = 'X'.
      lv_extension  = 'BMP'.
      PERFORM import_bitmaps_bds   USING ltt_blob
                                         ' '
                                CHANGING lv_docid

    Here's the error that sends previous perform

    And that error is caused by this, the call to the FM PIGFARMDATA

    This was on a sales check that sends me the error I describe, this is happening in some of them, I have read that rfcdestination uses a TCP/IP protocol but I don't know if should be a SAP configuration or a network configuration.


    Add comment
    10|10000 characters needed characters exceeded

  • Jul 24, 2017 at 07:42 AM

    It loks like your googleservice seem to have a problem. The rfc should work fine.

    No matter what, without publishing your coding (the important snippets for the call) nobody will find the problem for sure.

    So you have two options, share your code and maybe someone find a bug or tae care of it and let us know afterwards what the problem was and if I'm right, that the google-service is the bug:-)

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 11, 2017 at 07:10 AM

    Hi Emmanuel,

    just stumbled upon this thread while browsing through Florian's content. You probably have it solved already, seeing the thread is 3 weeks old, but in case not: The RFC-Dest for the IGS-Engine is an SAP Configuration i.e. a registered server program called via the standard TCP/IP-RFC "IGS_RFC_DEST". I'm not sure whether this connection has to be maintained manually by an admin or whether it's autogenerated when registering the server program. This is how it looks anyway:

    Additionally, when using ST01, beware that the transaction only fetches traces for the application server that you are currently logged on. I.e. if you have several app servers, the IGS-RFC might automatically be started on another one (e.g. via load balancing) and you won't see anything. You can switch the App server via SM51, which can be a pain in the ***. Also check the following wiki -->

    Cheers, Lukas

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 09, 2017 at 06:59 PM

    Hello Emmanuel, i have the same issue, do you have any solution? the message error texto is: "Function PIGFARMDATA not found"... Thanks, you can answer in spanish too....

    Add comment
    10|10000 characters needed characters exceeded