Application Development 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: 

VB_BATCH_GET_DETAIL

Former Member
0 Kudos

HI Guys, im currently doing some work out on a smartform. Im having an issue with VB_BATCH_GET_DETAIL.

After the first run all the correct data is being pulled and populates the lt_char table as it should.

However ever subsequent run the lt_char table is not being populated despite the fact i can see the data i want in the debugger.

Here is my code if anyone can help.

DATA: lt_char TYPE STANDARD TABLE OF clbatch,

      ls_char TYPE clbatch,

      ls_vbap TYPE vbap.

* Get batch for Material

  SELECT SINGLE * FROM vbap INTO ls_vbap

             WHERE vbeln = is_vbdka-vbeln

AND matnr = gs_vbdpa-matnr

  And CHARG = gs_vbdpa-CHARG.

* Now get batch characteristics

CALL FUNCTION 'VB_BATCH_GET_DETAIL'

  EXPORTING

    matnr              = ls_vbap-matnr

    charg              = ls_vbap-charg

    werks              = ls_vbap-werks

*vbeln                    = is_vbdka-vbeln

    get_classification = 'X'

  TABLES

    char_of_batch      = lt_char

  EXCEPTIONS

    no_material        = 1

    no_batch           = 2

    no_plant           = 3

    material_not_found = 4

    plant_not_found    = 5

    no_authority       = 6

    batch_not_exist    = 7

    lock_on_batch      = 8

    OTHERS             = 9.

* Get Batch Number (BATCHNUMBER)

READ TABLE lt_char INTO ls_char

                   WITH KEY atnam = 'BATCHNUMBER'.

gv_batch = ls_char-atwtb.

* Get Batch Expiry (LOBM_VFDAT)

clear: ls_char.

READ TABLE lt_char INTO ls_char

                   WITH KEY atnam = 'LOBM_VFDAT'.

break ext-bellr.

gv_batch_exp = ls_char-atwtb.

1 ACCEPTED SOLUTION

Subhankar
Active Contributor
0 Kudos

Hi Before call the FM VB_BATCH_GET_DETAIL call FM VB_INIT. It will solve your problems.

Thanks

Subhankar

6 REPLIES 6

Former Member
0 Kudos

Hi Michael Hurley

**********************************************************

  SELECT SINGLE * FROM vbap INTO ls_vbap

             WHERE vbeln = is_vbdka-vbeln

AND matnr = gs_vbdpa-matnr

  And CHARG = gs_vbdpa-CHARG.

* Now get batch characteristics

**************************************************************

Please check ls_vbap. since u r taking to structure it is giving only one record.

CLBATCH is a structure.

Get the datas to internal table.

Regards,

Ramya Ramasamy

0 Kudos

Hi Ramya,

Thanks for the reply,i really appreciate it.

If i understood you correctly i put in the change you suggested but its still only returning the 1st record.

Do you see anything incorrect with what ive done below?

Regards,

Michael

TYPES: BEGIN OF test_type,

ATNAM type ATNAM,

ATWTB type ATWTB,

  XDELETE type XDELETE,

  CHAR_NOT_VALID type XFELD,

  ATINN type ATINN,

  END Of Test_Type.

DATA: lt_char TYPE STANDARD TABLE OF clbatch,

      ls_char TYPE clbatch,

ls_vbap TYPE vbap,

ls_test type test_type.

* Get batch for Material

  SELECT SINGLE * FROM vbap INTO ls_vbap

             WHERE vbeln = is_vbdka-vbeln

             AND matnr = gs_vbdpa-matnr

  And CHARG = gs_vbdpa-CHARG.

* Now get batch characteristics

CALL FUNCTION 'VB_BATCH_GET_DETAIL'

  EXPORTING

    matnr              = ls_vbap-matnr

    charg              = ls_vbap-charg

    werks              = ls_vbap-werks

    get_classification = 'X'

  TABLES

    char_of_batch      = lt_char

  EXCEPTIONS

    no_material        = 1

    no_batch           = 2

    no_plant           = 3

    material_not_found = 4

    plant_not_found    = 5

    no_authority       = 6

    batch_not_exist    = 7

    lock_on_batch      = 8

    OTHERS             = 9.

* Get Batch Number (BATCHNUMBER)

READ TABLE lt_char into ls_test

                   WITH KEY atnam = 'BATCHNUMBER'.

gv_batch = ls_test-atwtb.

* Get Batch Expiry (LOBM_VFDAT)

READ TABLE lt_char INTO ls_test

                   WITH KEY atnam = 'LOBM_VFDAT'.

gv_batch_exp = ls_test-atwtb.

0 Kudos

Hi michel

SELECT SINGLE * FROM vbap INTO ls_vbap instead of tis

Try this.

SELECT  * FROM vbap INTO lt_char

you are using single and passing to the work area , so u r getting only one record.

So in select query use * and pass it into internal table lt_char.

Regards,

Ramya Ramasamy

Subhankar
Active Contributor
0 Kudos

Hi Before call the FM VB_BATCH_GET_DETAIL call FM VB_INIT. It will solve your problems.

Thanks

Subhankar

Former Member
0 Kudos

Hi,

As pointet out by Subhankar use FM VB_INIT which will 'Refresh' the buffers.

Regards

Raju Chitale

Former Member
0 Kudos

Thanks all.The VB_INIT worked.I really appreciate all who helped espcially Subhankar and Raju.

Regards,

Michael