Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

inserting data into ztable by web services is not working.

prabhanjan_reddy
Participant
0 Kudos

hi,

experts

i have created web services for function module

and i am using that web service and its not updating the data into ztable

where as if i execute that f module is getting updated in ecc working fine with rfc

and my code is

loop at recipe_item assigning <fs_recipe_item>.

wa_recipe_item-mandt = sy-mandt.

  • wa_recipe_head-reinr = im_reinr.

wa_recipe_item-reinr = im_reinr.

wa_recipe_item-matnr = <fs_recipe_item>-matnr.

wa_recipe_item-item = <fs_recipe_item>-item.

wa_recipe_item-arbpl = <fs_recipe_item>-arbpl.

wa_recipe_item-ltxa1 = <fs_recipe_item>-ltxa1.

wa_recipe_item-bmsch = <fs_recipe_item>-bmsch.

wa_recipe_item-vgw01 = <fs_recipe_item>-vgw01.

wa_recipe_item-vgw02 = <fs_recipe_item>-vgw02.

wa_recipe_item-vgw03 = <fs_recipe_item>-vgw03.

wa_recipe_item-vgw04 = <fs_recipe_item>-vgw04.

wa_recipe_item-vgw05 = <fs_recipe_item>-vgw05.

wa_recipe_item-vgw06 = <fs_recipe_item>-vgw06.

wa_recipe_item-uom = <fs_recipe_item>-uom.

append wa_recipe_item to ist_recipe_item.

clear wa_recipe_item.

endloop.

modify zpp_recipe_head from wa_recipe_head.

regards,

prabhanjan

3 REPLIES 3

Former Member
0 Kudos

wa_recipe_item-uom = <fs_recipe_item>-uom.

append wa_recipe_item to ist_recipe_item.

clear wa_recipe_item.

endloop.

MODIFY ZPP_RECIPE_ITEM from table IST_RECIPE_ITEM.

modify zpp_recipe_head from wa_recipe_head.

or:

wa_recipe_item-uom = <fs_recipe_item>-uom.

MODIFY ZPP_RECIPE_TIEM from WA_RECIPE_ITEM.

* comment out append wa_recipe_item to ist_recipe_item.*

clear wa_recipe_item.

endloop.

0 Kudos

As Pointed out, I dont know why your code works in SE37? Can you paste full code?

Regards,

Nitesh

0 Kudos

hi,

expert

this is the code of my function module

as it is working in ecc and wen if i use this web service through rfc its not updating the tble.

types: begin of ty_recipe_header,

mandt type mandt, " Client

reinr type zpp_recipe_head-reinr, " Request no. for Recipe

werks type zpp_recipe_head-werks, " Plant

matnr type zpp_recipe_head-matnr, " Material Number

stlal type zpp_recipe_head-stlal, " Alternative BOM

maktx type zpp_recipe_head-maktx, " Material Description

bmsch type zpp_recipe_head-bmsch, " Base Quantity

bom_txt type zpp_recipe_head-bom_txt, " BOM Text

alt_txt type zpp_recipe_head-alt_txt, " Alternate Text

end of ty_recipe_header.

types: begin of ty_recipe_item,

mandt type mandt, " Client

reinr type zpp_recipe_item-reinr, " Request no. for Recipe

matnr type zpp_recipe_item-matnr, " Material Number

item type zpp_recipe_item-item, " Item

arbpl type zpp_recipe_item-arbpl, " Resource

ltxa1 type zpp_recipe_item-ltxa1, " Resource Text

bmsch type zpp_recipe_item-bmsch, " Item Base Quantity

vgw01 type zpp_recipe_item-vgw01, " Set Up Time / Power (KWH)

vgw02 type zpp_recipe_item-vgw02, " Machine Time / Steam(Kg)

vgw03 type zpp_recipe_item-vgw03, " Eflluent(L)

vgw04 type zpp_recipe_item-vgw04, " Eflluent(S)

vgw05 type zpp_recipe_item-vgw05, " No. of Batches

vgw06 type zpp_recipe_item-vgw06, " Analysis Time

uom type zpp_recipe_item-uom, " UOM

end of ty_recipe_item.

----


  • Internal table Declarations *

----


data: ist_recipe_head type standard table of ty_recipe_header,

ist_recipe_item type standard table of ty_recipe_item.

----


  • Work Area table Declarations *

----


data: wa_recipe_head type ty_recipe_header,

wa_recipe_item type ty_recipe_item.

data: wa_return type bapiret2.

----


  • Field symbol Declaration *

----


field-symbols:<fs_recipe_item> type zrecipe_item.

clear wa_recipe_head.

----


  • Populating Recipe Header data *

----


wa_recipe_head-mandt = sy-mandt.

wa_recipe_head-reinr = im_reinr.

wa_recipe_head-werks = im_werks.

wa_recipe_head-matnr = im_matnr.

wa_recipe_head-stlal = im_stlal.

wa_recipe_head-maktx = im_maktx.

wa_recipe_head-bmsch = im_bmsch.

wa_recipe_head-bom_txt = im_bom_txt.

wa_recipe_head-alt_txt = im_alt_txt.

----


  • Populating Recipe Item data *

----


loop at recipe_item assigning <fs_recipe_item>.

wa_recipe_item-mandt = sy-mandt.

  • wa_recipe_head-reinr = im_reinr.

wa_recipe_item-reinr = im_reinr.

wa_recipe_item-matnr = <fs_recipe_item>-matnr.

wa_recipe_item-item = <fs_recipe_item>-item.

wa_recipe_item-arbpl = <fs_recipe_item>-arbpl.

wa_recipe_item-ltxa1 = <fs_recipe_item>-ltxa1.

wa_recipe_item-bmsch = <fs_recipe_item>-bmsch.

wa_recipe_item-vgw01 = <fs_recipe_item>-vgw01.

wa_recipe_item-vgw02 = <fs_recipe_item>-vgw02.

wa_recipe_item-vgw03 = <fs_recipe_item>-vgw03.

wa_recipe_item-vgw04 = <fs_recipe_item>-vgw04.

wa_recipe_item-vgw05 = <fs_recipe_item>-vgw05.

wa_recipe_item-vgw06 = <fs_recipe_item>-vgw06.

wa_recipe_item-uom = <fs_recipe_item>-uom.

append wa_recipe_item to ist_recipe_item.

clear wa_recipe_item.

endloop.

unassign <fs_recipe_item>.

----


  • Updating Recipe Header Table *

----


if wa_recipe_head is not initial.

modify zpp_recipe_head from wa_recipe_head.

if sy-subrc = 0.

commit work .

wait up to 2 seconds .

wa_return-type = 'S'.

wa_return-message = 'Recipe Header updated Sucessfully' .

append wa_return to return.

clear wa_return.

else.

rollback work.

endif.

endif.

----


  • Updating Recipe Item Table *

----


if ist_recipe_item[] is not initial.

modify zpp_recipe_item from table ist_recipe_item[].

if sy-subrc = 0.

commit work .

wait up to 2 seconds .

wa_return-type = 'S'.

wa_return-message = 'Recipe Item updated Sucessfully' .

append wa_return to return.

clear wa_return.

else.

rollback work.

endif.

endif.

refresh ist_recipe_item[].

regards,

prabhanjan