Skip to Content
0
Jun 29, 2008 at 12:02 PM

BAPI_MATERIAL_GET_ALL wrong length of internal table

529 Views

Hi Friends,

I want to extract material data with the FM above.

But I get a short dump like this.

Error analysis

An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was

not caught and

therefore caused a runtime error.

The reason for the exception is:

The call to the function module "BAPI_MATERIAL_GET_ALL" is incorrect:

In the function module interface, you can specify only

fields of a specific type and length under "CLIENTDATA".

Although the currently specified field

"DOWN_CLIENTDATA" is the correct type, its length is incorrect.

the code is as follow.

REPORT Z_EXTRACT_MAERIAL_BAPI.

tables marc.

SELECT-OPTIONS matnr for marc-matnr.

SELECt-options werks for marc-werks.

data down_plantdata TYPE STANDARD TABLE OF BAPI_MARC_GA.

data down_clientdata TYPE STANDARD TABLE OF BAPI_MARA_GA.

TYPES: BEGIN OF stru_sel_criteria,

matnr type BAPI_MARA_GA-MATERIAL,

werks type marc-werks,

END OF stru_sel_criteria.

data itab_sel_criteria TYPE TABLE OF stru_sel_criteria WITH HEADER LINE.

SELECT matnr werks

from marc

into CORRESPONDING FIELDS OF TABLE itab_sel_criteria

where matnr in matnr

and werks in werks.

loop at itab_sel_criteria.

CALL FUNCTION 'BAPI_MATERIAL_GET_ALL'

EXPORTING

MATERIAL = itab_sel_criteria-matnr

PLANT = itab_sel_criteria-werks

IMPORTING

CLIENTDATA = down_clientdata.

  • PLANTDATA = down_plantdata.