cancel
Showing results for 
Search instead for 
Did you mean: 

problem in passing data

Former Member
0 Kudos

Hello Friends,

I have created an application for equipment master...for create details...i m calling Bapi.....the following code for action event :

method ONACTIONB_CREATE .

data lv_bapi_itob type BAPI_ITOB.

data lv_BAPI_ITOB_EQ_ONLY type BAPI_ITOB_EQ_ONLY.

data lv_BAPI_ITOB_PARMS type BAPI_ITOB_PARMS-EQUIPMENT.

data lv_BAPI_FLEET type BAPI_FLEET.

data lv_BAPI_ITOB_EQ_INSTALL type BAPI_ITOB_EQ_INSTALL.

CALL FUNCTION 'BAPI_EQUI_CREATE'

EXPORTING

EXTERNAL_NUMBER = lv_BAPI_ITOB_PARMS

DATA_GENERAL = lv_BAPI_ITOB

DATA_SPECIFIC = lv_BAPI_ITOB_EQ_ONLY

DATA_FLEET = lv_BAPI_FLEET

VALID_DATE = SY-DATUM

DATA_INSTALL = lv_BAPI_ITOB_EQ_INSTALL .

  • IMPORTING

  • EQUIPMENT =

  • DATA_GENERAL_EXP =

  • DATA_SPECIFIC_EXP =

  • DATA_FLEET_EXP =

  • RETURN =

.

*---bapi

data: return type standard table of bapiret2.

data: ls_return type bapiret2.

DATA lo_nd_bapi_equip_display TYPE REF TO if_wd_context_node.

DATA lo_el_bapi_equip_display TYPE REF TO if_wd_context_element.

DATA ls_bapi_equip_display TYPE wd_this->Element_bapi_equip_display.

  • navigate from <CONTEXT> to <BAPI_EQUIP_DISPLAY> via lead selection

lo_nd_bapi_equip_display = wd_context->get_child_node( name = wd_this->wdctx_bapi_equip_display ).

  • @TODO handle non existant child

  • IF lo_nd_bapi_equip_display IS INITIAL.

  • ENDIF.

  • get element via lead selection

lo_el_bapi_equip_display = lo_nd_bapi_equip_display->get_element( ).

  • @TODO handle not set lead selection

IF lo_el_bapi_equip_display IS INITIAL.

ENDIF.

  • get all declared attributes

lo_el_bapi_equip_display->get_static_attributes(

IMPORTING

static_attributes = ls_bapi_equip_display ).

read table return into ls_return with key type = 'E'.

IF sy-subrc = 0.

else.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

IMPORTING

RETURN = ls_RETURN .

endif.

endmethod.

Pls help.

Thanks

Kiran

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

you didnt mention where you are facing the problem. Explain it clearly so that people here can help you!

Best Regards,

Srilatha

Former Member
0 Kudos

Hi,

I am new in Webdynpro....Can u pls tell me how to create change and dispaly data in webdynpro....what code we write for that using BAPI...I have developed this application for Equipment master.

Thanks

Kiran

Former Member
0 Kudos

Hi Kiran,

Go through the following article:

http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9cb5d345-0801-0010-6a8e-fc57c23fd...

It explains the usage of BAPI in webdynpro. The example mentioned in the article was using a display BAPI. But you can follow that to use create BAPI.

Let us know even if you are not able to proceed after going through the article.

Hope this helps!

Best Regards,

Srilatha

gill367
Active Contributor
0 Kudos

Hello Kiran,

You can use service controller for call to these BAPIs.

For doing this proceed as follows.

1. right click on the web dynpro comp that you created.

2. go to create->service controller.

3. popup will open , there click on continue.

4. in the next screen, select create new controller radio button then give a new name to custom controler say 'Zeuip_Create'.

5 click on continue, select Function Module in the nexte screen and contibue.

6. give the name of the BAPI here BAPI_EQUI_CREATE and some description

7. in the next screen it will ask for the context nodes and attirbutes to be created.

8 . from the drop donw in the third col ObjectType select context node for all the fields if you need all the details.

9. continue and in next screen again continue.

and done. one custum controller with a service call to your BAPI to create equipment has been created.

It will haev one execute method with name EXECUTE_BAPI_EQUI_CREATE.

Map the required attribute to the context of the view and then after fillign in the data call this execute method.

it will execute the BAPI and fill the imported data in the importing node.

SAme way create service calls to display and change.

thanks

sarbjeet singh