cancel
Showing results for 
Search instead for 
Did you mean: 

Two Comp, Two RFC models: how to pass an input table through interface

Former Member
0 Kudos

Hi,

I read several posts about this, but it does'nt work for me since my application uses two Components (each component has a RFC model) and I don't know how and where to bind the model node.

First, here's the architecture of my application (two components, 1 main view) :

1) GestionAvisComp : ( GestionSimplifieeAvisModel <-- GestionAvisComp <-- *GestionAvisCompInterface* )

2) AvisComp : ( *GestionAvisCompInterface* <-- AvisView --> AvisComp --> RechercherAvisModel

Now here's the model node of GestionAvisComp :

Z2_I_Gestion_Simplifiee_Avis_Input (card 1..1, sel 1..1, singleton true, modelClass Z2_I_Gestion_Simplifiee_Avis_Input)

+ It_Text (card 0..n, sel 0..1, singleton true, modelClass Tline)

      - Tdformat

      - Tdline

+ Output

 - Var1

 - Var2

...

Currently, from the AvisView (the only and main view of the app), I am able to send content of var1 and var2 to the model, this is working.

But, I am unable to send data into "It_Text" (it'a a long text table of type Tline).

Current code :

GestionAvisComp

{

public void wdDoInit()

wdContext.nodeZ2_I_Gestion_Simplifiee_Avis_Input().bind(new Z2_I_Gestion_Simplifiee_Avis_Input());

}

public void executeZ2_I_Gestion_Simplifiee_Avis_Input( )

{

IWDMessageManager manager = wdComponentAPI.getMessageManager();

try{

wdContext.currentZ2_I_Gestion_Simplifiee_Avis_InputElement().modelObject().execute();

wdContext.nodeOutput().invalidate();

} catch(WDDynamicRFCExecuteException ce) {

manager.reportException(ce.getMessage(), false);

}

GestionAvisCompInterface

public void sauvegarderAvis( )

{

wdThis.wdGetGestionAvisCompController().executeZ2_I_Gestion_Simplifiee_Avis_Input();

}

AvisView

public void onActionSaveAvis(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

// Accéder à l'élément Z2_I_Gestion_Simplifiee_Avis_Input

IZ2_I_Gestion_Simplifiee_Avis_InputElement GestionAvisEl = wdContext

.nodeZ2_I_Gestion_Simplifiee_Avis_Input()

.currentZ2_I_Gestion_Simplifiee_Avis_InputElement();

// Copier les champs de l'écran dans la structure de la fonction

GestionAvisEl.setVar1("content1");

GestionAvisEl.setVar2("Content2");

wdThis.wdGetGestionAvisCompInterface().sauvegarderAvis();

...

}

Can you show me the modifications needed to add two lines in "It_Text" and send it to the model.

Thanks a lot!

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I changed the code of the wdDoInit of the GestionAvisComp to try something else.

Again the Var1 and Var2 are passed, but not the table.

Do I have to check the binding? The declaration in the function module?

public void wdDoInit()

{

//@@begin wdDoInit()

//$$begin Service Controller(1353609186)

Z2_I_Gestion_Simplifiee_Avis_Input input = new Z2_I_Gestion_Simplifiee_Avis_Input();

wdContext.nodeZ2_I_Gestion_Simplifiee_Avis_Input().bind(input);

Tline tab;

tab = new Tline();

tab.setTdformat("/*");

tab.setTdline("Line1");

input.addIt_Text (tab);

tab = new Tline();

tab.setTdformat("/*");

tab.setTdline("Line2");

input.addIt_Text (tab);

input.setVar1("text1");

input.setVar2("text2");

//$$end

//@@end

}

What is still wrong?

sid_sunny
Contributor
0 Kudos

Hi Emanuel Champagne,

Does it require input of type AbstractList if yes then please refer to this [THREAD|;

The sample code is pasted below:

AbstractList flightList = new Bapisfldat.Bapisfldat_List();

Bapisfldat flight = new Bapisfldat();

flight.setAirline("LH");

flightList.add(flight);

Bapi_Flight_Getlist_Output flightOutput =

new Bapi_Flight_Getlist_Output();

flightOutput.setFlight_List(flightList);

Regards

Sid

Former Member
0 Kudos

Tline has the setting "isAbstract = false" in the model, so it's not an abstractList.

In my RFC function, the table is defined in TABLE tab, as "LIKE TLINE".

What node I'm supposed to bind and populate for passing input values to the table of this model? By default I only binded the Z2_I_Gestion_Simplifiee_Avis_Input node, as they show in Templates. Is it right?

Here is the detail of the model I use :

GestionSimplifieeAvisModel

- Z2_I_Gestion_Simplifiee_Avis_Input 

          + It_Ajout_Texte_Avis (Tline)

- Z2_I_Gestion_Simplifiee_Avis_Output

          + It_Ajout_Texte_Avis (Tline)

- Bapiret2

- Tline

- Z2I123S

Former Member
0 Kudos

As your are going to pass the input from a structure to the model you need to change the binding as it is discussed above.If it is attribute we can bind it directly.As we are passing the the structure as a input you need to bind it as discussed above.

Former Member
0 Kudos

Can you show me an example for adding two elements to an input table plz.

Former Member
0 Kudos

Refer to

Edited by: Emanuel Champagne on Jan 17, 2008 9:52 PM