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

4.6 to ecc6

Former Member
0 Likes
392

we are in the middle of ecc6 upgrade and now getting some issue to send invoice in pdf format.

the error is

only character-type data objects are supported at the argument position

"P_PDF_XSTRING".

and this is the coding which we given.

FIELD-SYMBOLS <P>. "workarea for pdf data

p_pdf_string type XSTRING.

ASSIGN str TO <p> TYPE 'X'.

CONCATENATE p_pdf_xstring <p>(len)

INTO p_pdf_xstring.

this concatenate part is giving issue, any body can help to clear the issue. I don't have any idea how can I change it.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
369

Hi,

Try this code, finally PDF_CONTENT will have the hexadecimal code. I have just posted a piece of my code.


DATA: PDF_CONTENT        TYPE SOLIX_TAB.
DATA: W_I_SIZE TYPE I,
      I_DOCS  TYPE TABLE OF DOCS,
      I_LINES TYPE TABLE OF TLINE.
DATA: I_OTF TYPE TSFOTF.

DATA: I_BIN TYPE SOLIX_TAB.

data: gd_buffer type string,
it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE.
.



  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
         EXPORTING  formname           = 'SF_EXAMPLE_01'
*                 variant            = ' '
*                 direct_call        = ' '
         IMPORTING  fm_name            = lf_fm_name
         EXCEPTIONS no_form            = 1
                    no_function_module = 2
                    OTHERS             = 3.
    IF sy-subrc <> 0.
*   error handling
    ENDIF.


    ls_control_param-getotf = 'X'.
    ls_control_param-NO_DIALOG = 'X'.

* call smartform invoice
      CALL FUNCTION lf_fm_name
           EXPORTING
                      archive_index        = toa_dara
                      archive_parameters   = arc_params
                      control_parameters   = ls_control_param
*                 mail_appl_obj        =
                      mail_recipient       = ls_recipient
                      mail_sender          = ls_sender
                      output_options       = ls_composer_param
                      user_settings        = space
                      CUSTOMER              = I_CUST
                      BOOKINGS              = I_BOOK
                      CONNECTIONS           = I_CONN
                      is_repeat            = repeat
           importing  job_output_info      = ls_job_info
*                     document_output_info =
*                     job_output_options   =
           EXCEPTIONS formatting_error     = 1
                      internal_error       = 2
                      send_error           = 3
                      user_canceled        = 4
                      OTHERS               = 5.
      IF sy-subrc = 0.

         I_OTF = LS_JOB_INFO-OTFDATA[].

      endif.

  CALL FUNCTION 'CONVERT_OTF_2_PDF'
*    EXPORTING
*      USE_OTF_MC_CMD               = 'X'
*      ARCHIVE_INDEX                =
    IMPORTING
      BIN_FILESIZE                 =   w_i_size
     TABLES
       OTF                          =  I_OTF
       DOCTAB_ARCHIVE               =  I_docs
       LINES                        =  I_LINES
*    EXCEPTIONS
*      ERR_CONV_NOT_POSSIBLE        = 1
*      ERR_OTF_MC_NOENDMARKER       = 2
*      OTHERS                       = 3
             .
   IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
   ENDIF.

   CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
     EXPORTING
       INPUT_LENGTH       = w_i_size
      FIRST_LINE         = 0
      LAST_LINE          = 0
    IMPORTING
      BUFFER             =  w_xstr
     TABLES
       BINARY_TAB         = it_mess_att
    EXCEPTIONS
      FAILED             = 1
      OTHERS             = 2
             .
   IF SY-SUBRC <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
   ENDIF.

* Transfer the 132-long strings to 255-long strings
LOOP AT i_lines into wa_lines.
TRANSLATE wa_lines USING '~'.
CONCATENATE gd_buffer wa_lines INTO gd_buffer.
ENDLOOP.

TRANSLATE gd_buffer USING '~'.

DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.

PDF_CONTENT = CL_DOCUMENT_BCS=>XSTRING_TO_SOLIX( IP_XSTRING = w_xstr ).

Regards,

Subramanian

we are in the middle of ecc6 upgrade and now getting some issue to send invoice in pdf format.

the error is

only character-type data objects are supported at the argument position

"P_PDF_XSTRING".

and this is the coding which we given.

FIELD-SYMBOLS <P>. "workarea for pdf data

p_pdf_string type XSTRING.

ASSIGN str TO <p> TYPE 'X'.

CONCATENATE p_pdf_xstring <p>(len)

INTO p_pdf_xstring.

this concatenate part is giving issue, any body can help to clear the issue. I don't have any idea how can I change it.

1 REPLY 1
Read only

Former Member
0 Likes
370

Hi,

Try this code, finally PDF_CONTENT will have the hexadecimal code. I have just posted a piece of my code.


DATA: PDF_CONTENT        TYPE SOLIX_TAB.
DATA: W_I_SIZE TYPE I,
      I_DOCS  TYPE TABLE OF DOCS,
      I_LINES TYPE TABLE OF TLINE.
DATA: I_OTF TYPE TSFOTF.

DATA: I_BIN TYPE SOLIX_TAB.

data: gd_buffer type string,
it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE.
.



  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
         EXPORTING  formname           = 'SF_EXAMPLE_01'
*                 variant            = ' '
*                 direct_call        = ' '
         IMPORTING  fm_name            = lf_fm_name
         EXCEPTIONS no_form            = 1
                    no_function_module = 2
                    OTHERS             = 3.
    IF sy-subrc <> 0.
*   error handling
    ENDIF.


    ls_control_param-getotf = 'X'.
    ls_control_param-NO_DIALOG = 'X'.

* call smartform invoice
      CALL FUNCTION lf_fm_name
           EXPORTING
                      archive_index        = toa_dara
                      archive_parameters   = arc_params
                      control_parameters   = ls_control_param
*                 mail_appl_obj        =
                      mail_recipient       = ls_recipient
                      mail_sender          = ls_sender
                      output_options       = ls_composer_param
                      user_settings        = space
                      CUSTOMER              = I_CUST
                      BOOKINGS              = I_BOOK
                      CONNECTIONS           = I_CONN
                      is_repeat            = repeat
           importing  job_output_info      = ls_job_info
*                     document_output_info =
*                     job_output_options   =
           EXCEPTIONS formatting_error     = 1
                      internal_error       = 2
                      send_error           = 3
                      user_canceled        = 4
                      OTHERS               = 5.
      IF sy-subrc = 0.

         I_OTF = LS_JOB_INFO-OTFDATA[].

      endif.

  CALL FUNCTION 'CONVERT_OTF_2_PDF'
*    EXPORTING
*      USE_OTF_MC_CMD               = 'X'
*      ARCHIVE_INDEX                =
    IMPORTING
      BIN_FILESIZE                 =   w_i_size
     TABLES
       OTF                          =  I_OTF
       DOCTAB_ARCHIVE               =  I_docs
       LINES                        =  I_LINES
*    EXCEPTIONS
*      ERR_CONV_NOT_POSSIBLE        = 1
*      ERR_OTF_MC_NOENDMARKER       = 2
*      OTHERS                       = 3
             .
   IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
   ENDIF.

   CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
     EXPORTING
       INPUT_LENGTH       = w_i_size
      FIRST_LINE         = 0
      LAST_LINE          = 0
    IMPORTING
      BUFFER             =  w_xstr
     TABLES
       BINARY_TAB         = it_mess_att
    EXCEPTIONS
      FAILED             = 1
      OTHERS             = 2
             .
   IF SY-SUBRC <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
   ENDIF.

* Transfer the 132-long strings to 255-long strings
LOOP AT i_lines into wa_lines.
TRANSLATE wa_lines USING '~'.
CONCATENATE gd_buffer wa_lines INTO gd_buffer.
ENDLOOP.

TRANSLATE gd_buffer USING '~'.

DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.

PDF_CONTENT = CL_DOCUMENT_BCS=>XSTRING_TO_SOLIX( IP_XSTRING = w_xstr ).

Regards,

Subramanian