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

Batch is not updating BAPI_BATCH_SAVE_REPLICA in msc2n Tcode

Former Member
0 Likes
1,312

Dear All,

I'm cerating batchin using above bapi with combination of material, batch, plant , S.L    through se37  option ...that time batch is creating also allocates to that material also ...

suppose if i'm creating using se38 .. by calling in editor ... this time oly batch is creating ... but its not maintaing for that material ....

if i see in tcode msc2n .. it showing error

Batch xxxx does not exist for material xxxxxx

pls help me where i'm missing

regards,

Anbu

4 REPLIES 4
Read only

I042439
Product and Topic Expert
Product and Topic Expert
0 Likes
891

Hi Anbu

The message seems to be

It arises from sub check_import_data of FM VB_BATCH_DETERMINATION.

Debug in front end and see what is missing in import.

regards,

Modak

Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
891

Hi Anbu

Did you call BAPI_TRANSACTION_COMMIT after the call of the BAPI..? Does RETURN tbale shows all sucess messages

Nabheet


Read only

0 Likes
891

if its error then oly it returns .. elso return table is initial only

Read only

0 Likes
891

craeting batch using this BAPI


CALL FUNCTION 'BAPI_BATCH_SAVE_REPLICA'

       EXPORTING

         material             = lv_matnr

         batch                = lv_charg

         plant                = lv_werks

         batchattributes      = lw_batchatt

         batchattributesx     = lw_batchattx

         batchstatus          = lw_batchstatus

         batchstatusx         = lw_batchstatusx

         batchcontrolfields   = lw_batchcontrolfields

         batchstoragelocation = lv_lgort

       TABLES

         return               = lt_return

         classallocations     = lt_classallocations

         classvaluationschar  = lt_classvaluationschar.

     IF lt_return IS INITIAL.

       CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

        EXPORTING

          WAIT          = 'X'

        IMPORTING

          RETURN        = lW_return

                 .

**      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

**        EXPORTING

**          wait = 'X'.

     ENDIF.

     CLEAR : gw_item.

   ENDLOOP.

BATCH is saved in DB without any error

again updating stock  in mb1c using created batch  .. document number also creating successfully ..

my issue is .. if i see in msc2n .. that time BATCH is not allocated for material i'm facing error...

but if i try creating using mb1c transaction itself ... with i/p mov type .. S.L ,Plant , Material , Quan, Batch... document also creating .. same time batch is also maintaing for that material ...

same input passing to this bapi ... oly document creating .. batch is not maintaining to that material

   CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

     EXPORTING

       goodsmvt_header         = gw_head

       goodsmvt_code           = gw_code

*     TESTRUN                 = ' '

*     GOODSMVT_REF_EWM        =

     IMPORTING

       goodsmvt_headret        = gw_headret

       materialdocument        = gw_mat

*     MATDOCUMENTYEAR         =

     TABLES

       goodsmvt_item           = gt_item

*     GOODSMVT_SERIALNUMBER   =

       return                  = lt_return

*     GOODSMVT_SERV_PART_DATA =

*     EXTENSIONIN             =

     .

   IF sy-subrc = 0.

     IF lt_return IS INITIAL.

       CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

        EXPORTING

          wait          = 'X'

* IMPORTING

*   RETURN        = lt_return

                 .