2014 Sep 03 6:44 AM
Hi ,
i created a customized table and i try to fill the table using bdc call transaction..For this purpose i created a tcode for that table using table maintenance generator. when i try to upload the excel file it is not uploaded...i checked through it program wise all are correct but i did'nt knew how to rectify. can anybody help me?
2014 Sep 03 6:47 AM
Hi,
why do you use BDC if it's a specific table ? BDC is for standard transactions, not for specific.
try the statement INSERT
regards
Fred
2014 Sep 03 6:57 AM
Hi,
I didnt understand why your using the BDC to update the table and please give me exactly what error ur getting at the time of execution the tcode.
Thanks & Regards
Anoop menon
2014 Sep 03 6:59 AM
Hi Frederic ,
First of all thanks for your reply.. i need to explain my requirment. i have to browse the excel file in system and upload in the customized table using bdc call transaction method..This is the scenario. hope you understand my scenario..
2014 Sep 03 7:16 AM
check ur code the rows you mentioned in Excel and code are correct
2014 Sep 03 7:46 AM
report ZBDC4_TASK
no standard page heading line-size 255.
TYPES : BEGIN OF TY_TASK,
ZLIFNR TYPE ZLIFNR_DE,
ZBUKRS TYPE ZBUKRS_DE,
ZLAND1 TYPE ZLAND1_DE,
ZNAME1 TYPE ZNAME1_DE,
ZNAME2 TYPE ZNAME2_DE,
ZORT01 TYPE ZORT01_DE,
ZORT02 TYPE ZORT02_DE,
ZPFACH TYPE ZPFACH_DE,
ZPSTLZ TYPE ZPSTLZ_DE,
ZREGIO TYPE ZREGIO_DE,
ZSTRAS TYPE ZSTRAS_DE,
ZADRNR TYPE ZADRNR_DE,
ZKTOKK TYPE ZKTOKK_DE,
ZSPRAS TYPE ZSPRAS_DE,
ZPHONENO TYPE ZPHONENO_DE,
ZBANKNAME TYPE ZBANKNAME_DE,
ZBANKBRCH TYPE ZBANKBRCH_DE,
ZACCOUNTNO TYPE ZACCOUNT_DE,
END OF TY_TASK.
DATA : IT TYPE TABLE OF TY_TASK WITH HEADER LINE,
WA TYPE TY_TASK,
bdcdata TYPE TABLE OF bdcdata WITH HEADER LINE,
it_excel TYPE TABLE OF alsmex_tabline,
wa_excel TYPE alsmex_tabline,
ctu TYPE ctu_params,
etable TYPE TABLE OF bdcmsgcoll,
col TYPE i.
field-symbols <fs> type any.
parameters pr_file type rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR PR_FILE.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
* FIELD_NAME = ' '
IMPORTING
FILE_NAME = PR_FILE
.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = PR_FILE
I_BEGIN_COL = 1
I_BEGIN_ROW = 1
I_END_COL = 100
I_END_ROW = 100
TABLES
INTERN = IT_EXCEL[].
* EXCEPTIONS
* INCONSISTENT_PARAMETERS = 1
* UPLOAD_OLE = 2
* OTHERS = 3
.
START-OF-SELECTION.
LOOP AT it_excel INTO wa_excel.
col = wa_excel-col.
ASSIGN COMPONENT col OF STRUCTURE wa TO <fs>.
<fs> = wa_excel-value.
AT END OF row.
IF wa IS NOT INITIAL.
APPEND wa TO it.
ENDIF.
CLEAR wa.
ENDAT.
CLEAR col.
ENDLOOP.
ctu-dismode = 'N'.
ctu-updmode = 'A'.
ctu-defsize = 'X'.
LOOP AT IT INTO WA.
REFRESH BDCDATA.
perform bdc_dynpro using 'SAPLZTASK3_PART' '0001'.
perform bdc_field using 'BDC_CURSOR'
'VIM_POSITION_INFO'.
perform bdc_field using 'BDC_OKCODE'
'=NEWL'.
perform bdc_dynpro using 'SAPLZTASK3_PART' '0002'.
perform bdc_field using 'BDC_CURSOR'
'ZTASK3_PART-ZACCOUNTNO'.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
perform bdc_field using 'ZTASK3_PART-ZLIFNR' WA-ZLIFNR.
* '12356'.
perform bdc_field using 'ZTASK3_PART-ZBUKRS' WA-ZBUKRS.
* '2007'.
perform bdc_field using 'ZTASK3_PART-ZLAND1' WA-ZLAND1.
* 'US'.
perform bdc_field using 'ZTASK3_PART-ZNAME1' WA-ZNAME1.
* 'RAM'.
perform bdc_field using 'ZTASK3_PART-ZNAME2' WA-ZNAME2.
* 'MOHAN'.
perform bdc_field using 'ZTASK3_PART-ZORT01' WA-ZORT01.
* 'ORISSA'.
perform bdc_field using 'ZTASK3_PART-ZORT02' WA-ZORT02.
* 'RANJUR'.
perform bdc_field using 'ZTASK3_PART-ZPFACH' WA-ZPFACH.
* 'ORISSA'.
perform bdc_field using 'ZTASK3_PART-ZPSTLZ' WA-ZPSTLZ.
* '154654'.
perform bdc_field using 'ZTASK3_PART-ZREGIO' WA-ZREGIO.
* 'NORTH'.
perform bdc_field using 'ZTASK3_PART-ZSTRAS' WA-ZSTRAS.
* '2 GANDHI'.
perform bdc_field using 'ZTASK3_PART-ZADRNR' WA-ZADRNR.
* 'VIOLET CAFE'.
perform bdc_field using 'ZTASK3_PART-ZKTOKK' WA-ZKTOKK.
* '4321'.
perform bdc_field using 'ZTASK3_PART-ZSPRAS' WA-ZSPRAS.
* 'HI'.
perform bdc_field using 'ZTASK3_PART-ZPHONENO' WA-ZPHONENO.
* '8680909324'.
perform bdc_field using 'ZTASK3_PART-ZBANKNAME' WA-ZBANKNAME.
* 'SBI'.
perform bdc_field using 'ZTASK3_PART-ZBANKBRCH' WA-ZBANKBRCH.
* 'GUJ'.
perform bdc_field using 'ZTASK3_PART-ZACCOUNTNO' WA-ZACCOUNTNO.
* '85258000011'.
CALL TRANSACTION 'ZTASKK6' USING BDCDATA. " OPTIONS FROM CTU MESSAGES INTO ETABLE.
*----------------------------------------------------------------------*
* Start new screen *
*----------------------------------------------------------------------*
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
*----------------------------------------------------------------------*
* Insert field *
*----------------------------------------------------------------------*
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> SPACE.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.
ENDLOOP.
2014 Sep 03 7:47 AM
Hi anup,
The above is my coding details..tell me where i can made mistakes.
2014 Sep 03 8:05 AM
Hi,
In future could you please use better discussion titles, rather than just "BDC" which is pretty meaningless and stops people from finding anything useful in if they are searching on SCN.
Also, as a few others have said, there is absolutely no benefit to use BDC if you are updating a custom table, as you should have complete control over locking it, inserting/updating/deleting records and unlocking it in your own logic.
Thanks,
G.
2014 Sep 04 8:12 AM
Hi ,
if above is the exact copy of your code,
if you are adding multiple entries then bdc cursor need to be handled.
last perform should be
perform bdc_field using 'BDC_OKCODE'
'=BACK'.
LOOP AT IT INTO WA.
v_index = v_index + 1.
if v_index = max record allowed on screen then
ok code 'P+'
endloop .
2014 Sep 03 6:56 AM
Either use SQL statements, and check data validity (foreign key, domain) in your code or use the FM associated to maintenance dialog (e.g. VIEW_MAINTENANCE_SINGLE_ENTRY, ref : BC Extended Applications Function Library : Extended table maintenance, Call via function module)
Regards,
Raymond
2014 Sep 03 7:20 AM
call this function ' TEXT_CONVERT_XLS_TO_SAP', pass the parameters and it will copy the excel data to internal table then you can use INSERT db-tab FROM TABLE itab
Example:
TYPES truxs_t_text_data(4096) type c occurs 0.
DATA : g_raw_data TYPE TRUXS_T_TEXT_DATA.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR =
I_LINE_HEADER = 'X'
I_TAB_RAW_DATA = g_raw_data
I_FILENAME = "Excel file path
TABLES
I_TAB_CONVERTED_DATA = itab
* EXCEPTIONS
* CONVERSION_FAILED = 1
* OTHERS = 2
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
2014 Sep 03 7:57 AM
Field mapping i asked with the excel and the table u ceated tat order is same or not
2014 Sep 03 8:03 AM
2014 Sep 03 8:06 AM
Then Please check the Attributes of the table table maintainace allowed with restriction
2014 Sep 03 8:10 AM
2014 Sep 03 8:15 AM
manually thrugh table maintance u can save the data or not please check????
and try to save 2 data manually .
2014 Sep 03 8:51 AM
no am unable to save the data in table maintenance generator
2014 Sep 03 8:25 AM
Have you debugged your program? I would debug and look for where you might be getting subrc ne 0. Also I would debug and stop at the point where your bdc table is completely filled. I would then take this information i.e. what is in the BDC itab and open another session and process the entries step by step with the data and ok-codes as they are in this itab.
2014 Sep 03 9:24 AM
2014 Sep 10 12:49 PM
Hi all,
i found the solution for that rectified it.. Thanks for all .
2014 Sep 11 7:25 AM
Please could you post the solution, it would be good to know how you resolved this in case anyone else has similair problem.