2007 Mar 11 6:23 AM
Dear Experts,
<b>I am using 4.6c system and using RPY_VIEW_INSERT for creating views.
I am getting an error code = 6 [DB_ACCESS_ERROR]. Please help me in this regard.</b>
Please see the code below -
[code]&----
*& Report ZCREATEVIEW
*&
&----
*&
*&
&----
REPORT ZCREATEVIEW.
itabs for RPY_VIEW_READ
DATA : LV_VIEW1 LIKE RPY_VIHD-VIEWNAME.
DATA : WA_VIEW_HEAD1 LIKE RPY_VIHD.
DATA : IT_VIEW_FIELDS1 LIKE RPY_VIFD OCCURS 0 WITH HEADER LINE.
DATA : IT_VIEW_SELCONDS1 LIKE RPY_VISC OCCURS 0 WITH HEADER LINE.
DATA : IT_VIEW_TABLES1 LIKE RPY_VITB OCCURS 0 WITH HEADER LINE.
itabs for RPY_VIEW_READ
itabs for RPY_VIEW_INSERT
DATA : LV_VIEW LIKE RPY_VIHD-VIEWNAME,
LV_TRANSPORT LIKE RGLIF-TRKORR,
LV_DEVCLASS LIKE RGLIF-DEVCLASS.
DATA : WA_VIEW_HEAD LIKE RPY_VIHD.
DATA : IT_VIEW_FIELDS LIKE RPY_VIFD_U OCCURS 0 WITH HEADER LINE.
DATA : IT_VIEW_SELCONDS LIKE RPY_VISC OCCURS 0 WITH HEADER LINE.
DATA : IT_VIEW_TABLES LIKE RPY_VITB OCCURS 0 WITH HEADER LINE.
itabs for RPY_VIEW_INSERT
START-OF-SELECTION.
get the data from SAP to populate the required entries.
CLEAR : LV_VIEW1.
CLEAR : WA_VIEW_HEAD1.
CLEAR : IT_VIEW_FIELDS1, IT_VIEW_FIELDS1[].
CLEAR : IT_VIEW_SELCONDS1, IT_VIEW_SELCONDS1[].
CLEAR : IT_VIEW_TABLES1, IT_VIEW_TABLES1[].
LV_VIEW1 = 'LIPS_VLPMA'.
CALL FUNCTION 'RPY_VIEW_READ'
EXPORTING
ACTIVATION_TYPE_I = 'M'
LANGUAGE = SY-LANGU
VIEW_NAME = LV_VIEW1
IMPORTING
VIEW_HEAD = WA_VIEW_HEAD1
TABLES
VIEW_FIELDS = IT_VIEW_FIELDS1
VIEW_SELCONDS = IT_VIEW_SELCONDS1
VIEW_TABLES = IT_VIEW_TABLES1
EXCEPTIONS
CANCELLED = 1
NOT_FOUND = 2
PERMISSION_ERROR = 3
ILLEGAL_TYPE = 4
OTHERS = 5.
to create view call the Function module
CLEAR : LV_VIEW, LV_TRANSPORT, LV_DEVCLASS.
CLEAR : WA_VIEW_HEAD.
CLEAR : IT_VIEW_FIELDS, IT_VIEW_FIELDS[].
CLEAR : IT_VIEW_SELCONDS, IT_VIEW_SELCONDS[].
CLEAR : IT_VIEW_TABLES, IT_VIEW_TABLES[].
LV_VIEW = 'ZLIPS_VLPMA'.
You can assign the devlopment class and Transport number when
when requests in a pop-Up box.
LV_TRANSPORT = 'CR1K900223'.
LV_DEVCLASS = '$TMP'.
IF NOT WA_VIEW_HEAD1 IS INITIAL.
populate View Attributes
WA_VIEW_HEAD-VIEWNAME = LV_VIEW.
WA_VIEW_HEAD-LANGUAGE = 'EN'.
WA_VIEW_HEAD-AGGTYPE = 'V'.
WA_VIEW_HEAD-READONLY =
WA_VIEW_HEAD-ROOTTAB = 'VLPMA'.
*WA_VIEW_HEAD-MOD_USER =
*WA_VIEW_HEAD-MOD_DATE =
*WA_VIEW_HEAD-MOD_TIME =
WA_VIEW_HEAD-DDTEXT = 'NEW VIEW'.
WA_VIEW_HEAD-VIEWCLASS = 'C'.
WA_VIEW_HEAD-MASTERLANG = 'EN'.
WA_VIEW_HEAD-DELIVERYCL = 'A'.
*WA_VIEW_HEAD-VIEWGRANT =
MOVE-CORRESPONDING WA_VIEW_HEAD1 TO WA_VIEW_HEAD.
populate View Fields
IF NOT IT_VIEW_FIELDS1[] IS INITIAL.
CLEAR : IT_VIEW_FIELDS1.
LOOP AT IT_VIEW_FIELDS1.
IT_VIEW_FIELDS-VIEWNAME = LV_VIEW.
MOVE-CORRESPONDING IT_VIEW_FIELDS1 TO IT_VIEW_FIELDS.
APPEND IT_VIEW_FIELDS.
CLEAR IT_VIEW_FIELDS.
ENDLOOP.
ENDIF.
populate view selection Conditions
IF NOT IT_VIEW_SELCONDS1[] IS INITIAL.
CLEAR IT_VIEW_SELCONDS1.
LOOP AT IT_VIEW_SELCONDS1.
IT_VIEW_SELCONDS-VIEWNAME = LV_VIEW.
MOVE-CORRESPONDING IT_VIEW_SELCONDS1 TO IT_VIEW_SELCONDS.
APPEND IT_VIEW_SELCONDS.
CLEAR IT_VIEW_SELCONDS.
ENDLOOP.
ENDIF.
populate table join
IF NOT IT_VIEW_TABLES1 IS INITIAL.
CLEAR IT_VIEW_TABLES1.
LOOP AT IT_VIEW_TABLES1.
IT_VIEW_TABLES1-VIEWNAME = LV_VIEW.
MOVE-CORRESPONDING IT_VIEW_TABLES1 TO IT_VIEW_TABLES.
APPEND IT_VIEW_TABLES.
CLEAR IT_VIEW_TABLES.
ENDLOOP.
ENDIF.
ENDIF.
for WA_VIEW_HEAD1 IS INITIAL.
Call the FM 'RPY_VIEW_INSERT'
CALL FUNCTION 'RPY_VIEW_INSERT'
EXPORTING
LANGUAGE = SY-LANGU
VIEW_NAME = LV_VIEW
TRANSPORT_NUMBER = LV_TRANSPORT
DEVELOPMENT_CLASS = LV_DEVCLASS
VIEW_HEAD = WA_VIEW_HEAD
TABLES
VIEW_FIELDS = IT_VIEW_FIELDS
VIEW_SELCONDS = IT_VIEW_SELCONDS
VIEW_TABLES = IT_VIEW_TABLES
EXCEPTIONS
CANCELLED = 1
ALREADY_EXIST = 2
PERMISSION_ERROR = 3
NAME_NOT_ALLOWED = 4
NAME_CONFLICT = 5
DB_ACCESS_ERROR = 6
OTHERS = 7.
IF SY-SUBRC = 0.
COMMIT WORK AND WAIT.
ACTIVATE THE CREATED TABLES
CALL FUNCTION 'DDIF_VIEW_ACTIVATE '
EXPORTING
NAME = LV_VIEW.
IF SY-SUBRC = 0.
COMMIT WORK AND WAIT.
ENDIF.
ENDIF.
END-OF-SELECTION.
[/code]
<b>I have also debugged thisFM [RPY_VIEW_INSERT ] and I get an error in the FM DD_VIEW_PUT.
If I debug further the FM - DD_VIEW_PUT, this errors out as an SQL error.</b>
Experts Please help..
Thanks in Advance.
2007 Mar 12 6:41 AM
I have answered this query myself.
Solution - The Internal tables passed to the FM was not correct.
Thanks for viewing and your interest.