Application Development and Automation 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: 
Read only

Updating SAP Database Table

Former Member
0 Likes
1,977

Using the following code I'm trying to update a field in the sap database table LIKP. The field I'm trying to update is called vlabdata. Please note I'm using this code in a user exit within the IDOC_INPUT_DELVRY. But its not updating the value in LIKP when I try to see the table in SE16 for that delivery #. What could be the problem?

TABLES likp.

UPDATE likp SET vlabdata = delivery_head-vlabdata where vbeln = delivery_head-vbeln_VL.

Please note:

In debug mode I can see that the values in delivery_head-vlabdata & delivery_head-vbeln_VL are correct.

Thanks in advance,

Risad

Edited by: mrisad on Aug 25, 2010 3:34 AM

Edited by: mrisad on Aug 25, 2010 3:35 AM

Using the following code I'm trying to update a field in the sap database table LIKP. The field I'm trying to update is called vlabdata. Please note I'm using this code in a user exit within the IDOC_INPUT_DELVRY. But its not updating the value in LIKP when I try to see the table in SE16 for that delivery #. What could be the problem?

TABLES likp.

UPDATE likp SET vlabdata = delivery_head-vlabdata where vbeln = delivery_head-vbeln_VL.

Please note:

In debug mode I can see that the values in delivery_head-vlabdata & delivery_head-vbeln_VL are correct.

Thanks in advance,

Risad

Edited by: mrisad on Aug 25, 2010 3:34 AM

Edited by: mrisad on Aug 25, 2010 3:35 AM

10 REPLIES 10
Read only

former_member189059
Active Contributor
0 Likes
1,790

Hello,

Did you use a 'commit work' statement?

Note that it is not advisable to make direct updates on standard tables.

The better option is to search for a BAPI or other function module.

Read only

0 Likes
1,790

I've never used a BAPI before but I'm going to look into it right now. But will BAPI's work from user exits?

Read only

Former Member
0 Likes
1,790

I just wanted to double check: can BAPI function modules be called and performed within a user exit? I am programming within a user exit in the function module IDOC_INPUT_DELVRY.

Within a call customer function '002' within IDOC_INPUT_DELVRY.

Am I going to be successfully able to use the BAPI from that user exit?

Read only

0 Likes
1,790

Yes Standard BAPI will work in user exit,

try :BAPI_OUTB_DELIVERY_CHANGE

Edited by: pr@t on Aug 25, 2010 10:03 AM

Read only

Former Member
0 Likes
1,790

DEar Risad,

Update statement for STANDARD SAP TABLE is not recommended,

Try to update that filed by using BAPI...

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,790

Guys,

Do you realise that IDOC_INPUT_DELVRY updates LIKP? I don't understand why the OP needs to use BAPI to update LIKP?

@OP: Post your exact business requirement for further inputs.

BR,

Suhas

Read only

0 Likes
1,790

@Suhas,

I checked the IDOC_INPUT_DELVRY and I couldn't find a location where likp-vlabdata was being updated. Basically what I need to do is once a DELVRY03 idoc comes in to the system, it needs to grab one value from a specific location from the idoc (which is done) and update likp-vlabdata with that value. When I was going through the function module I personally couldn't find a place where vlabdata was being updated.

@Sachin,

I'm new to abap and sap so I didn't realize that it was a rule of thumb not to try and update the standard tables directly, so I'm looking into BAPI's now.

Thanks,

Risad

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,790

Hello Risad,

I don't find the field VLABDATA in LIKP & LIPS. Is it a custom field added to the table ?

If you debug deep into the IB processing FM you'll find the location where the table LIKP is updated

What i want to say is that you don't have to use BAPI to update this field. In the relevant Exit / BAdI, you can write code to populate the custom fields. SAP will automatically update the table.

BR,

Suhas

Read only

0 Likes
1,790

suhas,

It is a custom field I believe. I'm basically working on a client system where there is code (within the IDOC_INPUT_DELVRY) to update not likp-vlabdata but a control record (someone else wrote that code not SAP). I tried to manipulate my user exit so it would be able to use that existing code but it just didn't work. My last option is to just use a BAPI and hope it works.

my question is, if it is a custom field, will bapi work?

Risad

Read only

0 Likes
1,790

well the dudes that modified/enhanced the table with the custom field have hopefully updated the BAPI structures as well.

then yes you can use your custom field within the BADI as well.

If not you cant, unless you update the BAPI-structures.

Note, that in some cases this works automatically since sometimes the bapi structures are including the real tables.