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: 

Problem with ''BAPI_GOODSMVT_CREATE'' inside LMBGBFSU ( FORM ausgabe )

shiz0frenik
Participant
0 Kudos

Hi, experts.
i've got a problem at  ''BAPI_GOODSMVT_CREATE'.
I've got  an  custom field at MSEG, with type of Quan, with 9 possible decimal digits.
When i try to post document with quantity of digits 4 or more i'm getting an mistake "Account determination for entry AUM not possible". And if quantity of digits of this field is 3 or less posting works well.

I found a program a place deep inside ''BAPI_GOODSMVT_CREATE' where it happends.
I think the reason of it is table XZCXCM which filled by values inside LMBGBFSU( FORM ausgabe ).
Here it goes for loop at x156w. The values of x156w absolutely the same but values of XZCXCM fills differently.

shiz0frenik_0-1713877501306.png

 

 

 

FORM ausgabe USING a-bustw LIKE mseg-bustw.

  DATA: curtp   LIKE smbew-curtp,
        waers   LIKE smbew-waers,
        xsubs   TYPE zcxcm-xsubs,
        l_menge TYPE mseg-menge,
        l_dmbtr TYPE mseg-dmbtr,
        l_msgv1 TYPE symsgv,
        l_msgv2 TYPE symsgv.

* Unicode change
  DATA name_of_struct_comp(22) TYPE c.

  LOOP AT x156w WHERE bustw = a-bustw.
    IF x156w-xbgbb IS INITIAL OR ycurtp-umwae IS INITIAL.
      curtp = ycurtp-curtp.
      waers = ycurtp-waers.
      xsubs = ycurtp-xsubs.
    ELSE.
      curtp = ycurtp-umcur.
      waers = ycurtp-umwae.
      xsubs = ycurtp-umxsu.
    ENDIF.
    CLEAR: xzcxcm-vkwrt, xzcxcm-bualt, xzcxcm-lbbtr, xzcxcm-shkzm.

    ASSIGN (x156w-feldn) TO <betrag>.

    IF NOT sy-subrc IS INITIAL.
      MESSAGE e103 WITH x156w-feldn '<betrag>'.
    ENDIF.

    ASSIGN (x156w-shnam) TO <sh_kzg>.

    IF NOT sy-subrc IS INITIAL.
      MESSAGE e103 WITH x156w-shnam '<sh_kzg>'.
    ENDIF.
    IF NOT x156w-smnam IS INITIAL.
      ASSIGN (x156w-smnam) TO <sm_kzg>.
      IF NOT sy-subrc IS INITIAL.
        MESSAGE e103 WITH x156w-smnam '<sm_kzg>'.
      ENDIF.
      xzcxcm-shkzm = <sm_kzg>.
    ENDIF.
    xzcxcm-dmbtr = <betrag>.
    xzcxcm-shkzg = <sh_kzg>.
ENHANCEMENT-POINT ausgabe_01 SPOTS es_saplmbgb.

ENHANCEMENT-SECTION     ausgabe_04 SPOTS es_saplmbgb.
*   note 673328: consistency for SHKZG ---------------------------------
*   SHKZG is supposed to be the same for BSX in current period and in
*   MSEG. Check it to detect inconsistencies before document is posted.
    IF   x156w-xbmat = x AND x156w-xumbw = space
*     check XZCXCM for lines with material update (XBMAT = X) which are
*     not the revaluation for postings to the prev. period (XUMBW = X)
      AND
          xzcxcm-shkzg <> space AND mseg-shkzg <> space
*     a value <> 0 is posted
      AND
         ( ( xzcxcm-shkzg <> mseg-shkzg AND x156w-buzid = m )
*           no transfer line: expecting MSEG-SHKZG = XZCZCM-SHKZG for
*           BUZID = M -> BSX for primary posting (Leitbuchung)
          OR
           ( xzcxcm-shkzg = mseg-shkzg  AND x156w-buzid = u ) ).
*           automatically created line for transfer: expecting
*           MSEG-SHKZG <> XZCZCM-SHKZG, identify line with BUZID = U
      IF mseg-shkzg = s.
        l_menge = mseg-menge.
        l_dmbtr = 0 - xzcxcm-dmbtr.
      ELSE.
        l_menge = 0 - mseg-menge.
        l_dmbtr = xzcxcm-dmbtr.
      ENDIF.
      WRITE l_menge UNIT mseg-meins TO l_msgv1.
      WRITE l_dmbtr CURRENCY mseg-waers TO l_msgv2.
      CONDENSE: l_msgv1, l_msgv2.
      MESSAGE e330 WITH l_msgv1 l_msgv2.
*     Preis der Warenbewegung wird negativ
    ENDIF.
*   end of consistency check for SHKZG ---------------------------------
END-ENHANCEMENT-SECTION.
    IF x156w-vorsl = vorsl_bsx.
      IF x156w-buzid = m.
        IF x156w-xumbw IS INITIAL.
          xzcxcm-bualt = bualt.
          xzcxcm-lbbtr = lbwert.
        ELSEIF NOT smbestu IS INITIAL.
          IF smbestd = smbestu.
            xzcxcm-bualt = buaum - bualt.
          ELSE.
            xzcxcm-bualt = bualt - buaum.
          ENDIF.
        ENDIF.
      ELSEIF x156w-buzid = u.
        IF x156w-xumbw IS INITIAL.
          xzcxcm-bualt = umbua.
        ELSEIF NOT shumbsu IS INITIAL.
          IF shverbr = shumbsu.
            xzcxcm-bualt = umbum - umbua.
          ELSE.
            xzcxcm-bualt = umbua - umbum.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.
    IF NOT x156w-xbmat IS INITIAL AND x156w-xumbw IS INITIAL.
      IF NOT vm07m-xvkbw IS INITIAL AND x156w-buzid = m.
        xzcxcm-vkwrt = mseg-vkwrt.
      ELSEIF NOT dm07m-umxvk IS INITIAL AND x156w-buzid = u.
        xzcxcm-vkwrt = dm07m-umvkw.
      ENDIF.
    ENDIF.
    xzcxcm-cnt02 = x156w-cnt02.
    xzcxcm-buzid = x156w-buzid.
    xzcxcm-vorsl = x156w-vorsl.
    xzcxcm-xumbw = x156w-xumbw.
    xzcxcm-waers = waers.
    xzcxcm-curtp = ycurtp-curtm.
    xzcxcm-xsubs = xsubs.
ENHANCEMENT-POINT ausgabe_02 SPOTS es_saplmbgb.
    APPEND xzcxcm.
*   Extract data for cross-system goods movments to use the
*   valuation in this system on the other side.
*   Relevant only for the settlement posting (GBB).
*   Document currency is not needed.
    IF x156w-settlement = x AND xzcxcm-curtp <> '00'.       "sdp462
      CALL METHOD cl_mmim_cross_system=>fetch_valuation     "sdp462
        EXPORTING                                           "sdp462
          i_line_id = mseg-line_id                          "sdp462
          is_zcxcm  = xzcxcm.                               "sdp462
    ENDIF.                                                  "sdp462
  ENDLOOP.

ENHANCEMENT-POINT ausgabe_03 SPOTS es_saplmbgb.
ENDFORM.  

 

 

The problem is with assigning fileds to  <sh_kzg> (32 line ) and <betrag> (26 line)

 

ASSIGN (x156w-feldn) TO <betrag>.
ASSIGN (x156w-shnam) TO <sh_kzg>.

, which lately inserting into XZCXCM.
i don't understand why at one case it becames empty and in another it equals to 'S'.
As i told field of x156w absolutely the same. 
 
  

1 REPLY 1

shiz0frenik
Participant
0 Kudos

 

I found that it happends because of difference between UMLAGERUNG and FW_VERBRAUCH at LMBGBFWA
(Form wa04. )

 

   
   UMBST = UMLAGERUNG.                                          "561708
    UMBST = 0 - UMBST.                                           "561708
    bestd = bestand.
    prdif = verbrauch.
    prdif = prdif - bestd.
    umdif = fw_verbrauch.
    umdif = 0 - umbst - umdif.

 

 After first part of posting the document creates and this block works for BETRAG which lately assigned to FW_VERBRAUCH.
at second part when two documents should be created same block works for UMLAGERUNG.

 

FORM wert_preisproportional USING w-stprs  LIKE mbew-stprs
                                  w-peinh  LIKE mbew-peinh
                                  w-menge  LIKE menge
                                  w-betrag LIKE betrag.

  w-betrag = ( w-menge * w-stprs / 1000 ) / w-peinh.
  IF w-betrag > maximum OR w-betrag < minimum.
    MESSAGE e302 WITH 'WERT_PREISPROPORTIONAL' 'W-BETRAG'.
  ENDIF.

ENDFORM.  

 

Here w_betrag becames equal to 8.0039999999999996E+00,

when :
w_menge = 2.0000000000000000E+00
W-STPRS = 40.02
W-PEINH = 1.
1) Why it becames  8.0039999999999996E+00, when it should be  8.0039999999999996E-02,
2) Why after compiling this line result of  w_betrag  at once assigning to BETRAG at first part
and to UMLAGERUNG at second.