Xml conversion of data refs with dynamic type
Hi Colleagues,
I have to create an XML from a TYPE REF TO DATA, where this data is created using a dynamic internal table. By dynamic internal table i mean that the internal table is created dynamically using the class method cl_alv_table_create=>create_dynamic_table.
Now the problem that i face is when i use the statement:
CALL TRANSFORMATION id
SOURCE jsag_data = im_context_b64
RESULT XML lv_xml
OPTIONS data_refs = 'embedded'
value_handling = 'move'.
to generate the XML i get a dump of type CX_XSLT_SERIALIZATION_ERROR saying "The ABAP data cannot be serialized."
I found a solution to avoid the dump by adding the additional option " TECHNICAL_TYPES = 'ignore' " to the CALL TRANSFORMATION statement, like
CALL TRANSFORMATION id
SOURCE jsag_data = im_context_b64
RESULT XML lv_xml
OPTIONS data_refs = 'embedded'
value_handling = 'move'
TECHNICAL_TYPES = 'ignore'.
But, using this addition the dynamic type ref to data part is totally ignored from the XML generation.
If I use a specific DDIC table type to create the data, we do not face this issue and the XML is generated as desired
Does anyone have a solution to this problem as it has become a sort of blockade for our development?
Thanks and Cheers,
Gaurav.
Hello,
I reached same problem with dynamic data references, the only solution I got is to used global DDIC types (also for table types !!) when creating data which needs to be serialized.
The options technical_types = 'ignore' doesn't solve the problem - it just instructs the parser to skip data references without global ddic type. The options value_handling = 'move' is very helpful as XML serialization is very picky about values beeing serialized.
Here is summary of my observations:
- Global DDIC type has to be associated with data reference, otherwise only technical type is there and this is not supported (you can use OPTIONS TECHNICAL_TYPES = u2018IGNOREu2019 but this will just skip the data to be serialized to XML) u2026
- The above means that if you are serializing data reference to table then you have to have also global DDIC type for the table-type !! Unfortunatelly there is no default table type available for transparent tables u2026. They are treated as structures not as table-types u2026 thus:
- CREATE DATA lr_data TYPE <global_ddic_structure> - can be serialized
- CREATE DATA lr_data TYPE STANDARD TABLE OF <global_ddic_structure> - cannot be serialized
- CREATE DATA lr_data TYPE <global_ddic_table_type> - can be serialized
- !! Unfortunatelly !! CREATE DATA lr_data TYPE <type_pool_ddic_structure/ type_pool_table_type> - also cannot be serialized u2013 this is pitty u2026 this should be supported u2026.
Similar Messages
-
Creating context node with dynamic type
When we are creating context node thru wizard, Dictionary type must be filled. I'm trying to create Context node manually.Did any one tried created Context node class with Dynamic type.
Hi Prasad,
I have a similar requirement.
Can you please share with me how did you create context node with dynamic table data?
Thanks
Vicky -
Problem to create data source with OCI type of driver
Hi Experts
We are creating an XA datasource with OCI type of driver using an enterprise application with data-sources.xml, the xml is like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE data-sources SYSTEM "data-sources.dtd" >
<data-sources>
<data-source>
<data-source-name>OCI_DS_XA</data-source-name>
<driver-name>ORACLE_DRIVER</driver-name>
<init-connections>1</init-connections>
<max-connections>25</max-connections>
<max-time-to-wait-connection>120</max-time-to-wait-connection>
<expiration-control>
<connection-lifetime>60</connection-lifetime>
<run-cleanup-thread>300</run-cleanup-thread>
</expiration-control>
<sql-engine>Vendor_SQL</sql-engine>
<jdbc-2.0>
<xads-class-name>
oracle.jdbc.xa.client.OracleXADataSource
</xads-class-name>
<object-factory>
oracle.jdbc.pool.OracleDataSourceFactory
</object-factory>
<properties>
<property>
<property-name>serverName</property-name>
<property-value><SERVER_NAME></property-value>
</property>
<property>
<property-name>serverPort</property-name>
<property-value>1521</property-value>
</property>
<property>
<property-name>databaseName</property-name>
<property-value>ORCL</property-value>
</property>
<property>
<property-name>driverType</property-name>
<property-value>oci</property-value>
</property>
<property>
<property-name>user</property-name>
<property-value>username</property-value>
</property>
<property>
<property-name>password</property-name>
<property-value>password</property-value>
</property>
</properties>
</jdbc-2.0>
</data-source>
</data-sources>
We have installed oracle client in server M/C and configured all the environment variables. While we are deploying the application from CE developer studio IDE to the CE 7.1 AS, we are getting the following error:
Description:
1. Exception has been returned while the 'sap.com/DS_TEST_EAR' was starting. Warning/Exception :
[ERROR CODE DPL.DS.6193] Error while ; nested exception is:
com.sap.engine.services.deploy.exceptions.ServerDeploymentException: [ERROR CODE DPL.DS.5030] Clusterwide exception: server ID 7653550:com.sap.engine.services.dbpool.exceptions.BaseDeploymentException: Cannot create DataSource "OCI_DS_XA".
at com.sap.engine.services.dbpool.deploy.ContainerImpl.startDataSources(ContainerImpl.java:1467)
at com.sap.engine.services.dbpool.deploy.ContainerImpl.prepareStart(ContainerImpl.java:468)
at com.sap.engine.services.deploy.server.application.StartTransaction.prepareCommon(StartTransaction.java:219)
at com.sap.engine.services.deploy.server.application.StartTransaction.prepare(StartTransaction.java:179)
at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhasesOnOneServer(ApplicationTransaction.java:419)
at com.sap.engine.services.deploy.server.application.ParallelAdapter.makeAllPhasesImpl(ParallelAdapter.java:495)
at com.sap.engine.services.deploy.server.application.StartTransaction.makeAllPhasesImpl(StartTransaction.java:554)
at com.sap.engine.services.deploy.server.application.ParallelAdapter.runInTheSameThread(ParallelAdapter.java:248)
at com.sap.engine.services.deploy.server.application.ParallelAdapter.makeAllPhasesAndWait(ParallelAdapter.java:389)
at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:3387)
at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:3373)
at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:3276)
at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:3249)
at com.sap.engine.services.dc.lcm.impl.J2EELCMProcessor.doStart(J2EELCMProcessor.java:99)
at com.sap.engine.services.dc.lcm.impl.LifeCycleManagerImpl.start(LifeCycleManagerImpl.java:62)
at com.sap.engine.services.dc.cm.deploy.impl.LifeCycleManagerStartVisitor.visit(LifeCycleManagerStartVisitor.java:34)
at com.sap.engine.services.dc.cm.deploy.impl.DeploymentItemImpl.accept(DeploymentItemImpl.java:83)
at com.sap.engine.services.dc.cm.deploy.impl.DefaultDeployPostProcessor.postProcessLCMDeplItem(DefaultDeployPostProcessor.java:80)
at com.sap.engine.services.dc.cm.deploy.impl.DefaultDeployPostProcessor.postProcess(DefaultDeployPostProcessor.java:56)
at com.sap.engine.services.dc.cm.deploy.impl.DeployerImpl.doPostProcessing(DeployerImpl.java:741)
at com.sap.engine.services.dc.cm.deploy.impl.DeployerImpl.performDeploy(DeployerImpl.java:732)
at com.sap.engine.services.dc.cm.deploy.impl.DeployerImpl.doDeploy(DeployerImpl.java:576)
at com.sap.engine.services.dc.cm.deploy.impl.DeployerImpl.deploy(DeployerImpl.java:270)
at com.sap.engine.services.dc.cm.deploy.impl.DeployerImpl.deploy(DeployerImpl.java:192)
at com.sap.engine.services.dc.cm.deploy.impl.DeployerImplp4_Skel.dispatch(DeployerImplp4_Skel.java:875)
at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:351)
at com.sap.engine.services.rmi_p4.server.ServerDispatchImpl.run(ServerDispatchImpl.java:70)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:62)
at com.sap.engine.services.rmi_p4.P4Message.execute(P4Message.java:37)
at com.sap.engine.services.cross.fca.FCAConnectorImpl.executeRequest(FCAConnectorImpl.java:872)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:53)
at com.sap.engine.services.cross.fca.MessageReader.run(MessageReader.java:58)
at com.sap.engine.core.thread.execution.Executable.run(Executable.java:108)
at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:304)
Caused by: com.sap.engine.frame.core.database.DatabaseException: Exception of type java.sql.SQLException occurred: Closed Connection.
at com.sap.engine.core.database.impl.DataSourceAdministratorImpl.createDataSource(DataSourceAdministratorImpl.java:49)
at com.sap.engine.services.dbpool.deploy.ContainerImpl.startDataSources(ContainerImpl.java:1400)
... 33 more
Caused by: java.sql.SQLException: Closed Connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227)
at oracle.jdbc.driver.GetCharSetError.processError(T2CConnection.java:3082)
at oracle.jdbc.driver.T2CConnection.getCharSetIds(T2CConnection.java:2811)
at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:300)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:344)
at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:136)
at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:79)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:545)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:194)
at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPhysicalConnection(OracleConnectionPoolDataSource.java:121)
at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:333)
at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:84)
at com.sap.sql.connect.factory.XADSPooledConnectionFactory.getPooledConnection(XADSPooledConnectionFactory.java:27)
at com.sap.sql.connect.datasource.DBDataSourceImpl.createPooledConnection(DBDataSourceImpl.java:677)
at com.sap.sql.connect.datasource.DBDataSourcePoolImpl.initConnections(DBDataSourcePoolImpl.java:1099)
at com.sap.sql.connect.datasource.DBDataSourcePoolImpl.<init>(DBDataSourcePoolImpl.java:49)
at com.sap.sql.connect.datasource.DataSourceManager.createDataSource(DataSourceManager.java:507)
at com.sap.sql.connect.datasource.DataSourceManager.createDataSource(DataSourceManager.java:136)
at com.sap.sql.manager.OpenSQLManager.createDataSource(OpenSQLManager.java:141)
at com.sap.engine.core.database.impl.DataSourceAdministratorImpl.createDataSource(DataSourceAdministratorImpl.java:42)
... 34 more
But when we are creating the datasource with thin type of driver, it is working fine. We have already created a driver with name ORACLE_DRIVER in server using the ojdbc14.jar using Netweaver administrator consol.
Same this is happening when we are creating the OCI type of datasource by using Netweaver administrator consol by specifying all the parameter as above and also the initial connection pool size is more than zero.
Same thing is happening for normal (JDBC 1x) datasource creation with OCI type driver.Hello,
I ran a search on SDN, related to your error code, i found the following:
UnsupportedClassVersionError in NWDS CE
DeploymentWarning-WebService-Collection
Maybe its useful to you
Regards,
Siddhesh -
Posting Data Issue with IDOC Type : COND_A03
Friends,
I'm posting the data from Middleware(Message Broker) to SAP using the IDOC Type : COND_A03 with Message Type : COND_A.
For this IDOC,I'm populating the below Segment's data.
Segement :E1KOMG:
Fields:
KVEWE,KOTABNR,KAPPL ,KSCHL,VAKEY ,KONDA,MATNR .
Segement :E1KONH:
Fields:
KNUMH,DATAB,DATBI
Segement :E1KONP:
Fields:
KSCHL,STFKZ,KSTBM,KSTBW,KRECH ,KBETR,KONWA,KPEIN,KUMZA,KUMNE,MXWRT,GKWRT,ZAEHK_IND ,KBRUE,VALTG,
VALDT,ANZAUF,MIKBAS,MXKBAS,KOMXWRT,KLF_STG,KLF_KAL
Problem: In SAP, IDOC's are processing successfully with status 53 and updating the tables : KONH,KONP successfully.
But Table A957 which is passing against KOTABNR field is not pupulating with the Materials passing.
Can anyone please guide me why the Materials are not populating in the table : A957.
Regards,
SreeramHi,
I guess there might be some issue with VAKEY population.
All the key fields in A957 should be concated properly while populating VAKEY. (Leading zeros must be prefixed to the material)
Regards,
Ganga -
Hi,
In what table can I find relation between the<b> Plan Activity</b> and <b>Distribution Key</b> data assciated with a <b>Activity Type</b> field in Costing transaction KP26.
Please help.
Regards,
Rajesh.HI,
Please check these notes.
86613
688883 Confirmation with price 0: Message BK057
645811 Confirmation with plan price 0: No costs in CO
Plese assign points if it useful.
Regards
Ravinagh Boni -
Business View data foundation with dynamic data connection hangs
We are running Business Objects XI 3.0 with Crystal Reports 2008 and Business View Manager 12.0.0.683. In the Business View Manager tool, when I try to open a data foundation that uses the ACD Dynamic data connection, it hangs with the hourglass icon. I have left it trying to open for at least an hour before killing the Business View Manager with the Windows Task Manager. Data foundations using a static connection open fine as do the elements and views based on the data foundation with the dynamic connection. The static data connections included in the ACD Dynamic connector point back to an Oracle Server. Any ideas how to get the data foundations to open so I can edit our custom business views?
Thanks,
KathyI created some Views to pull the data in from the Oracle side.
-
How to create a data connection with dynamic XML file?
Thanks for all reply first!
I have formatted the submitted data into an XML file on the server side,this file can be import to PDF form correctly.
I try to send this XML file to the user to let him can review what he has submitted.
I guess that I should create a data connection to the XML file so that it can be reviewed by the user.
But the question is that the XML file is dynamic generated.
How can i do?
give me some clus or examples,please.
thanks,
Jasper.Hi Jasper,
To show user back the result, you can use PDF instead of XML. You can store the PDF template in server and you can merge XML data with PDF template by Livecycle Form Data Integration service.
We, as KGC, can generate huge number of Adobe Livecycle forms in small periods. Also we give consultancy on Adobe Livecycle ES products and Adobe Livecyle Designer. In case of any need, do not hesitate to contact us.
Asiye Günaydın
Project Consultant
KGC Consulting Co.
www.kgc.com.tr -
Hello all,
I've been writing a set of libraries for a CRUD application, whereby you specify the table and column names in a model class and it will handle the Ajax stuff for you. All well and good.
I have validation functions that use the signature:
Func<dynamic, Dictionary<string, object>, ValidationHost, string>
where the `dynamic` is the value to be validated - it might come from the database, the Ajax form or be explicitly defined (hence why I've made it dynamic).
What I would like to do now is be able to define a validation function in a custom attribute in the model. Normally that wouldn't be a problem, but with that `dynamic`, not so much.
I understand the reasons for it not working (dynamic being resolved at run time and attributes being a compile time construct), so I'm wondering if there is any way around it? More generally, I'm wondering if I've made a mistake using `dynamic` for the value
and should have perhaps used `object`?
Many thanks,
AllanCertainly!
In essence I have a model that describes the column names for a database table:
public class StaffModel
public string first_name { get; set; }
public string last_name { get; set; }
public string position { get; set; }
The class properties describe the db column names, the JSON structure sent to the client for display and the HTTP variables from the form submission (Ajax). They can be named differently, but for simplicity here...
The model and db table name are fed to a controller instance that handles the data get (i.e. reading of the db and output of data to JSON) and the create, update, delete aspects based on what is submitted:
new Editor(db, "staff")
.Model<StaffModel>()
Using reflection each model property has a `Field` instance created. Each field has a value. I don't have a value class at the moment, just a `dynamic` variable which has the value dumped into it (be it from the database or form submission).
The value is passed around and operations performed on it - for example this is a simplified numeric validation function:
public static string Numeric(dynamic val)
try
Convert.ToDecimal(val);
return null;
catch (Exception) { }
return "Not valid numeric data";
I could change that to pass in an object which has its value set and get by an overloaded method with the data types I want to support, although it seems like a bit of a pain to need to use `val.Val()` to get the value rather than just having the value in
`val` and potentially a waste of memory.
Is that what you might suggest?
Thanks,
Allan -
Date Picker with Dynamic Action
Hi
I have a situation where a DA is fired onchange of a date field using the apex 4 date picker item type.
The DA does a number of calculations and database requests, so it can take a few seconds over our slow internet connection.
While the DA is executing, the calendar remains displayed. The application demands that I display at least 1 or preferably 2 months as well as the current month to facilitate the user entry, which means much of the page is obscured. Not only would it be nice so see the various fields in multiple regions being updated progressively, it would also be reassuring for the user to see that the application has not "hung".
Is this the expected behavior? Is there a technique to close the date picker before the DA actions are triggered?
Thanks for your advice.
CSHi,
Try this write a Zprogram for this.
REPORT Zget_date.
TABLES : RP50D, PA0041, P0041, PA0019.
PERFORM Z_date. "3CML Dynamic action for IT0000
FORM Z_date.
DATA: DATE1 LIKE SY-DATUM.
DATA: DATE2 LIKE SY-DATUM.
SELECT * FROM PA0041
WHERE DAR01 EQ '11'
AND PERNR = P0041-PERNR
AND BEGDA = P0041-BEGDA.
DATE1 = PA0041-DAT01.
DATE2 = DATE1 + 1.
RP50D-DATE1 = DATE2.
EXIT.
ENDSELECT.
ENDFORM.
and use this in your dynamic action.
F Z_date(Zget_date)
W P0041-DAT01=RP50D-DATE2
Hope this will solve your problem.
Regards,
ARU -
Call transformation with dynamic table
hi
i uploaded the xml file from application server into a internal table
data : begin of t_x occurs 0,
d type string,
end of t_x.
OPEN DATASET file FOR INPUT IN TEXT MODE ENCODING DEFAULT .
DO.
READ DATASET file INTO t_x-d.
IF sy-subrc <> 0.
EXIT.
ELSE.
append t_x.
clear t_x.
ENDIF.
ENDDO.
CLOSE DATASET filename.
and after i want to call call transformation but i can't put a structure ref to a table like this
CALL TRANSFORMATION ('ID')
SOURCE XML xmlupl
RESULT tab = t001[]
because my file xml are not always the same structure.
So is it possible to have a call transformation wit dynamic structure
thanks for your help
sergeHello Serge
If you know what kind of structure you require for your itab you can dynamically create the appropriate itab:
DATA:
gd_struc TYPE tabname,
gdo_data TYPE REF TO DATA.
FIELD-SYMBOLS:
<gt_itab> TYPE TABLE.
* Somehow find the required structure name
gd_struc = 'KNA1'. " for example
* Create data reference with required type (dynamically)
CREATE DATA gdo_dref TYPE (gd_struc).
* Assign the data reference to your field symbol
ASSIGN gdo_data->* TO <gd_itab>.
* NOTE: <gd_itab> has the line structure of 'KNA1'.
Regards
Uwe -
Enhance purchasing datasource with movement type
Hi
I need to enhance purchasing data source with movement type ( BWART). Can you please suggest me if any standard datasource ( Purchasing ) having this info. I can see that field is present in EKBE table, but how to link EKPO and EKBE table as there are many keys in EKBE table.
Regards
KamalHi
you need to check the requirement first prior to addressing this issue.
Purchasing Document will not have the Movement type field. It exists in the Inventory transaction.
Table EKBE is the History table for Purchase documents. IF you check this table carefully you will see that the Material documents against every Purchase document are stored in this table. The Movement type field in the EKBE table refers to the Material document.
So if you try to link BKART with Purchasing document # then you may have one or more than one BKART number against one Purchasing document.
If yoou need the Purchasing document with BKART then it is essential to consider all the keys in EKBE.
Cheers
Umesh -
Here's how to do ALV (OO) with dynamic fcat, int table and editable data
Hi everybody
Here's a more useful approach to ALV grid with OO using dynamic table, data NOT from DDIC, dynamic FCAT and how to get changed lines from the grid when ENTER key is pressed.
It's really not too dificult but I think this is more useful than the ever present SFLIGHT methods from the demos.
This also defines a subclass of cl_gui_alv_grid so you can access the protected attributes / methods of that class.
You don't need to add the class via SE24 -- done fron this ABAP.
When you run it click Edit for the first time.
After editing data press ENTER and the break point should bring you into the relevant method.
Code developed on NW2004S trial version but also works on rel 6.40 on a "Real" system.
The code should work without any changes on any system >=6.40.
All you need to do is to create a blank screen 100 via SE51 with a custom container on it called CCONTAINER1.
The rest of the code can just be uploaded into your system using the SE38 upload facility.
When running the program click on the EDIT button to enable the edit functionality of the grid.
Change your data and when you press ENTER you should get the break-point where you can see the original table and changed rows.
This program is actually quite general as it covers Dynamic tables, building a dynamic fcat where your table fields are NOT in the DDIC, intercepting the ENTER key via using an event, and accessing the protected attributes of the cl_gui_alv_grid by defining a subclass of this class in the abap.
I've seen various questions relating to all these functions but none in my view ever answers the questions in a simple manner. I hope this simple program will answer all these and show how using OO ALV is actually quite easy and people shouldn't be scared of using OO.
Have fun and award points if useful.
Cheers
Jimbo.
<b>PROGRAM zdynfieldcat.
Simple test of dynamic ITAB with user defined (not ddic) fields
Build dynamic fcat
use ALV grid to display and edit.
*When edit mode set to 1 toolbar gives possibility of adding and
*deleting rows.
*Define subclass of cl_gui_alv_grid so we can use protected attributes
*and methods.
Add event handler to intercept user entering data and pressing the
*ENTER key.
When enter key is pressed get actual value of NEW table (all rows)
rather than just the changed data.
*use new RTTI functionality to retrieve internal table structure
*details.
Create a blank screen 100 with a custom container called CCONTAINER1.
James Hawthorne
include <icon>.
define any old internal structure NOT in DDIC
types: begin of s_elements,
anyfield1(20) type c,
anyfield2(20) type c,
anyfield3(20) type c,
anyfield4(20) type c,
anyfield5(11) type n,
end of s_elements.
types: lt_rows type lvc_t_roid.
Note new RTTI functionality allows field detail retrieval
at runtime for dynamic tables.
data: wa_element type s_elements ,
wa_data type s_elements,
c_index type sy-index,
c_dec2 type s_elements-anyfield5,
wa_it_fldcat type lvc_s_fcat,
it_fldcat type lvc_t_fcat,
lr_rtti_struc TYPE REF TO cl_abap_structdescr, "RTTI
lt_comp TYPE cl_abap_structdescr=>component_table,"RTTI
ls_comp LIKE LINE OF lt_comp, "RTTI
zog like line of lr_rtti_struc->components, "RTTI
struct_grid_lset type lvc_s_layo,
l_valid type c,
new_table type ref to data.
field-symbols: <dyn_table> type standard table,
<actual_tab> type standard table,
<fs1> type ANY,
<FS2> TYPE TABLE.
data: grid_container1 type ref to cl_gui_custom_container.
class lcl_grid_event_receiver definition deferred.
data: g_event_receiver type ref to lcl_grid_event_receiver.
data: ls_modcell type LVC_S_MODI,
stab type ref to data,
sdog type s_elements. .
class lcl_grid_event_receiver definition.
public section.
methods:
handle_data_changed
for event data_changed of cl_gui_alv_grid
importing er_data_changed,
toolbar for event toolbar of cl_gui_alv_grid
importing e_object
e_interactive,
user_command for event user_command of cl_gui_alv_grid
importing e_ucomm.
endclass.
*implementation of Grid event-handler class
class lcl_grid_event_receiver implementation.
method handle_data_changed.
code whatever required after data entry.
various possibilites here as you can get back Cell(s) changed
columns or the entire updated table.
Data validation is also possible here.
perform check_data using er_data_changed.
endmethod.
Method for handling all creation/modification calls to the toolbar
method toolbar.
data : ls_toolbar type stb_button.
Define Custom Button in the toolbar
clear ls_toolbar.
move 0 to ls_toolbar-butn_type.
move 'EDIT' to ls_toolbar-function.
move space to ls_toolbar-disabled.
move 'Edit' to ls_toolbar-text.
move icon_change_text to ls_toolbar-icon.
move 'Click2Edit' to ls_toolbar-quickinfo.
append ls_toolbar to e_object->mt_toolbar.
clear ls_toolbar.
move 0 to ls_toolbar-butn_type.
move 'UPDA' to ls_toolbar-function.
move space to ls_toolbar-disabled.
move 'Update' to ls_toolbar-text.
move icon_system_save to ls_toolbar-icon.
move 'Click2Update' to ls_toolbar-quickinfo.
append ls_toolbar to e_object->mt_toolbar.
clear ls_toolbar.
move 0 to ls_toolbar-butn_type.
move 'EXIT' to ls_toolbar-function.
move space to ls_toolbar-disabled.
move 'Exit' to ls_toolbar-text.
move icon_system_end to ls_toolbar-icon.
move 'Click2Exit' to ls_toolbar-quickinfo.
append ls_toolbar to e_object->mt_toolbar.
endmethod.
method user_command.
case e_ucomm .
when 'EDIT'. "From Tool bar
perform set_input.
perform init_grid.
when 'UPDA'. "From Tool bar
perform refresh_disp.
perform update_table.
when 'EXIT'. "From Tool bar
leave program.
endcase.
endmethod.
endclass.
class zcltest definition inheriting from cl_gui_alv_grid.
define this as a subclass so we can access the protected attributes
of the superclass cl_gui_alv_grid
public section.
methods: constructor, disp_tab.
endclass.
need this now to instantiate object
as we are using subclass rather than the main cl_gui_alv_grid.
class zcltest implementation.
METHOD constructor.
CALL METHOD super->constructor
exporting i_appl_events = 'X'
i_parent = grid_container1.
endmethod.
method disp_tab.
FIELD-SYMBOLS: <outtab> TYPE STANDARD TABLE.
break-point 1.
mt_outtab is the data table held as a protected attribute
in class cl_gui_alv_grid.
ASSIGN me->mt_outtab->* TO <outtab>. "Original data
do whatever you want with <outtab>
contains data BEFORE changes each time.
Note that NEW (Changed) table has been obtained already by
call to form check_data USING P_ER_DATA_CHANGED
TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL.
Entered data is in table defined by <fs2>
In this method you can compare original and changed data.
Easier than messing around with individual cells.
do what you want with data in <fs2> validate / update / merge etc
endmethod.
endclass.
data :
ok_code like sy-ucomm,
save_ok like sy-ucomm,
i4 type int4,
Container Object [grid_container]
now created via method constructor
in the subclass zcltest.
Control Object [grid]
grid1 type ref to zcltest,
Event-Handler Object [grid_handler]
grid_handler type ref to lcl_grid_event_receiver.
start-of-selection.
call screen 100.
module status_0100 output.
now display it as grid
if grid_container1 is initial.
create object grid_container1
exporting
container_name = 'CCONTAINER1'.
create object grid1.
break-point 1.
create object grid_handler.
set handler:
grid_handler->user_command for grid1,
grid_handler->toolbar for grid1,
grid_handler->handle_data_changed for grid1.
perform create_dynamic_fcat.
perform create_dynamic_itab.
perform populate_dynamic_itab.
perform init_grid.
perform register_enter_event.
set off ready for input initially
i4 = 0.
call method grid1->set_ready_for_input
exporting
i_ready_for_input = i4.
endif.
endmodule.
module user_command_0100 input.
*PAI not needed in OO ALV anymore as User Commands are handled as events
*in method user_command.
*we can also get control if the Data entered and the ENTER is pressed by
*raising an event.
Control then returns to method handle_data_changed.
endmodule.
form create_dynamic_fcat.
get structure of our user table for building field catalog
Use the RTTI functionality
lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data( wa_data ).
Build field catalog just use basic data here
colour specific columns as well
loop at lr_rtti_struc->components into zog.
c_index = c_index + 1.
clear wa_it_fldcat.
wa_it_fldcat-fieldname = zog-name .
wa_it_fldcat-datatype = zog-type_kind.
wa_it_fldcat-inttype = zog-type_kind.
wa_it_fldcat-intlen = zog-length.
wa_it_fldcat-decimals = zog-decimals.
wa_it_fldcat-lowercase = 'X'.
if c_index eq 2.
wa_it_fldcat-emphasize = 'C411'.
endif.
if c_index eq 3.
wa_it_fldcat-emphasize = 'C511'.
endif.
append wa_it_fldcat to it_fldcat .
endloop.
endform.
form create_dynamic_itab.
Create dynamic internal table and assign to field sysmbol.
Use dynamic field catalog just built.
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fldcat
importing
ep_table = new_table.
assign new_table->* to <dyn_table>.
endform.
form populate_dynamic_itab.
load up a line of the dynamic table
c_dec2 = c_dec2 + 11.
wa_element-anyfield1 = 'Tabbies'.
wa_element-anyfield2 = 'ger.shepards'.
wa_element-anyfield3 = 'White mice'.
wa_element-anyfield4 = 'Any old text'.
wa_element-anyfield5 = c_dec2.
append wa_element to <dyn_table>.
endform.
form check_data USING P_ER_DATA_CHANGED
TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL.
Get altered data back
ASSIGN p_er_data_changed->mp_mod_rows TO <FS1>.
stab = p_er_data_changed->mp_mod_rows.
ASSIGN STAB->* TO <FS2>.
LOOP AT <FS2> INTO sdog.
ALV grid display with altered data is now in <fs2>.
do any extra processing you want here
endloop.
now display new table
call method grid1->disp_tab.
endform.
form exit_program.
call method grid_container1->free.
call method cl_gui_cfw=>flush.
leave program.
endform.
form refresh_disp.
call method grid1->refresh_table_display.
endform.
form update_table.
The dynamic table here is the changed table read from the grid
after user has changed it
Data can be saved to DB or whatever.
loop at <dyn_table> into wa_element.
do what you want with the data here
endloop.
switch off edit mode again for next function
i4 = 0.
call method grid1->set_ready_for_input
exporting
i_ready_for_input = i4.
endform.
form set_input.
i4 = 1.
call method grid1->set_ready_for_input
exporting
i_ready_for_input = i4.
endform.
form switch_input.
if i4 = 1.
i4 = 0.
else.
i4 = 1.
endif.
call method grid1->set_ready_for_input
exporting
i_ready_for_input = i4.
endform.
form init_grid.
Enabling the grid to edit mode,
struct_grid_lset-edit = 'X'. "To enable editing in ALV
struct_grid_lset-grid_title = 'Jimbos Test'.
call method grid1->set_table_for_first_display
exporting
is_layout = struct_grid_lset
changing
it_outtab = <dyn_table>
it_fieldcatalog = it_fldcat.
endform.
form register_enter_event.
call method grid1->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
Instantiate the event or it won't work.
create object g_event_receiver.
set handler g_event_receiver->handle_data_changed for grid1.
endform.</b>Hi there
IE7 doesn't give me the add new page option and I get 404 error when trying to access the "How to contribute" section.
I'll load up Firefox later (this browser usually works when IE7 doesn't always work properly).
I'll copy the stuff to the wiki when I've got the browser sorted out.
Cheers
jimbp -
WCF Service as Data source in SSRS report with Complex Types
Hi All,
I have a requirement where we are suppose to use WCF service as datasource in SSRS. I was able to do that when the WCF response type was simple.
Now the requirement have changed where the response type is complex . I couldn't figure out a way of accessing WCF with complex types.
Any pointer will be of great help as I couldn't find any related articles for this kind of scenario.
RajHi Raj,
WCF uses a serialization engine called the Data Contract Serializer by default to serialize and deserialize data (convert it to and from XML). All .NET Framework primitive types, such as integers and strings, as well as certain types
treated as primitives, such as DateTime and XmlElement,
can be serialized with no other preparation and are considered as having default data contracts. Many .NET Framework types also have existing data contracts. For a full list of serializable types, see Types
Supported by the Data Contract Serializer.
New complex types that you create must have a data contract defined
for them to be serializable. You can explicitly create a data contract by using DataContractAttribute and DataMemberAttribute attributes.
This is normally done by applying the DataContractAttribute attribute
to the type.
You can refer to :
http://msdn.microsoft.com/en-us/library/ms733811(v=vs.110).aspxhttp://www.codeproject.com/Articles/738844/Using-WCF-Data-Contract-Known-Types-by-Example
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. -
Extending EventDispatcher with dynamic event types
I'm currently trying to write my own class to extend the
EventDispatcher class. My goal is to create a Service class which
acts as a switchboard for incoming socket data. Incoming socket
data is parsed to create an Event which is Dispatched to the
appropriate Service object which dispatches the event to any
registered listeners.
The problem I'm having is that I'm confused about how to
handle the event types -- the string parameter which is always
supplied as the first argument to the addEventListener() function.
In all the examples I've seen, the value supplied is a class
constant like MouseEvent.CLICK or VideoEvent.READY. In the case of
my application, I want the developer to define their own Event
types without having to go and edit my class files. In other words,
I'd like to use dynamic event types with my class--maybe something
like the code I've attached.
I'm not new to Actionscript but am very new to the
EventDispatcher class. I'm wondering a bit what that first
parameter really does in a strict programming sense -- i haven't
seen it explained all that well in the piles of documentation I've
read on the Adobe site so I don't really know if I need to define
my own Event class or what and whether I have to define all those
possible event type constants/strings in advance or what.
Any help/advice would be much appreciated.I have looked it up here:
Actionscript
3.0 Language Reference
and it just says that the first arg to 'addEventListener' is
"The type of event" with no further explanation at all.
I have read this:
Flash
Quick Starts: Programming With Actionscript 3.0: Event handling
It doesn't help much either. It tells me I need the
appropriate event object which makes me wonder DO I NEED MY OWN
CLASS? For that first ard to addEventListener, it merely says
"Substitute the appropriate constant". Given that I want to use
dynamic types (i think so anyway) that is not helpful information
either. Every single example on that page uses a class constant for
event type.
It links to
this
which says "First, the name of the specific event you want to
respond to. Once again, each event is affiliated with a specific
class, and that class will have a special value predefined for each
event--sort of like the event's own unique name, which you should
use for the first parameter." Still no useful detail about what
that arg does and the insistence on constants.
The quick start page also has a link title "Handling Events"
in Programming ActionScript 3.0 but it links to some documentation
titled "Working with XML". The only discussion of events in that 10
or so pages is because some user posted a comment.
I have read this
entire
article which is more helpful than anything in the flash docs
but still doesn't answer all my questions which (AGAIN) are:
1) What is the real function of the first argument to
addEventListener? I have not seen a clear explanation anywhere.
2) Do I need to write my own Event class?
3) What about dynamic event types that are defined at
runtime? Are there any pitfalls or risks that arise from using a
string instead of a predefined constant as the first param to
addEventListener() ?
Please stop telling me to read the documentation. I've been
reading it for days. -
SprySuggest fails in IE with dynamic server data
When using SprySuggest with dynamic server xml suggestions,
the suggestions are never displayed in IE, if the XML response does
not have the correct content-type. Code in SpryData.js attempts to
handle this situation, but it did not work in my configuration,
until I made the change shown below in bold.
Spry.Data.XMLDataSet.prototype.xhRequestProcessor =
function(xhRequest)
// XMLDataSet uses the responseXML from the xhRequest
var resp = xhRequest.responseXML;
var manualParseRequired = false;
if (xhRequest.status != 200)
if (xhRequest.status == 0)
// The page that is attempting to load data was probably
loaded with
// a file:// url. Mozilla based browsers will actually
provide the complete DOM
// tree for the data, but IE provides an empty document node
so try to parse
// the xml text manually to create a dom tree we can use.
if (xhRequest.responseText && (!resp ||
!resp.firstChild))
manualParseRequired = true;
else if ( (!resp) || (!resp.getElementById))
// The server said it sent us data, but for some reason we
don't have
// an XML DOM document. Some browsers won't auto-create an
XML DOM
// unless the server used a content-type of "text/xml" or
"application/xml".
// Try to manually parse the XML string, just in case the
server
// gave us an unexpected Content-Type.
manualParseRequired = true;
if (manualParseRequired)
resp = Spry.Utils.stringToXMLDoc(xhRequest.responseText);
if (!resp || !resp.firstChild || resp.firstChild.nodeName ==
"parsererror")
return null;
return resp;
};Hi John,
it is a known IE browser behavior for the files that don't
have the content-type set on xml, that will not get be interpreted
as text. So if you want to have your page working ok, you must
assure that the server response contained an xml and not other
content-type.
Diana
Maybe you are looking for
-
hi, I am working in jdev 11.1.1.5 My requirment to have to image icon.When somebody click on that image print command fire and user able to take printout. First question- i know showPrintPageBehaviour component.But i can put this in commandImageLink?
-
Hi upload Reconciliation accounts
Hi Gurus, How to upload reconciliations accounts ex:if i upload vendor balances individually, how reconciliation a/c will be updated, please explain the procedure how it will be updated, what steps we take before uploading vendor a/c and reconciliati
-
<b>Hi all,</b> An error is happening in my application. my net is unstable and nor always I obtain to complete to the synchronization. When I sending one solicitation and happens error, suggests the user to restart the process again. What it happens
-
Why is the quality of the microphon so bad
The sound quality while using the telefon is very bad. When I talk with someone the other person can hardly understand me. When I talk with the freehand function the quality is good. Is it a hardware or a software problem?
-
Error -2048 and corrupted movies. Help!
I recently transferred several large quicktime movies from one firewire hard drive to another. Now, it appears they were corrupted during the transfer! They display an error -2048 and Quicktime "cannot understand" them. It's hard to believe that an e