cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Material Request

Former Member
0 Kudos

Hi All,

I am developing a WebDynPro application. The application is failry simple.

I am using the bapi BAPI_MATERIAL_GET_DETAIL. I need to enter the Material no and supposed to retrieve the foll.

1. Material Desc

2. Material Group

3. Material Type

I have created a Model.

Have mapped the Model Node to Context of the Views (SearchView, ResultView) and also to Custom Controller.

SLD is configured JCo are tested successfully.

When I am running the application, then on giving the material no 100 and on pressing search I am not able to get any data in the Result View.

What am I missing and how can I debug my application.

Points assured.

Regards

Nikhil Bansal

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member189631
Active Contributor
0 Kudos

Hi Nikhil,

Thr may b two scenarios,

Scenario1:

Ur RFC not exceuted .

U can use Message Manager to test ur RFC execution

Scenario2:

1)Ur BAPI not giving the result.

2)Its always good practice to Map the return node also. and u can map them in a seperate table.

I suggest u to concentrate on second scenario and see the result..

Regards,

Ramganesan K.

Former Member
0 Kudos

Hi Ram,

The context of the Custom Controller looks like foll.

Bapi_Material_Get_Detail_Input

-


Output

-


Material_General_Data

-


Matl_Cat

-


Matl_Desc

-


Matl_Group

-


Matl_Type

-


Material

Material General Data has been binded to the Result View context. and Material to the input views context.

Bapi is being executed in the Application after the Search button has been pressed.

Please let me know what is wrong with the application.

Regards

Nikhil Bansal

Former Member
0 Kudos

Hi Ram,

Can you tell me how should I test whether BAPI is returning values or not.

Regards

Nikhil Bansal

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hallo Nikhil,

is 'Material' a context model node or an attribute of model node 'Bapi_Material_Get_Detail_Input'?

Regards, Bertram

Former Member
0 Kudos

Hi Bertram,

Thanks for the reply.

Material is the attribute in the model node 'Bapi_Material_Get_Detail_Input.

Regards

Nikhil Bansal

Former Member
0 Kudos

Hi,

After the Execute method find the size of the Node then u find the node size == 0 then nothong return.

else

it return the value.

find the size like this.

int i= wdContext.node<uroutputnodeName>().size();

By using thid u can find the Fnmodule returns value. or not?

Thanks,

Lohi.

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hallo Nikhil,

Have you properly defined the data binding relation from UI element properties to context model elements? That's a decisive part for a working generic data transport service between WD Runtime and WD Client.

Regards, Bertram

former_member189631
Active Contributor
0 Kudos

Hi Nikhil,

1)U can test ur BAPI in R/3 system itself,

2)Logon R/3

3)goto se37 Transaction --->enter ur Bapi Name --> press execute

4)Give the input --> Presss execute

5)U will see the result.

[Sorry for the delayed reply :)]

Regards,

Ramganesan K.

.

former_member189631
Active Contributor
0 Kudos

Hi,

While mapping the component context with model context u can map the

return node also.and Bind these return node with a table . While executing the BAPI. It will display some result incase if ur input is Wrong or u may missed

any mandatory parameter.

Thats y i suggested u to mapp return node also.

Regards,

Ramganesan K.

sid_sunny
Contributor
0 Kudos

Hi Nikhil,

Have you tried to execute the BAPI in SAP GUI, is it returning the data there properly, if yes are you able to execute the BAPI properly from WD.

Regards

Sid

Former Member
0 Kudos

Hi Siddharth,

Thx for the reply.

I have executed the BAPI in SAP GUI. It is returning the data for Material No.

You said "are you able to execute the BAPI properly from WD". Can you let me know how to execute BAPI from WD.

Regards

Nikhil Bansal

sid_sunny
Contributor
0 Kudos

Hi Nikhil,

Try this:

In component controller

public void wdDoInit()

{

//@@begin wdDoInit()

Bapi_Material_Get_Detail_Input input = new Bapi_Material_Get_Detail_Input();

wdContext.nodeBapi_Material_Get_Detail_Input().bind(input);

//@@end

}

public void executeMaterialDetailBAPI( )

{

//@@begin executeMaterialDetailBAPI()

try {

wdComponentAPI.getMessageManager().reportWarning(wdContext.currentBapi_Material_Get_Detail_InputElement().getMaterial());

wdContext.currentBapi_Material_Get_Detail_InputElement().modelObject().execute();

wdContext.nodeOutput().invalidate();

wdComponentAPI.getMessageManager().reportSuccess("BAPI executed successfully");

} catch (WDDynamicRFCExecuteException e) {

// TODO Auto-generated catch block

wdComponentAPI.getMessageManager().reportException("Unable to execute the BAPI", true);

e.printStackTrace();

}

wdComponentAPI.getMessageManager().reportSuccess("Plug fired successfully");

//@@end

}

In Search View

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

{

//@@begin onActionSeachClicked(ServerEvent)

wdThis.wdGetBAPIMaterialDetailsCompController().executeMaterialDetailBAPI();

wdThis.wdFirePlugToResultView();

//@@end

}

Regards

Sid

Former Member
0 Kudos

Hi,

BAPI_MATERIAL_GET_DETAILis my function module name and three inputs

BAPI_MATERIAL_GET_DETAIL_INPUT input = new BAPI_MATERIAL_GET_DETAIL_INPUT

();

wdcontext.nodeBAPI_MATERIAL_GET_DETAIL_INPUTElement().bind(input);

After this.

input.setCatogory("Value");

input.setDate("dd/mm/yyyy);

input.setProjId(value);

aftert this.

try{

wdContext.currentBAPI_MATERIAL_GET_DETAIL_INPUTElement().modelObject().execute();

wdContext.nodeOutPut.Invalidate();

}

catch(EX e)

{

e.prstack();

}

Add this code n ur any of custom controller or view init mehtod.

Get the conxt variables into ur View context like context mapping and bind with the output node to table then u will get the data.

If this s the Standarad function module no need to give the authorization otherwise u need to give authorization R/3 side.

Thanks,

Lohi.

Message was edited by:

Lohitha M

Former Member
0 Kudos

Hi Siddharth,

Yes the Bapi is executed successfully.

I am getting the messages when I run my application.

BAPI executed successfully

Plug fired successfully

Regards

Nikhil Bansal

Former Member
0 Kudos

Hi ,

First define ExecuteRFC method in controller and in this method execute your RFC

i.e.

try{

wdcontext.currentBAPI_MATERIAL_GET_DETAIL._InputElement().modelobject().execute();

wdcontext.nodeOutput().invalidate();

}

catch(Exception e)

{

}

on click of search button , call controllers ExcuteRFC in onactionSearch Method.

i.e. wdthis.wdget<controller>.ExecuteRFC();

Sunitha.