<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Error Message after changing another Infotype inside a dynamic action in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-message-after-changing-another-infotype-inside-a-dynamic-action/m-p/785482#M39568</link>
    <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;Sorry for the missing coding. I added the coding of the second example I made.&lt;/P&gt;&lt;P&gt;Thanks and kind regards&lt;/P&gt;</description>
    <pubDate>Tue, 05 Mar 2019 09:41:32 GMT</pubDate>
    <dc:creator>former_member310342</dc:creator>
    <dc:date>2019-03-05T09:41:32Z</dc:date>
    <item>
      <title>Error Message after changing another Infotype inside a dynamic action</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-message-after-changing-another-infotype-inside-a-dynamic-action/m-p/785480#M39566</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;
  &lt;P&gt;I got two cases where I get a warning or an error message.&lt;/P&gt;
  &lt;P&gt;In both cases I'm using a dynamic action which then changes another infotype via FM hr_infotype_operation.&lt;/P&gt;
  &lt;P&gt;First example:&lt;BR /&gt;On changing IT2001 I need to change another IT2001 (Subtype 0171) and IT9010.&lt;BR /&gt;For some reason I get the warning that there is no data available for subtype 0171.&lt;BR /&gt;While debugging the FM doesn't return any error and also the IT is being processed.&lt;/P&gt;
  &lt;P&gt;Second example:&lt;BR /&gt;On changing IT0008 (wage type 1101) an IT0014 (wagetype 9900 and 9980) should be created. I'm getting an error that the wagetyp 1101 isn't allowed for IT0014.&lt;BR /&gt;While debugging here are also now errors.&lt;/P&gt;
  &lt;P&gt;Does anyone had the same issue using dynamic actions?&lt;BR /&gt;I checked all the data while debugging and I they seem alright. The wagetype f.e. is always the right one and in the IT0014 processing there is no wagetyp 1101 to be found.&lt;BR /&gt;Somewhere SAP is mixing things together but I can't figure out where and how to seperated these processes.&lt;/P&gt;
  &lt;P&gt;Class (Main):&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;    DATA: lv_prozent      TYPE p0008-bsgrd.
    DATA: lv_betrag       TYPE pad_amt7s.
    DATA: lv_jahresgehalt TYPE pad_amt7s.
    DATA: ls_return       TYPE bapireturn1.
    DATA: ls_p0014        TYPE p0014.
**************************************************************
* Prüfungen um Personalnummer einzuordnen (MaKrs, Tarif)     *
**************************************************************
    check_pernr( ).
**************************************************************
* Berechnungen der Werte durchführen                         *
**************************************************************
    calculate_values(
      IMPORTING
        ev_prozent      = lv_prozent             " Beschäftigungsgrad
        ev_betrag       = lv_betrag              " Lohnartenbetrag für Bezüge
        ev_jahresgehalt = lv_jahresgehalt        " Lohnartenbetrag für Bezüge
    ).
    ev_jahresgehalt = lv_jahresgehalt.

**************************************************************
* Anpassung / Anlage der Infotypen                           *
**************************************************************
    ls_p0014-pernr = gv_pernr.
    ls_p0014-begda = gv_begda.
    ls_p0014-endda = gv_endda.
    ls_p0014-aedtm = sy-datum.
    ls_p0014-infty = '0014'.
    ls_p0014-betrg = lv_betrag.
    ls_p0014-waers = 'EUR'.

    CASE gv_persk.
      WHEN '20'."Außendienst =&amp;gt; Provision
        ls_p0014-lgart = 9985.
        ls_p0014-subty = '9985'.
      WHEN '01' "AT-Mitarbeiter, Leitender MA, Vorstand/GF =&amp;gt; Erfolgsbeteiligung (EFB)
        OR '02'
        OR '03'.
        ls_p0014-lgart = 9900.
        ls_p0014-subty = '9900'.
      WHEN OTHERS.
    ENDCASE.



    CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
      EXPORTING
        number = gv_pernr
      IMPORTING
        return = ls_return.

    CALL FUNCTION 'HR_INFOTYPE_OPERATION'
      EXPORTING
        infty         = '0014'
        number        = gv_pernr
        subtype       = ls_p0014-subty
*       OBJECTID      =
*       LOCKINDICATOR =
        validityend   = gv_endda
        validitybegin = gv_begda
*       RECORDNUMBER  =
        record        = ls_p0014
        operation     = 'INS'
*       TCLAS         = 'A'
*       DIALOG_MODE   = '0'
        nocommit      = ' '
*       VIEW_IDENTIFIER        =
*       SECONDARY_RECORD       =
      IMPORTING
        return        = ls_return
*       KEY           =
      .



    IF ls_return IS NOT INITIAL.

      "Fehlermeldung

      CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

    ENDIF.


    CASE gv_persk.
      WHEN '20'."Außendienst =&amp;gt; Provision
        ls_p0014-lgart = 9986.
        ls_p0014-subty = '9986'.
      WHEN '01' "AT-Mitarbeiter, Leitender MA, Vorstand/GF =&amp;gt; Erfolgsbeteiligung (EFB)
        OR '02'
        OR '03'.
        ls_p0014-lgart = 9980.
        ls_p0014-subty = '9980'.
      WHEN OTHERS.
    ENDCASE.

    CLEAR: ls_p0014-betrg, ls_p0014-waers.

    ls_p0014-anzhl = lv_prozent.

    ls_p0014-zeinh = 030. "Prozent



    CALL FUNCTION 'HR_INFOTYPE_OPERATION'
      EXPORTING
        infty         = '0014'
        number        = gv_pernr
        subtype       = ls_p0014-subty
*       OBJECTID      =
*       LOCKINDICATOR =
        validityend   = gv_endda
        validitybegin = gv_begda
*       RECORDNUMBER  =
        record        = ls_p0014
        operation     = 'INS'
*       TCLAS         = 'A'
*       DIALOG_MODE   = '0'
        nocommit      = ' '
*       VIEW_IDENTIFIER        =
*       SECONDARY_RECORD       =
      IMPORTING
        return        = ls_return
*       KEY           =
      .

    IF ls_return IS NOT INITIAL.
      "Fehlermeldung
      CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
    ELSE.
*      COMMIT WORK.
    ENDIF.

    CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
      EXPORTING
        number = gv_pernr
      IMPORTING
        return = ls_return.
  ENDMETHOD.&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;P&gt;Method CALCULATE VALUES:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;  METHOD calculate_values.
    DATA: lv_betrg TYPE p0008-bet01.
    DATA: lv_lgart TYPE p0008-lga01.
    DATA: lv_ausna TYPE p0033-aus01.
    DATA: lv_y160 TYPE boole_d.
    DATA: lt_p0033 TYPE TABLE OF p0033.
    DATA: ls_p0033 TYPE p0033.

**************************************************************
* Prozentwert ermitteln                                      *
**************************************************************

    CASE gv_trfgr.
      WHEN 'AT1-ADP'
        OR 'AT2'.
        ev_prozent = '15.00'.
      WHEN 'AT1'
        OR 'VG1'
        OR 'VG2'.
        ev_prozent = '10.00'.
      WHEN 'OFK'
        OR 'VG3'.
        ev_prozent = '20.00'.
      WHEN 'VG2'.
        ev_prozent = '25.00'.
      WHEN 'LFK1'
        OR 'LFK2'
        OR 'VG5'
        OR 'VG6'.
        ev_prozent = '30.00'.
      WHEN 'UL'
        OR 'VG7'.
        ev_prozent = '40.00'.
      WHEN 'VS'.
        ev_prozent = '50.00'.
      WHEN OTHERS.
    ENDCASE.

**************************************************************
* EFB-Betrag / Provision berechnen                           *
**************************************************************
    DO 12 TIMES
      VARYING lv_lgart
        FROM gs_p0008_new-lga01
        NEXT gs_p0008_new-lga02
      VARYING lv_betrg
        FROM gs_p0008_new-bet01
        NEXT gs_p0008_new-bet02.
      IF lv_lgart EQ '1101'.
        ev_betrag = lv_betrg.
        EXIT.
      ENDIF.
    ENDDO.

    CALL FUNCTION 'HR_READ_INFOTYPE'
      EXPORTING
        pernr           = gv_pernr
        infty           = '0033'
        begda           = gv_begda
        endda           = gv_endda
      TABLES
        infty_tab       = lt_p0033
      EXCEPTIONS
        infty_not_found = 1
        OTHERS          = 2.

    IF sy-subrc &amp;lt;&amp;gt; 0.
* Implement suitable error handling here
    ENDIF.

    LOOP AT lt_p0033 INTO ls_p0033.
      DO 20 TIMES
        VARYING lv_ausna
          FROM ls_p0033-aus01
          NEXT ls_p0033-aus02.
        IF lv_ausna EQ 'Y160'.
          lv_y160 = 'X'.
        ENDIF.
      ENDDO.
    ENDLOOP.
    ev_jahresgehalt = ev_betrag.
    IF lv_y160 IS INITIAL.
      ev_jahresgehalt = ( ev_betrag * 13 ).
      ev_betrag = ( ev_betrag * 13 ) * ( ev_prozent / 100 ).
    ELSE.
      ev_jahresgehalt = ( ev_betrag * 12 ).
      ev_betrag = ( ev_betrag * 12 ) * ( ev_prozent / 100 ).
    ENDIF.
  ENDMETHOD.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Dynamic Action Function:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;*****Alten Datensatz ermitteln****************************************
  lv_var = '(MP000800)PSAVE'.
  ASSIGN (lv_var) TO FIELD-SYMBOL(&amp;lt;psave&amp;gt;) .
  ls_p0008_old = &amp;lt;psave&amp;gt;.
**********************************************************************
  lo_helper = NEW zcl_dyn_atgehalt_it14(
    iv_p0008_new  = p0008
    iv_p0008_old  = ls_p0008_old
  ).

  lo_helper-&amp;gt;main(
    IMPORTING
      ev_jahresgehalt = lv_jahresgehalt        " Lohnartenbetrag für Bezüge
  ).
  p0008-ansal = lv_jahresgehalt.
  p0008-ancur = 'EUR'.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Mar 2019 08:39:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-message-after-changing-another-infotype-inside-a-dynamic-action/m-p/785480#M39566</guid>
      <dc:creator>former_member310342</dc:creator>
      <dc:date>2019-03-05T08:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: Error Message after changing another Infotype inside a dynamic action</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-message-after-changing-another-infotype-inside-a-dynamic-action/m-p/785481#M39567</link>
      <description>&lt;P&gt;It would be great if you can provide the code excerpt of the function module. &lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 09:20:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-message-after-changing-another-infotype-inside-a-dynamic-action/m-p/785481#M39567</guid>
      <dc:creator>bpawanchand</dc:creator>
      <dc:date>2019-03-05T09:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: Error Message after changing another Infotype inside a dynamic action</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-message-after-changing-another-infotype-inside-a-dynamic-action/m-p/785482#M39568</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;Sorry for the missing coding. I added the coding of the second example I made.&lt;/P&gt;&lt;P&gt;Thanks and kind regards&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 09:41:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-message-after-changing-another-infotype-inside-a-dynamic-action/m-p/785482#M39568</guid>
      <dc:creator>former_member310342</dc:creator>
      <dc:date>2019-03-05T09:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: Error Message after changing another Infotype inside a dynamic action</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-message-after-changing-another-infotype-inside-a-dynamic-action/m-p/785483#M39569</link>
      <description>&lt;P&gt;I was able to debug the process a bit further.&lt;BR /&gt;Problem seems to be that the PAI of IT0008 is called twice. (Method P0008_INPUT)&lt;BR /&gt;In the second run in the PSPAR-structure the infotype is 0014.&lt;/P&gt;&lt;P&gt;While using the HR_INFOTYPE_OPERATION something was mixed up so that the structure now contains the wrong infotype.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Got anyone an idea how to fix this or how to better implement the logic to generate the IT14?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 10:21:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-message-after-changing-another-infotype-inside-a-dynamic-action/m-p/785483#M39569</guid>
      <dc:creator>former_member310342</dc:creator>
      <dc:date>2019-03-05T10:21:40Z</dc:date>
    </item>
  </channel>
</rss>

