‎2008 Jul 21 12:46 PM
Hello i am getting my BDc code syntactically correct but, when i am executeing the code system is asking for the input rather than taking from the flatfile.
This is in my SE38 whole code....
please help me to achieve this...
TYPES: BEGIN OF TY_STU,
MATNR LIKE RMMG1-MATNR, "MATERIAL NUMBER"
MBRSH LIKE RMMG1-MBRSH, "INDUSTRY SECTOR"
MTART LIKE RMMG1-MTART, "MATERIAL TYPE"
WERKS LIKE RMMG1-WERKS, "PLANT"
LGORT LIKE RMMG1-LGORT, "STROAGE LOCATION"
MAKTX LIKE MAKT-MAKTX, "DESCRIPTION"
MEINS LIKE MARA-MEINS, "BUM"
MATKL LIKE MARA-MATKL, "MATERIAL GROUP"
EKGRP LIKE MARC-EKGRP, "PURCHASE GROUP"
DISMM LIKE MARC-DISMM, "MRP TYPE"
DISPO LIKE MARC-DISPO, "MRP CONTROLLER"
DISLS LIKE MARC-DISLS, "LOT SIZE"
PLIFZ LIKE MARC-PLIFZ, "PLANNED DELIVERY TIME"
FHORI LIKE MARC-FHORI, "SCHEDULING MARGIN KEY"
BKLAS LIKE MBEW-BKLAS, "VALUATION CLASS"
VPRSV LIKE MBEW-VPRSV, "PRICE CONTROL"
PEINH LIKE MBEW-PEINH, "PRICE UNIT"
VERPR LIKE MBEW-VERPR, "MOVING PRICE"
END OF TY_STU.
INTERNAL TABLE & WORKAREA DECLARATION
DATA : T_UPLOAD TYPE STANDARD TABLE OF TY_STU INITIAL SIZE 0,
T_BDCDATA TYPE STANDARD TABLE OF BDCDATA INITIAL SIZE 0,
T_BDCMSGCOLL TYPE STANDARD TABLE OF BDCMSGCOLL INITIAL SIZE 0,
W_UPLOAD TYPE TY_STU,
BDCDATA TYPE BDCDATA,
W_BDCMSGCOLL TYPE BDCMSGCOLL,
G_MESSAGE TYPE C.
DATA : G_FILE TYPE string.
----
SELECTION SCREEN
----
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME.
PARAMETERS : p_file LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK blk1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_file.
g_file = p_file.
start-of-selection.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = g_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = T_UPLOAD
.
IF SY-SUBRC <> 0.
ENDIF.
LOOP AT T_UPLOAD INTO W_UPLOAD.
REFRESH T_BDCDATA.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RMMG1-MATNR'
W_UPLOAD-MATNR.
perform bdc_field using 'RMMG1-MBRSH'
W_UPLOAD-MBRSH.
perform bdc_field using 'RMMG1-MTART'
W_UPLOAD-MTART.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(14)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
W_UPLOAD-KZSEL_01_004.
*perform bdc_field using 'MSICHTAUSW-KZSEL(02)'
W_UPLOAD-KZSEL_02_005.
*perform bdc_field using 'MSICHTAUSW-KZSEL(09)'
W_UPLOAD-KZSEL_09_006.
*perform bdc_field using 'MSICHTAUSW-KZSEL(12)'
W_UPLOAD-KZSEL_12_007.
*perform bdc_field using 'MSICHTAUSW-KZSEL(13)'
W_UPLOAD-KZSEL_13_008.
*perform bdc_field using 'MSICHTAUSW-KZSEL(14)'
W_UPLOAD-KZSEL_14_009.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(16)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
*perform bdc_field using 'MSICHTAUSW-KZSEL(16)'
W_UPLOAD-KZSEL_16_010.
perform bdc_dynpro using 'SAPLMGMM' '0080'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-LGORT'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'RMMG1-WERKS'
W_UPLOAD-WERKS.
perform bdc_field using 'RMMG1-LGORT'
W_UPLOAD-LGORT.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'=SP09'.
perform bdc_field using 'MAKT-MAKTX'
W_UPLOAD-MAKTX.
perform bdc_field using 'BDC_CURSOR'
'MARA-MATKL'.
perform bdc_field using 'MARA-MEINS'
W_UPLOAD-MEINS.
perform bdc_field using 'MARA-MATKL'
W_UPLOAD-MATKL.
*perform bdc_field using 'MARA-MTPOS_MARA'
record-MTPOS_MARA_016.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP12'.
perform bdc_field using 'MAKT-MAKTX'
W_UPLOAD-MAKTX.
perform bdc_field using 'BDC_CURSOR'
'MARC-EKGRP'.
perform bdc_field using 'MARA-MEINS'
W_UPLOAD-MEINS.
perform bdc_field using 'MARC-EKGRP'
W_UPLOAD-EKGRP.
perform bdc_field using 'MARA-MATKL'
W_UPLOAD-MATKL.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'SP13'.
perform bdc_field using 'MAKT-MAKTX'
W_UPLOAD-MAKTX.
perform bdc_field using 'MARA-MEINS'
W_UPLOAD-MEINS.
perform bdc_field using 'MARC-EKGRP'
W_UPLOAD-EKGRP.
perform bdc_field using 'MARC-DISMM'
W_UPLOAD-DISMM.
perform bdc_field using 'MARC-DISPO'
W_UPLOAD-DISPO.
perform bdc_field using 'BDC_CURSOR'
'MARC-DISLS'.
perform bdc_field using 'MARC-DISLS'
W_UPLOAD-DISLS.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP24'.
perform bdc_field using 'MAKT-MAKTX'
W_UPLOAD-MAKTX.
perform bdc_field using 'BDC_CURSOR'
'MARC-FHORI'.
perform bdc_field using 'MARC-PLIFZ'
W_UPLOAD-PLIFZ.
perform bdc_field using 'MARC-FHORI'
W_UPLOAD-FHORI.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'MAKT-MAKTX'
W_UPLOAD-MAKTX.
perform bdc_field using 'MARA-MEINS'
W_UPLOAD-MEINS.
perform bdc_field using 'BDC_CURSOR'
'MBEW-VERPR'.
perform bdc_field using 'MBEW-BKLAS'
W_UPLOAD-BKLAS.
perform bdc_field using 'MBEW-VPRSV'
W_UPLOAD-VPRSV.
perform bdc_field using 'MBEW-PEINH'
W_UPLOAD-PEINH.
perform bdc_field using 'MBEW-VERPR'
W_UPLOAD-VERPR.
*perform bdc_transaction using 'MM01'.
CALL TRANSACTION 'MM01' USING T_BDCDATA MODE 'A' update 'S' MESSAGES
INTO T_BDCMSGCOLL.
CLEAR W_BDCMSGCOLL.
READ TABLE T_BDCMSGCOLL INTO W_BDCMSGCOLL INDEX 1.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID
LANG = '-D'
NO = SY-MSGNO
V1 = SY-MSGV1
V2 = SY-MSGV2
V3 = SY-MSGV3
V4 = SY-MSGV4
IMPORTING
MSG = G_MESSAGE
EXCEPTIONS
NOT_FOUND = 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.
WRITE : / G_MESSAGE.
REFRESH T_BDCMSGCOLL.
ENDLOOP.
*enddo.
*
*perform close_group.
*perform close_dataset using dataset.
----
Start new screen *
----
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA TO T_BDCDATA.
CLEAR bdcdata.
ENDFORM.
----
Insert field *
----
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> NODATA.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA TO T_BDCDATA.
ENDIF.
ENDFORM.
Thks
‎2008 Jul 21 1:06 PM
Hi
In the Loop Remove/Comment the following statement.
(Below LOOP AT T_UPLOAD INTO W_UPLOAD.)
REFRESH T_BDCDATA.
Hope this would help you.
Murthy
‎2008 Jul 21 1:18 PM
Hello i have disabled REFRESH T_BDCDATA but still it is taking only material number from the flatfile and throwing the error like please enter material type.
Any modification that i have to do still. Please help me to achieve this.
Thks
‎2008 Jul 21 1:09 PM
hi balu ,
I have copied this same code and upload the thru a dummy data and it was working fine . It was not asking for any data rather it is taking data from the "tab delimited file".
Try to upload same and still u finds prob then paste the screen shot of that along with ur data file...
Regards
Binod
‎2008 Jul 21 1:16 PM
Hi thks for the reply how come it is working for you...
when i am executeing the program the material number is taking and the error message is throwing after like enter material type....
Please help me to achieve this.
Thks
‎2008 Jul 21 2:53 PM
balu ,
actually there were some commented line which i uncomeented and it was working fine.just massage it and u will get the outcome.
gudluck buddy
regards binod
‎2008 Jul 21 1:15 PM
u need to select atleast one view from the first screen...
but in ur code it was commented....
uncomment atleast one view from ur code, then u can able to create the material.
the statement
*perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
should be perform bdc_field using 'MSICHTAUSW-KZSEL(01)' 'X'.
‎2008 Jul 21 1:26 PM
Hi thks for responding i have done the relavent modifications suggested wise...
perform bdc_field using 'MSICHTAUSW-KZSEL(01)''X'
W_UPLOAD-KZSEL_01_004.
*perform bdc_field using 'MSICHTAUSW-KZSEL(02)'
W_UPLOAD-KZSEL_02_005.
i have uncommented the first view but in this it is throwing error like "The data object 'w_upload' does not have a component called 'KZSEL_01_004'".
Can there be anymore modifications.
‎2008 Jul 21 1:36 PM
Hi Balu,
pls let me know for which u need to update the data?
for that view just pass value as 'X'. thats it...
no need to place the value W_UPLOAD-KZSEL_01_004.
instead of this we are placing 'X'.
‎2008 Jul 21 1:41 PM
Hi Balu,
First point you are using REFRESH comment inside loop statment that means you are clearing the body of the BDCDATA tab everytime you loop. SO tables does not contain any data.
Second in just pass 'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)' 'X'.
Hope it resolves you issue.
Thanks & Regards,
Nagaraj Kalbavi