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

Dump while trying to assign components .

Former Member
0 Likes
1,875

HI all,

i using this code for in order to get table and add it to csv file with delimiter

and i get dump

Error analysis

At the statment

"CONCATENATE"

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

position "<F>".

In this particular case, the operand "<F>" has the non-charcter-type type

"P".

but the field symbol is type any .

DATA: intab TYPE TABLE OF agr_users,
wa_intab LIKE LINE OF intab,
no_of_rec TYPE i,
count TYPE i.
DATA: BEGIN OF f_intab,
str(255) TYPE c,
END OF f_intab.
DATA: t_intab LIKE TABLE OF f_intab,
w_intab LIKE LINE OF t_intab,
temp(255) TYPE c.
FIELD-SYMBOLS: <f> TYPE any.
data delimit TYPE c value ';'.

  SELECT *
 FROM agr_users INTO CORRESPONDING FIELDS OF TABLE intab.


   DO.
      ASSIGN COMPONENT sy-index OF STRUCTURE wa_intab TO <f>.
      IF sy-subrc <> 0.
        EXIT.
      ELSE.
        count = count + 1.
      ENDIF.
    ENDDO.
    LOOP AT intab INTO wa_intab.
      DO count TIMES. " Adding the delimiter in required places
        ASSIGN COMPONENT sy-index OF STRUCTURE wa_intab TO <f>. "here is the dump 
        CONCATENATE temp delimit <f> INTO temp.
      ENDDO.
      SHIFT temp.
      APPEND temp TO t_intab.


      CLEAR temp.
    ENDLOOP.

How i can overcome this issue ?

Regards

Joy

1 ACCEPTED SOLUTION
Read only

faisalatsap
Active Contributor
0 Likes
1,146

Hi, Joy

i have done some changes in you code now it is working fine check the bellow and reply in case of any issue,

TYPES:  BEGIN OF ty_agr_users ,  " Add this
        mandt TYPE mandt,
        agr_name TYPE agr_name,
        uname TYPE xubname,
        from_dat TYPE agr_fdate,
        to_dat TYPE agr_tdate,
        exclude TYPE agr_excl,
        change_dat TYPE menu_date,
        change_tim TYPE menu_time,
        change_tst(16)," TYPE rstimestmp,
        org_flag TYPE agr_org,
        col_flag TYPE agr_col,
        END OF ty_agr_users.

DATA: intab TYPE TABLE OF ty_agr_users,
      wa_intab LIKE LINE OF intab,
      intab2 TYPE TABLE OF agr_users,  " Add this
      wa_intab2 LIKE LINE OF intab2,  " Add this
      no_of_rec TYPE i,
      count TYPE i.
DATA: BEGIN OF f_intab,
      str(255) TYPE c,
      END OF f_intab.
DATA: t_intab LIKE TABLE OF f_intab,
      w_intab LIKE LINE OF t_intab,
      temp(255) TYPE c.

FIELD-SYMBOLS: <f> TYPE ANY.
DATA delimit TYPE c VALUE ';'.

SELECT *
FROM agr_users INTO CORRESPONDING FIELDS OF TABLE intab2. " Change here

LOOP AT intab2 INTO wa_intab2.   " Add this Loop
  MOVE-CORRESPONDING wa_intab2 TO wa_intab.
  APPEND wa_intab to intab.
ENDLOOP.

DO.
  ASSIGN COMPONENT sy-index OF STRUCTURE wa_intab TO <f>.
  IF sy-subrc NE 0.
    EXIT.
  ELSE.
    count = count + 1.
  ENDIF.
ENDDO.
LOOP AT intab INTO wa_intab.
  DO count TIMES. " Adding the delimiter in required places
    ASSIGN COMPONENT sy-index OF STRUCTURE wa_intab TO <f>. "here is the dump
    CONDENSE <f>.   " Add this
    CONCATENATE temp delimit <f> INTO temp.
  ENDDO.
  SHIFT temp.
  APPEND temp TO t_intab.
  CLEAR temp.
ENDLOOP.

Faisal

4 REPLIES 4
Read only

Former Member
0 Likes
1,146

Hi,

Instead of

'ASSIGN COMPONENT sy-index OF STRUCTURE wa_intab TO <f>. '.

Try this.

Declare

DATA: new_line TYPE REF TO data.

CREATE DATA new_line LIKE LINE OF intab.

ASSIGN new_line->* TO <f>.

In the DO-ENDDO loop, use CONCATENATE, MOVE-CORRESPONDING, etc. It should work.

The catch here is since <f> doesnt have any structure, it is not able to cast/determine the values your are trying to pass.

Regards,

Amit

Read only

faisalatsap
Active Contributor
0 Likes
1,147

Hi, Joy

i have done some changes in you code now it is working fine check the bellow and reply in case of any issue,

TYPES:  BEGIN OF ty_agr_users ,  " Add this
        mandt TYPE mandt,
        agr_name TYPE agr_name,
        uname TYPE xubname,
        from_dat TYPE agr_fdate,
        to_dat TYPE agr_tdate,
        exclude TYPE agr_excl,
        change_dat TYPE menu_date,
        change_tim TYPE menu_time,
        change_tst(16)," TYPE rstimestmp,
        org_flag TYPE agr_org,
        col_flag TYPE agr_col,
        END OF ty_agr_users.

DATA: intab TYPE TABLE OF ty_agr_users,
      wa_intab LIKE LINE OF intab,
      intab2 TYPE TABLE OF agr_users,  " Add this
      wa_intab2 LIKE LINE OF intab2,  " Add this
      no_of_rec TYPE i,
      count TYPE i.
DATA: BEGIN OF f_intab,
      str(255) TYPE c,
      END OF f_intab.
DATA: t_intab LIKE TABLE OF f_intab,
      w_intab LIKE LINE OF t_intab,
      temp(255) TYPE c.

FIELD-SYMBOLS: <f> TYPE ANY.
DATA delimit TYPE c VALUE ';'.

SELECT *
FROM agr_users INTO CORRESPONDING FIELDS OF TABLE intab2. " Change here

LOOP AT intab2 INTO wa_intab2.   " Add this Loop
  MOVE-CORRESPONDING wa_intab2 TO wa_intab.
  APPEND wa_intab to intab.
ENDLOOP.

DO.
  ASSIGN COMPONENT sy-index OF STRUCTURE wa_intab TO <f>.
  IF sy-subrc NE 0.
    EXIT.
  ELSE.
    count = count + 1.
  ENDIF.
ENDDO.
LOOP AT intab INTO wa_intab.
  DO count TIMES. " Adding the delimiter in required places
    ASSIGN COMPONENT sy-index OF STRUCTURE wa_intab TO <f>. "here is the dump
    CONDENSE <f>.   " Add this
    CONCATENATE temp delimit <f> INTO temp.
  ENDDO.
  SHIFT temp.
  APPEND temp TO t_intab.
  CLEAR temp.
ENDLOOP.

Faisal

Read only

Former Member
0 Likes
1,146

Try someting like followinf

DATA LS_VALUE(255)TYPE C. "declare a new varaible
LOOP AT intab INTO wa_intab.
  DO.
    ASSIGN COMPONENT sy-index OF STRUCTURE wa_intab TO <f>. "here is the dump
    IF SY-SUBRC NE '0'.
       EXIT. 
    ENDIF.
    CONDENSE <f>.   " Add this
    lv_value = <f>.   "MOVE FIELD SYMBOL TO CHARACTER VARIABLE
    CONCATENATE temp delimit ls_value INTO temp. "Replace FS with character variable
  ENDDO.
  SHIFT temp.
  APPEND temp TO t_intab.
  CLEAR temp.
ENDLOOP.

Read only

Former Member
0 Likes
1,146

Hello Joy,

Dump is not comming for line:


ASSIGN COMPONENT sy-index OF STRUCTURE wa_intab TO <f>.

But it is coming for following statement and it is because you are trying to concatenate type P with type char.


 CONCATENATE temp delimit <f> INTO temp.

Alternative to this problem could be to convert <f> time being into char and then use concatenate.

Hope this helps!

Thanks,

Augustin.