on 09-06-2007 10:30 AM
Hi All,
Can anybody have the code related to call rfc_read_table bapi from webdynpro. I wrote the code like
try {
Rfc_Read_Table_Input input = new Rfc_Read_Table_Input ();
wdContext.nodeRfc_Read_Table_Input().bind(input);
Rfc_Db_Opt optionValue = new Rfc_Db_Opt ();
input.setQuery_Table("/BIC/AZEMPLOYE00");
optionValue.setText("USERNAME LIKE 'suresh');
wdContext.nodeRfc_Read_Table_Input().bind(input);
input.addOptions(optionValue);
wdContext.currentRfc_Read_Table_InputElement().modelObject().execute();
} catch (WDDynamicRFCExecuteException e) {
// TODO Auto-generated catch block
mgr.reportException("EXception "+e, true);
}
It is giving 0 results.
Problem solved
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The following code may be used for fetching data from RFC_READ_TABLE.
IPublic<app>.IRfc_Read_Table_InputNode rfcNode =
wdContext.nodeRfc_Read_Table_Input();
try {
Rfc_Read_Table_Input input =
new Rfc_Read_Table_Input();
input.setQuery_Table("<tablename>");
input.setDelimiter("|");
Rfc_Db_Fld fieldValue = new Rfc_Db_Fld();
fieldValue.setFieldname("<field1>");
input.addFields(fieldValue);
fieldValue = new Rfc_Db_Fld();
fieldValue.setFieldname("<field2>");
input.addFields(fieldValue);
Rfc_Db_Opt optionValue = new Rfc_Db_Opt ();
optionValue.setText(" USERNAME LIKE 'abc' ");
input.addOptions(optionValue);
rfcNode.bind(input);
wdContext
.currentRfc_Read_Table_InputElement()
.modelObject()
.execute();
wdContext.nodeOutput().invalidate();
}
catch (WDDynamicRFCExecuteException e) {
// TODO Auto-generated catch block
mgr.reportException("EXception " + e, true);
}
Ashish shah
hi
only one solution......
go in bapi and change little programing .......instade of space change to comma(,)
then it is possible.....
and even sequense is also important because it is going to use in programing...
with regards
jayesh talreja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
wdContext.nodeRfc_Read_Table_Input().bind(input);
input.addOptions(optionValue);
in above to line......
first add option value.......i.e.input.addOptions(optionValue);
then bind....
ok
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks fro your response. I Got the result what I want with my code only, the issue I was faced with setting the input parameter, any way thanks for your code.
One more issue I am facing here is my output table has 20 fields and those fields are comming as one whole string. I want to display those in view with different UI elements.Do you have any idea regarding my issue?
When we execute Rfc_Read_Table function module it will give two tables as output one is for fields and another one is for records based on our query, but the table for the records is comming as one string and the string is comming as spaces for every record in the whole string.
The Tabales for the output are : Fields and Data
Actual output is comming in Data table, the table has only one field.
Hi,
You can get the values from the nodes as follow:
wdContext.node<nodename>().get<nodename>ElementAt(<index>).get<attributename>();
For breaking your single space seperated string you can use this:
StringTokenizer st = new StringTokenizer(<outputstring>," ");
while(st.hasMoreElements())
{
wdComponentAPI.getMessageManager().reportSuccess(st.nextToken());
//your logic
}
Regards,
Murtuza
Actauallu when we execute that bapi the table itself is giving as one string and the output is comming as single string with the collection attributes. I can seperate those records onlt with the spaces but for some attributes are having spaces(For ex: the country name "United States"). Is there any other solution to resolve my issue?
hi......
Z_Admin_Schadd_Input obj_add = new Z_Admin_Schadd_Input();
Zschedule_Table obj_add_table = new Zschedule_Table();
obj_add_table.setAgency(wdContext.currentContextElement().getCtx_agency());
obj_add_table.setBatchsize(wdContext.currentContextElement().getCtx_batch_size());
obj_add_table.setDuration(wdContext.currentContextElement().getCtx_duration());
Date temp1 =Date.valueOf(wdContext.currentContextElement().getCtx_e_date().toString());
obj_add_table.setE_Date(temp1);
obj_add_table.setE_Time(wdContext.currentContextElement().getCtx_e_time());
obj_add_table.setFactype(wdContext.currentContextElement().getCtx_fac_type());
obj_add_table.setFaculty(wdContext.currentContextElement().getCtx_faculty());
obj_add_table.setLoc(wdContext.currentContextElement().getCtx_location());
Date temp =Date.valueOf(wdContext.currentContextElement().getCtx_s_date().toString());
obj_add_table.setS_Date(temp);
obj_add_table.setS_Time(wdContext.currentContextElement().getCtx_s_time());
obj_add_table.setSeat_Avail(wdContext.currentContextElement().getCtx_seats_aval());
obj_add_table.setSeat_Res(wdContext.currentContextElement().getCtx_seats_res());
obj_add_table.setVenue(wdContext.currentContextElement().getCtx_venue());
short select = 1;
obj_add.setI_Select(select);
obj_add.addIt_Adm(obj_add_table);
wdContext.nodeZ_Admin_Schadd_Input().bind(obj_add);
try
{
wdContext.currentZ_Admin_Schadd_InputElement().modelObject().execute();
}
catch (Exception e)
{
wdComponentAPI.getMessageManager().reportSuccess(e.getMessage());
}
wdContext.nodeOutput().invalidate();
i hope this code will be help full for u
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
10 | |
9 | |
9 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.