‎2009 Aug 31 8:14 AM
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
‎2009 Aug 31 8:40 AM
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
‎2009 Aug 31 8:29 AM
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
‎2009 Aug 31 8:40 AM
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
‎2009 Aug 31 9:25 AM
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.
‎2009 Aug 31 9:35 AM
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.