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

mass prod order release bapi

Former Member
0 Likes
2,788

Hiiii Experts,

I am coding a mass production order release program and i am using the following BAPI s but getting runtime errors with last 2. Would greatly appreciate any insights to solve my runtime errors. Thanks

BAPI_PRODORD_RELEASE  (works fine)

BAPI_TRANSACTION_COMMIT  (Error)

BAL_DSP_LOG_DISPLAY  (Error)


this is how i coded.


data: w_line TYPE BSVX-STTXT .

data: it_commit TYPE TABLE OF BAPIRET2.

data: w_disp TYPE BAL_S_EXCM .

data: it_order TYPE TABLE OF BAPI_ORDER_KEY,

         it_log TYPE TABLE OF BAPI_ORDER_APPLICATION_LOG.



CALL FUNCTION 'BAPI_PRODORD_RELEASE'

*   EXPORTING

*     RELEASE_CONTROL          = '1'

*     WORK_PROCESS_GROUP       = 'COWORK_BAPI'

*     WORK_PROCESS_MAX         = 99

*   IMPORTING

*     RETURN                   =

     TABLES

       ORDERS                   =      it_order

*     DETAIL_RETURN            =

      APPLICATION_LOG          =      it_log

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

      EXPORTING

        WAIT          =      5

      IMPORTING

        RETURN        =      it_commit.

.


CALL FUNCTION 'BAL_DSP_LOG_DISPLAY'

        EXPORTING

*         I_S_DISPLAY_PROFILE          =

          I_T_LOG_HANDLE               =      it_log

*         I_T_MSG_HANDLE               =

*         I_S_LOG_FILTER               =

*         I_S_MSG_FILTER               =

*         I_T_LOG_CONTEXT_FILTER       =

*         I_T_MSG_CONTEXT_FILTER       =

*         I_AMODAL                     = ' '

*         I_SRT_BY_TIMSTMP             = ' '

        IMPORTING

          E_S_EXIT_COMMAND             =      w_disp

*       EXCEPTIONS

*         PROFILE_INCONSISTENT         = 1

*         INTERNAL_ERROR               = 2

*         NO_DATA_AVAILABLE            = 3

*         NO_AUTHORITY                 = 4

*         OTHERS                       = 5

                 .








11 REPLIES 11
Read only

himanshu_gupta13
Product and Topic Expert
Product and Topic Expert
0 Likes
2,105

Hi Anushka,

you can use another one bapi BAPI_PO_RELEASE to release your PO in loop

Many Thanks/  Himanshu Gupta


Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,105

You MUST analyze the RETURN parameter after execution of first BAPI and don't commit if any error raised.

Regards,

Raymond

Read only

0 Likes
2,105

Hiii Raymond,

what do u mean by analyse? and do u know what i need to pass to the last bapi?

Read only

0 Likes
2,105

Hi Anushka

Firstly in BAPI_TRANSACTION_COMMIT it is expecting a character as 'X'. not a numeric one.

Seconldy What Raymond means is during the first call of the BAPI check the what is returned via the below mentioned parameters. If it is sucessful then call commit.

*   IMPORTING

*     RETURN                   =

Thirdly the type of IT_LOG which last FM is expecting is different from one returned by first BAPI.

Nabheet

Read only

0 Likes
2,105

Hi anushka,

please see this code

CALL FUNCTION 'BAPI_PRODORD_RELEASE'

*   EXPORTING

*     RELEASE_CONTROL          = '1'

*     WORK_PROCESS_GROUP       = 'COWORK_BAPI'

*     WORK_PROCESS_MAX         = 99

*   IMPORTING

  RETURN                   = it_return (see here any data is present or not)

     TABLES

       ORDERS                   =      it_order

*     DETAIL_RETURN            =

      APPLICATION_LOG          =      it_log

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

      EXPORTING

        WAIT          =      'X'

      IMPORTING

        RETURN        =     lt_return.

.

Read only

0 Likes
2,105

Just check value of RETURN-TYPE, if 'E' or 'A', execute a ROLLBACK and not a COMMIT.

Also compare defijnition of structure returned by BAPI in APPLICATION_LOG and definition of BAL_DSP_LOG_DISPLAY parameters. (or use SCI which should raise an error)

Regards,

Raymond

Read only

himanshu_gupta13
Product and Topic Expert
Product and Topic Expert
0 Likes
2,105

Hi anushka,

you should check for  RETURN-TYPE <> 'E' at any line item in return internal table, then do the bapi_transaction_commit..

Many Thanks / Himanshu Gupta


Read only

Former Member
0 Likes
2,105

Okay experts i have my first 2 BAPIs working fine now with all the useful comments.

But my last BAPI to display the log is still not working, in fact i am clueless as to what import/export fields to use. Any suggestions?

Read only

0 Likes
2,105

Hi Anushka,

please see this wiki help for better understandings, i think you have missed adding BAL_S_MSG_ADD

Application Log Methodology Part II - ABAP Development - SCN Wiki

Read only

0 Likes
2,105

I am struggling on this

Read only

0 Likes
2,105

Hi Anushka,

please understands, firstly you have to put your messages into application log, thats why i have told you to add your messages in BAL_S_MSG_ADD, and then you can use your BAL_DSP_LOG_DISPLAY to display your message log, have you used the previous shown wiki help or not, what is the present issues you are facing.