cancel
Showing results for 
Search instead for 
Did you mean: 

How to create radiobuttons dynamically

Former Member
0 Kudos

Hi,

I've always used static simpletypes when I created radiobuttons dynamically, but now I'm trying to get the possible answers of a radiobutton from a RFC.

My scenario is:

I use an initial RFC which returns me a table with questions, desciptions,...and then I use a 2nd RFC with the identifier of each question and SAP returns the different possible answers the user could choose in the radiobutton. All possible answers will be strings.

Can you help me?

wdDoInit

======


....
//execute first RFC: Zhr_Bapi_Appraisal_Getdetail_Input
wdContext.currentZhr_Bapi_Appraisal_Getdetail_InputElement().setAppraisal_Id(codeBapi2);	  wdContext.currentZhr_Bapi_Appraisal_Getdetail_InputElement().setPernr(pernBapi2);
wdContext.currentZhr_Bapi_Appraisal_Getdetail_InputElement().setPlan_Version("01");
wdThis.wdGetBapiEvaluacionesCust0Controller().executeBapi_Appraisal_GetDetail();
wdThis.wdGetBapiEvaluacionesCust0Controller().executeZhr_Bapi_Appraisal_Getdetail_Input();

for (int i=0; i<IAppraisal_DataSalidaNode dataSalidaNode = wdContext.nodeOutputSalida().nodeAppraisal_DataSalida().size(); i++){

//execute second RFC:Bapi_Appraisal_Scale_Getdetail_Input
wdContext.currentBapi_Appraisal_Scale_Getdetail_InputElement().setElement_Id(element.getElement_Id());	wdContext.currentBapi_Appraisal_Scale_Getdetail_InputElement().setElement_Type(element.getElement_Type());
wdContext.currentBapi_Appraisal_Scale_Getdetail_InputElement().setPlan_Version("01");
wdThis.wdGetBapiEvaluacionesCust0Controller().executeBapi_Appraisal_Scale_Getdetail_Input();
// if the second RFC returns a anything different form null I would like to create/edit generic simpletype to create the radiobutton possible answers
if (wdContext.nodeOutputSalida2().size>0){
//which code should I use here?? I guess that something like this:
for (int j=0; j<wdContext.nodeOutputSalida2().size; j++){
IwdAttibuteInfo info=wdcontext.node<nodename>().getNodeInfo().getAttribute(<Attribute name created in the Node>);
ISimpleTypeModifiable stm=info.getModifiableSimpleType();
IModifiableSimpleValueSet svs=stm.getSVServices().getModifiableSimpleValueSet();
svs.put(""+j,wdContext.nodeOutputSalida2().getAnswerElementAt(j).getAnswerText());
}
}
}

Edited by: Joan Roda on Jun 13, 2008 10:24 AM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Just use a RadioButtonGroupByIndex, bind the "texts" property to attribute "OutputSalida2.answerText" and you are done.

Armin

Former Member
0 Kudos

Hi Armin,

I am encountering a similar problem.

The texts property is supposed to be bound to an element in the context, but it need to provide more than one text (and one element only has one value, if I am correct).

How can I show more than one element in the radiobuttongroup?

Thanks, Johannes

Former Member
0 Kudos

The context attribute that provides the texts for the radio buttons must live inside a node with cardinality 0:N (or 1:N). Each node element corresponds to a radio button. The selected button is given by the node element that is lead-selected.

Armin

Answers (0)