Search code examples
sap-erpsaprfcbapifunction-module

RFC-enabled function module to update physical samples


I need to update some fields of Physical samples in SAP ERP:

List of columns which are in the table QPRS:

  • ABINF: Storage Information
  • ABDAT: Storage Deadline
  • ABORT: Storage Location

List of fields which correspond to statuses (table JEST):

  • Sample Was Stored: status I0363 (short code in Status History: "STRD")
  • Sample Consumed/Destroyed: status I0362 (short code in Status History: "USED")

Is there a RFC-enabled function module to update these fields?

Thanks.


Solution

  • As far as I know there is no BAPI for updating storage data. Anyhow but you will need ABAP development for this, QPRS_QPRS_STORAGE_UPDATE is the FM you can copy into Z one and make it remote-enabled:

    DATA: i_qprs      TYPE qprs,
          i_lgort     TYPE qprs-lgort  VALUE 'Z07',
          i_abort     TYPE qprs-abort  VALUE '1',
          i_abdau     TYPE qprs-abdau  VALUE 10,
          i_abdat     TYPE qprs-abdat  VALUE '20200510',
          i_abinf     TYPE qprs-abinf  VALUE 'info 1st',
          i_aufbx     TYPE rqprs-aufbx VALUE 'first storage',
          i_prnvx     TYPE rqprs-prnvx VALUE abap_true,
          i_qprs_cust TYPE qprs_cust,
          e_qprs_new  TYPE qprs,
          e_aufbx     TYPE rqprs-aufbx,
          e_prnvx     TYPE rqprs-prnvx.
    
    i_qprs-phynr = '000900000054'.
    
    CALL FUNCTION 'QPRS_QPRS_STORAGE_UPDATE'
      EXPORTING
        i_qprs                 = i_qprs
        i_lgort                = i_lgort
        i_abort                = i_abort
        i_abdau                = i_abdau
        i_abdat                = i_abdat
        i_abinf                = i_abinf
        i_aufbx                = i_aufbx
        i_prnvx                = i_prnvx
        i_qprs_cust            = i_qprs_cust
      IMPORTING
        e_qprs_new             = e_qprs_new
        e_aufbx                = e_aufbx
        e_prnvx                = e_prnvx
      EXCEPTIONS
        sample_locked          = 1
        locking_error          = 2
        sample_not_found       = 3
        abort_not_found        = 4
        sample_already_changed = 5.