2013 Sep 02 12:59 PM
Hi,
My question is I am uploading Source list through BDC call transaction
I am getting message as 'Successfully Updated' but when i see in me01 that source list is not available.
Please help me.
Point will be awarded.
Thanks
Veda
2013 Sep 06 8:58 AM
Hi,
I found out the problem.
It is inserting data into the cells which are editable in me01.
Now the question is how to make non editable cell as editable cells in me01.
Thanks
Veda
2013 Sep 02 2:26 PM
Hi,
As you have mentioned its BDC. Have you checked in ALL screen mode what are the steps begin carried out as a part of the BDC. Check the link below for more information BDC debugging and process understanding.
http://wiki.sdn.sap.com/wiki/display/ABAP/Batch+Input+-+BDC
Also check if it in Sessions mode then You will have to process the generated session in SM35.
Cheers,
Arindam
2013 Sep 03 7:44 AM
Hi,
I checked in ALL screen mode it showing message as no source list records are changed.
2013 Sep 02 2:55 PM
Hi,
You just check the BDCMSGCOLL error table have any records, and also run once again in the No mode and synchronous process.
Check you were using lock object. As well as custom field. pass the proper value.
Regards,
John.
2013 Sep 03 7:41 AM
Hi,
I checked in ALL screen mode, the data is not getting saved , its showing message as no source list changed.
2013 Sep 06 8:58 AM
Hi,
I found out the problem.
It is inserting data into the cells which are editable in me01.
Now the question is how to make non editable cell as editable cells in me01.
Thanks
Veda
2013 Sep 06 9:38 AM
Better give a precise example and explain why you would change content in non-editable fields.
This may just not be foreseen by SAP or you have to do it a different way.
But without knowing the fields this cannot be answered
2013 Sep 06 9:52 AM
Hi Jurgen,
I am uploading valid date from ,valid date to , vendor name and purchasing org.
It is working fine up to 20 entries and after that its showing message as ' Field EORD-EKORG(28) doesnt exists in the SCreem SAPMELOR205' .
Hope you got my point.
Thanks
Veda
2013 Sep 06 11:02 AM
you did a recording and your screen has only 20 lines, to reach line 21 you would need to page down, which was not recorded.
you better use other import methods than own recordings
2013 Sep 11 11:25 AM
Hi Veda,
I have also created BDC for ME01 for only 20 records after that it will give you error of there is not any input field and screen become stuck . So try for page down (P+ ) functionality and than start a counter
so that cursor will stop on an input field.
Regards
Nishant
2013 Sep 11 11:33 AM
Hi Veda,
after 20 lines you have add ur entries into 21st Line.But I think as per your code it is trying to add int 28th line as per your message : ******* Field EORD-EKORG(28) doesnt exists in the SCreem SAPMELOR205' . ******
You have to follow BDC table control.
Either in the time of recording after 20 entries you have to PRESs PAGE DOWN and you have cath the OKCODE for PAGE DOWN---okcode - (P+).Than again you have to give your entries.
Now check SHDB Recording.And write you code as per recording.You have to handle the BDC Table Control.Than it will work properly.
If you are not clear than PASTE you code here.i will check and give you the correct code.
Thanks
Tarak
2013 Sep 11 12:16 PM
2013 Sep 11 12:17 PM
Hi Tarak,
I am pasting my code here. Its in OOP,
Please help me
TYPE-POOLS: ztgrp, truxs.
*Variables
DATA: gv_err TYPE c.
*Workarea
DATA: gs_data TYPE ztgrp_sldata.
*Internal tables
DATA: gt_data TYPE STANDARD TABLE OF ztgrp_sldata,
gt_bdcmsg TYPE TABLE OF bdcmsgcoll.
*Object
DATA: obj_sl TYPE REF TO zcl_sl.
*Include Selection screen
INCLUDE zselscreen.
*Start-of-Selection
START-OF-SELECTION.
* Initialize the variables, work area and internal tables
CLEAR gv_err.
REFRESH gt_data[].
IF p_app EQ 'X'.
* Check the input paramters
PERFORM check_par_app.
CHECK gv_err IS INITIAL.
* Upload the comma separated file from Application server
PERFORM upload_app.
ELSE.
* Check the input paramters
PERFORM check_par_pre.
CHECK gv_err IS INITIAL.
* Upload the comma separated file/Excel file from Presentation server
PERFORM upload_pre.
ENDIF.
*&---------------------------------------------------------------------*
*& Form UPLOAD_APP
*&---------------------------------------------------------------------*
* Upload the comma separated file from Application server
*----------------------------------------------------------------------*
FORM upload_app .
*Read the file from Application Server
PERFORM file_read.
* Check for error
CHECK gv_err IS INITIAL.
IF gt_data IS INITIAL.
MESSAGE i002.
gv_err = 'X'.
EXIT.
ENDIF.
* Create data object
CREATE OBJECT obj_sl.
* Create vendor using BDC and call transaction XK01
PERFORM create_source_list.
* Write log files
CALL METHOD obj_sl->write_log_files
EXPORTING
i_sfile = p_asfile
i_efile = p_aefile.
* Write screen output
CALL METHOD obj_sl->write_screen_out.
* Free the object
FREE obj_sl.
ENDFORM. " UPLOAD_APP
*&---------------------------------------------------------------------*
*& Form CREATE_SOURCE_LIST
*&---------------------------------------------------------------------*
* create source list
*----------------------------------------------------------------------*
FORM create_source_list .
*Local data
DATA: lv_fval TYPE bdcdata-fval,
lv_fnam TYPE bdcdata-fnam,
lv_exists TYPE c,
lv_cnt TYPE i,
lv_row(2) TYPE c.
*Refresh the table
REFRESH obj_sl->gt_bdcdata[].
LOOP AT gt_data INTO gs_data.
* Check whether the record is already created?
CLEAR lv_exists.
CALL METHOD:obj_sl->check_exist
EXPORTING i_data = gs_data
IMPORTING e_exists = lv_exists.
IF lv_exists EQ 'X'.
CONTINUE.
ENDIF.
CALL METHOD: obj_sl->bdc_dynpro
EXPORTING i_program = 'SAPLMEOR'
i_dynpro = '0200'
i_dynbegin = 'X'.
CALL METHOD: obj_sl->bdc_data
EXPORTING i_fnam = 'BDC_CURSOR'
i_fval = 'EORD-WERKS',
obj_sl->bdc_data
EXPORTING i_fnam = 'BDC_OKCODE'
i_fval = '/00'.
CLEAR lv_fval.
lv_fval = gs_data-matn.
CALL METHOD: obj_sl->bdc_data
EXPORTING i_fnam = 'EORD-MATNR'
i_fval = lv_fval.
CLEAR lv_fval.
lv_fval = gs_data-plnt.
CALL METHOD: obj_sl->bdc_data
EXPORTING i_fnam = 'EORD-WERKS'
i_fval = lv_fval.
CALL METHOD: obj_sl->bdc_dynpro
EXPORTING i_program = 'SAPLMEOR'
i_dynpro = '0205'
i_dynbegin = 'X'.
* Now get the line no where the record needs to be inserted
CLEAR lv_cnt.
CALL METHOD obj_sl->get_count
EXPORTING
i_data = gs_data
IMPORTING
e_cnt = lv_cnt.
lv_cnt = lv_cnt + 1.
CLEAR lv_fval.
lv_row = lv_cnt.
* if lv_row le 20.
CONCATENATE 'EORD-EKORG(' lv_row ')' INTO lv_fval.
CALL METHOD: obj_sl->bdc_data
EXPORTING i_fnam = 'BDC_CURSOR'
i_fval = lv_fval,
obj_sl->bdc_data
EXPORTING i_fnam = 'BDC_OKCODE'
i_fval = '=BU'.
CLEAR lv_fval.
lv_fval = gs_data-valf.
CLEAR lv_fnam.
CONCATENATE 'EORD-VDATU(' lv_row ')' INTO lv_fnam.
CALL METHOD: obj_sl->bdc_data
EXPORTING i_fnam = lv_fnam
i_fval = lv_fval.
CLEAR lv_fval.
lv_fval = gs_data-valt.
CLEAR lv_fnam.
CONCATENATE 'EORD-BDATU(' lv_row ')' INTO lv_fnam.
CALL METHOD: obj_sl->bdc_data
EXPORTING i_fnam = lv_fnam
i_fval = lv_fval.
CLEAR lv_fval.
lv_fval = gs_data-vend.
CLEAR lv_fnam.
CONCATENATE 'EORD-LIFNR(' lv_row ')' INTO lv_fnam.
CALL METHOD: obj_sl->bdc_data
EXPORTING i_fnam = lv_fnam
i_fval = lv_fval.
CLEAR lv_fval.
lv_fval = gs_data-porg.
CLEAR lv_fnam.
CONCATENATE 'EORD-EKORG(' lv_row ')' INTO lv_fnam.
CALL METHOD: obj_sl->bdc_data
EXPORTING i_fnam = lv_fnam
i_fval = lv_fval.
* Refresh the error message table
REFRESH gt_bdcmsg[].
* Call transaction ME01
CALL METHOD obj_sl->create_slist
CHANGING
gt_bdcmsg_e = gt_bdcmsg[].
* Refresh the table
REFRESH obj_sl->gt_bdcdata[].
* Log error and success data
CALL METHOD obj_sl->insert_final_tabs
EXPORTING
i_data = gs_data
gt_bdcmsg_i = gt_bdcmsg[].
ENDLOOP.
ENDFORM. " CREATE_SOURCE_LIST
*&---------------------------------------------------------------------*
*& Form FILE_READ
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM file_read .
* Local data dec
CONSTANTS: gc_sep TYPE c VALUE ','.
DATA: gv_str(1000) TYPE c.
* Using Open dataset
OPEN DATASET p_afile FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
* Set error flag
gv_err = 'X'.
MESSAGE i000.
EXIT.
ENDIF.
* Read the data into string
DO.
CLEAR gv_str.
READ DATASET p_afile INTO gv_str.
IF sy-subrc NE 0.
EXIT.
ENDIF.
IF sy-index EQ 1.
* Dont read file header
CONTINUE.
ENDIF.
* Split the read record on ',' and append to internal table
SPLIT gv_str AT gc_sep
INTO gs_data-matn
gs_data-plnt
gs_data-valf
gs_data-valt
gs_data-vend
gs_data-porg.
IF gs_data-matn IS INITIAL AND gs_data-plnt IS INITIAL.
CONTINUE.
ENDIF.
APPEND gs_data TO gt_data[].
ENDDO.
* Close file after read
CLOSE DATASET p_afile.
ENDFORM. " FILE_READ
*&---------------------------------------------------------------------*
*& Form UPLOAD_PRE
*&---------------------------------------------------------------------*
* Upload the comma separated file/Excel file from Presentation
* server
*----------------------------------------------------------------------*
FORM upload_pre .
IF p_csv EQ 'X'.
CLEAR gv_err.
* Upload csv file
PERFORM upload_csv.
* Check for error
CHECK gv_err IS INITIAL.
* Create data object
CREATE OBJECT obj_sl.
* Create source list using BDC and call transaction ME01
PERFORM create_source_list.
CALL METHOD obj_sl->write_log_pres
EXPORTING
i_sfile = p_psfile
i_efile = p_pefile
i_type = 'C'.
* Write screen output
CALL METHOD obj_sl->write_screen_out.
* Free Object
FREE obj_sl.
ELSE.
CLEAR gv_err.
* Upload xls file
PERFORM upload_xls.
* Check for error
CHECK gv_err IS INITIAL.
* Create data object
CREATE OBJECT obj_sl.
* Create source list using BDC and call transaction ME01
PERFORM create_source_list.
call method obj_sl->write_log_pres
exporting
i_sfile = p_psfile
i_efile = p_pefile
i_type = 'X'.
* Write screen output
CALL METHOD obj_sl->write_screen_out.
* Free Object
FREE obj_sl.
ENDIF.
ENDFORM. " UPLOAD_PRE
*&---------------------------------------------------------------------*
*& Form UPLOAD_CSV
*&---------------------------------------------------------------------*
* Upload CSV
*----------------------------------------------------------------------*
FORM upload_csv .
DATA: lv_fname TYPE string,
lt_csv TYPE truxs_t_text_data,
ls_csv(4096) TYPE c.
lv_fname = p_pfile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_fname
filetype = 'DAT'
TABLES
data_tab = lt_csv
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 i000 WITH p_pfile.
gv_err = 'X'.
EXIT.
ENDIF.
LOOP AT lt_csv INTO ls_csv.
IF sy-tabix EQ 1.
* If Header?
CONTINUE.
ENDIF.
* Split the read record on ',' and append to internal table
SPLIT ls_csv AT ','
INTO gs_data-matn
gs_data-plnt
gs_data-valf
gs_data-valt
gs_data-vend
gs_data-porg.
IF gs_data-matn IS INITIAL AND gs_data-plnt IS INITIAL.
CONTINUE.
ENDIF.
APPEND gs_data TO gt_data[].
ENDLOOP.
ENDFORM. " UPLOAD_CSV
*&---------------------------------------------------------------------*
*& Form UPLOAD_XLS
*&---------------------------------------------------------------------*
* Upload XLS
*----------------------------------------------------------------------*
FORM upload_xls .
DATA: lt_exl TYPE truxs_t_text_data.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_line_header = 'X'
i_tab_raw_data = lt_exl
i_filename = p_pfile
TABLES
i_tab_converted_data = gt_data[]
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE i000 WITH p_pfile.
gv_err = 'X'.
EXIT.
ENDIF.
ENDFORM.
Regards
Veda
2013 Sep 06 11:10 AM
2013 Sep 11 11:18 AM
Hi,
How to scroll page down, BDC recording '=P+' is not helping.
Please sugggest how to reach 21st line.
Its urgent Please help me.
Regards
Veda
2013 Sep 11 9:41 PM
Investigate the case manually in ME01 transaction, you can use F7 to get the next page, if the first if full.
2013 Sep 11 10:01 PM
That is probably the easiest way. By using the 'Insert new record' functionality (F7 or Ctrl + F3, depending on whether it's the first record or not), you are able to enter one new record at the time. The first record, you will need to enter on line 1, all the rest are posted in line 2. The BDC_OKCODE that you need to use is '=NS'. After processing the last record of the source list, you should use BDC_OKCODE '=BU' to save the record.
The logic will be like this :
loop at itab.
**First record
if sy-tabix = '1'.
fill first line with data with ok_code '=NS'.
elseif.
**..All other records
fill second line with data with ok_code '=NS'.
endif.
endloop.
**After processing all records
save using ok_code '=BU'.
Regards,
Freek
2013 Sep 16 8:10 AM
Hi,
Thank you all for your help. my problem is solved.
Thanks
Veda