Skip to Content
avatar image
Former Member

Concatenate Internal table to string separeted by ';' - Could anybody help?

Hi forum,

I want to concatenate an internal table with lots of fields into a string type c length 1023.

But the internal table includes some fields, which are not type char (NUMC, DEC and INT4).

Here the tablefields:

SCMG_CASE_GUID CHAR

SCMGSTATUSONR NUMC

SCMGSTAT_DESCR CHAR

SCMG_EXT_KEY CHAR

SCMG_CREATE_TIME DEC

SCMG_CHANGE_TIME DEC

ZCRM_TEAM_244 CHAR

Z_CRM_TEAMN_244 CHAR

ZCRM_TEAMSINCE_244 DEC

ZCRM_DURATION_244 DEC

ZCRM_CASE_DESCR_244 CHAR

ZCRM_TAXLEVEL1_244 CHAR

ZCRM_TAXLEVEL2_244 CHAR

ZCRM_TAXLEVEL3_244 CHAR

BU_PARTNER CHAR

ZCRM_COMPANY_244 CHAR

ZCRM_NOACTIONS_244 INT4

ZCRM_ACTIVI_244 CHAR

ZCRM_ACTIVI_DESC_244 CHAR

When I concatenate this fields, for example, via coding:

CONCATENATE out_cases-stat_ordno_descr out_cases-create_time

into iv_string SEPARATED BY ';'.

then I get the error:

"OUT_CASES-CREATE_TIME" must be a character-type data object (data type

C, N, D, T or STRING). field string)."

Could anybody help me, to get this fields from internal tab to a string separated by ; ???

Thanks in advance

Thorsten

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Jan 18, 2008 at 05:00 PM

    hi Thorsten,

    first move the non character fields to character type fields (temporarly) and concatenate after that:

    DATA : lv_char(n) TYPE c.

    ...

    lv_char = OUT_CASES-CREATE_TIME.

    ...

    CONCATENATE ...lv_char ... SEPARATED BY ';'.

    hope this helps

    ec

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 18, 2008 at 05:01 PM

    Hi forum,

    I want to concatenate an internal table with lots of fields into a string type c length 1023.

    But the internal table includes some fields, which are not type char (NUMC, DEC and INT4).

    Here the tablefields:

    SCMG_CASE_GUID CHAR

    SCMGSTATUSONR NUMC

    SCMGSTAT_DESCR CHAR

    SCMG_EXT_KEY CHAR

    SCMG_CREATE_TIME DEC

    SCMG_CHANGE_TIME DEC

    ZCRM_TEAM_244 CHAR

    Z_CRM_TEAMN_244 CHAR

    ZCRM_TEAMSINCE_244 DEC

    ZCRM_DURATION_244 DEC

    ZCRM_CASE_DESCR_244 CHAR

    ZCRM_TAXLEVEL1_244 CHAR

    ZCRM_TAXLEVEL2_244 CHAR

    ZCRM_TAXLEVEL3_244 CHAR

    BU_PARTNER CHAR

    ZCRM_COMPANY_244 CHAR

    ZCRM_NOACTIONS_244 INT4

    ZCRM_ACTIVI_244 CHAR

    ZCRM_ACTIVI_DESC_244 CHAR

    "define another field type char and assign value before concatenate..
    DATA : t_str(255).
    t_str = out_cases-create_time.
           CONCATENATE out_cases-stat_ordno_descr t_str
             into iv_string SEPARATED BY ';'.
    
    

    When I concatenate this fields, for example, via coding:

    CONCATENATE out_cases-stat_ordno_descr out_cases-create_time

    into iv_string SEPARATED BY ';'.

    then I get the error:

    "OUT_CASES-CREATE_TIME" must be a character-type data object (data type

    C, N, D, T or STRING). field string)."

    Could anybody help me, to get this fields from internal tab to a string separated by ; ???

    Thanks in advance

    Thorsten

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 18, 2008 at 05:02 PM

    data : begin of i_out_cases,
      SCMG_CASE_GUID CHAR type c,
      coma type c value ';',
      SCMGSTATUSONR NUMC
      coma1 type c value ';',
      ....
      ....
      ....
      ....
    data : end of i_out_cases.
    
    loop at out_cases 
      move corresponding out_cases to i_out_cases.
      append i_out_cases.
    endloop.
    
    class cl_abap_container_utilities definition load.
    loop at i_out_cases.
     
     call method cl_abap_container_utilities=>fill_container_c
        exporting
          im_value               = i_out_cases
        importing
          ex_container           = iv_string 
        exceptions
          illegal_parameter_type = 1
          others                 = 2.
     
    endloop.
    

    a®s

    Edited by: a®s on Jan 18, 2008 12:16 PM

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 18, 2008 at 05:13 PM

    Hi Thorsten

    check this code:

    DATA : lf_buf TYPE string,

    lf_line TYPE string.

    FIELD-SYMBOLS : <fs_record>,<fs_comp>.

    LOOP AT p_final_table ASSIGNING <fs_record>.

    DO.

    ASSIGN COMPONENT sy-index OF STRUCTURE <fs_record> TO <fs_comp>.

    IF sy-subrc <> 0.

    EXIT.

    ENDIF.

    lf_buf = <fs_comp>.

    CONCATENATE lf_line lf_buf INTO lf_line SEPARATED BY c_tab.

    ENDIF.

    CLEAR lf_buf.

    ENDDO.

    APPEND lf_line TO p_output_file.

    CLEAR lf_line.

    ENDLOOP.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 18, 2008 at 07:40 PM

    Thank you very much to all of you. I`ll check your suggestions. So, one last question from my side:

    If I want to concatenate a 40 character field (CHAR 40), which has for example only 10 letters in this field, and I do not want to concatenate the leading <blanks> from this field into string, is there a facility, to cut this <blanks> before concatenate to the string field?

    Add comment
    10|10000 characters needed characters exceeded