cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass the values from the Wb Dynpro Application to the SAP Backend ?

Former Member
0 Kudos

Hi All,

Good morning..,

I have scenario like:

I want to pass the values from the web dynpro appication to the SAP Back end R/3 Table. IN backend the RFC is writtn to accept the structure input from the Webdynpro.

Upto know I imported the corresponding RFC and maaped to the View.

How to proceed with the coding to save the data...

PLease suggest...

Regards and Thanks in Advance,

CSP

Accepted Solutions (1)

Accepted Solutions (1)

arun_srinivasan
Contributor
0 Kudos

Hi Pradeep

Steps:

1. First create an instance for bapi and bind the instance to the bapi node.

Z<bapi name> zb=new Z<bapi name>();

wdContext.nodeZ<bapi name>. bind(zb);

2. Then if u have the import parameter u have to set them by using

The instance of the above bapi.

Zb.set<import parameters>;

3. If the bapi has a table parameters then the structure for the table parameters will also be imported

In the model class.

4. Set the table parameters by creating the instance for that structure and using this instance set it.

Z<Struct>itm tab=new Z<Struct>();

Tab.set<table parameters>

5. Then add the structure instance to the bapi instance.

Zb.add(Tab);

6. Then Execute the bapi after setting the import parameters.

7. If there is any export parameters, then get the values after execution.

Look at this thread for codes

Regards,

Arun

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Pradeep,

1. In wdDoInit(), add

<Bapi>_Input input=new <Bapi>_Input();//DECLARE this variable globally

wdContext.node<Bapi>_Input().bind(input);

2. In execute() method,

/**********FOR STRUCTURE*************/

<InputStructure> zh=new <InputStructure>();

zh.setXX("xx");

zh.setYY("yy");

input.set<InputStructure>(zh);

/**********************************************/

/**************FOR TABLE****************/

for(int i=0;i<5;i++)//ADDS 5 ROWS

{

<InputTable> zt=new <InputTable>();

zt.setXX("xx");

zt.setYY("yy");

input.add <InputTable>(zt);

}

/**********************************************/

wdContext.current<Bapi>InputElement().modelObject().execute();

wdContext.nodeOutput().invalidate();

Regards,

Fahad Hamsa

Former Member
0 Kudos

Hi,

Go through the tutorial to understand how to use BAPI in Webdynpro

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/355b9c90-0201...