cancel
Showing results for 
Search instead for 
Did you mean: 

IB01 - CSAI_BOM_CREATE - ERROR SY-SUBRC = 1.

Former Member

Hello everyone, I'm trying to run the BAPI CSAI_BOM_CREATE for creating BOMs of equipment. I am filling in the data exactly according to what I put in the tra tion IB01. By the transaction I can create successfully, but by FM no, I have sy-subrc = 1. Could you tell me if any important data is missing? Here's the code I'm using.

The code is an adaptation of one found on the Internet explaining the use of the function.

Link of the source code: http://ficosapfico.blogspot.com/2014/09/bdc-for-ib01-one-equipment-and-more.html

Code:

DATA ECSIN TYPE CSIN.
DATA ESTKOB TYPE STKOB .
DATA ESTZUB TYPE STZUB .
DATA ASTLNR TYPE STZUB-STLNR .
DATA T_STPOB TYPE STANDARD TABLE OF STPOB WITH HEADER LINE .

TYPES : BEGIN OF ST,

BUZEI(3),
EQUNR(18),
STLAN(4),
POSNR(4),
POSTP(1),
IDNRK(18),
MENGE(13),
MEINS(3),

END OF ST.

DATA : ITAB TYPE TABLE OF ST.
DATA : WA TYPE ST.

WA-buzei = '1'.
WA-equnr = '51000003'.
WA-stlan = '4'.
WA-posnr = '0010'.
WA-POSTP = 'C'.
WA-MENGE = '10'.
WA-meins = 'L'.

APPEND WA TO ITAB.

LOOP AT ITAB INTO WA.

IF WA-BUZEI EQ 'N'.
"Post the Document
CALL FUNCTION 'CSAI_BOM_CREATE'
EXPORTING
ECSIN = ECSIN
ESTKOB = ESTKOB
ESTZUB = ESTZUB
*FL_NO_CHANGE_DOC = ' '
*FL_COMMIT_AND_WAIT = ' '
*FL_NO_COMMIT_WORK = ' '
*FL_ALE = ' '
IMPORTING
*FL_WARNING =
ASTLNR = ASTLNR
TABLES
T_STPOB = T_STPOB
EXCEPTIONS
ERROR = 1
OTHERS = 2.

IF ASTLNR IS INITIAL.
"ERROR. <- HERE IS SY-SUBRC = 1.
ENDIF.

IF WA-BUZEI EQ '1'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = WA-EQUNR
IMPORTING
OUTPUT = WA-EQUNR.
ECSIN-EQUNR = WA-EQUNR.
ECSIN-STLTY = 'E' .
ECSIN-STLAN = '4' .
ECSIN-WERKS = '2015'. "My Plant.
ECSIN-DATUV = SY-DATUM.

ESTKOB-BMEIN = 'NO'.
ESTKOB-BMENG = ''."10.
ESTKOB-STKTX = 'TEST'.

T_STPOB-STLTY = 'E' .
T_STPOB-POSTP = 'C' .
ENDIF.

IF WA-BUZEI NE 'N'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = WA-IDNRK
IMPORTING
OUTPUT = WA-IDNRK.
T_STPOB-IDNRK = WA-IDNRK.
T_STPOB-MEINS = 'WA-MEINS'.

T_STPOB-MENGE = WA-MENGE.
T_STPOB-RVREL = 'X' .

APPEND T_STPOB .
ENDIF.
ENDLOOP.

Thanks!

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member598127
Discoverer

Same problem here.