on 06-03-2004 11:59 PM
Hi everyone!!
I am trying to create a function module that updates data of a table from an internal table. and it gives me a error saying that the Tablename is smaller than the table itself.
If some can help me I will appreciate it.
Here is the code.
FUNCTION Z_SAVE_DATA.
*"----
""Local interface:
*" IMPORTING
*" VALUE(TABLENAME) TYPE SOBJ_NAME
*" TABLES
*" ITTAB
*" EXCEPTIONS
*" DB_ERROR
*" NOT_FOUND
*" WRONG_PARAM
*" INTERNAL_ERROR
*"----
DATA: DBCNT LIKE SY-DBCNT.
UPDATE (TABLENAME) FROM TABLE ITTAB.
IF SY-SUBRC > 0.
RAISE NOT_FOUND.
ENDIF.
CALL 'C_MOD_TABLE' ID 'TABLNAME' FIELD TABLENAME
ID 'ITTAB' FIELD ITTAB-SYS
ID 'FCODE' FIELD 'U'
ID 'DBCNT' FIELD DBCNT.
SET EXTENDED CHECK OFF.
SY-DBCNT = DBCNT.
SET EXTENDED CHECK ON.
CASE SY-SUBRC.
WHEN 0.
WHEN 1.
RAISE DB_ERROR.
WHEN 4.
RAISE NOT_FOUND.
WHEN 8.
RAISE WRONG_PARAM.
WHEN OTHERS.
RAISE INTERNAL_ERROR.
ENDCASE.
ENDFUNCTION.
Thanks in advance.
Fidel Peralta
Hi!
One alternative is that you can use some other dynamic operations by defining and creating dynamic data. For much information inspect SAPhelp for "CREATE DATA" and field-symbols.
Another way is to generate subroutine pools at runtime. For this, refer to the keyword 'GENERATE SUBROUTINE POOL <itab> NAME <name>.'
It is not exactly about what we talk about but you may like to look at the thread:
And I think I must remind the warning about "GENERATE ..." statement:
"This statement is for internal use only.
Incompatible changes or further developments may occur at any time without warning or notice."
*--Serdar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Fidel,
difficult to tell from here. Set a break point and check in the debugger that the structure in "tablename" matches a line in ittab. It looks to me as if the function module might be called with incorrect parameters.
Sorry for not being able to help more
Joerg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Fidel,
I meant something else: look at the content of the field "tablename" at runtime(!). The string contains the name of a structure. This structure must be compatible with one line of ittab. SOBJ_NAME is not important here; important is what is contained there when the function module is called.
Please try the debugging and tell me the results; I'll try to take it from there.
Regards
Joerg
User | Count |
---|---|
7 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.