Skip to Content
B K

Short Dump while using BAPI_PR_CHANGE - Update Purchase Requisitions

Hi I/m trying to change PR using BAPI_PR_CHANGE. Could any one please help on this.

Test Data:

PREQ_NO PREQ_ PLAN QUANTITY DELIV_DATE GR_P C

10084050 00010 LE01 5,000,000.000 01/25/2010 15 X

10084050 00010 LE01 5,000,000.000 01/26/2010 15 X

when I execute with single record, PR is getting updated successfully.

when I execute with two records, getting shortdump

* loop thru PR Input data
    LOOP AT p_t_pur_reqs_in INTO l_w_pur_reqs WHERE chg_ind = c_x.
* read pur req data table
      READ TABLE t_eban WITH KEY banfn = l_w_pur_reqs-preq_no
                                 bnfpo = l_w_pur_reqs-preq_item.
* check if record found
      IF sy-subrc = 0.
* Populate PR item
        t_pritem-preq_item   = l_w_pur_reqs-preq_item.
        t_pritem-plant       = l_w_pur_reqs-plant.
        t_pritemx-preq_item  = l_w_pur_reqs-preq_item.
        t_pritemx-preq_itemx = c_x.
* clear change flag
        clear g_flag_ch.
* check if SAP quantity & Input quantity are not equal
        IF l_w_pur_reqs-quantity NE t_eban-menge.
* Populate input quantit in item table
          t_pritem-quantity  = l_w_pur_reqs-quantity.
          t_pritemx-quantity = c_x.
* set change flag
          g_flag_ch = c_x.
        ENDIF.  "check for quantity

* check if SAP delivery date & Input delivery date are not equal
        IF l_w_pur_reqs-deliv_date NE t_eban-lfdat.
* Populate input delivery date in item table
          t_pritem-deliv_date  = l_w_pur_reqs-deliv_date.
          t_pritemx-deliv_date = c_x.
* set change flag
          g_flag_ch = c_x.
        ENDIF.  "check for delivery date

* check if SAP GR proc time & Input GR proc time are not equal
        IF l_w_pur_reqs-gr_pr_time NE t_eban-webaz.
* Populate input GR proc time in item table
          t_pritem-gr_pr_time  = l_w_pur_reqs-gr_pr_time.
          t_pritemx-gr_pr_time = c_x.
* set change flag
          g_flag_ch = c_x.
        ENDIF.  "check fir GR proc time

* append item tables
        APPEND t_pritem. APPEND t_pritemx.

* check if changes to the purchase requisition
        IF g_flag_ch = c_x.
* call BAPI_PR_CHANGE with the parameters as defined above
          CALL FUNCTION 'BAPI_PR_CHANGE'
            EXPORTING
              PRNUMBER = l_w_pur_reqs-preq_no
            TABLES
              RETURN   = t_return_pr
              PRITEM   = t_pritem
              PRITEMX  = t_pritemx.
* check return table
          READ TABLE t_return_pr WITH KEY type = c_e.
* if error in BAPI
          IF sy-subrc = 0.
* roll back changes
            CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
* clear work area
            clear t_return_pr.
            LOOP AT t_return_pr.
* populate return messages
              MOVE-CORRESPONDING t_return_pr TO t_return_pur_req.
* append & clear return table
              APPEND t_return_pur_req.
              CLEAR: t_return_pur_req, t_return_pr.
            ENDLOOP.
* if success
          ELSE.
* commit changes
            CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
* clear work area
            clear t_return_pr.
            LOOP AT t_return_pr.
* populate return messages
              MOVE-CORRESPONDING t_return_pr TO t_return_pur_req.
* append & clear return table
              APPEND t_return_pur_req.
              CLEAR: t_return_pur_req, t_return_pr.
            ENDLOOP.
          ENDIF.  "check for bapi return
* if no changes
        ELSE.
* return message as no change to be made
          CONCATENATE text-003 l_w_pur_reqs-preq_no INTO
                      t_return_pur_req-message SEPARATED BY space.
* append & clear return table
          APPEND t_return_pur_req. clear t_return_pur_req.
        ENDIF.  "check for change flag
      ENDIF.  "check for read pur req data
* clear work area
      clear: l_w_pur_reqs, t_eban, t_pritem, t_pritemx, t_loistd,
             w_loistd, t_return_pr, t_return_pr[], g_flag_ch.
    ENDLOOP.

Error analysis

An exception occurred. This exception is dealt with in more detail below

. The exception, which is assigned to the class 'CX_SY_REF_IS_INITIAL', was

neither

caught nor passed along using a RAISING clause, in the procedure

"GET_CURRENT_DATA" "(FORM)"

.

Since the caller of the procedure could not have expected this exception

to occur, the running program was terminated.

The reason for the exception is:

Es wurde versucht mit einer 'NULL' Objektreferenz (zeigt auf 'nichts')

auf eine Komponente zuzugreifen.

Eine Objektreferenz muß auf ein Objekt (eine Instanz einer Klasse)

zeigen, bevor man sie zum Zugriff auf Komponenten nutzen kann.

Entweder die Referenz wurde noch nie gesetzt, oder sie wurde mit

einer CLEAR Anweisung auf 'NULL' gesetzt.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Nov 10, 2009 at 04:13 PM

    Can you please check how to post code in SDN ...

    I cannot read your code properly

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.