Hello,
I need to display/modify/insert entries of a Z table in the BSP. I read pcui cook book, but I have doubts...
This is my scenario:
Select data from Z-Table in method: IF_CRM_BSP_MODEL_ACCESS_IL~QUERY
Display data in BSP with method: IF_CRM_BSP_MODEL_ACCESS_IL~READ
Insert/Modify data of Z-Table in method: IF_CRM_BSP_MODEL_ACCESS_IL~MODIFY???
Method Modify:
FIELD-SYMBOLS: <ft_data> TYPE ZTABLE,
<fs_new_data> TYPE ZTABLE.
" Mapping table
ASSIGN it_screen_structure TO <ft_data>.
" Read data from BSP
READ TABLE <ft_data> INDEX 1 ASSIGNING <fs_new_data>.
" Check if is a new entry
IF <fs_new_data>-object_key IS INITIAL.
APPEND ls_new_data TO me->gt_data.
ENDIF.
....
" If is a new entry
IF <fs_new_data>-object_key IS INITIAL.
" Create GUID
CALL FUNCTION 'GUID_CREATE'
IMPORTING
ev_guid_32 = lv_guid.
" Insert data in ZTABLE
TRY.
INSERT ZTABLE FROM ls_zstructure.
CATCH cx_sy_open_sql_db.
ENDTRY.
ELSE.
" Insert data in ZTABLE
TRY.
MODIFY ZTABLE FROM ls_zstructure.
CATCH cx_sy_open_sql_db.
ENDTRY
ENDIF.
Is this correct?
Can you give me explain how to do it and if there is any way to check the data before insert?
Thanks in advance!!
Jose