06-06-2012 12:03 PM
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.
06-07-2012 6:58 PM
Hi Before call the FM VB_BATCH_GET_DETAIL call FM VB_INIT. It will solve your problems.
Thanks
Subhankar
06-06-2012 12:10 PM
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
06-06-2012 1:03 PM
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.
06-07-2012 5:30 PM
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
06-07-2012 6:58 PM
Hi Before call the FM VB_BATCH_GET_DETAIL call FM VB_INIT. It will solve your problems.
Thanks
Subhankar
06-08-2012 5:40 AM
Hi,
As pointet out by Subhankar use FM VB_INIT which will 'Refresh' the buffers.
Regards
Raju Chitale
06-29-2012 2:54 PM
Thanks all.The VB_INIT worked.I really appreciate all who helped espcially Subhankar and Raju.
Regards,
Michael