Application Development and Automation 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: 
Read only

Help required on PR change BAPI

Former Member
0 Likes
1,866

Hi,

Could anyone help me out in working with PR change BAPI.

Here I am passign OLD values and New Values to the ITEMS table. But still unable to get the changed results. Even I have executed the Commit BAPI after executng the PR change BAPI. Any help could be very useful and will be awarded.

Regards,

Ramesh

8 REPLIES 8
Read only

Former Member
0 Likes
1,341

Hi,

Have you checked if you are getting any error messages in Return Tbale of this BAPI?

Regds,

Akshay Bhagwat

Read only

Former Member
0 Likes
1,341

Are you getting any error messages from the BAPI?

-Kiran

Read only

0 Likes
1,341

I am not getting any error messages even. Thats the problem. Even the Return Table is empty without any error messages.

Regards,

Ramesh

Read only

0 Likes
1,341

Refer the BAPI documentation to understand how to fill the tables.

Note You cannot add any new items. The method(BAPI_REQUISITION_CHANGE) only supports the changing of already existing items.

-Kiran

Read only

Former Member
0 Likes
1,341

Hi Ramesh,

Just check whether you have authorization for PR change.

(Check whether you have authorization for following authorization objects

M_BANF_BSA Document type in requisition

M_BANF_EKG Purchasing group in requisition

M_BANF_EKO Purch. organization in requisition

M_BANF_WRK Plant in requisition)

Another way you can check authorizations is, execute TXn ME52 or ME52N and then check if you can do the changes manually.

After this execution use SU53 to check authorizations.

Regds,

Akshay Bhagwat

Read only

Former Member
0 Likes
1,341

Hello Ramesh,

I got the same Problems on using

BAPI_REQUISITION_CHANGE and no changes are done for my Subcontractor PR.

I'm currently debugging Transaction ME52N.

If I find a solution I'll tell you about.

cheers

Stefan

Read only

Former Member
0 Likes
1,341

I debug Transactin ME52N as for subcontractor on PR on Release 4.6C no solution is jet available.

For further info se OSS Notes:

499627

499626

204689

Greetings

Stefan

Read only

Former Member
0 Likes
1,341

Hi Ramesh,

check out this coding for changing the Quantity of

a subcontractor Purchase requisition position.

I got this from debugging Transaction ME52.

In my problem case it worked.

cheers

Stefan

hint: on the lines with comment '@@' you have to fill other values according to you own test case.


REPORT zmneub01 .

PARAMETERS: p_banfn LIKE eban-banfn OBLIGATORY,
            p_bnfpo TYPE bnfpo OBLIGATORY DEFAULT '00010',
            p_menge TYPE gsmng OBLIGATORY.

TABLES: ebkn.

START-OF-SELECTION.

**** read eban:
  DATA: lt_eban TYPE STANDARD TABLE OF eban,
        lw_mdpa TYPE mdpa,
        lw_mdpa_old TYPE mdpa,
        lw_mdpa_new TYPE mdpa,
        lf_updkz,		
        lf_rcode	LIKE	cm61q-rcode,
        lf_verid	LIKE	eket-verid.
  DATA: lw_epdecdata TYPE epdecdata,
        lw_eban_old  TYPE eban,
        lt_eban_old  TYPE STANDARD TABLE OF eban,
        lw_eban_new LIKE eban,
        lt_eban_new  TYPE STANDARD TABLE OF eban,
        lt_mdlb TYPE STANDARD TABLE OF mdlb,
        lw_mdlb TYPE mdlb,
        lt_ebkn TYPE STANDARD TABLE OF ebkn.

  SELECT * INTO TABLE lt_eban
             FROM eban
             WHERE banfn = p_banfn
               AND bnfpo = p_bnfpo.

  IF lt_eban[] IS INITIAL.
    WRITE: 'Keine Banf-daten gefunden'.
    EXIT.
  ENDIF. "lt_eban[] is initial.

  READ TABLE lt_eban[] INTO lw_eban_old INDEX 1.

*** Daten für zugehörige Reservierung finden.
  CALL FUNCTION 'ME_FILL_MDPA_FROM_EBAN'
               EXPORTING
                 im_eban       = lw_eban_old
*               IM_EBKN       =
               IMPORTING
                 ex_mdpa       = lw_mdpa
                       .

  lw_mdpa_old = lw_mdpa.
  lw_mdpa_new = lw_mdpa.
  lw_mdpa_new-gsmng = p_menge.

*  CALL FUNCTION 'ENQUEUE_EMRKPF'
*       EXPORTING
*            mode_rkpf      = 'E'
*            rsnum          = lw_mdpa-rsnum
*       EXCEPTIONS
*            foreign_lock   = 1
*            system_failure = 2
*            OTHERS         = 3.

  break bergesef.
* commit work and wait.

  MOVE-CORRESPONDING lw_eban_old TO lw_epdecdata.
*  lw_eban_old = lt_eban.
  lw_eban_new = lw_eban_old.
  lw_eban_new-menge = p_menge.

*  CALL FUNCTION 'ME_EPROFILE_REQ_CHANGE'
*       EXPORTING
*            im_eban_old  = lw_eban_old
*            im_aktyp     = 'V'  "IM_AKTYP
*            im_epdecdata = lw_epdecdata
*       CHANGING
*            ch_eban_new  = lw_eban_new
*       EXCEPTIONS
*            OTHERS       = 1.

* commit work and wait.
  break bergesef.

* finde Kopfdaten fuer Lohnbearbeitungskomponenten
  CALL FUNCTION 'ME_FILL_MDLB_FROM_EBAN'
    EXPORTING
      im_eban       = lw_eban_old
*   IM_EBKN       =
   IMPORTING
     ex_mdlb       = lw_mdlb.

  APPEND lw_mdlb TO lt_mdlb.

*  CALL FUNCTION 'DEQUEUE_EMRKPF'
*   EXPORTING
**     MODE_RKPF       = 'E'
**     MANDT           = SY-MANDT
*     rsnum           = lw_mdpa-rsnum
**     X_RSNUM         = ' '
**     _SCOPE          = '3'
**     _SYNCHRON       = ' '
**     _COLLECT        = ' '
*            .

  DATA: xeban TYPE STANDARD TABLE OF ueban,
        yeban TYPE STANDARD TABLE OF ueban,
        xebkn TYPE STANDARD TABLE OF uebkn,
        yebkn TYPE STANDARD TABLE OF uebkn,
        lw_xeban TYPE ueban,
        lw_yeban TYPE ueban,
        icdtxt TYPE STANDARD TABLE OF cdtxt.

  lt_eban_old = lt_eban.

  APPEND lw_eban_new TO lt_eban_new.
*  xeban[] = lt_eban_new[].


**** Vorbereitung Positions-updates im Verbucher
  LOOP AT lt_eban_new INTO lw_xeban.
    lw_xeban-kz = 'U'.
    lw_xeban-t001waers = 'EUR'.
    APPEND lw_xeban TO xeban.
  ENDLOOP. "at lt_eban_new into lw_eban.

  LOOP AT lt_eban_old INTO lw_yeban.
*    lw_yeban-kz = 'U'.
    lw_yeban-t001waers = 'EUR'.
    APPEND lw_yeban TO yeban.
  ENDLOOP. "at lt_eban_old into lw_eban.


*  CALL FUNCTION 'SWE_REQUESTER_TO_UPDATE'.

************************************************************************
*** VERBUCHER ***
************************************************************************
*** BANF ändern ****
  CALL FUNCTION 'BANF_WRITE_DOCUMENT' IN UPDATE TASK
       EXPORTING
            objectid                = lw_eban_new-banfn
            tcode                   = 'ME52'
            utime                   = sy-uzeit
            udate                   = sy-datum
            username                = sy-uname
            planned_change_number   = ' '
            object_change_indicator = 'U'
            planned_or_real_changes = ' '
            no_change_pointers      = ' '
*            upd_icdtxt_banf         = 'U'
            upd_eban                = 'U'
*            upd_ebkn                = 'U'
       TABLES
            icdtxt_banf             = icdtxt  "leer
            xeban                   = xeban
            yeban                   = yeban
            xebkn                   = xebkn  "leer
            yebkn                   = xebkn. "leer

*** Ändern der Menge in Lohnbearbeitungskomponenten (Reservierung)
  CALL FUNCTION 'ME_COMPONENTS_MAINTAIN'     "FuGr MEXF
        EXPORTING
             i_ebeln    = lw_eban_old-banfn
             i_ebelp    = lw_eban_old-bnfpo
             i_mdpa     = lw_mdpa_new
             i_mdpa_old = lw_mdpa_old
             i_txz01    = lw_eban_old-txz01
             i_vorga    = 'C'   "'C' "MDM_VORGA
             i_fcall    = 'X'   "no dynp please !!!
          IMPORTING
             e_rcode = lf_rcode
             e_verid = lf_verid
             e_updkz = lf_updkz.

************************************************************************
*** VERBUCHER *** im innern in ME_COMPONENTS_UPDATE
************************************************************************
  CALL FUNCTION 'ME_COMPONENTS_UPDATE_PREPARE'
    EXPORTING
*   I_EBELN_OLD       =
      i_number          = lw_eban_new-banfn
*   I_VENDOR          =
    TABLES
      t_mdlb            = lt_mdlb.


************************************************************************
*** VERBUCHER ***
************************************************************************
*** Datenbankfortschreibungen der Bestellanforderung
  CALL FUNCTION 'ME_UPDATE_REQUISITION' IN UPDATE TASK
       TABLES
            xeban = xeban
            xebkn = xebkn
            yeban = yeban
            yebkn = yebkn.

*** Auslösen Workflow-Event für Gesamtfreigabe Bestellanforderungen
*CALL FUNCTION 'ME_REL_EVENT_GENERAL_EBAN'
** EXPORTING
**   I_CALL_UPDKZ       = ' '
**   I_FRGCO            =
**   I_WFBAN            =
**   I_ERNAM            =
*  TABLES
*    t_geban_new        =
*    t_geban_old        =
*  .

*** Hilfsstrukturen und Tabellen für Dispositionsfelder
  DATA: lt_dis	LIKE	STANDARD TABLE OF edisp,
        lw_dis LIKE edisp.

  lw_dis-matnr	= lw_eban_new-matnr.   "'050085212006111'.
  lw_dis-werks	= lw_eban_new-werks. "4000
  lw_dis-dismm	= 'ZD'. "@@Plangest. Disposition m. Verf.
  lw_dis-disst	= '001'. "@@Dispostufe
  lw_dis-pstat	= 'ED'. "@@Pflegestatus(K,E,D,B,L,A)
*RELEV	C	1 	
*FUNKT	C	1 	
  lw_dis-mtart	= 'ERZE'.  "@@-> get from Mara

  APPEND lw_dis TO lt_dis.

************************************************************************
*** VERBUCHER ***
************************************************************************
*** Erstellen der Disposaetze aus Bestellanforderung
  CALL FUNCTION 'ME_CREATE_MRPRECORD_REQ' IN UPDATE TASK
       TABLES
            dis   = lt_dis
            xeban = xeban
            yeban = yeban.

*** Hau rein -> Verbucher starten.
  COMMIT WORK AND WAIT.

  WRITE: 'ready'.

END-OF-SELECTION.