cancel
Showing results for 
Search instead for 
Did you mean: 

connecting Web dynpro application to an SAP database

Former Member
0 Kudos

Hi

Iam new to the Web dynpro

I created a proto type for this screen.

In my project ,under one of the module "std Allo" option will come.By clicking that "std allo" screen will come.

In that Create , Export buttons is there.In that, table is present consists of Allowance Code, sub code,type,level,expense type,amount fields are present.

1. After clicking create button , these elements are present.

Save and Cancel buttons are present.

allowance code - (i/p field) , sub code - (i/p field) , period Type - (Dropdown by key) ,

Type - (Checkbox group) , level - ( Dropdown by key) , expense type - ( Dropdown by key) ,

trip - ( Dropdown by key) , currency - ( Dropdown by key) ,amount - (i/p field)

2.By clicking first row in the table ,,

delete ,edit cancel buttons are present.

same elements are present which i mentioned in step 1.

To connect to the R3 database, Function module is required.Can any one help what are the specifications i need to give to the ABAP team to develop a Function module for this appluication.

Please tell me procedure.

Regards

Sushma

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Sushma ,

Please go through these 2 tutorials:

[https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f64e7a90-0201-0010-e0b4-ec1f849ecd4e]

and

[https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a00f7103-6790-2a10-ac9c-fcac7c5b18a3]

These will help you to create your applications.

As, you said that Abaper have created ztable. Now you need to import model. steps are given in 2 link.

Please follow it.

Regards,

Abhijeet

Edited by: Abhijeet Parihar on Mar 24, 2009 11:17 AM

Former Member
0 Kudos

For table in the dropdownlist ,,,how we can get this.

Former Member
0 Kudos

Save button is present in Create screen.

Please provide the code for this,how the data we are giving will be stored in the database.

and also help me how we can access dropdown data from web dynpro to R3.

Former Member
0 Kudos

You just have to import the RFC and bind the table with RFC parameters (Model). First the RFC should be in place then decide about code.

Former Member
0 Kudos

For save button you have to go through 2 tutorial which shows you how you can connect use ABAP function.

In brief : first you have to import Model.

Second you have to bind Context of View -


> Controller -


> fields of Model

Please read 1st tutorial.

Now, if you want to create a dropdown in your Web Dynpro application then.

Create a value node in context of your View i.e Emp ---> create a value attribute say name.

Now go to web dynpro explorer, go to Dictionaries -


> local dictionary -
> data types -
> simple types-----> right click -
> create simple type.

This action will open a window.

Now, go to enumeration (name it ENUM)-----> click add -


> enter value and name.

You can enter few values by repeating above step.

After that go to context of your view----> select node Emp -


> name -
> right click property -
> you will get type -
> click on it -
> there will be a button on right side of it> click it you will get packages---> traverse up to the package in which ENUM is.

This will set the type of you name to ENUM.

Finally you

Add a DropdownbyIndex UI to your layout and assign its text property to name

Regards

Abhijeet

Former Member
0 Kudos

For save button you have to go through 2 tutorial which shows you how you can connect use ABAP function.

In brief : first you have to import Model.

Second you have to bind Context of View -


> Controller -


> fields of Model

Please read 1st tutorial.

Now, if you want to create a dropdown in your Web Dynpro application then.

Create a value node in context of your View i.e Emp ---> create a value attribute say name.

Now go to web dynpro explorer, go to Dictionaries -


> local dictionary -
> data types -
> simple types-----> right click -
> create simple type.

This action will open a window.

Now, go to enumeration (name it ENUM)-----> click add -


> enter value and name.

You can enter few values by repeating above step.

After that go to context of your view----> select node Emp -


> name -
> right click property -
> you will get type -
> click on it -
> there will be a button on right side of it> click it you will get packages---> traverse up to the package in which ENUM is.

This will set the type of you name to ENUM.

Finally you

Add a DropdownbyIndex UI to your layout and assign its text property to name

Regards

Abhijeet

Former Member
0 Kudos

Hi,

Basically you just want your table(backend) to be modified and saved in DB. There should be an RFC that allows you to modify this backend table. You may call that Z-RFC in webdynpro and bind its parameters to the webdynpro table. whatever modifications you do in your webdynpro table should go as input to the RFC.

So, the RFC should take some parameters (table columns) as input .. you may create new rows in the table. It should also provide these parameters as output for display in webdynpro & modification. When you click save button in your webdynpro view, the RFC action should be to commit changed data (or newly inserted data) into the DB table.

Reagrds,

Anagha

Former Member
0 Kudos

Hi Sushma,

Well for creating a new record you have to send all these field data to Function Modules.

Ask your ABAPer to create a Z table with all these fields as export parameter. Then you can use these export parameter to send data to R/3.

Please discuss with your ABAPer the fields you are using and the data type you will be sending.

Regards,

Abhijeet

Former Member
0 Kudos

They created table by name zmstr_allowance .

After that in what way i have to proceed in web dynpro application.

Can any one please provide the step by step document for this.

In the Drop down -


two columns are present like in the table.(code & PRD Type)

Is it possible to do this in ABap, if possible please help me.

Former Member
0 Kudos

Iam trying to connect my web dynpro application to R3 Database.

Iam having list screen consistts of Create and Export buttons and table.

Table Fields :

Allowance Code , sub code ,Type , Level , expense Type , amount

After clicking Create button ,

the screen consists of save and Cancel buttons.

Allowance Code -- (Input Field)

Sub Code -- (Input Field)

Period Type -


(Dropdown by key)

Type -


(Radio button Group)

Level --- (Dropdown by key)

Expense Type -(Dropdown by key)

Trip - (Dropdown by key)

Currency - (Dropdown by key)

Amount --(Input Field)

In the Create screen all these fields are present. But in the table in the List Screen it is taking only mandatory Fields.

For this our Abapers created

Fun Mod : Zup_Allowance_Input

Table : ZMSTR_ALLOW

Iam getting error in this code under IdataType in this "Save Button ".

Can any one help me where i went wrong in this code.or else please provide the Code for this.

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

{

//@@begin onActionSave(ServerEvent)

try{

String str1=wdContext.currentStdAllowanceElement().getAllowanceCode();

String str2=wdContext.currentStdAllowanceElement().getSubCode();

IDataType dataType = wdContext.nodeStdAllowance().getNodeInfo().getAttribute("PeriodType").getDataType();

String index=wdContext.currentStdAllowanceElement().getPeriodType();

String str3=wdThis.getTextFromSimpleType(dataType,index);

wdComponentAPI.getMessageManager().reportSuccess("wetreer "+str3);

String arr[]={"Fixed","Actual"};

for(int i=0;i<arr.length;i++)

{

IPrivateEtrecStdCreateView.ICheckElement e=wdContext.nodeCheck().createCheckElement();

wdContext.nodeCheck().addElement(e);

e.setType(arr<i>);

IDataType dataType = wdContext.nodeStdAllowance().getNodeInfo().getAttribute("").getDataType();

String index=wdContext.currentStdAllowanceElement().getLevel();

String str5=wdThis.getTextFromSimpleType(dataType,index);

wdComponentAPI.getMessageManager().reportSuccess("wetreer "+str5);

IDataType dataType = wdContext.nodeStdAllowance().getNodeInfo().getAttribute("ExpenseType").getDataType();

String index=wdContext.currentStdAllowanceElement().getExpenseType();

String str6=wdThis.getTextFromSimpleType(dataType,index);

wdComponentAPI.getMessageManager().reportSuccess("wetreer "+str6);

IDataType dataType = wdContext.nodeStdAllowance().getNodeInfo().getAttribute("Trip").getDataType();

String index=wdContext.currentStdAllowanceElement().getTrip();

String str7=wdThis.getTextFromSimpleType(dataType,index);

wdComponentAPI.getMessageManager().reportSuccess("wetreer "+str7);

IDataType datatype = wdContext.nodeStdAllowance().getNodeInfo().getAttribute("Currency").getDataType();

String index=wdContext.currentStdAllowanceElement().getCurrency();

String str8=wdThis.getTextFromSimpleType(dataType,index);

wdComponentAPI.getMessageManager().reportSuccess("wetreer "+str8);

String str9=wdContext.currentStdAllowanceElement().getAmount();

Zup_Allowance_Input input=new Zup_Allowance_Input();

input.setAllow_Opt("C");

input.setAllowance_Code(str1);

input.setSubcode(str2);

input.setType1(str3);

input.setLevel1(str5);

input.setExpense(str6);

input.setCurr_Key(str8);

wdContext.nodeZup_Allowance_Input().bind(input);

wdContext.currentZup_Allowance_InputElement().modelObject().execute();

String str10=wdContext.currentOutputElement().get();

if(str10.equalsIgnoreCase("3"))

{

String errorMessage = "Inserted Successfully !";

IWDEventHandlerInfo windowHandler = wdControllerAPI.getViewInfo().getViewController().findInEventHandlers("OK");

IWDConfirmationDialog windowDialog = wdComponentAPI.getWindowManager().createConfirmationWindow(errorMessage, windowHandler, "OK");

windowDialog.open();

windowDialog.setWindowPosition(300,250);

}if(str10.equalsIgnoreCase("2"))

{

String errorMessage = "Duplicate Value !";

IWDEventHandlerInfo windowHandler = wdControllerAPI.getViewInfo().getViewController().findInEventHandlers("OK");

IWDConfirmationDialog windowDialog = wdComponentAPI.getWindowManager().createConfirmationWindow(errorMessage, windowHandler, "OK");

windowDialog.open();

windowDialog.setWindowPosition(300,250);

}

}catch(Exception e)

{

wdComponentAPI.getMessageManager().reportSuccess(e.toString());

}

//@@end

}

//@@begin javadoc:onPlugFromEtrecStdView(ServerEvent)

/** Declared validating event handler. */

//@@end

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

{

//@@begin onPlugFromEtrecStdView(ServerEvent)

wdContext.currentStdAllowanceElement().setAllowanceCode("");

wdContext.currentStdAllowanceElement().setAmount("");

wdContext.currentStdAllowanceElement().setSubCode("");

//@@end

}