2008 Jan 16 3:15 PM
Hi All,
I am trying out an application in which ,i have to enter a commnet in text box and save it.
in the layout i have created a text box and two buttons ie. SAVE and CANCEL.
The following code is of eventhandler onInitialization
data: lv_id type zgtis_http_id.
data: t_tdline type table of tdline,
lw_tdline type tdline,
lv_comm type string.
lv_id = session_id.
Pull in Quote Comments from table*
clear tc.
import t_tdline to t_tdline from
database zgtis_http_indx(qc) id lv_id.
if sy-subrc is initial.
loop at t_tdline into lw_tdline.
if lw_tdline is not initial.
if tc is initial.
move lw_tdline to tc.
else.
concatenate tc lw_tdline into tc
separated by space.
endif.
endif.
endloop.
endif.
Pull in Quote Additional Comments from table*
clear tca.
import t_tdline to t_tdline from
database zgtis_http_indx(qa) id lv_id.
if sy-subrc is initial.
loop at t_tdline into lw_tdline.
if lw_tdline is not initial.
if tca is initial.
move lw_tdline to tca.
else.
concatenate tca lw_tdline into tca
separated by space.
endif.
endif.
endloop.
endif.
replace all occurences of '<br>' in tc
with cl_abap_char_utilities=>cr_lf.
replace all occurences of '<br>' in tca
with cl_abap_char_utilities=>cr_lf.
And the code in eventhandler onInputprocessing is:
data: lv_id type zgtis_http_id.
data: t_tdline type table of tdline,
lv_comm type string.
lv_id = session_id.
navigation->set_parameter( name = 'tC'
value = '' ).
navigation->set_parameter( name = 'tCA'
value = '' ).
case event_id.
Do not save comments*
when 'cancel'.
navigation->set_parameter( 'SESSION_ID' ).
navigation->set_parameter( 'USER_ID' ).
navigation->set_parameter( 'CUSTOMER_ID' ).
navigation->set_parameter( 'PERMS' ).
navigation->set_parameter( 'SLSORG' ). "STANDARD
navigation->next_page( 'DETAILS' ).
Save Comments*
when 'save'.
Convert Comments String to Table to pass between pages*
if tc is not initial.
replace all occurrences of cl_abap_char_utilities=>cr_lf
in tc with '<br>'.
replace all occurrences of '"' in tc with '`'.
call function 'SOTR_SERV_STRING_TO_TABLE'
exporting
text = tc
flag_no_line_breaks = 'X'
line_length = 132
langu = sy-langu
tables
text_tab = t_tdline.
export t_tdline from t_tdline to
database zgtis_http_indx(qc) id lv_id.
clear tc.
else.
delete from database zgtis_http_indx(qc) id lv_id.
endif.
Convert Additional Comments (update only) String to Table*
if tca is not initial.
replace all occurrences of cl_abap_char_utilities=>cr_lf
in tca with '<br>'.
replace all occurrences of '"' in tca with '`'.
clear t_tdline.
call function 'SOTR_SERV_STRING_TO_TABLE'
exporting
text = tca
flag_no_line_breaks = 'X'
line_length = 132
langu = sy-langu
tables
text_tab = t_tdline.
export t_tdline from t_tdline to
database zgtis_http_indx(qa) id lv_id.
clear tca.
else.
delete from database zgtis_http_indx(qa) id lv_id.
endif.
navigation->set_parameter( name = 'tC'
value = '' ).
navigation->set_parameter( name = 'tCA'
value = '' ).
navigation->set_parameter( 'SESSION_ID' ).
navigation->set_parameter( 'USER_ID' ).
navigation->set_parameter( 'CUSTOMER_ID' ).
navigation->set_parameter( 'PERMS' ).
navigation->set_parameter( 'SLSORG' ).
navigation->next_page( 'DETAILS' ).
endcase.
The table ZGTIS_HTTP-INDX is a copy of the standard tabel INDX in which the second field table specific key fields by inserting an include .
This include has three fields SESSIONID , RFC , INPUTDATA . and this include is a key field in ZGTIS_HTTP_INDX.
Now can anyone please tell me that where are the comments that i enter in the text box are stored and how can i see them?
Thanks,
Anubhav.
2008 Jan 16 10:00 PM
hi,
when you save the data in a cluster you cannot see them directly in the table but you need to create a program for reading them in fact if you go in the cluster the last 2 fields are
CLUSTR
CLUSTD
the first contain the lenght of the field
the second contain the data compressed.
hope that it is useful for you
Regards
Marco
2008 Jan 16 10:00 PM
hi,
when you save the data in a cluster you cannot see them directly in the table but you need to create a program for reading them in fact if you go in the cluster the last 2 fields are
CLUSTR
CLUSTD
the first contain the lenght of the field
the second contain the data compressed.
hope that it is useful for you
Regards
Marco
2008 Jan 16 10:05 PM
Hi Marco,
It will be great if you could give me a hint of the program required to read data from cluster tables.
Many many thaks for the reply!
Regards,
Anubhav.
2008 Jan 16 11:27 PM
hi,
here is an example for extract the text in your cluster.
create only the dynpro 100.
>REPORT zget_text.
>DATA: lv_id TYPE zgtis_http_id
>data: t_tdline TYPE TABLE OF tdline.
>DATA: dialog TYPE REF TO cl_gui_dialogbox_container.
>DATA: editor TYPE REF TO cl_gui_textedit.
>IMPORT t_tdline FROM DATABASE zgtis_http_indx(qa) ID lv_id.
>
>CALL SCREEN 100.
>----
>MODULE status_0100 OUTPUT.
> CREATE OBJECT dialog
> EXPORTING
> width = 540
> height = 100
> top = 150
> left = 150
> repid = sy-cprog
> dynnr = sy-dynnr.
>
> CREATE OBJECT editor
> EXPORTING
> parent = dialog.
>
> CALL METHOD editor->set_text_as_r3table
> EXPORTING
> table = t_tdline
> EXCEPTIONS
> error_dp = 1
> error_dp_create = 2
> OTHERS = 3.
>ENDMODULE. " STATUS_0100 OUTPUT
>----
>MODULE user_command_0100 INPUT.
> LEAVE PROGRAM.
>ENDMODULE. " USER_COMMAND_0100 INPUT
regards
Marco
Edited by: nicolai marco on Jan 17, 2008 12:27 AM
2008 Jan 17 3:16 PM
Hi Marco,
The program looks perfect , but thers a small problem....the table ZGTIS_HTTP_INDX is showing only one record and even that is not coming in text format through this program .
Thanks & Regards,
Anubhav .
Edited by: Anubhav Jain on Jan 17, 2008 6:12 PM
2008 Jan 17 5:34 PM
hi,
it's normal. when you use import and export command for reading or saving data in a cluster the key is the ID.
In your code
>* Convert Additional Comments (update only) String to Table
>if tca is not initial.
>replace all occurrences of cl_abap_char_utilities=>cr_lf
>in tca with '
>'.
>replace all occurrences of '"' in tca with '`'.
>clear t_tdline.
>call function 'SOTR_SERV_STRING_TO_TABLE'
>exporting
>text = tca
>flag_no_line_breaks = 'X'
>line_length = 132
>langu = sy-langu
>tables
>text_tab = t_tdline.
>export t_tdline from t_tdline to
>database zgtis_http_indx(qa) id lv_id.
>clear tca.
>else.
>delete from database zgtis_http_indx(qa) id lv_id.
>endif.
the lv_id ,here, has the same value of lv_id used in the import command so you overwrite the data.
if you want to trace all modification on the text you have to put them in the ID of the cluster or append the new information to the old text.
However, the number of records that are written by the Export command to the database depends on how many data are included in the internal table that you pass by parameters of the command and not by the number of saves that you made.
I hope that I have explain well the funcionality of the Cluster. my English isn't very good
bye
Marco
2008 Jan 17 8:40 PM
Thanks for all the great information.
For full information on Cluster Tables please go through the following link:
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3c1f358411d1829f0000e829fbfe/content.htm
Best Regards,
Anubhav.
Edited by: Anubhav Jain on Jan 18, 2008 4:23 PM