Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2175

Problem with MWST replace by condition formula

$
0
0

Hi Gurus,

 

I have settled an EDI process (inbound message ORDERS05) to create a sales order in SAP ECC 700.

 

The requirement is to acquire MWST value passed by IDOC as they are.

 

To fit the requirement, considering I didn't find the solution by means of IDOC, I added to the pricing procedure a manual statistical condition ZSWT that ia fulfilled by IDOC values.

 

Then I use this condition to set values in MWST (real VAT condition) with a value formula (904).

The ABAP code of the formula is the following:

 

------------------------------------------------------------------------------------------------------------------------

CONSTANTS: c_zwst TYPE C LENGTH 4 VALUE 'ZWST',

            c_mwst TYPE C LENGTH 4 VALUE 'MWST'.

 

DATA: ls_vbkd TYPE vbkd,

       tkomv type standard table of komv_index

                      with header line,

       idx type I,

       work_kbetr type P,

       work_kwert type P.

 

FIELD-SYMBOLS <lt_xvbkd> TYPE ANY TABLE.

 

FIELD-SYMBOLS: <ls_xkomv> LIKE LINE OF tkomv,

                <ls2_xkomv> LIKE LINE OF tkomv.

 

CLEAR ls_vbkd.

 

ASSIGN ('(SAPMV45A)XVBKD[]') TO <lt_xvbkd>.

 

IF sy-subrc = 0.

   CLEAR: ls_vbkd, tkomv, idx.

 

    LOOP AT  <lt_xvbkd> INTO ls_vbkd.

     IF ls_vbkd-posnr = xkomv-kposn.

 

        if xkomv-kschl EQ c_mwst.

           IF ls_vbkd-posex_e NE ''.

             xkomv-mwsk1 = ls_vbkd-posex_e.

              clear: work_kbetr, work_kwert.

              READ TABLE xkomv ASSIGNING <ls_xkomv> WITH KEY

                          kposn = ls_vbkd-posnr kschl = c_zwst.

                 if sy-subrc = 0.

                       work_kbetr = <ls_xkomv>-kbetr.

                       work_kwert = <ls_xkomv>-kwert.

 

                       READ TABLE xkomv ASSIGNING <ls2_xkomv> WITH KEY

                                  kposn = ls_vbkd-posnr kschl = c_mwst.

                       if sy-subrc = 0.

                             idx = sy-tabix.

                             <ls2_xkomv>-kbetr <ls_xkomv>-kbetr.

                             <ls2_xkomv>-kofrm = 0.

                             xkwert = <ls_xkomv>-kwert.

                             MODIFY xkomv INDEX idx FROM <ls2_xkomv>

                                    TRANSPORTING kbetr kofrm.

                       endif.

                endif.

           ENDIF.

        ENDIF.

     ENDIF.

   ENDLOOP.

 

ENDIF.


----------------------------------------------------------------------------------------------------------------------------------


I cheched that XKOMV after running this formula set properly values coming form i-doc in XKOMV-KBETR, XKOMV-KWERT and XKOMV-MWSK1 as requested in the requirement.


But the last call of the value formula during debug process before saving the order is called by this piece of code inside INCLUDE LV61AA55



* execute condition value formula not changing xkomv

* will normally be processed in xkomv_kwert_ermitteln

     if xkomv-kofrm ne 0 and wertformel eq space and komp-kposn ne 0.

       rettkomv = xkomv.

       xkwert   = xkomv-kwert.

       frm_kondi_wert-nr = xkomv-kofrm.

       perform (frm_kondi_wert) in program saplv61a if found.

       xkomv    = rettkomv.

     endif.


I tried to set in my condition value formula the field XKOMV-KOFRM= 0 in order to by-bass this last call, because structure rettkomv is determined by the system and cannot be modified inside the condition value formula, but unsuccessfully.


Can anyone of you help me in finding the right solution to the issue?


Many Thanks in advance for your support.


Gianni


Viewing all articles
Browse latest Browse all 2175

Trending Articles