SAP Jobsuche bei DV-Treff


Suchen
creative235
vor 4 Jahre
Hallo Leute,

ich suche zurzeit eine Möglichkeit über einen FuBa Preisstaffeln zu hinterlegen (KONM). Ausgetestet habe ich den FuBa "BAPI_PRICES_CONDITIONS" mit folgendem Coding:

   iv_konm-operation    = '018'.
   iv_konm-cond_no      = iv_knumh.
   iv_konm-cond_count   = '01'.
   iv_konm-line_no      = '0001'.
   iv_konm-scale_qty    = '1'.
   iv_konm-currency     = iv_input-ekp.

   APPEND iv_konm TO it_konm.

   LOOP AT it_staf INTO iv_staf.
     DATA: iv_lineno    TYPE i.

     iv_lineno            = ( iv_staf-stafi * 3 ) + 1.

     iv_konm-operation    = '018'.
     iv_konm-cond_no      = iv_knumh.
     iv_konm-cond_count   = '01'.
     iv_konm-line_no      = iv_lineno.
     iv_konm-scale_qty    = iv_staf-stafm.
     iv_konm-currency     = iv_staf-stafe.

     APPEND iv_konm TO it_konm.

   ENDLOOP.

   CALL FUNCTION 'BAPI_PRICES_CONDITIONS'
     TABLES
       ti_bapicondct  = it_ti_bapicondct
       ti_bapicondhd  = it_ti_bapicondhd
       ti_bapicondit  = it_ti_bapicondit
       ti_bapicondqs  = it_konm
       ti_bapicondvs  = it_ti_bapicondvs
       to_bapiret2    = it_to_bapiret2
       to_bapiknumhs  = it_to_bapiknumhs
       to_mem_initial = it_to_mem_initial
     EXCEPTIONS
       update_error   = 1                      " Fehler bei der Verbuchung
       OTHERS         = 2.

Ich habe nur die it_konm gefüllt, alle anderen sind initial. Als Operationswert habe ich alle einmal ausprobiert, leider hat es bei keinem hingehauen. Habt ihr Vorschläge oder eventuell andere FuBa's mit welchen ich Einträge in die KONM bekomme?

Viele Grüße

PS: Eine Exception wirft mir der FuBa nicht

wreichelt
vor 4 Jahre
Hallo,

ein BAPI_TRANSACTION_COMMIT wird ausgeführt ?

Gruß Wolfgng

creative235
vor 4 Jahre
Hallo,

danke für die schnelle Antwort! Ja den Commit setze ich ab. Hier der komplette Formcode:

FORM create_staf_infosatz USING iv_input TYPE input.

   DATA:   it_konm       TYPE STANDARD TABLE OF     bapicondqs.
   DATA:   iv_konm       LIKE LINE OF               it_konm.

   DATA:   iv_knumh      TYPE                       knumh.
   DATA:   iv_sobsl      TYPE                       sobsl.
   DATA:   iv_esokz      TYPE                       esokz.

   "  Testdeklarationen
   DATA:
     it_ti_bapicondct  TYPE STANDARD TABLE OF bapicondct, "TABLES PARAM
     it_ti_bapicondhd  TYPE STANDARD TABLE OF bapicondhd, "TABLES PARAM
     it_ti_bapicondit  TYPE STANDARD TABLE OF bapicondit, "TABLES PARAM
     it_ti_bapicondvs  TYPE STANDARD TABLE OF bapicondvs, "TABLES PARAM
     it_to_bapiret2    TYPE STANDARD TABLE OF bapiret2, "TABLES PARAM
     it_to_bapiknumhs  TYPE STANDARD TABLE OF bapiknumhs, "TABLES PARAM
     it_to_mem_initial TYPE STANDARD TABLE OF cnd_mem_initial.

   SELECT SINGLE sobsl INTO iv_sobsl FROM marc WHERE matnr = iv_input-matnr AND werks = '1010'.

   IF sy-subrc IS NOT INITIAL.
     "    Fehlervariable aufbauen
     iv_error-matnr = iv_input-matnr.
     iv_error-log   = 'Fehler beim Einfügen des Infosatzes'.
     APPEND iv_error TO it_error.
     CLEAR  iv_error.
     RETURN.
   ENDIF.

   IF iv_sobsl EQ '10'.
     iv_esokz = '2'.
   ELSE.
     iv_esokz = '0'.
   ENDIF.

   p_lifnr = |{ p_lifnr ALPHA = IN }|.

   SELECT SINGLE knumh INTO iv_knumh FROM a018 WHERE kappl = 'M'
                                                 AND kschl = 'PB00'
                                                 AND lifnr = p_lifnr
                                                 AND matnr = iv_input-matnr
                                                 AND ekorg = '1000'
                                                 AND esokz = iv_esokz
                                                 AND datbi GE sy-datum
                                                 AND datab LE sy-datum.

   IF sy-subrc IS NOT INITIAL.
     "    Fehlervariable aufbauen
     iv_error-matnr = iv_input-matnr.
     iv_error-log   = 'Fehler beim Einfügen des Infosatzes'.
     APPEND iv_error TO it_error.
     CLEAR  iv_error.
     RETURN.
   ENDIF.

   iv_konm-operation    = '005'.
   iv_konm-cond_no      = iv_knumh.
   iv_konm-cond_count   = '01'.
   iv_konm-line_no      = '0001'.
   iv_konm-scale_qty    = '1'.
   iv_konm-currency     = iv_input-ekp.

   APPEND iv_konm TO it_konm.

   LOOP AT it_staf INTO iv_staf.
     DATA: iv_lineno    TYPE i.

     iv_lineno            = ( iv_staf-stafi * 3 ) + 1.

     iv_konm-operation    = '005'.
     iv_konm-cond_no      = iv_knumh.
     iv_konm-cond_count   = '01'.
     iv_konm-line_no      = iv_lineno.
     iv_konm-scale_qty    = iv_staf-stafm.
     iv_konm-currency     = iv_staf-stafe.

     APPEND iv_konm TO it_konm.

   ENDLOOP.

   CALL FUNCTION 'BAPI_PRICES_CONDITIONS'
     TABLES
       ti_bapicondct  = it_ti_bapicondct
       ti_bapicondhd  = it_ti_bapicondhd
       ti_bapicondit  = it_ti_bapicondit
       ti_bapicondqs  = it_konm
       ti_bapicondvs  = it_ti_bapicondvs
       to_bapiret2    = it_to_bapiret2
       to_bapiknumhs  = it_to_bapiknumhs
       to_mem_initial = it_to_mem_initial
     EXCEPTIONS
       update_error   = 1                      " Fehler bei der Verbuchung
       OTHERS         = 2.

   IF sy-subrc IS NOT INITIAL.
     "    Fehlervariable aufbauen
     iv_error-matnr = iv_input-matnr.
     iv_error-log   = 'Fehler beim Einfügen des Infosatzes'.
     APPEND iv_error TO it_error.
     CLEAR  iv_error.
     RETURN.
   ENDIF.

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
*    EXPORTING
*      wait   =                  " Verwendung des Kommandos 'COMMIT AND WAIT'
*    IMPORTING
*      return =                  " Rückmeldungen
    .

  BREAK-POINT.

 ENDFORM.

Viele Grüße