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

Commit on LIKP doesn't work.

Former Member
0 Likes
1,784

Hi all,

I need to perform an update on a transparent table LIKP. In particular, I have to select a special delivery number (VBELN) into the LIKP and set up the VSART field to a particular value.

I have used the following code but the COMMIT doesn't work:

SELECT SINGLE * FROM likp INTO wa_likp
          WHERE vbeln EQ ddt.
        wa_likp-vsart = '03'.
        MODIFY likp FROM wa_likp.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .
WAIT UP TO 5 SECONDS.

If I put a breakpoint on the select statement, the code works fine.

Does anyone have any suggestion to do this work?

Thanks,

GB

18 REPLIES 18
Read only

Former Member
0 Likes
1,716

Instead of BAPI* FM use Commit Work

Read only

Former Member
0 Likes
1,716

commit work would definately or else try calling the fm u are using, in update task

Read only

former_member156446
Active Contributor
0 Likes
1,716

Hi there... try this

Its always good practice to check the select and then perform the process..

SELECT SINGLE * FROM likp INTO wa_likp
          WHERE vbeln EQ ddt.
        wa_likp-vsart = '03'.
if sy-subrc eq 0.
        MODIFY likp FROM wa_likp.
        Commit work.
endif.

Read only

Former Member
0 Likes
1,716

Hi,

I would suggest you use UPDATE instead of MODIFY.


SELECT SINGLE * FROM likp INTO wa_likp
          WHERE vbeln EQ ddt.
        wa_likp-vsart = '03'.

UPDATE LIKP SET VSART = '03'
where vbeln EQ wa_likp-vbeln.
COMMIT WORK.

Now if you already have the document number, you need not select from the database. Simply use the UPDATE statment. And remember to use the conversion exit for the delivery number before you do the update.

regards,

Aadvait

Edited by: Advait Gode on Dec 13, 2008 8:32 PM

Read only

0 Likes
1,716

Hi all,

I used all your tips, but without any result.

Other ideas?

Thanks,

Gianluca

Read only

0 Likes
1,716

Hi,

Can you paste the code that you have implemented ? I hope you are using the conversion exit for the Delivery number as I mentioned earlier.

What I was proposing was something like this.


" call the conversion exit for the field ddt 
UPDATE LIKP SET VSART = '03'
where vbeln EQ ddt.
if sy-subrc = 0.  "Put a breakpoint here and see what is the value of Sy-subrc. If you dont want to put a break point, then give a message with the value of the sy-subrc to see if the update was successfull
COMMIT WORK.
endif.

Also make sure that 03 is an acceptable value for the field VSART and that there is no check table/ restrictive domain vaules for it.

regards,

Advait

Read only

0 Likes
1,716

Here are my code, that not work (Note that the VBELN doesn't need a conversion exit because it's filled by the SELECT single stm)

SELECT SINGLE * FROM likp INTO wa_likp
          WHERE vbeln EQ wa_sel_object_tab2-ddt.
         UPDATE likp SET vsart = '03'
          WHERE vbeln EQ wa_likp-vbeln.
        IF sy-subrc = 0.
          COMMIT WORK.
*        COMMIT WORK AND WAIT.
        ENDIF.

The value of sy-subr is 0 (I seen it in debug mode).

Also I tryed with the stm COMMIT WORK AND WAIT. without any result.

Help me please.

Thanks,

GB

Read only

0 Likes
1,716

your Code looks good through.

Small doubt:Check the Sy-subrc value for Below query?

*SELECT SINGLE * FROM likp INTO wa_likp*

WHERE vbeln EQ wa_sel_object_tab2-ddt

And VSART NE '03'.

Does Sy-subrc = 0 here?

Read only

Former Member
0 Likes
1,716

>

> CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .

> WAIT UP TO 5 SECONDS.

>

Try calling the FM like this

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' in update task.

Read only

rainer_hbenthal
Active Contributor
0 Likes
1,716

>

>

SELECT SINGLE * FROM likp INTO wa_likp
>           WHERE vbeln EQ ddt.
>         wa_likp-vsart = '03'.
>         MODIFY likp FROM wa_likp.
> 
> CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .
> WAIT UP TO 5 SECONDS.

>

> GB

Why do you do the select? Bad Performance....


update likp
  set vsart = '03'
  where vbeln = ddt.
if sy-subrc = 0.
  commit work and wait.
else.
  message 'Update likp failed' type 'A'.
endif.

Read only

0 Likes
1,716

No one of your solution works...

I try with:

the update task, the SET UPDATE TASK LOCAL, the UPDATE stm in place of the modify, the BAPI_TRANSACTION_COMMIT, the COMMIT WORK, but no result are taken.

How it's possible??!?

Read only

0 Likes
1,716

>

> No one of your solution works...

> How it's possible??!?

Yoa are doing something wrong.

Read only

0 Likes
1,716

There's any BAPI to perform the VSART change into an existing Delivery?

I created the Delivery with BAPI_OUTB_DELIVERY_CREATENOREF

I found BAPI_OUTB_DELIVERY_CHANGE but how can I change the LIKP-VSART?

Thanks in advance,

GB

Read only

0 Likes
1,716

> > No one of your solution works...

> > How it's possible??!?

Yoa are doing something wrong.

Seems most likely to me.

Read only

0 Likes
1,716

Hi all,

I solved the issue with this code:

*    Wait until COMMIT of Delivery
        DO.
          SELECT COUNT(*) FROM likp
            WHERE vbeln = ddt.
          CHECK sy-subrc = 0.
          EXIT.
        ENDDO.

        UPDATE likp SET vsart = '03'
         WHERE vbeln EQ ddt.
        IF sy-subrc NE 0.
          MESSAGE w904 WITH ddt '03'.
        ENDIF.

The infinite loop is useful to guarantee that the delivery is committed.

Best regards,

Gianluca Barile

Read only

0 Likes
1,716

Hi,

It seems like you are doing this in a user exit while creating the delivery. In that case yes the update will not happen until the delivery is created in the database. You didn't mention in your question about this and hence everybody was on a single track.

regards,

Advait

Read only

Former Member
0 Likes
1,716

after MODIFY likp FROM wa_likp.

try with SET UPDATE TASk LOCAL

Read only

Former Member
0 Likes
1,716

I tried your code. It works fine. You are probably not SELECTing anything in the first place because of missing leading zeroes.

Rob