Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8620

Webdynpro Java Coding Error

$
0
0

Hi,

 

We have a requirement in WD java application where in a table user is trying to change WBS status's and the same are to be passed to the R/3 system.

 

We have saved the changed data in a hashmap and then passed it to RFC. We are getting issue while setting the data in the RFC.

 

when we are passing more than one wbs Statuses(suppose 2 wbs status for instance) only the last data is picked and sent twice to the RFC which results in a RFC duplication error.

Based on our analysis, only the last value is stored in the abstract list of the RFC and this gets duplicated for the times that the user enters(in this case ) while passing to the backend.

 

//Value in the Hashmap  changedusrstatus : {"PG01" , "TECO"}  {"PG03", "REL"}

                                       

 

 

Please find the below code and help us in tracking the issue.

 

Z_Project_Status_Update_Input sInput = new Z_Project_Status_Update_Input(); //Z_Project_Status_Update is the RFC for updating the portal data

com.sap.aii.proxy.framework.core.AbstractList ulist = new Zwbs_Status.Zwbs_Status_List();

Zwbs_Status Ustatus = new Zwbs_Status();

 

String suffix = null;

String usrvalue = null;

String wbselement = wdContext.currentHelperValuesElement().getProjectCode(); //wbs status are displayed based on the project code.

 

if (changedsysstatus.size() != 0 || changedusrstatus.size() != 0)  // changedsysstatus and changedusrstatus are the hashmaps where the system and user status's are stored.

{            

         

     Set mapSet1 = (Set) changedusrstatus.entrySet();

                                                Iterator mapIterator1 = mapSet1.iterator();

                                                while (mapIterator1.hasNext()) {

 

                                                                Map.Entry mapEntry = (Map.Entry) mapIterator1.next();

                                                                suffix = (String) mapEntry.getKey();

                                                                usrvalue = (String) mapEntry.getValue();

                                                                String concatwbs = wbselement + suffix;

                                                                                                                                                               

                                                                Ustatus.setWbs_Element(concatwbs);

                                                                Ustatus.setStatus(usrvalue);

ulist.add(Ustatus); //ulist is the abstract list ;

// we tried printing the values being set in Ustatus here the 2 values are set perfectly but while adding values in ulist only the last      

//values gets added. Unable to find the cause of the issue.

// Values printed PAH2008PG01 ,TECO and PAH2008PG03 ,REL

 

 

}

 

//  But Passed value is PAH2008PG03 ,REL and PAH2008PG03 ,REL

 

 

                                                try {

                                                                sInput.execute();

for (int i = 0; i < sInput.getOutput().getReturn1().size(); i++) {

 

                                                                                Bapiret1.Bapiret1_List returns = (Bapiret1.Bapiret1_List) sInput.getOutput().getReturn1();

                                                                                if (returns.getBapiret1(i).getType().equalsIgnoreCase("E")) {

                                                                                                //msgMgr.reportWarning("for loop");

                                                                                                msgMgr.reportException("Error Changing Item:" + returns.getBapiret1(i).getMessage(), true);

                                                                                } else {

                                                                                                //msgMgr.reportWarning("else");

                                                                                                msgMgr.reportSuccess(returns.getBapiret1(i).getMessage());

                                                                                }

 

                                                                }

 

                                                } catch (WDDynamicRFCExecuteException e) {

                                                                msgMgr.reportException("Exception in submitting values to R3: " + e.getMessage(), true);

                                                                e.printStackTrace();

                                                } finally {

                                                                sInput.modelInstance().disconnectIfAlive();

                                                }


Viewing all articles
Browse latest Browse all 8620

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>