2007 Apr 25 3:58 AM
Hello Experts,
I'm now working on a dynamic open sql generator under version: 46C. The code which is proved correct under 610 turns out to run into some error under 46C. Here attaches my code:
SELECT SINGLE (p_sel_cls)
FROM (p_tabname) INTO li_fldresult
WHERE (p_where_cls).
p_sel_cls, p_tabname and p_where_cls are all dynamically constructed.
The compiling error is:
p_sel_cls is not an internal table.
Could anyone help me out? Thanks a lot.
Best regards,
James
2007 Apr 25 5:42 AM
Hi,
In 46C p_tabname can be a variable
p_sel_cls, p_where_cls should be an internal table.
Declare p_sel_cls and p_where_cls as internal tables.
Append you dynamic clause in these internal tables and check.
Thanks and regards,
S. Chandra Mouli.
Hi Experts,
Can anyone help me with this? The datatype of the database field is: CHAR with length 30 and I use a ABAP type: char with length 100 to hold this, the error says data read during the select access couldn't be inserted into the target field.
So how can I define a ABAP variable to receive db selection field.
Thanks a lot.
Regards,
James Xie
2007 Apr 25 5:42 AM
Hi,
In 46C p_tabname can be a variable
p_sel_cls, p_where_cls should be an internal table.
Declare p_sel_cls and p_where_cls as internal tables.
Append you dynamic clause in these internal tables and check.
Thanks and regards,
S. Chandra Mouli.
2007 Apr 25 5:47 AM
The original error disappears and now the error is:
li_fldresult cannot be a table, a reference, a string or contain any of these objects.
Could you let me know how I can hold the result? Thanks a lot.
Regards,
James Xie
2007 Apr 25 6:12 AM
2007 Apr 25 6:16 AM
2007 Apr 26 3:49 AM
Hi Experts,
Can anyone help me with this? The datatype of the database field is: CHAR with length 30 and I use a ABAP type: char with length 100 to hold this, the error says data read during the select access couldn't be inserted into the target field.
So how can I define a ABAP variable to receive db selection field.
Thanks a lot.
Regards,
James Xie
2007 Apr 26 5:27 AM
Hi James,
Try the following code:
[code]
DATA: tabname LIKE dd03l-tabname VALUE 'T001'.
DATA: BEGIN OF fieldtab OCCURS 0,
text(100),
END OF fieldtab.
DATA: BEGIN OF destab OCCURS 0,
text(100),
END OF destab.
DATA dref TYPE REF TO data.
FIELD-SYMBOLS: <fs> TYPE ANY.
creates dynamic data
CREATE DATA dref TYPE (tabname).
ASSIGN dref->* TO <fs>.
*
fieldtab-text = 'BUKRS'.
APPEND fieldtab.
fieldtab-text = 'BUTXT'.
APPEND fieldtab.
SELECT SINGLE (fieldtab) INTO <fs> FROM (tabname).
/code]
Thanks and regards,
S. Chandra Mouli.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |