‎2008 Dec 20 5:30 AM
Hi,
I want to make a bdc for the tcode CS01(BOM Creation),but the thing when i perform the Recording then there is a point that the BOM having the sub - items which might be 3 or 2 or maybe 10 . how can i manage that during the recording.
plzz provide me guidelines for solving this problem.
‎2008 Dec 20 5:40 AM
‎2008 Dec 20 5:43 AM
hi,
but i dont know how to use BAPI as i had uploaded the data throught BDC only.is there any exmaple of it ?
‎2008 Dec 20 5:48 AM
Hi,
Search the SCN forums with the BAPI name, you will find lot of threads regarding that, or go to SE37 and give that FM name, click on documentation, regarding how to use.
Regards
Bala Krishna
‎2008 Dec 20 5:44 AM
‎2008 Dec 20 5:46 AM
hi,
plzz provide me guidelines how to use a BAPI for uploading the data...
‎2008 Dec 20 6:46 AM
Hi,
Try to use BAPI. If you still want to use BDC find the screen element and screen fields
in your recording ,for the line items.
Loop at them with your internal table having the line item fields.
Regards,
Manoj Kumar P
‎2008 Dec 23 11:49 AM
hi,
i want to use the BDC and how do i the looping i.e. if the sub material is having the 2 items and next is having 3 items. is the looping is the correct way of doing it?
plzz provide me guidelines for solving this problem.
‎2008 Dec 23 12:07 PM
Hi,
This code for BOM creation/Change,
using BAPI as well as BDC check this.
LOOP AT it_bom_create INTO wa_bom_create.
* Begin of CCT51465 - B09794 - 11/28/2007
* PERFORM f_bdc_dynpro USING 'SAPLCSDI' '0100'.
* PERFORM f_bdc_field USING 'BDC_OKCODE'
* '/00'.
* PERFORM f_bdc_field USING 'RC29N-MATNR'
* wa_bom_create-matnr.
* PERFORM f_bdc_field USING 'RC29N-WERKS'
* wa_mbew-bwkey.
* PERFORM f_bdc_field USING 'RC29N-STLAN'
* '2'.
* PERFORM f_bdc_field USING 'RC29N-STLAL'
* '01'.
*
* PERFORM f_bdc_dynpro USING 'SAPLCSDI' '0110'.
* PERFORM f_bdc_field USING 'BDC_OKCODE'
* '/00'.
*
* CONDENSE wa_bom_create-bmeng.
* PERFORM f_bdc_field USING 'RC29K-BMENG'
* wa_bom_create-bmeng.
*
* PERFORM f_bdc_dynpro USING 'SAPLCSDI' '0111'.
* PERFORM f_bdc_field USING 'BDC_OKCODE'
* '/00'.
*
* CONDENSE wa_bom_create-menge.
* PERFORM f_bdc_dynpro USING 'SAPLCSDI' '0140'.
* PERFORM f_bdc_field USING 'BDC_CURSOR'
* 'RC29P-IDNRK(01)'.
* PERFORM f_bdc_field USING 'BDC_OKCODE'
* '/00'.
* PERFORM f_bdc_field USING 'RC29P-IDNRK(01)'
* wa_bom_create-idnrk.
* CONDENSE wa_bom_create-menge.
* PERFORM f_bdc_field USING 'RC29P-MENGE(01)'
* wa_bom_create-menge.
* PERFORM f_bdc_field USING 'RC29P-POSTP(01)'
* 'L'.
*
* PERFORM f_bdc_dynpro USING 'SAPLCSDI' '0130'.
* PERFORM f_bdc_field USING 'BDC_OKCODE'
* '/00'.
*
* PERFORM f_bdc_dynpro USING 'SAPLCSDI' '0131'.
* PERFORM f_bdc_field USING 'BDC_OKCODE'
* '/00'.
*
* PERFORM f_bdc_dynpro USING 'SAPLCSDI' '0140'.
* PERFORM f_bdc_field USING 'BDC_OKCODE'
* '=FCBU'.
*
* PERFORM f_bdc_transaction USING 'CS01'.
it_stko1-base_quan = wa_bom_create-bmeng.
CALL FUNCTION 'CSAP_MAT_BOM_CREATE'
EXPORTING
material = wa_bom_create-matnr
plant = wa_marc-werks
bom_usage = '2'
valid_from = v_valid " CCT52206 - B09794 - 12/10/2007
* CHANGE_NO =
* REVISION_LEVEL =
i_stko = it_stko1
* FL_NO_CHANGE_DOC = ' '
fl_commit_and_wait = 'X'
* FL_CAD = ' '
fl_default_values = ' '
IMPORTING
fl_warning = flg_warning
* BOM_NO =
TABLES
t_stpo = it_stpo1
* T_DEP_DATA =
* T_DEP_DESCR =
* T_DEP_ORDER =
* T_DEP_SOURCE =
* T_DEP_DOC =
* T_LTX_LINE =
* T_STPU =
EXCEPTIONS
error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Begin of CCT59311 - B09794 - 07/01/2008
IF p_show = 'X'.
PERFORM f_check_lock.
ENDIF.
* End of CCT59311 - B09794 - 07/01/2008
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = sy-msgid
lang = sy-langu
no = sy-msgno
v1 = sy-msgv1
v2 = sy-msgv2
v3 = sy-msgv3
v4 = sy-msgv4
IMPORTING
msg = v_mstring
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc = 0.
CONDENSE v_mstring.
wa_errormsg-matnr = wa_bom_create-matnr.
wa_errormsg-werks = wa_marc-werks.
wa_errormsg-mtart = v_mat_typ.
wa_errormsg-msgtyp = sy-msgty.
IF sy-msgid = '29' AND sy-msgno = '037'.
v_mstring = text-027. " Costing BOM already exist (For Material -
CONCATENATE v_mstring wa_marc-matnr ')' INTO v_mstring.
wa_errormsg-msgtxt = v_mstring.
ELSE.
wa_errormsg-msgtxt = v_mstring.
ENDIF.
APPEND wa_errormsg TO it_errormsg1.
CLEAR wa_errormsg.
ENDIF.
ELSE.
wa_successmsg-matnr = wa_marc-matnr.
wa_successmsg-werks = wa_marc-werks.
wa_successmsg-mtart = v_mat_typ.
wa_successmsg-msgtyp = 'S'.
v_mstring = text-017. " Costing BOM created successfully (For Material -
CONCATENATE v_mstring wa_marc-matnr ')' INTO v_mstring.
wa_successmsg-msgtxt = v_mstring.
APPEND wa_successmsg TO it_successmsg.
CLEAR wa_successmsg.
ENDIF.
Code Formatted by: Alvaro Tejada Galindo on Dec 23, 2008 10:21 AM