‎2012 Feb 26 7:12 PM
Hi guys,
I'm trying to do this
INSERT (l_nametab) FROM TABLE <dynamic_table>.
where:
DATA: l_nametab TYPE TABNAME VALUE 'PA0002'.
FIELD-SYMBOLS: <dynamic_table> TYPE STANDARD TABLE.
DATA: dy_table2 type ref to data.
CREATE DATA dy_table2 TYPE STANDARD TABLE OF (l_nametab).
ASSIGN dy_table2->* TO <dynamic_table>
... but I received this runtime error:
DBIF_RSQL_INTERNAL_ERROR
Internal error when accessing a table.
The current ABAP/4 program terminated due to
an internal error in the database interface.
An internal error in the database interface occurred during access to
the data of table "PA0002 ".
The situation points to an internal error in the SAP software
or to an incorrect status of the respective work process.
For further analysis the SAP system log should be examined
(transaction SM21).
For a precise analysis of the error, you should supply
documents with as many details as possible.
Does anybody know how can it be solved?
I'll really apreciate it.
Thanks and Regards.
‎2012 Feb 26 10:14 PM
Hi
Your code it seems to be ok, so I don't think the error can be due by your code, you should explain how you fill your dynamic table or you should check if there is a problem for that table in your db
Max
‎2012 Feb 27 1:27 AM
Hi Max,
How can I upload this data if I'm reading the info from an Input File.
The FM HR_INFOTYPE_OPERATION is useless because the UNAME fild doesn't remain into the record. They really need these field.
The main idea of these program is to read the Input File Line, wich can belong to any infotype.
I'm already reading the Infotype data from the input file and I need to transfer it to the PAXXXX table.
Next, a little explanation of it:
This program is to INSERT DATA INTO HR TABLES...
The FM HR_INFOTYPE_OPERATION is useless in this process...
Only with INSERT dbtab it has to be done!!!
1.- Read HR data from an input file. The data type of the file lines is PRELP.
2.- Get the input file data into an internal table (TYPE PRELP) using the ABAP Method CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD.
3.- Get the DDic. Table Name using CONCATENATE 'PA' wa_file-infty INTO l_nametab.
4.- Get the DDic.Struct.Name using CONCATENATE 'P' wa_file-infty INTO l_nametype.
5.- Assign values with the same code:
FIELD-SYMBOLS: <dyn_table> type standard table,
<dyn_wa>,
<dyn_field>.
FIELD-SYMBOLS: <dyn_table2> type standard table,
<dyn_wa2>,
<dyn_field2>.
DATA: dy_table2 type ref to data,
dy_line2 type ref to data.
DATA: dy_table type ref to data,
dy_line type ref to data,
CREATE DATA dy_table TYPE STANDARD TABLE OF (l_nametype).
ASSIGN dy_table->* TO <dyn_table>.
" Create dynamic work area and assign to FS
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.
CREATE DATA dy_table2 TYPE STANDARD TABLE OF (l_nametab).
ASSIGN dy_table2->* TO <dyn_table2>.
" Create dynamic work area and assign to FS
CREATE DATA dy_line2 LIKE LINE OF <dyn_table2>.
ASSIGN dy_line2->* TO <dyn_wa2>.
6.- Convert the Input File Line from PRELP type to PNNNN type with the ABAP method
CL_HR_PNNNN_TYPE_CAST=>PRELP_TO_PNNNN EXPORTING PRELP = wa_file
IMPORTING PNNNN = <dyn_wa>.
7.- As <dyn_wa2> and <dyn_table2> are of PANNNN Data Type, there is an structure with the MANDT field to be assigned to it:
" Type Definition
TYPES: BEGIN OF type_mandt,
mandt TYPE MANDT,
END OF type_mandt.
" Structure Definition
DATA: wa_mandt TYPE type_mandt.
" Structure value assignation
wa_mandt-mandt = sy-mandt.
8.- Assign corresponding values and INSERT INTO dbtab
MOVE-CORRESPONDING <dyn_wa> TO <dyn_wa2>. "XXXX
MOVE-CORRESPONDING wa_mandt TO <dyn_wa2>.
APPEND <dyn_wa2> TO <dyn_table2>.
INSERT (l_nametab) FROM TABLE <dyn_table2> ACCEPTING DUPLICATE KEYS.
9.- In these code line, the menctioned runtime error appears.
I hope it can be solved...
Thanks and regards...
‎2012 Feb 28 1:38 PM
Hi,
This error occurs when the structure from which the data is inserted into the table does not match with the table structure.
Just compare both of them.
Regards,
Aravind
‎2012 Feb 28 1:47 PM
Thanks Aravind,
I has already done that comparisson and there are not differences between them.
The workFlow is:
I read from HR file with GUI_DOWNLOAD into a internal table TYPE PRELP.
I use the CL_HR_PNNNN_TYPE_CAST=>PRELP_TO_PNNNN method to CAST the file line TO a PNNNN line.
I move PNNNN line to a dynamic structure TYPE PAxxxx and I also move the MANDT value up to the PAxxxx structure.
... and...
I try to INSERT INTO PAxxxx using dynamic structures and tables to achive it, but the error appears...
Regards.
‎2012 Feb 28 3:28 PM
Hi,
The FM HR_INFOTYPE_OPERATION is useless because the UNAME fild doesn't remain into the record
Still, you should use it to perform operations on HR infotypes... you could then implement a badi to update the uname field accordingly.... Even, I think it's better to use an UPDATE..SET statement after HR_INFOTYPE_OPERATION successfully created the record (At least you only update 1 field on an existing record...)
Using the INSERT statement on a standard infotype is not something advisable...
Cheers,
Manu.
Edited by: Manu D'Haeyer on Feb 28, 2012 4:33 PM
‎2012 Feb 28 10:06 PM
Hi Manu,
I really would like to use the FM HR_INFOTYPE_OPERATION but the client really need the UNAME and AEDTM fields.
That's the reason why I'm using the INSERT. I saw that the problem is not the INSERT statement. Is the GUI_DOWNLOAD method. When I read the data using it, something is different.
I checked the data in both sides and it seems to be equal.
Now, I don't know how can it be solved.
Regards...
‎2012 Feb 28 10:26 PM
I think Manu has given you the answer. Use the FM and change the fields you need to after the data has been inserted. Since the FM uses the logic from the dialogs for the individual infotypes, you won't be able to change the data there.
I would process the file in two steps:
1) Read the file and use the FM to do the inserts
2) Read the file again and change the fields you need to.
Doing it in that order will hopefully reduce the chances of lock conflicts.
Rob
‎2012 Feb 28 2:22 PM
I Think you sould find a bapi before trying the insert into standard table
regards, sebastian
‎2012 Feb 28 3:12 PM
- Take a look at SM21 for the actual SQL error message (*)
- Truly you must not use INSERT statement on standard table, where are the checks for consistency , good luck for next steps... (**)
- MOVE-CORRESPONDING <dyn_wa> TO <dyn_wa2>. " Are you sure, check via debug the value of <dyn_wa2> after the statement (***)
Regards,
Raymond
(*) Is it mapping invalid data, duplicate records, other database error message...(ORA-0060 or the like)
(**) Exception - if you are copying data to a sandbox
(***) Try to map like CL_HR_PNNNN_TYPE_CAST methods, basically are you sure your field symbols are recognized for structure by Abap