cancel
Showing results for 
Search instead for 
Did you mean: 

creating a purchase order in web dynpro for java.........

Former Member
0 Kudos

hello all,

i am new to web dynpro for java.i have already done an application

"Creating a Web Dynpro Application Accessing ABAP Functions" this application

have good document on sdn.

this application is working fine .

Now i got an requiremnt for creating a purchase order in web dynpro for java.

in normal report when i call the bapi the parameter are the header, headerx,item, itemx is an internal table.

CALL FUNCTION 'BAPI_PO_CREATE1'

EXPORTING

POHEADER = HEADER

POHEADERX = HEADERX

  • POADDRVENDOR =

  • TESTRUN =

  • IMPORTING

  • EXPPURCHASEORDER =

  • EXPHEADER =

  • EXPPOEXPIMPHEADER =

TABLES

RETURN = RETURN

POITEM = ITEM

POITEMX = ITEMX.

i just want to know how can i fill these internal table in web dynpro

for java to create an application accessing "Bapi_po_create" .

Thanks

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

To create a Purchase Order u need to call Bapi_po_create standard bapi from r/3.

1) Go to File -> New -> Project - > Web Dyn pro Project -.

Give Name , pkg Name Click On Finish .

2) Expand ur project hirarchy -> go TO Application -> Right Click -> Create Application - > Give Application name and Pkg name - Click on Finish .

3) Now ur View And Controller Are Created by Default .

4) Go to Model-> Right Click on it-> Create Model -> Give Model Name & Pkg name Should diff from Application pkg the Click On Next

a) Here u have to Two JCo Destination Name Like Model Data And Meta data & R/3 System Details like System Number , Host name Etc -> then Click on next .

b) Here u will text filed where u want to search for ur Required BAPI . Type ur BAPI Name i.e.,bapi_po_create1 Click on Search . Ur bapi will be displyed In Down . click on Next .

c) Now Ur model is Importedint into NWDS .

5)Right click on cmponent and click open Data Modeler .

6)Here u add ur Model .

7)Right click on Component cpontroller --> Apply template -->service controller and Map ur model data To Controller which r required.

This Servce Controller will contain the code to execute the bapi.

8)Do context mapping between Component controller and View Controller .

9) create a button in view and in the Action of the button call the Service controller execute mathod.

Go to -> Project Name -> Right Click -> go to -> Deploy New Archive .

after wards u have to go Apllication -> Right click -> deploy and Run .

Enter the data in the fields and click the Button.

Refer this link,

http://help.sap.com/saphelp_nw04/helpdata/en/6a/11f1f29526944e8580c5e59333d96d/frameset.htm

Regards,

Sunaina reddy T

Former Member
0 Kudos

Hi,

Thanks a lot for your reply. I have already done a quick search and had a look at the following link and I am very much aware of the process of calling an RFC from webdynpro Java.

My question is not about this at all. Please read my requirement properly. I would appreciate your help if you can help me.

Regards,

Gopal.

Former Member
0 Kudos

Hi Gopal,

I'm not sure what is your issue, it seems you're not really understanding how the Model structure works in WDP.

I'll assume few things here, like you know how to Import the Model into the WDP, and you know a little bit about what Java Classes will represent this Model in the Project.

Try these steps:

1. Import your Model into the Project;

2. Open your Component Modeler, create a Data Link between your Model / Component (Or Custom Controller, as you prefer)

- You can also use the "Apply Template -> Service Controler"

3. Map the Input of your Model as the Main Node, check the Input Tables (you prob. will have two, POITEM = ITEM - POITEMX = ITEMX)

4. Also, check the Return box, since this is BAPI return (You can use to display Backend messages)

Now you have the Model mapped into your Controller, you need to develop the Java function to execute it.

1. Create a new Input class, like

-


BAPI_PO_CREATE1_Input purchaseOrderCreateInput = new BAPI_PO_CREATE1_Input();

2. Bind your Input Node, in the Controller, with your Input Class;

-


wdContext.nodeBAPI_PO_CREATE1().bind(purchaseOrderCreateInput);

3. Set any Import parameters you need:

-


purchaseOrderCreateInput.setEXPPURCHASEORDER(XXXX);

4. To Add references to the Table, you will perform something like:

First, you need to know what "Structure" you need to add (POItem Structure) - You have a Java class that represents that Structure..

POITEM_Element poItemElement = new POITEM_Element();

poItemElement.setPROPERTY(); /// Set your Properties

purchaseOrderCreateInput.getPOITEM().add(poItemElement);

5. Execute your Input,

purchaseOrderCreateInput .execute();

Hope it helps,

Regards,

Daniel

PradeepBondla
Active Contributor
0 Kudos

Hi,

follow the procedure given above.

To use any BAPI, first of all you need to know the input parameters (import parameters) and output parameters ( export parameters ) of the perticular BAPI very well. import parameters might be a table also.

depending on this you will supply the input to the bapi.

initialized the bapi in doInit () method. and give the input like...

wdcontext.Bai Node.getCurrentElementxxx .setXXXfield(supply the input);

need more clarification?

PradeeeP

Former Member
0 Kudos

Hi Pradeep,

I have got a similar requirements. Could you please give me more information about the inputs that I need to give to "BAPI_PO_CREATE1" bapi. Because, I am not able figure out the input data to test the BAPI. Do you know what I mean. Please help me resolve this issue. i would appreciate your help.

Regards,

Gopal.

former_member197348
Active Contributor
0 Kudos

Hi Vishal,

Create a model of type Adaptive RFC model in Web Dynpro Java application.

Design your BAPI interface like this:

The input structures or input parameters are as import parameters, the output structures or output parameters are as export parameters and input or output table as tables.

Write your logic in the BAPI. Make it remote enabled. Create a model in your in Web Dynpro Java application.

Regards,

Siva