To display flatfile rec's under 1 Alternative BOM using BDc recording.
Hi,
I m trying to display flat file entire(i.e.. 4 rec's i m using) records vertically under one (Alternative BOM) for CS01-BOM using BDC recording method.
Now i m tried with the following code,i m getting as one (Alternative BOM) for one ff record,by replacing one by one.
But i want as vertically under one (Alternative BOM).
Can anyone help me to overcome this.
report ZBOM
no standard page heading line-size 255.
*include bdcrecx1.
DATA: BEGIN OF bdc OCCURS 0,
matnr(18),
werks(4),
stlan(1),
END OF BDC.
DATA: BEGIN OF BDC1 OCCURS 0,
idnrk(18),
MENGE(18),
MEINS(3),
postp(1),
posnr(4),
END OF bdc1.
DATA: BEGIN OF BDCDATA OCCURS 0,
matnr(18),
werks(4),
stlan(1),
idnrk(18),
MENGE(18),
MEINS(3),
postp(1),
posnr(4),
END OF BDCDATA.
data ibdcdata type standard table of bdcdata WITH header line.
*start-of-selection.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:\Documents and Settings\dilipkumar.b\Desktop\soft.txt'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ','
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = BDCDATA
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*perform open_group.
loop at bdcdata.
perform bdc_dynpro using 'SAPLCSDI' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RC29N-STLAN'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RC29N-MATNR'
'SOFTDRINKS'.
perform bdc_field using 'RC29N-WERKS'
'WIND'.
perform bdc_field using 'RC29N-STLAN'
'1'.
perform bdc_field using 'RC29N-DATUV'
'16.09.2008'.
perform bdc_dynpro using 'SAPLCSDI' '0110'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RC29K-BMENG'
'1'.
perform bdc_field using 'RC29K-STLST'
'1'.
perform bdc_field using 'BDC_CURSOR'
'RC29K-EXSTL'.
perform bdc_dynpro using 'SAPLCSDI' '0111'.
perform bdc_field using 'BDC_CURSOR'
'RC29K-LABOR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLCSDI' '0140'.
perform bdc_field using 'BDC_CURSOR'
'RC29P-POSTP(01)'.
perform bdc_field using 'BDC_OKCODE'
'=FCBU'.
perform bdc_field using 'RC29P-IDNRK(001)'
BDCDATA-IDNRK.
perform bdc_field using 'RC29P-MENGE(001)'
BDCDATA-MENGE.
perform bdc_field using 'RC29P-MEINS(001)'
BDCDATA-MEINS.
perform bdc_field using 'RC29P-POSTP(001)'
BDCDATA-POSTP.
perform bdc_dynpro using 'SAPLCSDI' '0130'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RC29P-POSNR'.
perform bdc_field using 'RC29P-POSNR'
BDCDATA-POSNR. "'0010'.
perform bdc_field using 'RC29P-IDNRK'
BDCDATA-IDNRK. "'15'.
perform bdc_field using 'RC29P-MENGE'
BDCDATA-MENGE. "'1'.
perform bdc_field using 'RC29P-MEINS'
BDCDATA-MEINS. "'ml'.
perform bdc_dynpro using 'SAPLCSDI' '0131'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RC29P-POTX1'.
perform bdc_field using 'RC29P-SANKA'
'X'.
*perform bdc_transaction using 'CS01'.
*perform close_group.
CALL TRANSACTION 'CS01' USING IBDCDATA MODE 'A' UPDATE 'S'.
REFRESH IBDCDATA.
clear ibdcdata.
endloop.
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR iBDCDATA.
iBDCDATA-PROGRAM = PROGRAM.
iBDCDATA-DYNPRO = DYNPRO.
iBDCDATA-DYNBEGIN = 'X'.
APPEND ibDCDATA .
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL NODATA.
CLEAR iBDCDATA.
iBDCDATA-FNAM = FNAM.
iBDCDATA-FVAL = FVAL.
APPEND iBDCDATA .
ENDIF.
ENDFORM.
Hi Dilip,
Please change your code.
I request you to please go through BDC tutorials before even starting to write the program.
There are many online tutorials which can help you with.
Also, search in SDN.. there you will get more than thousand results.. with the search term BDC.
Take this suggestion seriously before nayone reports the moderators that u have been posting this thread daily without taking into consideration the previous replies.
Regards,
Vishwa.
Similar Messages
-
Problem uploding flatfile in bom(cs01) using bdc recording
Hi,
I had a problem while uploading flatfile records in bom(cs01) by using bdc recording.
I had four records in flatfile(.txt & xl), i.e., header data with its components.
Sample material:
(Header data) (components)
SOFTDRINKS,WIND,1, ' 14','1','ml','l'
SOFTDRINKS,WIND,1, '11','1','ml','l'
SOFTDRINKS,WIND,1, '13','1','ml','l'
SOFTDRINKS,WIND,1, ' 15','1','ml','l'
while executing, the same component entered while recording has been displayed four times not the ff records.
So, i want to know whether whether ff structure is ok or not,
whether coding is correct or not?
report ZBOM1
no standard page heading line-size 255.
*include bdcrecx1.
DATA: BEGIN OF bdc OCCURS 0,
matnr(18),
werks(4),
stlan(1),
END OF BDC.
DATA: BEGIN OF BDC1 OCCURS 0,
idnrk(40),
MENGE(13),
MEINS(3),
postp(1),
END OF bdc1.
DATA: BEGIN OF BDCDATA OCCURS 0,
matnr(18),
werks(4),
stlan(1),
idnrk(18),
MENGE(18),
MEINS(3),
postp(1),
END OF BDCDATA.
data: ibdcdata type standard table of bdcdata with header line.
*start-of-selection.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:\Documents and Settings\dilipkumar.b\Desktop\soft.txt'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ','
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = BDCDATA
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*perform open_group.
loop at bdcdata.
perform bdc_dynpro using 'SAPLCSDI' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RC29N-STLAN'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RC29N-MATNR'
'SOFTDRINKS'.
perform bdc_field using 'RC29N-WERKS'
'WIND'.
perform bdc_field using 'RC29N-STLAN'
'1'.
perform bdc_field using 'RC29N-DATUV'
'16.09.2008'.
perform bdc_dynpro using 'SAPLCSDI' '0110'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RC29K-BMENG'
'1'.
perform bdc_field using 'RC29K-STLST'
'1'.
perform bdc_field using 'BDC_CURSOR'
'RC29K-EXSTL'.
perform bdc_dynpro using 'SAPLCSDI' '0111'.
perform bdc_field using 'BDC_CURSOR'
'RC29K-LABOR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLCSDI' '0140'.
perform bdc_field using 'BDC_CURSOR'
'RC29P-POSTP(01)'.
perform bdc_field using 'BDC_OKCODE'
'=FCBU'.
perform bdc_field using 'RC29P-IDNRK(01)'
'11'.
perform bdc_field using 'RC29P-MENGE(01)'
'1'.
perform bdc_field using 'RC29P-MEINS(01)'
'ml'.
perform bdc_field using 'RC29P-POSTP(01)'
'l'.
perform bdc_dynpro using 'SAPLCSDI' '0130'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RC29P-POSNR'.
perform bdc_field using 'RC29P-POSNR'
'0010'.
perform bdc_field using 'RC29P-IDNRK'
'11'.
perform bdc_field using 'RC29P-MENGE'
'1'.
perform bdc_field using 'RC29P-MEINS'
'ML'.
perform bdc_dynpro using 'SAPLCSDI' '0131'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RC29P-POTX1'.
perform bdc_field using 'RC29P-SANKA'
'X'.
*perform bdc_transaction using 'CS01'.
*perform close_group.
CALL TRANSACTION 'CS01' USING IBDCDATA MODE 'A' UPDATE 'S'.
REFRESH IBDCDATA.
endloop.
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR iBDCDATA.
iBDCDATA-PROGRAM = PROGRAM.
iBDCDATA-DYNPRO = DYNPRO.
iBDCDATA-DYNBEGIN = 'X'.
APPEND ibDCDATA .
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> NODATA.
CLEAR iBDCDATA.
iBDCDATA-FNAM = FNAM.
iBDCDATA-FVAL = FVAL.
APPEND iBDCDATA .
ENDIF.Hi Dilip,
You are reading your flat file into an internal table, you perform a LOOP over the read itab, but you are not using your BDCDATA data anywhere into IBDCDATA internal table! Those data have to be filled into FVAL parameter.
Here an additional hint:
1. The content of flat file is delivered as a STRING in GUI_UPLOAD. First you have to post these values into a structured internal table. And then perform the LOOP at this structured table.
2. In the new ABAP concept newer ever user Header Lines (in an internal table). One reason: Header Lines are not allowed in ABAP Objects. Instead use
LOOP AT itab into wa_structure.
*do something with wa_structure
APPEND wa_structure to IBDCDATA.
ENDLOOP.
Good success,
Heinz -
Error in creating Alternative BOM using IDOC_INPUT_BOMMAT
Hi all,
I am trying to create an Alternative BOM using IDoc BOMMAT03.I have checked this IDoc will use FM IDOC_INPUT_BOMMAT inside.
In this function module, it is using FM CSAP_MAT_BOM_CREATE and CSAP_MAT_BOM_MAINTAIN to create and change.
This FM is allowing to create an Alterative BOM = '01' but it is not creating for Alt BOM = '02'.
Can anyone provide inputs on this .
Regards
SathibabuHai Guy,
use below code for Alternate BOM with sub item .
Part 1.
DATA: bom_header LIKE cad_bicsk,
bom_item type table of cad_bom_item WITH HEADER LINE,
bom_sub_item type table of cssubitem WITH HEADER LINE,
dms_class_data type table of cls_charac WITH HEADER LINE,
sap_field_data type table of rfcdmsdata WITH HEADER LINE,
e_return LIKE cad_return-value,
e_message LIKE message-msgtx,
e_message_len LIKE cad_return-message_len.
DATA v_ITEM TYPE I.
TYPES : BEGIN OF ty_data,
level TYPE i,
matnr TYPE cad_bicsk-matnr,
werks TYPE werks_d,
usage TYPE stlan,
qty TYPE cad_bom_item-menge,
fqty type fmeng, " Quantity is Fixed
sub_upmng type upmng,
text type cad_bicsk-ztext,
END OF ty_data.
DATA : it_data TYPE TABLE OF ty_data ,
wa_data TYPE ty_data.
**---selection screen
PARAMETERS:p_file TYPE ibipparms-path OBLIGATORY.
**---f4 help for the file from PC
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM get_f4help.
*--start-of-selection .
START-OF-SELECTION.
PERFORM upload_file_itab.
CLEAR: bom_header, bom_item, bom_sub_item.
REFRESH: bom_item, bom_sub_item.
data : v_lineitem type SPOSN value '0000',
v_slineitem type SPOSN value '0'.
LOOP AT it_data INTO wa_data.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_data-matnr
IMPORTING
output = wa_data-matnr.
IF wa_data-level = 0.
* fill BOM header
clear bom_header.
bom_header-matnr = wa_data-matnr. "'000000000200000016'.
* bom_header-stlal = '1'. " Alternative Bom
bom_header-werks = wa_data-werks. "'1000'.
bom_header-stlan = wa_data-usage."'3'.
bom_header-bmeng = wa_data-qty.
bom_header-cadkz = 'X'.
bom_header-stktx = wa_data-text.
* bom_header-ztext = wa_data-text.
bom_header-datuv = '01.10.2010'.
ELSEIF wa_data-level = 1.
* fill item
v_lineitem = v_lineitem + 10.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_lineitem
IMPORTING
output = v_lineitem.
* bom_item-upskz = 'X'. " If We hav the Sub items Enable it.
bom_item-idnrk = wa_data-matnr. "'000000000200000017'.
bom_item-posnr = v_lineitem.
bom_item-postp = 'L'.
bom_item-menge = wa_data-qty. "'1'.
bom_item-fmeng = wa_data-fqty.
APPEND bom_item.
CLEAR: bom_item.
*** fill sub item
CLEAR V_ITEM .
v_slineitem = v_slineitem + 1.
ELSEIF wa_data-level = 2.
* V_ITEM = V_ITEM + 1.
* bom_sub_item-posid = v_slineitem.
* bom_sub_item-ebort = 'test'.
* bom_sub_item-upmng = wa_data-sub_upmng.
* bom_sub_item-uposz = V_ITEM.
* bom_sub_item-uptxt = 'test'.
* append bom_sub_item.
* clear bom_sub_item.
ENDIF.
if wa_data-level = 0.
else.
at END OF LEVEL.
* Call function
CALL FUNCTION 'CAD_CREATE_BOM_WITH_SUB_ITEMS'
EXPORTING
i_bom_header = bom_header
i_auto_posnr = ''
IMPORTING
e_return = e_return
e_message = e_message
e_message_len = e_message_len
e_bom_header = bom_header
TABLES
bom_item = bom_item
bom_sub_item = bom_sub_item
dms_class_data = dms_class_data
sap_field_data = sap_field_data
EXCEPTIONS
OTHERS = 1.
refresh bom_item.
write : e_message.
ENDAT.
ENDIF.
CLEAR wa_data.
endloop. -
Sample code creating BOM for CS01 using BDC recording.
Hi,
Can anyone give me sample coding creating BOM for CS01 using BDC recording.
I want to display the flat file records,under one (Alternative BOM).
I m already working on it,but i m getting one A.BOM for each records.
[ Header data ] [ Item Data ]
SOFTDRINKS WIND 1 13 1 ml l
SOFTDRINKS WIND 1 11 1 ml l
SOFTDRINKS WIND 1 15 1 ml l
SOFTDRINKS WIND 1 14 1 ml l
Code:
report ZBOM
no standard page heading line-size 255.
*include bdcrecx1.
*DATA: BEGIN OF bdc OCCURS 0,
matnr(18),
werks(4),
stlan(1),
END OF BDC.
*DATA: BEGIN OF BDC1 OCCURS 0,
idnrk(18),
MENGE(18),
MEINS(3),
postp(1),
posnr(4),
END OF bdc1.
DATA: BEGIN OF BDCDATA OCCURS 0,
matnr(18),
werks(4),
stlan(1),
idnrk(18),
MENGE(18),
MEINS(3),
postp(1),
posnr(4),
END OF BDCDATA.
data ibdcdata type standard table of bdcdata WITH header line.
*start-of-selection.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:\Documents and Settings\dilipkumar.b\Desktop\soft.txt'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ','
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = BDCDATA
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*perform open_group.
loop at bdcdata.
perform bdc_dynpro using 'SAPLCSDI' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RC29N-STLAN'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RC29N-MATNR'
'SOFTDRINKS'.
perform bdc_field using 'RC29N-WERKS'
'WIND'.
perform bdc_field using 'RC29N-STLAN'
'1'.
perform bdc_field using 'RC29N-DATUV'
'16.09.2008'.
perform bdc_dynpro using 'SAPLCSDI' '0110'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RC29K-BMENG'
'1'.
perform bdc_field using 'RC29K-STLST'
'1'.
perform bdc_field using 'BDC_CURSOR'
'RC29K-EXSTL'.
perform bdc_dynpro using 'SAPLCSDI' '0111'.
perform bdc_field using 'BDC_CURSOR'
'RC29K-LABOR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLCSDI' '0140'.
perform bdc_field using 'BDC_CURSOR'
'RC29P-POSTP(01)'.
perform bdc_field using 'BDC_OKCODE'
'=FCBU'.
perform bdc_field using 'RC29P-IDNRK(001)'
BDCDATA-IDNRK.
perform bdc_field using 'RC29P-MENGE(001)'
BDCDATA-MENGE.
perform bdc_field using 'RC29P-MEINS(001)'
BDCDATA-MEINS.
perform bdc_field using 'RC29P-POSTP(001)'
BDCDATA-POSTP.
perform bdc_dynpro using 'SAPLCSDI' '0130'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RC29P-POSNR'.
perform bdc_field using 'RC29P-POSNR'
BDCDATA-POSNR. "'0010'.
perform bdc_field using 'RC29P-IDNRK'
BDCDATA-IDNRK. "'15'.
perform bdc_field using 'RC29P-MENGE'
BDCDATA-MENGE. "'1'.
perform bdc_field using 'RC29P-MEINS'
BDCDATA-MEINS. "'ml'.
perform bdc_dynpro using 'SAPLCSDI' '0131'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RC29P-POTX1'.
perform bdc_field using 'RC29P-SANKA'
'X'.
*perform bdc_transaction using 'CS01'.
*perform close_group.
CALL TRANSACTION 'CS01' USING IBDCDATA MODE 'A' UPDATE 'S'.
REFRESH IBDCDATA.
clear ibdcdata.
endloop.
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR iBDCDATA.
iBDCDATA-PROGRAM = PROGRAM.
iBDCDATA-DYNPRO = DYNPRO.
iBDCDATA-DYNBEGIN = 'X'.
APPEND ibDCDATA .
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> NODATA.
CLEAR iBDCDATA.
iBDCDATA-FNAM = FNAM.
iBDCDATA-FVAL = FVAL.
APPEND iBDCDATA .
ENDIF.
ENDFORM.Hi,
I tried with the sample code but i m not getting the required result.
Can anyone give some other soln.
Code:
REPORT ZBOM2
no standard page heading line-size 255.
*include bdcrecx1.
TYPES: BEGIN OF TY_FLAT, " structure for flat file
STRING(200),
END OF TY_FLAT.
TYPES: BEGIN OF TY_HEAD, " structure for header file
IND(2) TYPE N,
MATNR(18),
WERKS(4),
STLAN(1),
END OF TY_HEAD.
TYPES : BEGIN OF TY_ITEM, "structure for item file
IND(2) TYPE N,
POSTP(1),
IDNRK(18),
MENGE(13),
meins(3),
END OF TY_ITEM.
TYPES :BEGIN OF TY_FLAT1, " structure for final file
MATNR(18),
WERKS(4),
STLAN(1),
posnr(4),
POSTP(1),
IDNRK(18),
MENGE(13),
meins(3),
END OF TY_FLAT1.
INTERNAL TABLE DECLERATIONS:
DATA : T_FLAT TYPE STANDARD TABLE OF TY_FLAT,
T_FLAT1 TYPE STANDARD TABLE OF TY_FLAT1,
T_HEAD TYPE STANDARD TABLE OF TY_HEAD,
T_ITEM TYPE STANDARD TABLE OF TY_ITEM,
T_BDCDATA TYPE STANDARD TABLE OF BDCDATA with header line ,
T_BDCMSG TYPE STANDARD TABLE OF BDCMSGCOLL.
WORK AREA DECLERATIONS:
DATA : ST_FLAT TYPE TY_FLAT,
ST_FLAT1 TYPE TY_FLAT1,
ST_HEAD TYPE TY_HEAD,
ST_ITEM TYPE TY_ITEM,
ST_BDCDATA TYPE BDCDATA,
ST_BDCMSG TYPE BDCMSGCOLL.
VARIABLES:
DATA : FNAM TYPE LOCALFILE, "rlgrap-filename,
FTYP TYPE RLGRAP-FILETYPE,
LF_FNAM TYPE STRING.
DATA : V_IND(2) TYPE N, " value 1,
V_FLD(20),
V_NO(2) TYPE N.
*start-of-selection.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:\Documents and Settings\dilipkumar.b\Desktop\soft.txt'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ','
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = T_FLAT
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT T_FLAT INTO ST_FLAT.
SPLIT ST_FLAT AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
INTO ST_FLAT1-MATNR ST_FLAT1-WERKS
ST_FLAT1-STLAN ST_FLAT1-POSTP
ST_FLAT1-IDNRK ST_FLAT1-MENGE ST_FLAT1-MEINS.
APPEND ST_FLAT1 TO T_FLAT1.
CLEAR ST_FLAT1.
ENDLOOP.
SORT T_FLAT1 BY MATNR WERKS STLAN POSTP IDNRK MENGE MEINS.
LOOP AT T_FLAT1 INTO ST_FLAT1.
MOVE :
ST_FLAT1-MATNR TO ST_HEAD-MATNR,
ST_FLAT1-WERKS TO ST_HEAD-WERKS,
ST_FLAT1-STLAN TO ST_HEAD-STLAN,
ST_FLAT1-POSTP TO ST_ITEM-POSTP,
ST_FLAT1-IDNRK TO ST_ITEM-IDNRK,
ST_FLAT1-MENGE TO ST_ITEM-MENGE,
ST_FLAT1-MENGE TO ST_ITEM-MEINS.
AT new STLAN.
ADD 1 TO V_IND.
ENDAT.
MOVE V_IND TO ST_HEAD-IND.
MOVE V_IND TO ST_ITEM-IND.
APPEND ST_HEAD TO T_HEAD.
APPEND ST_ITEM TO T_ITEM.
CLEAR ST_HEAD.
CLEAR ST_ITEM.
ENDLOOP.
CLEAR V_IND.
*perform open_group.
SORT T_ITEM BY IND.
SORT T_HEAD BY IND.
DELETE ADJACENT DUPLICATES FROM T_HEAD.
LOOP AT T_HEAD INTO ST_HEAD.
perform bdc_dynpro using 'SAPLCSDI' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RC29N-STLAN'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RC29N-MATNR'
ST_HEAD-MATNR.
perform bdc_field using 'RC29N-WERKS'
ST_HEAD-WERKS.
perform bdc_field using 'RC29N-STLAN'
ST_HEAD-STLAN.
perform bdc_field using 'RC29N-DATUV'
'16.09.2008'.
perform bdc_dynpro using 'SAPLCSDI' '0110'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RC29K-BMENG'
'1'.
perform bdc_field using 'RC29K-STLST'
'1'.
perform bdc_field using 'BDC_CURSOR'
'RC29K-EXSTL'.
perform bdc_dynpro using 'SAPLCSDI' '0111'.
perform bdc_field using 'BDC_CURSOR'
'RC29K-LABOR'.
LOOP AT T_ITEM INTO ST_ITEM WHERE IND = ST_HEAD-IND.
ADD 1 TO V_NO.
perform bdc_dynpro using 'SAPLCSDI' '0140'.
perform bdc_field using 'BDC_CURSOR'
'RC29K-MENGE(01)'.
perform bdc_field using 'BDC_OKCODE'
'=FCBU'.
perform bdc_dynpro using 'SAPLCSDI' '0140'.
perform bdc_field using 'BDC_CURSOR'
'RC29P-POSNR(01)'.
perform bdc_field using 'BDC_OKCODE'
'=FCBU'.
perform bdc_field using 'RC29P-IDNRK(01)'
ST_ITEM-IDNRK.
perform bdc_field using 'RC29P-MENGE(01)'
ST_ITEM-MENGE.
perform bdc_field using 'RC29P-MEINS(01)'
ST_ITEM-MEINS.
perform bdc_field using 'RC29P-POSTP(01)'
ST_ITEM-POSTP.
CONCATENATE 'RC29K-IDNRK(' V_NO ')' INTO V_FLD.
CONDENSE V_FLD.
PERFORM BDC_FIELD USING V_FLD
ST_ITEM-IDNRK.
CONCATENATE 'RC29K-MENGE(' V_NO ')' INTO V_FLD.
CONDENSE V_FLD.
PERFORM BDC_FIELD USING V_FLD
ST_ITEM-MENGE.
CONCATENATE 'RC29K-MEINS(' V_NO ')' INTO V_FLD.
CONDENSE V_FLD.
PERFORM BDC_FIELD USING V_FLD
ST_ITEM-MEINS.
CONCATENATE 'RC29K-POSTP(' V_NO ')' INTO V_FLD.
CONDENSE V_FLD.
PERFORM BDC_FIELD USING V_FLD
ST_ITEM-POSTP.
V_NO = 1.
ENDLOOP.
CLEAR V_NO.
*perform bdc_dynpro using 'SAPLCSDI' '0130'.
*perform bdc_field using 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'BDC_CURSOR'
'RC29P-POSNR'.
*perform bdc_field using 'RC29P-POSNR'
POSNR.
*perform bdc_field using 'RC29P-IDNRK'
bdcdata-IDNRK.
*perform bdc_field using 'RC29P-MENGE'
bdcdata-MENGE.
*perform bdc_field using 'RC29P-MEINS'
bdcdata-MEINS.
perform bdc_dynpro using 'SAPLCSDI' '0131'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RC29P-POTX1'.
perform bdc_field using 'RC29P-SANKA'
'X'.
perform bdc_dynpro using 'SAPLCSDI' '0133'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RC29P-matkl'.
perform bdc_field using 'RC29P-SANKA'
'zv01'.
perform bdc_dynpro using 'SAPLCSDI' '0140'.
perform bdc_field using 'BDC_CURSOR'
'RC29N-POSNR(01)'.
perform bdc_field using 'BDC_OKCODE'
'=FCBU'.
*perform bdc_transaction using 'CS01'.
perform close_group.
CALL TRANSACTION 'CS01' USING t_bdcdata MODE 'A' UPDATE 'S'.
REFRESH t_bdcdata.
clear t_bdcdata.
endloop.
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR st_bdcdata.
st_bdcdata-PROGRAM = PROGRAM.
st_bdcdata-DYNPRO = DYNPRO.
st_bdcdata-DYNBEGIN = 'X'.
APPEND st_bdcdata to t_bdcdata .
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> NODATA.
CLEAR st_bdcdata.
st_bdcdata-FNAM = FNAM.
st_bdcdata-FVAL = FVAL.
APPEND st_bdcdata to t_bdcdata.
ENDIF.
ENDFORM. -
Creating BOM using BDC :How to display no of records from flat file under
Hi,
How to display no of records from flat file under one (Alternative BOM) vertically.
When i execute, the records are replacing one by one.
Here my coding:
report ZBOM1
no standard page heading line-size 255.
*include bdcrecx1.
DATA: BEGIN OF bdc OCCURS 0,
matnr(18),
werks(4),
stlan(1),
END OF BDC.
DATA: BEGIN OF BDC1 OCCURS 0,
idnrk(18),
MENGE(18),
MEINS(3),
postp(1),
END OF bdc1.
DATA: BEGIN OF BDCDATA OCCURS 0,
matnr(18),
werks(4),
stlan(1),
idnrk(18),
MENGE(18),
MEINS(3),
postp(1),
posnr(4),
END OF BDCDATA.
data: ibdcdata type standard table of bdcdata WITH HEADER LINE.
*start-of-selection.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:\Documents and Settings\dilipkumar.b\Desktop\soft.txt'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ','
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = BDCDATA
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*perform open_group.
loop at bdcdata.
perform bdc_dynpro using 'SAPLCSDI' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RC29N-STLAN'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RC29N-MATNR'
'SOFTDRINKS'.
perform bdc_field using 'RC29N-WERKS'
'WIND'.
perform bdc_field using 'RC29N-STLAN'
'1'.
perform bdc_field using 'RC29N-DATUV'
'16.09.2008'.
perform bdc_dynpro using 'SAPLCSDI' '0110'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RC29K-BMENG'
'1'.
perform bdc_field using 'RC29K-STLST'
'1'.
perform bdc_field using 'BDC_CURSOR'
'RC29K-EXSTL'.
perform bdc_dynpro using 'SAPLCSDI' '0111'.
perform bdc_field using 'BDC_CURSOR'
'RC29K-LABOR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLCSDI' '0140'.
perform bdc_field using 'BDC_CURSOR'
'RC29P-POSTP(01)'.
perform bdc_field using 'BDC_OKCODE'
'=FCBU'.
perform bdc_field using 'RC29P-IDNRK(01)'
BDCDATA-IDNRK.
perform bdc_field using 'RC29P-MENGE(01)'
BDCDATA-MENGE.
perform bdc_field using 'RC29P-MEINS(01)'
BDCDATA-MEINS.
perform bdc_field using 'RC29P-POSTP(01)'
BDCDATA-POSTP.
perform bdc_dynpro using 'SAPLCSDI' '0130'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RC29P-POSNR'.
perform bdc_field using 'RC29P-POSNR'
BDCDATA-POSNR. "'0010'.
perform bdc_field using 'RC29P-IDNRK'
BDCDATA-IDNRK. "'15'.
perform bdc_field using 'RC29P-MENGE'
BDCDATA-MENGE. "'1'.
perform bdc_field using 'RC29P-MEINS'
BDCDATA-MEINS. "'ml'.
perform bdc_dynpro using 'SAPLCSDI' '0131'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RC29P-POTX1'.
perform bdc_field using 'RC29P-SANKA'
'X'.
*perform bdc_transaction using 'CS01'.
*perform close_group.
CALL TRANSACTION 'CS01' USING IBDCDATA MODE 'A' UPDATE 'S'.
REFRESH IBDCDATA.
endloop.
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR iBDCDATA.
iBDCDATA-PROGRAM = PROGRAM.
iBDCDATA-DYNPRO = DYNPRO.
iBDCDATA-DYNBEGIN = 'X'.
APPEND ibDCDATA .
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> NODATA.
CLEAR iBDCDATA.
iBDCDATA-FNAM = FNAM.
iBDCDATA-FVAL = FVAL.
APPEND iBDCDATA .
ENDIF.
ENDFORM.Hi,
the BDCDATA structure must be fnam, fval,dynbegin,dynpro,program.
You have to declare like this and pass this in your CALL TRANSACTION statement.
Please give some other table name for BDCDATA you declared for and also for IBDCDATA. -
Purchase requisition generate for alternative bom use for finished product
i hav alternative BOM for finished product in which different raw material component in both BOM of same finished product.But when i RUN MRP that time only one raw material requisition generate another alternative bom raw material requision not generate.
Is there any option when i RUN MRP that time we select one of the alternative bom component of raw material for generation purchase requisition.
Thnaks in AdvanceDear ,
MRP will select the BOM based on the MRP4-BOM Explosion tab -Selection Indicator .It can eitehr of these ways :
1.Maintain Production Version with different Alternative BOM and keep Selection Indicator -3 .So sysetm will look into only the Valaidty and lot size of the Production version and select the correct BOM to explode and generate PR for depednts based on stock situation
2.If you maintain Blank -then it will look into order qty and select the BOM according ly
As in your case , selection methods 3 will fit and you need to maintain PV with correct validity and lot size in MMR-MRP4-PV option .
Try in sand box with different lot size and validity with indicator-3 .Create Order and run MRP-MD02-1,,3,3,3,2
Check and revert
Regards
JH -
Bad display with datepicker field under apex 4 using French lang
Hi,
I am using a datepicker field under apex 4 and if I change the language to French, the calendar is not displayed correctly.
Any idee why?
Many thanks for your help
jko
Edited by: user617942 on 03-Aug-2010 00:10The Calendar doesn't stick into the window...
It seems that the window is not resized to handle french days.
Jko
Is it more clear?
Edited by: user617942 on 2 août 2010 08:33 -
Alternative BOM creation problem in CS01
Hi.
I have created a BOM with CS01 with list of components. Now i want to create an alternative BOM for the same FG.
When I am trying to create alternative BOM using CS01, I added the components, system is showing me in the header as Alternative BOM 2. But when i try to save this BOM system is giving me the error as "Alternative BOM cannot be created for this material".
Can you please help me how to create alternative BOM for this FG.
Regards,
PadmavathiDear Padma,
If my understanding is correct,if the check box for multiple BOM inactive is set in OS27 means,you will not be allowed to even
enter into the BOM item maintenance screen.
It seems the system is allowing you to enter the second alternative BOM,but at the time of save the system is blocking from
doing so.check what's the message and check whether by means of exit this check has been incorporated in the system.
Check and revert back.
Regards
Mangalraj.S -
While uploading bom using bdc method how to upload item details into subscreen table.explain table control in bdc
hi,
When you try to create, you would find a pushbutton 'INSERT NEW LINES' or something simialr to enter your data in the next line. Say you're entering the Material inthe first row, its field position would be MARA-MATNR(01). Now when you click the Insert Pushbitton the cursor always is at positon 2. so you have to loop the remaining data to enter in MARA-MATNR(02). Yougenereally set a counter and pass that counter value (in this case the counter value is 2 always)
The other case when you don't have a push button to Insert. Enter all the rows and then do a Page down. Now your cursor would sit back at position 2 again. Say if there are 20 rows in the first screen. You would keep incrementing the counter and then when it is 21 you do a pagedown and then reset the counter to 2. You loop the pagedown and in it you loop the counter.
I have attached a BDC where I use the second case (no push button). Do a recording and then you would know all the answers by yourself.
*& REPORT ZPP0122 *
*& Module : PP |
*& Application : The program loads the Material Assignment of Routings |
*& |
REPORT zpp0122 NO STANDARD PAGE HEADING
MESSAGE-ID z0
LINE-SIZE 132
LINE-COUNT 65(2).
Internal Tables *
*Internal table for the Routing fields.
DATA: BEGIN OF i_rout OCCURS 0,
plnnr(8),
plnal(2),
matnr(18),
werks(4),
END OF i_rout.
DATA:
g_my_rec_in LIKE i_rout.
Declare internal table for Call Transaction and BDC Session
DATA: i_bdc_table LIKE bdcdata OCCURS 0 WITH HEADER LINE.
Global Variables *
DATA: g_counter(2) TYPE n,
g_field_name(18) TYPE c,
zc_yes TYPE syftype VALUE 'X'.
Selection Screen *
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
PARAMETERS: p_fname1 TYPE localfile .
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE text-002.
PARAMETERS: p_rloc1 AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN BEGIN OF BLOCK c WITH FRAME TITLE text-005.
PARAMETERS p_group(12) OBLIGATORY DEFAULT 'ZROUTING'.
SELECTION-SCREEN END OF BLOCK c.
SELECTION-SCREEN END OF BLOCK b.
SELECTION-SCREEN END OF BLOCK a.
**WRITE the report header
TOP-OF-PAGE.
INCLUDE zheading.
Start of selection *
START-OF-SELECTION.
Load Input file
PERFORM f_load_input_file.
Create BDC records.
PERFORM create_bdc_records .
*& Form Create_BDC_records
perform the BDC for the records in the internal table
FORM create_bdc_records .
IF NOT i_rout[] IS INITIAL.
Open BDC session
PERFORM open_bdc_session.
LOOP AT i_rout.
g_my_rec_in = i_rout.
AT NEW plnnr.
CLEAR i_bdc_table[].
PERFORM insert_screen_header.
ENDAT.
CONCATENATE 'MAPL-PLNAL(' g_counter ')' INTO g_field_name.
PERFORM bdc_field USING g_field_name i_rout-plnal.
CONCATENATE 'MAPL-MATNR(' g_counter ')' INTO g_field_name.
PERFORM bdc_field USING g_field_name i_rout-matnr.
CONCATENATE 'MAPL-WERKS(' g_counter ')' INTO g_field_name.
PERFORM bdc_field USING g_field_name i_rout-werks.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
g_counter = g_counter + 1.
Page Down for further entries
IF g_counter = 19.
PERFORM bdc_field USING 'BDC_OKCODE' '=P+'.
PERFORM bdc_dynpro USING 'SAPLCZDI' '1010'.
g_counter = 2.
ENDIF.
AT END OF plnnr.
PERFORM bdc_field USING 'BDC_OKCODE' '=BACK'.
PERFORM bdc_dynpro USING 'SAPLCPDI' '1200'.
PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.
PERFORM insert_bdc_new.
ENDAT.
ENDLOOP.
CLEAR i_rout[].
PERFORM close_bdc_session.
Release the BDC sessions created
PERFORM release_bdc.
ENDIF.
ENDFORM. " open_group
*& Form bdc_dynpro_start
Call the screen for the input of fields
-->P_G_PROGRAM_1
-->P_G_SCREEN
FORM bdc_dynpro USING p_g_program_1
p_g_screen.
CLEAR i_bdc_table.
i_bdc_table-program = p_g_program_1.
i_bdc_table-dynpro = p_g_screen.
i_bdc_table-dynbegin = 'X'.
APPEND i_bdc_table.
ENDFORM. " bdc_dynpro_start
*& Form bdc_field
Insert field *
FORM bdc_field USING f_name f_value.
IF f_value <> space.
CLEAR i_bdc_table.
i_bdc_table-fnam = f_name.
i_bdc_table-fval = f_value.
APPEND i_bdc_table.
ENDIF.
ENDFORM. "bdc_insert_field
*& Form open_bdc_session
Create the BDC session
FORM open_bdc_session .
Open BDC session and creat and update condition records
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
DEST = FILLER8
group = p_group
HOLDDATE = FILLER8
keep = 'X'
user = sy-uname
RECORD = FILLER1
PROG = SY-CPROG
IMPORTING
QID =
EXCEPTIONS
client_invalid = 1
destination_invalid = 2
group_invalid = 3
group_is_locked = 4
holddate_invalid = 5
internal_error = 6
queue_error = 7
running = 8
system_lock_error = 9
user_invalid = 10
OTHERS = 11
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " create_bdc_session
*& Form insert_screen_header
Header Data inserted
FORM insert_screen_header .
g_counter = 1.
First screen
PERFORM bdc_dynpro USING 'SAPLCPDI' '1010'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RC271-PLNNR'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ALUE'.
PERFORM bdc_field USING 'RC271-PLNNR' g_my_rec_in-plnnr.
PERFORM bdc_field USING 'RC27M-MATNR' ' '.
PERFORM bdc_field USING 'RC27M-WERKS' ' '.
PERFORM bdc_field USING 'RC271-PLNAL' ' '.
*next screen
PERFORM bdc_dynpro USING 'SAPLCPDI' '1200'.
PERFORM bdc_field USING 'BDC_OKCODE' '=MTUE'.
*next screen
PERFORM bdc_dynpro USING 'SAPLCZDI' '1010'.
ENDFORM. " insert_screen_header
*& Form insert_bdc
Insert the BDC for the transaction
FORM insert_bdc_new .
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = 'CA02'
POST_LOCAL = NOVBLOCAL
PRINTING = NOPRINT
SIMUBATCH = ' '
CTUPARAMS = ' '
TABLES
dynprotab = i_bdc_table
EXCEPTIONS
internal_error = 1
not_open = 2
queue_error = 3
tcode_invalid = 4
printing_invalid = 5
posting_invalid = 6
OTHERS = 7
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CLEAR i_bdc_table[].
ENDFORM. " insert_bdc
*& Form close_bdc_session
Close the session
FORM close_bdc_session .
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
not_open = 1
queue_error = 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.
ENDFORM. " close_bdc_session
*& Form f_load_input_file
Load the data file
FORM f_load_input_file.
The data file is from Presentation server
IF p_rloc1 = zc_yes.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = p_fname1
filetype = 'DAT'
TABLES
data_tab = i_rout
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.
ENDIF.
ENDFORM. " f_load_input_file
*& Form release_bdc
Release BDC session
FORM release_bdc.
SUBMIT rsbdcsub WITH mappe EQ p_group
WITH von EQ sy-datum
WITH bis EQ sy-datum
WITH fehler EQ '.'
EXPORTING LIST TO MEMORY
AND RETURN.
ENDFORM.
Regards
Sudheer -
Displaying alternative BOM's in a structural display
Hi,
We are on R/3 4.7. I have created two material alternative BOM's and am trying to find a way to display these in the structural display (IH01). When I create a equipment BOM and use alternate BOM #1 for a material it displays fine. I have not been able to find a way to display alternate BOM #2 for the same material putting it on a different equipment BOM. When I add the material to the equipment BOM and I double click into the 'assembly' section it shows the two alternative BOM's but I don't see a way to select which one I want. It always defaults to alternative #1.
Any help with this would be appreciated.
JRWHi,
We are on R/3 4.7. I have created two material alternative BOM's and am trying to find a way to display these in the structural display (IH01). When I create a equipment BOM and use alternate BOM #1 for a material it displays fine. I have not been able to find a way to display alternate BOM #2 for the same material putting it on a different equipment BOM. When I add the material to the equipment BOM and I double click into the 'assembly' section it shows the two alternative BOM's but I don't see a way to select which one I want. It always defaults to alternative #1.
Any help with this would be appreciated.
JRW -
Subcontract PO item withdrawal issue when alternative BOM item used
Hi,
As title mentioned, when we issue alternative material for a subcontract PO in BOM, but it still shows the quantity from primary item.
(For example, we have a product, let's say it as Product-A, it's combined by material-B1 and Material-C1
And the BOM for Product-A for item material-B1 has an alternative item, material-B2
Now the issue is when we issue material-B2 instead B1, but the PO usage/withdrawal listed in B1)
Because we are making a list for China custom for material usage, the issue listed above makes our list not available for custom department.
Please let us know how we could make the withdrawal in PO shows B2.
thanks,
StevenDear Steven,
As explained by our forum friend maintain this data.
1.Create 2 different BOM for the same header material with the respective BOM components.
2.Create production version for the header material using T COde MM02--->MRP4 view and click on prod.version,enter the same
as 0001,text as prod version 1,default valid from date will be the current date and the valid to date will be 31.12.9999.
3.Enter the lot size for which this prod version is valid and then in the alternative BOM select the BOM and save the data.
4.Prdo.version can also be maintained through C223.
5.Assign this prod version in the sub-contracting purchase info record in ME11,under prod version under purch org data(not sure
check this alone).
6.Likewise assign the prod version that is linked to the BOM to be picked for each sub-contracting vendor.
Check the results after MRP and revert.
Regards
S Mangalraj -
BOM Explosion (CS_BOM_EXPL_MAT_V2) - inactive alternative BOM
Hi,
I need to display the alternative BOM entered in the selection screen even if the entered alternative is inactive. i.e. status is inactive. i have used FM - CS_BOM_EXPL_MAT_V2.
Kindly advise.
Regards.Using Function module CS_BOM_EXPL_MAT_V2
As already has been said, the RNDKZ field is used for rounding. If you fill with '1', it will never round.
Example (the problem I had):
Material A consist of et al. 0.008 piece Material AA.
Material AA consist of 1.0 pice Material AAA,
of 7.0 piece Material AAB,
of 6.0 piece Material AAC,
of 12.0 piece Material AAD.
CASE 1: You fill RNDKZ field with '1':
You get the correct result which is:
You need for producing 1 piece of Material A
0.008 piece Material AA,
0.008 * 1 = 0.008 piece of Material AAA,
0.008 * 7.0 = 0,056 piece of Material AAB,
0.008 * 6.0 = 0,048 piece of Material AAC.
0.008 * 12.0 = 0,096 piece of Material AAD.
CASE 2: You let RNDKZ field blank.
In your user profile for BOM field "Round of" is set to blank (table field TCSPR-AMEKZ, TA S_ALR_87004496).
You get following result (which is wrong)
You need for producing 1 piece of Material A
1 piece Material AA,
1.0 *1.0 = 1.0 piece of Material AAA,
1.0 * 7.0 = 7.0 piece of Material AAB,
1.0 * 6.0 = 6.0 piece of Material AAC.
1.0 * 12.0 = 12.0 piece of Material AAD.
The number of decimals is seen depends as well from how many decimals is set for unit of measurement. In this case the number of decimals for "piece" was set to zero. (TA CUNI).
If you let the field RNDKZ field blank, the user profile field "Round of" (table field TCSPR-AMEKZ) is used. -
Alternative BOM in Production Order
Hi PP Experts,
I have a small issue which is like this:
I have two Alternative BOM for Material "A".
When I create production order it displays both Alt Bom for selection.
When I select the second Alt BOM, in production order it still reads the First Alt BOM.
Please advice.
Regards
MohanHi Mohan,
I suggest if you have two alternate BOM for a material, you can use the production versions and assign the same for the material in Material Master MRP4 view.
Create Production Versions 01 and 02 and assign the alt BOM 1 for the PV 01 and 02 alt bom for PV 02.
Goto SPRO : Production -> Shop Floor Control -> Define Order type dependent paramters ( Tcode : OPL8) : Define the Production Version Slection either 1 for manual and 2 for automatic. (if you use automatic system will select the version based on the material master selection method )
regards
radhak mk -
Critical Issue: Availabilty check & alternative BOM selction issue
During the upgradation project I'm working facing the following critical issues:
1)While creating the sales order, system carries out the availability check in APO.In material master checking group Z5 is defined.
Actually I want to know hw the system carries out the search in APO & what are the settings in R/3 or APO we have to make?
2)Suppose there are 3 alternative BOM's of a finished product.A requirement is while creating the sales order availabilty check should be carried out & system should check the availability of components on the required date.If the component is not avalable system should go & check the second alternative...third alternative until it gets the confirmation of component availability.
How we can set this functionality & what are the prerequisites or customisation settings we needs to make?
Would appreciate providing your inputs on this critical issue.
Thanks,
Nilesh<b></b>Before you understand how the APO Availability Checking concept works, I would suggest you understand about the regular R3 availability checking. As this is the core for the SD and APO GATP. Refer help.sap.com
Question 1:
<b>Settings in R3:</b> You have the ATP integration model in CFM1 transaction. You need to activate this just one time and never again. what this does is basically transfer all your availability checking customizing to APO.
All the settings for the Availability Checking group ( Z5, etc) are already maintained in R3 and they get transferred to APO by the integration model. You donot need to anything else.
<b>Settings in APO:</b>
If you are using <b>Product Allocation Concept</b>, You have to maintain the Check Instructions.... Otherwise there are no other settings in APO
<b>Availability Check in APO :</b>
( see the following blog for the requirements class( Name in R3) or check mode( Name in APO) determination http://solution-timezone-issue.blogspot.com/ )
The check mode and the business event( These are hardcode internally in R3 - For SD- A) are determined from the order and based on this in APO it follows the following order
(1) Reads the check instructions settings in APO
For example say the following have been determined from the SD Order : Check Mode 041 and Business Event A
Say we have maintained in APO that the first step is Availability Check and all the other two steps we havent maintained or left blank ( Product Allocation and Forecast)
Look for the customizing in APO
SPRO>APO>GATP>General Settings>Maintain Check Instructions ****
(2) Carries out availability Checking same as in R3 and no different
From the masterial master considers the availability checking group ( Ex: Z1) and the business event( SD transactions- A)
Very Important and the core of availability checking which is similar in R3 and APO***
Against these 2 combinations, the settings are checked which define what stock and in/outward movements are to be considered during the availability check
For customzing settings in APO
SPRO>APO>GATP>Maintain Check Control>
For Customizing in R3
SPRO>Sales and Distribution>Basic Functions>Availability Check and transfer of requirements>Availability check with ATP logic or planning>Carry out control for availability check
This is the answer to your first question.
Your second question would need some time and I will try to answer it as well.
Hope this helps you.. -
Reg: Creation of BOM along with Alternative BOM
Hi Experts,
I have written the below code for creating BOM along with Alternative BOM, I'm getting the following error.
W BAPI1080 028
Error/warning when checking the structure of the BOM group with ID=
A BAPI1080 002
Basic data for (BOM) group available twice
A BAPI 001
No instance of object type BOMGroup has been created. External reference:
W BAPI1080 028
Error/warning when checking the structure of the BOM group with ID=
A BAPI1080 002
Basic data for (BOM) group available twice
A BAPI 001
No instance of object type BOMGroup has been created. External reference:
Please find the piece of code below.
SORT it_bom01 BY matnr idnrk posnr ASCENDING.
LOOP AT it_bom01 INTO wa_bom01.
AT NEW matnr.
CLEAR:
it_bomgroup[],
wa_bomgroup,
it_variants[],
wa_variants,
it_items[],
wa_items,
it_matrel[],
wa_matrel,
it_itemas[],
wa_itemas,
it_return.
ENDAT.
* Material BoM Group Header Data
wa_bomgroup-bom_group_identification = 'IDENTIFICATION'.
wa_bomgroup-object_type = 'BGR'.
wa_bomgroup-object_id = 'ID'.
wa_bomgroup-bom_usage = wa_bom01-stlan.
wa_bomgroup-ltxt_lang = sy-langu.
wa_bomgroup-technical_type = ' '.
* wa_bomgroup-bom_text = .
wa_bomgroup-created_in_plant = wa_bom01-werks.
APPEND wa_bomgroup TO it_bomgroup.
* Header Details of the different variants
wa_variants-bom_group_identification = 'IDENTIFICATION'.
wa_variants-object_type = 'BOM'.
wa_variants-object_id = 'ID'.
wa_variants-alternative_bom = wa_bom01-stlal.
wa_variants-bom_status = wa_bom01-stlst.
wa_variants-base_qty = wa_bom01-bmeng.
wa_variants-valid_from_date = wa_bom01-datuv.
wa_variants-alt_text = wa_bom01-alt_text.
wa_variants-function = 'NEW'.
APPEND wa_variants TO it_variants.
* Details of the items of the variants
wa_items-bom_group_identification = 'IDENTIFICATION'.
wa_items-object_type = 'ITM'.
wa_items-object_id = 'ID'.
wa_items-item_no = wa_bom01-posnr.
wa_items-item_cat = wa_bom01-postp.
wa_items-component = wa_bom01-idnrk.
wa_items-comp_qty = wa_bom01-menge.
wa_items-valid_from_date = wa_bom01-datuv.
APPEND wa_items TO it_items.
* Details of the materials of the different variants
CLEAR it_matrel.
wa_matrel-bom_group_identification = 'IDENTIFICATION'.
wa_matrel-material = wa_bom01-matnr.
wa_matrel-plant = wa_bom01-werks.
wa_matrel-bom_usage = wa_bom01-stlan.
wa_matrel-alternative_bom = wa_bom01-stlal.
APPEND wa_matrel TO it_matrel.
* Linking items to the corresponding variants
CLEAR it_itemas.
wa_itemas-bom_group_identification = 'IDENTIFICATION'.
wa_itemas-sub_object_type = 'ITM'.
wa_itemas-sub_object_id = 'ID'.
wa_itemas-super_object_type = 'BOM'.
wa_itemas-super_object_id = wa_bom01-matnr.
wa_itemas-valid_from_date = wa_bom01-datuv.
wa_itemas-function = 'NEW'.
APPEND wa_itemas TO it_itemas.
AT END OF matnr.
CALL FUNCTION 'BAPI_MATERIAL_BOM_GROUP_CREATE'
EXPORTING
all_error = 'X'
TABLES
bomgroup = it_bomgroup
variants = it_variants
items = it_items
materialrelations = it_matrel
itemassignments = it_itemas
return = it_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
LOOP AT it_return.
WRITE:/ it_return-type, it_return-id, it_return-number,
it_return-message.
ENDLOOP.
ENDAT.
ENDLOOP.
Thanks and Regards,
Abdur RafiqueHi Sree,
I used your code, I removed the levels because, i have only one level 'the lineitems'. Please find the modified code below. I'm not able to create the BOM, it throws an error as "BOM is recursive". I checked the header and item contents before passing to FM, it is correct.
Please help me with the solution.
REPORT zbom_sdn.
TYPE-POOLS: truxs.
DATA: bom_header LIKE cad_bicsk,
bom_item TYPE TABLE OF cad_bom_item WITH HEADER LINE,
bom_sub_item TYPE TABLE OF cssubitem WITH HEADER LINE,
dms_class_data TYPE TABLE OF cls_charac WITH HEADER LINE,
sap_field_data TYPE TABLE OF rfcdmsdata WITH HEADER LINE,
e_return LIKE cad_return-value,
e_message LIKE message-msgtx,
e_message_len LIKE cad_return-message_len.
DATA v_item TYPE i.
TYPES : BEGIN OF ty_data,
matnr TYPE cad_bicsk-matnr," Material
werks TYPE csap_mbom-werks," Plant
stlan TYPE csap_mbom-stlan," BOM Usage
datuv TYPE csap_mbom-datuv," Valid From
* posnr TYPE stpo_api03-item_no," Item Number
idnrk TYPE stpo_api03-component," BOM Component
postp TYPE stpo_api03-item_categ," Item category
menge TYPE cad_bom_item-menge," Quantity
bmeng TYPE stko_api01-base_quan," Base Qty
stlst TYPE stko_api01-bom_status," BOM Status
stlal TYPE csap_mbom-stlal," Alternative BOM
alt_text TYPE stko_api01-alt_text," Alternative BOM text
END OF ty_data.
DATA : it_data TYPE TABLE OF ty_data ,
wa_data TYPE ty_data.
DATA: wa_raw TYPE truxs_t_text_data.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-001.
PARAMETER : p_file TYPE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b2.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
program_name = syst-repid
dynpro_number = syst-dynnr
CHANGING
file_name = p_file.
START-OF-SELECTION.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = wa_raw " Work Table
i_filename = p_file
TABLES
i_tab_converted_data = it_data[] " Actual Table
EXCEPTIONS
conversion_failed = 1
OTHERS = 2 .
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CLEAR: bom_header, bom_item, bom_sub_item.
REFRESH: bom_item, bom_sub_item.
DATA : v_lineitem TYPE sposn VALUE '0000',
v_slineitem TYPE sposn VALUE '0'.
LOOP AT it_data INTO wa_data.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_data-matnr
IMPORTING
output = wa_data-matnr.
* fill BOM header
CLEAR bom_header.
bom_header-matnr = wa_data-matnr. "'000000000200000016'.
bom_header-stlal = wa_data-stlal. " Alternative Bom
bom_header-werks = wa_data-werks. "'1000'.
bom_header-stlan = wa_data-stlan. "'3'.
bom_header-bmeng = wa_data-bmeng.
bom_header-cadkz = 'X'.
bom_header-stktx = wa_data-alt_text.
* bom_header-ztext = wa_data-text.
bom_header-datuv = wa_data-datuv."'01.10.2010'.
* fill item
v_lineitem = v_lineitem + 10.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_lineitem
IMPORTING
output = v_lineitem.
* bom_item-upskz = 'X'. " If We hav the Sub items Enable it.
bom_item-idnrk = wa_data-matnr. "'000000000200000017'.
bom_item-posnr = v_lineitem.
bom_item-postp = wa_data-postp."'L'.
bom_item-menge = wa_data-menge. "'1'.
* bom_item-fmeng = wa_data-fqty.
APPEND bom_item.
CLEAR: bom_item.
AT END OF matnr.
CALL FUNCTION 'CAD_CREATE_BOM_WITH_SUB_ITEMS'
EXPORTING
i_bom_header = bom_header
i_auto_posnr = ''
IMPORTING
e_return = e_return
e_message = e_message
e_message_len = e_message_len
e_bom_header = bom_header
TABLES
bom_item = bom_item
bom_sub_item = bom_sub_item
dms_class_data = dms_class_data
sap_field_data = sap_field_data
EXCEPTIONS
OTHERS = 1.
REFRESH bom_item.
WRITE : e_message.
ENDAT.
CLEAR wa_data.
ENDLOOP.
Thanks and Regards,
Abdur Rafique
Maybe you are looking for
-
ABAP runtime errors COMPUTE_BCD_OVERFLOW
ABAP runtime errors COMPUTE_BCD_OVERFLOW Occurred on 12/08/2010 at 06:44:17 >> Short dump has not been completely stored. It is too big. Error analysis An overflow has been determined in the current arithmetical operation containing ope
-
Mail icons - what is the "box with arrow" 3rd icon over?
Hi, When I am reading an email the 3rd icon on the bottom of the screen looks like a box with an arrow over it. What is that icon? When I click it the email seems to disappear. Once in awhile I see the trashcan icon, but not usually? Thanks Joe
-
Hi everybody! I want drag some element from some list and drop in some cell in jtable, but i have a problem because this element can use more than one cell, all depends! , the drag moviment seem to work fine between list and the JTable. when the drag
-
JPF portlet and setupStateChangeEvent
I have a JPF portlet as below <?xml version="1.0" encoding="UTF-8"?> <portal:root xmlns:netuix="http://www.bea.com/servers/netuix/xsd/controls/netuix/1.0.0" xmlns:portal="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0" xmlns:xsi="http://w
-
CAn you get Ipod Touch Apps to run on an an Ipod Nano?