CALO_INIT_API
Our customer is facing time-out (not getting reply back (or may be very very late) from SAP on calling calo_init_api.
How to debug this issue at SAP side?
The issue happens only for 150 o 200 times out of 5200 calls in approximately 8 hours.
The issue happens only for CALO_INIT_API RFC call. All other RFC working fine at the same time.
Hi,
Please check below link
http://help.sap.com/printdocu/core/Print46c/EN/data/pdf/LOAPI/LOAPI.pdf.
regards
jana
Similar Messages
-
No active nametab exists for...
Hi,
I try to maintain BOM data by CSAP_MAT_BOM_MAINTAIN bapi. Everthing works ok when I use example code of this function module. But when it comes to terms deleting an item from BOM, I always get error :
"No active nametab exists for CI_STPO".
But it also deletes the item. Do you have any idea?
*---- BOM header data structure
data: begin of tstk2.
include structure stko_api02.
data: end of tstk2.
*---- BOM items table
data: begin of tstp3 occurs 0.
include structure stpo_api03.
data: end of tstp3.
DATA tstko TYPE stko_api01.
*---- Object dependencies table
* Basis data
data: begin of tdep2_data occurs 0.
include structure dep_data.
data: end of tdep2_data.
* Description
data: begin of tdep2_descr occurs 0.
include structure dep_descr.
data: end of tdep2_descr.
* Source
data: begin of tdep2_source occurs 0.
include structure dep_source.
data: end of tdep2_source.
* Sequence
data: begin of tdep2_order occurs 0.
include structure dep_order.
data: end of tdep2_order.
* Documentation
data: begin of tdep2_doc occurs 0.
include structure dep_doc.
data: end of tdep2_doc.
data: flg_warning like capiflag-flwarning.
*data : error_code type BAPI_MSG.
*- Initialize database log
call function 'CALO_INIT_API'
exceptions
log_object_not_found = 1
log_sub_object_not_found = 2
other_error = 3
others = 4.
clear tstp3.
tstp3-id_item_no = '0050'. "Item identification.
tstp3-fldelete = 'X'.
append tstp3.
*- Change BOM
call function 'CSAP_MAT_BOM_MAINTAIN'
exporting
material = MATNR
plant = PLANT
bom_usage = BOM_USAGE
valid_from = VALID_FROM
fl_bom_create = ' '
fl_new_item = ' '
i_stko = tstko
importing
fl_warning = flg_warning
o_stko = tstk2
tables
t_stpo = tstp3
exceptions
others = 1.
if sy-subrc eq 1.
*---- Error
* Please see log
ERROR_CODE = 'Tanu0131msu0131z hata. Baku0131m ekranu0131 açu0131k olmasu0131n?'.
endif.
if flg_warning eq 'X'.
*---- Please see log for information, warning messages, and success
* messages.
* MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno
*WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = sy-msgid
msgnr = sy-msgno
msgv1 = sy-msgv1
msgv2 = sy-msgv2
msgv3 = sy-msgv3
msgv4 = sy-msgv4
IMPORTING
message_text_output = ERROR_CODE.
Endif.CI_STPO is a customer include in which you can put some specific fields
probably you call a user-exit that is used to maintain fields of this customer include and it does try to find the structure of it (which does not exist) -
Hi to all,
Can any one provide me sample program to update BOM via Function Module CSAP_MAT_BOM_CREATE.
As i already have created the program , but run time error is coming KEY_INCOMPLETE for CSAP_MAT_BOM_CREATE.
as i have already search the SDN , but cant get any specific answer for that.
Note: itab_bom_header and itab_bom_item_details are of same line type as
i_stko and t_stpo with data.
DATA: wa_bom_header TYPE zia_str_bom_header,
wa_itab_bom_item_details TYPE zia_str_bom_item_details.
IF itab_bom_header[] IS NOT INITIAL .
READ TABLE itab_bom_header INTO wa_bom_header INDEX 1 .
ENDIF.
*---- BOM header data structure
DATA: BEGIN OF tstko OCCURS 0.
INCLUDE STRUCTURE stko_api01.
DATA: END OF tstko.
DATA: wa_tstko LIKE LINE OF tstko.
*---- BOM items table
DATA: BEGIN OF tstpo OCCURS 0.
INCLUDE STRUCTURE stpo_api01.
DATA: END OF tstpo.
DATA: wa_tstpo LIKE LINE OF tstpo.
**---- Object dependencies table
Basis data
*data: begin of tdep_data occurs 0.
*include structure csdep_dat.
*data: end of tdep_data.
Description
*data: begin of tdep_descr occurs 0.
*include structure csdep_desc.
*data: end of tdep_descr.
Source
*data: begin of tdep_source occurs 0.
*include structure csdep_sorc.
*data: end of tdep_source.
Sequence
*data: begin of tdep_order occurs 0.
*include structure csdep_ord.
*data: end of tdep_order.
Documentation
*data: begin of tdep_doc occurs 0.
*include structure csdep_doc.
*data: end of tdep_doc.
CALL FUNCTION 'CALO_INIT_API'
EXPORTING
FLAG_DB_LOG_ON = 'X'
FLAG_MSG_ON = 'X'
FLAG_API_API_CALL_ON = ' '
FLAG_COLLECT_MSG_ON = ' '
EXTERNAL_LOG_NO = 'API'
DEL_LOG_AFTER_DAYS = '10'
DATA_RESET_SIGN = '!'
EXCEPTIONS
LOG_OBJECT_NOT_FOUND = 1
LOG_SUB_OBJECT_NOT_FOUND = 2
OTHERS = 3
LOOP AT itab_bom_header INTO wa_bom_header.
wa_tstko-BASE_QUAN = wa_bom_header-base_qty.
wa_tstko-BASE_UNIT = wa_bom_header-BASE_UOM.
wa_tstko-BOM_STATUS = wa_bom_header-BOM_STATUS.
ENDLOOP.
LOOP AT itab_bom_item_details INTO wa_itab_bom_item_details.
wa_tstpo-item_categ = wa_itab_bom_item_details-item_category.
wa_tstpo-item_no = wa_itab_bom_item_details-bom_itm_number.
wa_tstpo-component = wa_itab_bom_item_details-component.
wa_tstpo-comp_unit = wa_itab_bom_item_details-uom.
wa_tstpo-comp_qty = '10'.
wa_tstpo-valid_from = wa_itab_bom_item_details-valid_from.
wa_tstpo-itm_ident = wa_itab_bom_item_details-item_id .
APPEND wa_tstpo TO tstpo .
ENDLOOP.
FM to create BOM
CALL FUNCTION 'CSAP_MAT_BOM_CREATE'
EXPORTING
material = wa_bom_header-material
plant = wa_bom_header-plant
bom_usage = wa_bom_header-bom_usage
VALID_FROM = wa_bom_header-VALID_FROM
CHANGE_NO =
REVISION_LEVEL =
i_stko = tstko " bom header
FL_NO_CHANGE_DOC = ' '
FL_COMMIT_AND_WAIT = ' '
FL_CAD = ' '
fl_default_values = 'X'
IMPORTING
fl_warning = fl_warning
bom_no = bom_no
TABLES
t_stpo = tstpo " bom item
T_DEP_DATA = tdep_data
T_DEP_DESCR = tdep_descr
T_DEP_ORDER = tdep_source
T_DEP_SOURCE = tdep_order
T_DEP_DOC = tdep_doc
T_LTX_LINE =
T_STPU =
EXCEPTIONS
error = 1
OTHERS = 2
IF sy-subrc <> 1.
WRITE 'error'.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF fl_warning EQ 'X'.
WRITE 'done'.
ENDIF.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
please can any one provide me the solution for that.
i shall be thankfull to you for this.
Regards
Pavneet Rana
Edited by: pavneet rana on Aug 18, 2011 3:01 PMThanks for reply,
i have debug my program and found that run time error is coming at GET_MAST function module.
but i have already checked that MATNR and STLNR is already filled before reaching to that FM.
GET_MAST
IF NOT SET IS INITIAL.
IF WA-MATNR IS INITIAL
AND WA-STLNR IS INITIAL.
RAISE KEY_INCOMPLETE.
ENDIF.
IF WA-MATNR <> SPACE
AND WA-STLNR <> SPACE.
RAISE KEY_INVALID.
ENDIF.
please can any one provide me the solution for that.
Regards
Pavneet Rana -
!!urgent - BAPI ..... pls help!!
Hi,
I really need help to be able to save materials made up of several parts with BAPI.
Let me show you the idea by using the example of car (finished product):
Car is built from a lot of components, for instance:
- 1 engine
- 4 tires
- 2 front lights
etc.
My task is to implement a method responsible for creating a finished product and all necessary semi-finished products which are connected with ready prod and save them in SAP. Furthermore I've got to create a bill of materials.
Has somebody faced similar problem? How have you solved it? How?
Below I show what I've found out:
I've got to create material master record for trading goods(type: HAWA in Headdata) and create Semifinished products (type: HALB) by using BAPI_MATERIAL_SAVEDATA (hopefully I'm right, otherwise pls correct me), but I still don't know how to connect them with each other and then use to create BOM.
According to my best knowledge there is no BAPI to create BOM...i tried to find without any result.
Looking forward your answers.
BR,
RafalHi
This is the documentation for Function module - CSAP_MAT_BOM_CREATE
Functionality
You can use this function module to create simple material BOMs.
You cannot add alternatives or variants to a BOM, as in transaction CS01.
Current restrictions:
You cannot create long texts.
You cannot create sub-items.
You cannot classify BOM items for batches.
You can only save your BOM if no errors occur, because it is not yet possible to change a BOM. Both header data and all item data must be correct.
Please note:
Fields where no entry can be made because they were not selected are initialized. The log does not contain information on initialized fields.
The BOM default values defined in the control data and any user-specific defaults are handled in the same way as in the online transaction.
Default values that are dependent on BOM usage (for example, indicators for relevancy to production, costing, and so on) are not processed.
If you create items with object dependencies, the dependency must have basic data, a description, and source code entered.
The fields OBJECT_ID and IDENTIFIER identify the object to which a dependency belongs.
(OBJECT_ID = '2' => BOM item)
Dependencies are identified by internal or external names. When you create a dependency, you must enter an external name, because an internal name is not assigned until you save.
Recursiveness in class items is recognized, but no information is available on which objects in the class caused the recursiveness. You cannot define recursiveness as allowed for these objects.
Example
*---- Feldleiste Stücklistenkopfdaten
data: begin of tstko.
include structure stko_api01.
data: end of tstko.
*---- Tabelle Stücklistenpositionen
data: begin of tstpo occurs 0.
include structure stpo_api01.
data: end of tstpo.
*---- Tabellen für Beziehungswissen:
Basisdaten
data: begin of tdep_data occurs 0.
include structure csdep_dat.
data: end of tdep_data.
Beschreibung
data: begin of tdep_descr occurs 0.
include structure csdep_desc.
data: end of tdep_descr.
Source
data: begin of tdep_source occurs 0.
include structure csdep_sorc.
data: end of tdep_source.
Reihenfolge
data: begin of tdep_order occurs 0.
include structure csdep_ord.
data: end of tdep_order.
Dokumentation
data: begin of tdep_doc occurs 0.
include structure csdep_doc.
data: end of tdep_doc.
data: flg_warning like capiflag-flwarning.
*- Datenbankprotokoll eröffnen
call function 'CALO_INIT_API'
exceptions
log_object_not_found = 1
log_sub_object_not_found = 2
other_error = 3
others = 4.
*- Kopfdaten füllen
tstko-base_quan = '1.000'.
tstko-bom_text = 'Stücklistentext'.
*- Positionsdaten füllen
1. Position (Lagerteil)
clear tstpo.
tstpo-item_no = '0010'.
tstpo-item_categ = 'L'. "Mußeingabe
tstpo-component = 'MAT200'. "Mußeingabe
tstpo-comp_qty = '1.000'. "Mußeingabe
tstpo-comp_unit = 'ST'.
append tstpo.
2. Position (Rohmaßposition)
2 Stück a 4 m X 3 m => 2 St a 12 m2
clear tstpo.
tstpo-item_no = '0020'.
tstpo-item_categ = 'R'. "Mußeingabe
tstpo-component = 'MAT300'. "Mußeingabe
tstpo-comp_qty = '2.000'. "Mußeingabe
tstpo-vsi_size1 = '4.000'. "Mußeingabe
tstpo-vsi_size2 = '3.000'.
tstpo-vsi_szunit = 'M'.
tstpo-comp_unit = 'M2'.
append tstpo.
3. Position (Textposition)
clear tstpo.
tstpo-item_no = '0030'.
tstpo-item_categ = 'T'. "Mußeingabe
tstpo-item_text1 = 'Positionstext'. "Mußeingabe
append tstpo.
4. Position (Dokumentposition)
clear tstpo.
tstpo-item_no = '0040'.
tstpo-item_categ = 'D'. "Mußeingabe
tstpo-document = 'DOK1'. "Mußeingabe
tstpo-doc_type = 'DRW'. "Mußeingabe
tstpo-comp_qty = '1.000'.
tstpo-comp_unit = 'ST'.
5. Position (Klassenposition)
clear tstpo.
tstpo-item_no = '0050'.
tstpo-item_categ = 'K'. "Mußeingabe
tstpo-res_itm_ct = 'L'.
tstpo-class = 'CLS1'. "Mußeingabe
tstpo-class_type = '200'. "Mußeingabe
tstpo-comp_qty = '1.000'. "Mußeingabe
tstpo-comp_unit = 'ST'.
6. Position (Lagerteil) mit Beziehungswissen
clear tstpo.
tstpo-item_no = '0060'.
tstpo-item_categ = 'L'. "Mußeingabe
tstpo-component = 'MAT200'. "Mußeingabe
tstpo-comp_qty = '1.000'. "Mußeingabe
tstpo-comp_unit = 'ST'.
tstpo-identifier = 'P1'. "Mußeingabe beim Anlegen von BezWissen
append tstpo.
Beziehungswissen zu Position 0060
clear tdep_data.
tdep_data-object_id = '2'.
tdep_data-identifier = 'P1'.
tdep_data-dep_extern = 'B1'.
tdep_data-dep_type = '5'.
tdep_data-status = '1'.
append tdep_data.
clear tdep_source.
tdep_source-object_id = '2'.
tdep_source-identifier = 'P1'.
tdep_source-dep_extern = 'B1'.
tdep_source-line_no = '1'.
tdep_source-line = 'Farbe = ''rot'''.
append tdep_source.
clear tdep_descr.
tdep_descr-object_id = '2'.
tdep_descr-identifier = 'P1'.
tdep_descr-dep_extern = 'B1'.
tdep_descr-language = 'D'.
tdep_descr-descript = 'Beziehung B1 zu Position P1'.
append tdep_descr.
7. Position (Lagerteil) mit Beziehungswissen
clear tstpo.
tstpo-item_no = '0070'.
tstpo-item_categ = 'L'. "Mußeingabe
tstpo-component = 'MAT400'. "Mußeingabe
tstpo-comp_qty = '1.000'. "Mußeingabe
tstpo-comp_unit = 'ST'.
tstpo-identifier = 'P2'. "Mußeingabe beim Anlegen von BezWissen
append tstpo.
Beziehungswissen zu Position 0070
clear tdep_data.
tdep_data-object_id = '2'.
tdep_data-identifier = 'P2'.
tdep_data-dep_extern = 'B2'.
tdep_data-dep_type = '5'.
tdep_data-status = '1'.
append tdep_data.
clear tdep_source.
tdep_source-object_id = '2'.
tdep_source-identifier = 'P2'.
tdep_source-dep_extern = 'B2'.
tdep_source-line_no = '1'.
tdep_source-line = 'Farbe = ''rot'''.
append tdep_source.
clear tdep_descr.
tdep_descr-object_id = '2'.
tdep_descr-identifier = 'P2'.
tdep_descr-dep_extern = 'B2'.
tdep_descr-language = 'D'.
tdep_descr-descript = 'Beziehung B1 zu Position P1'.
append tdep_descr.
*- Materialstückliste anlegen
call function 'CSAP_MAT_BOM_CREATE'
exporting
material = 'MAT100'
plant = '0001'
bom_usage = '1'
valid_from = '01.01.1995'
i_stko = tstko
importing
fl_warning = flg_warning
tables
t_stpo = tstpo
t_dep_data = tdep_data
t_dep_descr = tdep_descr
t_dep_source = tdep_source
t_dep_order = tdep_order
t_dep_doc = tdep_doc
exceptions
error = 1.
if sy-subrc eq 1.
*---- Fehler aufgetreten (Stückliste kann nicht angelegt werden)
Bitte Protokoll auswerten
endif.
if flg_warning eq 'X'.
*---- Bitte Protokoll auswerten. Dieses enthält Informationen, War-
nungen und Erfolgsmeldungen
Endif.
Parameters
MATERIAL
PLANT
BOM_USAGE
VALID_FROM
CHANGE_NO
REVISION_LEVEL
I_STKO
FL_NO_CHANGE_DOC
FL_COMMIT_AND_WAIT
FL_CAD
FL_DEFAULT_VALUES
FL_WARNING
BOM_NO
T_STPO
T_DEP_DATA
T_DEP_DESCR
T_DEP_ORDER
T_DEP_SOURCE
T_DEP_DOC
T_LTX_LINE
T_STPU
Exceptions
ERROR
Function Group
CSAP
Regards
- Atul -
HI ABAP Guru's,
How to Update the BOM Using Below function Modules.
CSAP_MAT_BOM_OPEN CSAP_BOM_ITEM_MAINTAIN CSAP_MAT_BOM_CLOSE.
My Requremnet is For any components contains Issued storage location's .. I need to delete that storage location.
But it is not updating see the below code.
Can you please give me the Proper Reason why it is not get updated .
Afetr Maintain BOM I have tried with COMMIT statemnet also but helpless.
call function 'CONVERSION_EXIT_PDATE_OUTPUT'
exporting
input = sy-datum
importing
output = date.
*Enquee Exceptions
call function 'CALO_INIT_API'
exceptions
log_object_not_found = 1
log_sub_object_not_found = 2
others = 3.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
*BOM Open
call function 'CSAP_MAT_BOM_OPEN'
exporting
material = 'matnr'
plant = 'werks'
bom_usage = '1'
valid_from = date
importing
o_stko = gt_stko
fl_warning = fl_warning
tables
t_stpo = gt_stpo
exceptions
error = 1
others = 2.
loop at gt_stpo.
gt_stpo-issue_loc = ' '.
*change BOM Contents
call function 'CSAP_BOM_ITEM_MAINTAIN'
exporting
i_stpo = gt_stpo
importing
fl_warning = fl_warning
exceptions
error = 1
others = 2.
if sy-subrc <> 0.
commit work.
endloop.
*Close BOM
call function 'CSAP_MAT_BOM_CLOSE'
exporting
fl_commit_and_wait = ' X'
importing
fl_warning = fl_warning
exceptions
error = 1
others = 2.
Thanks in advance,
<<Thread unlocked, Urgency normalized>>
Edited by: kishan P on Jan 17, 2012 1:38 PM
Edited by: kishan P on Jan 17, 2012 5:47 PMCan you check the following code.
call function 'CALO_INIT_API'
exceptions
log_object_not_found = 1
log_sub_object_not_found = 2
other_error = 3
others = 4.
data v_datun type CSAP_MBOM-DATUV.
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
DATE_INTERNAL = SY-DATUM
IMPORTING
DATE_EXTERNAL = v_datun.
*- Eröffnen der Stückliste für Änderungen
call function 'CSAP_MAT_BOM_OPEN'
exporting
material = 'CG0012'
plant = '0002'
bom_usage = '1'
valid_from = v_datun
ALTERNATIVE = '03'
importing
o_stko = tstk2
fl_warning = flg_warning
tables
t_stpo = tstp2
exceptions
error = 1.
clear: tdep2_data,
tdep2_source,
tdep2_descr,
tdep2_order,
tdep2_doc.
refresh: tdep2_data,
tdep2_source,
tdep2_descr,
tdep2_order,
tdep2_doc.
data v_date type char10 .
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
DATE_INTERNAL = SY-DATUM
IMPORTING
DATE_EXTERNAL = v_date
EXCEPTIONS
DATE_INTERNAL_IS_INVALID = 1
OTHERS = 2
loop at tstp2.
if tstp2-COMPONENT = '61065A'.
tstp2-FLDELETE = 'X'.
tstp2-CHANGED_BY = SY-UNAME.
modify tstp2.
endif.
clear tstp2.
endloop.
perform item_maintain.
call function 'CSAP_MAT_BOM_CLOSE'
importing
fl_warning = flg_warning
exceptions
error = 1.
*- Unterroutine
Form item_maintain.
call function 'CSAP_BOM_ITEM_MAINTAIN'
exporting
i_stpo = tstp2
importing
fl_warning = flg_warning
tables
t_dep_data =
t_dep_descr =
t_dep_order =
t_dep_source = tdep2_source
t_dep_doc =
exceptions
error = 1
others = 2.
if sy-subrc = 0.
endif.
endform. -
Create BOM , CSAP_MAT_BOM_CREATE
Hi,
i have some problems with the call function mentioned above.
First let me show the code:
*- Kopfdaten füllen
wa_tstko-base_quan = '1'.
wa_tstko-bom_text = text-t11. "'Stücklistentext'.
APPEND wa_tstko TO xt_tstko.
hilfsfeld für Stücklistenposition
DATA: lh_item1(4) TYPE c VALUE '0000'
, lh_item(4) TYPE c.
LOOP AT xt_hstb WHERE box = 'X'.
*- Positionsdaten füllen
ADD 10 TO lh_item1.
SHIFT lh_item1 LEFT DELETING LEADING space.
CONCATENATE '00' lh_item1 INTO lh_item.
CLEAR xt_tstpo.
wa_tstpo-item_no = lh_item.
wa_tstpo-item_categ = 'L'. "Mußeingabe
wa_tstpo-component = xt_hstb-n_matnr. "Mußeingabe
wa_tstpo-comp_qty = xt_hstb-menge. "Mußeingabe
wa_tstpo-comp_unit = xt_hstb-mmein.
wa_tstpo-item_text1 = xt_hstb-ojtxb.
APPEND wa_tstpo TO xt_tstpo.
ENDLOOP.
CALL FUNCTION 'CALO_INIT_API'.
CALL FUNCTION 'CSAP_MAT_BOM_CREATE'
EXPORTING
material = xl_matnr
plant = xp_werks
bom_usage = 'L'
valid_from = xl_datuv
CHANGE_NO =
REVISION_LEVEL =
i_stko = xt_tstko
FL_NO_CHANGE_DOC = ' '
FL_COMMIT_AND_WAIT = ' '
FL_CAD = ' '
FL_DEFAULT_VALUES = 'X'
IMPORTING
FL_WARNING = xh_flg_warning
bom_no = xh_stlnr
TABLES
t_stpo = xt_tstpo
EXCEPTIONS
error = 1
OTHERS = 2
i always get following dump.
exception: ..... KEY_INCOMPLETE....
Does anybody have some answers for that problem?
thx
ThomasGive a example.
this program can create bom succcess.but add stpu(subitem) ,have some problem.
REPORT ZPDM_CREATEBOM .
DATA: i_stko like STKO_API01.
data: T_STPO like table of STPO_API01 WITH HEADER LINE.
data: T_STPU like table of STPU_API01 WITH HEADER LINE.
data: BOM_HEADER like BICSK.
DATA: return TYPE char100,
return2 TYPE char100.
i_stko-BASE_QUAN = 1.
T_STPO-ITEM_CATEG = 'L'.
T_STPO-ITEM_NO = '0010'.
T_STPO-COMPONENT = '52008022702'.
T_STPO-COMP_QTY = '10'.
APPEND T_STPO.
T_STPO-ITEM_CATEG = 'L'.
T_STPO-ITEM_NO = '0020'.
T_STPO-COMPONENT = '52008022701'.
T_STPO-COMP_QTY = '20'.
APPEND T_STPO.
T_STPU-POINTER = 20.
T_STPU-UPOSZ = '0001'.
T_STPU-EBORT = 'A1'.
T_STPU-UPMNG = '10'.
APPEND T_STPU.
T_STPU-POINTER = 20.
T_STPU-UPOSZ = '0002'.
T_STPU-EBORT = 'A2'.
T_STPU-UPMNG = '10'.
APPEND T_STPU.*
CALL FUNCTION 'CSAP_MAT_BOM_CREATE'
EXPORTING
material = 'FERT005'
PLANT = '1000'
bom_usage = '1'
VALID_FROM =
CHANGE_NO = 'ECO200909096'
REVISION_LEVEL =
i_stko = i_stko
FL_NO_CHANGE_DOC = ' '
FL_COMMIT_AND_WAIT = ' '
FL_CAD = ' '
FL_DEFAULT_VALUES = 'X'
IMPORTING
FL_WARNING =
BOM_NO =
TABLES
T_STPO = T_STPO
T_DEP_DATA =
T_DEP_DESCR =
T_DEP_ORDER =
T_DEP_SOURCE =
T_DEP_DOC =
T_LTX_LINE =
T_STPU = T_STPU
EXCEPTIONS
ERROR = 1
OTHERS = 2 -
BAPI to change a BOM copmonent
Hi gurus,
I am using a BAPI named by BAPI_BOM_UPLOAD_SAVE.
With this BAPI i could create a new BOM. But i am not able to change a specific component in the BOM. Is there any indicators to imply the change or is there any BAPI to change the existing BOM component without having the whole structure to be used.
Regards,
Nehru.FU CSAP_MAT_BOM_MAINTAIN
Functionality
You can use function module CSAP_MAT_BOM_MAINTAIN to process simple material BOMs.
This function module is intended mainly as a tool for changing BOMs. However, it can also be used to create BOMs.
If you only want to create BOMs, use function module CSAP_MAT_BOM_CREATE.
To change BOMs, you can also use the following function modules:
CSAP_MAT_BOM_OPEN
CSAP_BOM_ITEM_MAINTAIN
CSAP_MAT_BOM_CLOSE
For more information and examples, see the documentation of the individual function modules.
Restrictions:
To date, you can only process one alternative or variant with this function module. This means that, if you do not enter an alternative for function module CSAP_MAT_BOM_MAINTAIN, the system assumes that you want to process alternative 01.
To date, changes to the BOM header are not yet supported.
Please note:
The item to be changed can be identified in two ways:
via the fields item category, item number, sort string, and object (depending on the item category, this can be material, document data, or class data).
The names of these identifying fields begin with 'ID_' and are contained in structure CSIDENT_02. Structure CSIDENT_02 is part of structure STPO_API03.
You can use any combination of these fields to identify the item, provided the fields identify the item uniquely. Otherwise you see the error message 'Item cannot be identified uniquely'.
via the BOM node and BOM item counter
These fields are only known to the system if you have read the BOM before. If you identify the item in this way, you should therefore use function modules CSAP_MAT_BOM_OPEN, CSAP_BOM_ITEM_MAINTAIN, or CSAP_MAT_BOM_CLOSE to change the BOM.
If the error message 'Item cannot be changed' appears in the log, this can be for the following reasons:
- The item is not valid on the valid-from date - it becomes valid at a
later date.
- The item has already been changed on the same valid-from date
with a different change number.
You cannot change the item category of an item that exists already in the system.
To delete an item, you must identify it as described above for the change function and set the deletion indicator.
FL_BOM_CREATE (default ' ')
If you set this indicator to 'X', the system creates a new BOM if it cannot find the BOM you want to change and there is no other error.
Items can only be created if sufficient data exists to do this.
The system ignores items with a deletion indicator when creating a BOM.
FL_NEW_ITEM (default ' ')
If you set this indicator to 'X', the system creates a new item if it cannot find the item with the identification entered.
The system ignores items with a deletion indicator.
Example
*---- BOM header data structure
data: begin of tstk2.
include structure stko_api02.
data: end of tstk2.
*---- BOM items table
data: begin of tstp3 occurs 0.
include structure stpo_api03.
data: end of tstp3.
*---- Object dependencies table
* Basis data
data: begin of tdep2_data occurs 0.
include structure dep_data.
data: end of tdep2_data.
* Description
data: begin of tdep2_descr occurs 0.
include structure dep_descr.
data: end of tdep2_descr.
* Source
data: begin of tdep2_source occurs 0.
include structure dep_source.
data: end of tdep2_source.
* Sequence
data: begin of tdep2_order occurs 0.
include structure dep_order.
data: end of tdep2_order.
* Documentation
data: begin of tdep2_doc occurs 0.
include structure dep_doc.
data: end of tdep2_doc.
data: flg_warning like capiflag-warning.
*- Initialize database log
call function 'CALO_INIT_API'
exceptions
log_object_not_found = 1
log_sub_object_not_found = 2
other_error = 3
others = 4.
*- Fill item data
* Exception: items that can be identified uniquely via their item
* number
* 1. Item 0010: change quantity
clear tstp3.
tstp3-id_item_no = '0010'. "Item identification
tstp3-comp_qty = '5.000'.
append tstp3.
* 2. Item 0020: delete
clear tstp3.
tstp3-id_item_no = '0020'. "Item identification.
tstp3-fldelete = 'X'.
append tstp3.
*- 3. New item 0030 (stock material)
* For new items, the ID_ fields, BOM nodes, and BOM item counters are
* initial unless they use
* FLG_NEW_ITEM
clear tstp3.
tstp3-item_no = '0030'.
tstp3-component = 'MAT200'.
tstp3-item_categ = 'L'.
tstp3-comp_qty = '1'.
tstp3-rel_prod = 'X'.
tstp3-sortstring = 'A1'.
append tstp3.
* 3. Item 0040: change component
clear tstp3.
tstp3-id_item_no = '0040'. "Item identification
tstp3-component = 'MAT500'.
append tstp3.
*- Change BOM
call function 'CSAP_MAT_BOM_MAINTAIN'
exporting
material = 'MAT100'
plant = '0001'
bom_usage = '1'
valid_from = '14.10.1996'
fl_bom_create = ' '
fl_new_item = ' '
i_stko = tstko
importing
fl_warning = flg_warning
o_stko = tstk2
tables
t_stpo = tstp3
exceptions
others = 1.
if sy-subrc eq 1.
*---- Error
* Please see log
endif.
if flg_warning eq 'X'.
*---- Please see log for information, warning messages, and success
* messages.
Endif.
Parameters
MATERIAL
PLANT
BOM_USAGE
ALTERNATIVE
VALID_FROM
CHANGE_NO
REVISION_LEVEL
I_STKO
FL_NO_CHANGE_DOC
FL_COMMIT_AND_WAIT
FL_CAD
FL_BOM_CREATE
FL_NEW_ITEM
FL_COMPLETE
FL_DEFAULT_VALUES
FL_IDENTIFY_BY_GUID
FL_WARNING
O_STKO
T_STPO
T_DEP_DATA
T_DEP_DESCR
T_DEP_ORDER
T_DEP_SOURCE
T_DEP_DOC
T_DOC_LINK
T_DMU_TMX
T_LTX_LINE
T_STPU
Exceptions
ERROR
Function Group
CSAP -
Can anyone tell me why this isn't working?
Here is the simplified scenario:
I have a BOM for material number 123456. The BOM has one component called component1. I want to update that component to component2.
When I run what you see below, it opens fine (ran debugger and it returned all info on the BOM as expected).
It runs supposedly with no issue.
When I look at the log, it in fact says BOM for Material 123456 Changed. But when I go back into CS03 to look at the BOM, it shows no changes. Still has Component1 instead of Component2. I can tell you that in reality there are about 6 items in the BOM to begin with and I run this FM to delete all of the first 5 items so there is just one left. It is this last (and now only) item that I am trying to change. The delete of the first 5 items works without any issues. I then close it and again open the BOM and try to modify the remaining item to have component2. (I tried updating the component on the first pass and it didn't work so I thought I would simplify it and only have one item to deal wtih).
Here is the code. Does anyone see anything obvious as to why it is not working?
*---- Field string BOM header data
data: begin of tstk2.
include structure stko_api02.
data: end of tstk2.
*---- Table BOM items
data: begin of tstp2 occurs 0.
include structure stpo_api02.
data: end of tstp2.
*---- Tables for dependencies:
* basic Information
data: begin of tdep2_data occurs 0.
include structure dep_data.
data: end of tdep2_data.
* Description
data: begin of tdep2_descr occurs 0.
include structure dep_descr.
data: end of tdep2_descr.
* Source
data: begin of tdep2_source occurs 0.
include structure dep_source.
data: end of tdep2_source.
* Order
data: begin of tdep2_order occurs 0.
include structure dep_order.
data: end of tdep2_order.
* Documentation
data: begin of tdep2_doc occurs 0.
include structure dep_doc.
data: end of tdep2_doc.
data: flg_warning like capiflag-flwarning.
DATA: CONV_EXIT(10).
*- Database log open
call function 'CALO_INIT_API'
exceptions
log_object_not_found = 1
log_sub_object_not_found = 2
other_error = 3
others = 4.
*- Open the BOM for changes
call function 'CSAP_MAT_BOM_OPEN'
exporting
material = '000000000000123456'
plant = '1001'
bom_usage = '3'
valid_from = '07/08/2014'
importing
o_stko = tstk2
fl_warning = flg_warning
tables
t_stpo = tstp2
exceptions
error = 1.
LOOP at tstp2. "Go through the list of items for this BOM and set the values
tstp2-component = 'COMPONENT2'.
tstp2-comp_unit = 'PC'.
"MODIFY TSTP2. "tried this with the modify and without both return same result of nothing updated
perform item_maintain.
call function 'CSAP_MAT_BOM_CLOSE'
exporting
fl_commit_and_wait = 'X'
importing
fl_warning = flg_warning
exceptions
error = 1.
Form item_maintain.
call function 'CSAP_BOM_ITEM_MAINTAIN'
exporting
i_stpo = tstp2
importing
fl_warning = flg_warning
* tables
* t_dep_data =
* t_dep_descr =
* t_dep_order =
* t_dep_source = tdep2_source
* t_dep_doc =
exceptions
error = 1
others = 2.
ENDFORM.
--------------END OF CODE---------------
All looks good other than the fact that nothing gets changed in the BOM. Looking for ideas here.
ThxHi Richard,
You can try using:
CALL FUNCTION 'CSAP_MAT_BOM_CLOSE'
EXPORTING
fl_commit_and_wait = ''
EXCEPTIONS
error = 1
OTHERS = 2.
and FM BAPI_TRANSACTION_COMMIT:
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
* IMPORTING
* RETURN = .
I hope you help. -
SAP Server demo version for development?????
Hi,
Is there any version of SAP R/3 server for application development?
I develop my external application in Java in Eclipse environment (I use basically Material Management module), but I am using server from my university which is currently unavailable. I need access to server asap and therefore I wonder whether there is any version for development.
Any helpful answer will be properly rewarded.
BR,
RafalHi,
Firstly, thanks for an answer. Points will be rewarded later on.
I understand all these legal issues. Please explain me what means "technology basis release"? I mean, what does it include? Basically I use only a few BAPIs and function modules related to MM module and that's all what I really need. I list them below:
CALO_INIT_API
CSAP_MAT_BOM_CREATE
BAPI_MATERIAL_BOM_GROUP_CREATE
CSAP_MAT_BOM_READ
BAPI_MATERIAL_EXISTENCECHECK
BAPI_MATERIAL_GETLIST
BAPI_MATERIAL_GET_DATAIL
BAPI_MATERIAL_SAVEDATA
Do you know whether they are available within so called "technology basis release"? Perhaps it is stupid question, but I'm still new in SAP.
I've got to mention that I sent an email describing my problem to SAP. They've answered that I'm supposed to visit http://sdn.sap.com and there I can get a demo version. I still can't find it (perhaps I'm blind , or more probably names in download section are not so self-evident).
Looking forward any response.
BR,
Rafal -
Help with CALO_LOG_READ_MESSAGES
Hello all,
We're using JCo to execute CSAP function modules within SAP. The CSAP functions are working properly but we cannot get 'CALO_LOG_READ_MESSAGES' to pull any records.
We are executing 'CALO_INIT_API' prior to any CSAP calls
the same code in ABAP produces the desired results
JCo calls produce logs in SLG1. Just nothing returned in CALO_LOG_READ_MESSAGES.
Is there a flag we need to set for external use or anything different from using them FM's internally in ABAP?
Thanks in advance!
BThanks for the reply. We are using a pool and that makes sense--it may not use the same connection / session to read the messages that were initialized or created.
So, is there a way to handle using a pool? I'd rather not create custom BAPI's for standard functionality. I don't know or see of a way to specify a log with the CALO functions but maybe (hopefully) I'm overlooking something.
B
Maybe you are looking for
-
Yesterday, I got a problem with my iPhone 5S. When I updated it to iOS 8.1, it restarted along with the BSOD (Blue Screen of Death). When it rebooted, it stuck in recovery mode, and when I want to restore it, it won't. It will display the status bar
-
Runtime error R6034 c:\program files\itunes\itunes.exe.
On january 25, 2014 I installed new version of itunes 11.1.4 and error occured: itunes was not installed correctly. Please reintall itunes. Error 7 (windows error) 1114. Runtime Error: program c:\files\itunes\itunes.exe. R6034 An application has m
-
Wrong aspect ratio when space bar preview movies in finder
any way to change finder so that it previews 16x9 movies in the right aspect ratio? it always squishes my 16x9 to 4x3. ugly.
-
When playing music through iTunes, it no longer starts at a random song.
I have it set to shuffle and it used to start with a random song. Now, it always starts with the first song in my library. I prefer the random start, but after the last update, it no longer does it. Can I change this in a setting or something??
-
5.1 surround sound in final cut express HD????
is there 5.1 sound import or creation in the program? what im trying to say is, does Final Cut Express HD support surround sound??