Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BDC for a view

Former Member
0 Likes
682

Hi folks,

I am trying to make some changes in a view . My requirement is, i have to upload data from a excel file and need to do update the view. in the flat file, i am provided with country,rate, date and some other details. suppose if i have a country US in my file, i need to search that counrty name in the table entry and need to update the rate field for that record. Is this possible through BDC. If so, could any body suggest me the logic to proceed.Or any sample program for the requirement.

Thanks in advance,

Shyam.

1 ACCEPTED SOLUTION
Read only

vinod_vemuru2
Active Contributor
0 Likes
661

Hi Shyam,

Which view it is? Standard or Zview? Also what is the type of view? like table, maintenance etc.

If it is a Zview then even no need of BDC. U can directly update the table using ur conditions with UPDATE statement. If it is standard view then find the transaction which updates this view. Later u can try BDC or BAPI for updation.

Thanks,

Vinod.

Hi folks,

I am trying to make some changes in a view . My requirement is, i have to upload data from a excel file and need to do update the view. in the flat file, i am provided with country,rate, date and some other details. suppose if i have a country US in my file, i need to search that counrty name in the table entry and need to update the rate field for that record. Is this possible through BDC. If so, could any body suggest me the logic to proceed.Or any sample program for the requirement.

Thanks in advance,

Shyam.

4 REPLIES 4
Read only

vinod_vemuru2
Active Contributor
0 Likes
662

Hi Shyam,

Which view it is? Standard or Zview? Also what is the type of view? like table, maintenance etc.

If it is a Zview then even no need of BDC. U can directly update the table using ur conditions with UPDATE statement. If it is standard view then find the transaction which updates this view. Later u can try BDC or BAPI for updation.

Thanks,

Vinod.

Read only

0 Likes
661

Hi Vinod,

Thanks for ur answer. It is a maintance view.View name is V_T706U.

Thanks,

Shyam.

Read only

0 Likes
661

Hi Shyam,

Check this F1 help. It may help to some extent.

Maintenance views provide you with a business view of the data. You can change it either with the table maintenance transaction SM30, which allows you to maintain data from the base tables in a view at the same time, or with the customizing transaction. The mechanisms for data maintenance such as screens and processing programs can be created with a special transaction (SE54).

Thanks,

Vinod.

Read only

Former Member
0 Likes
661

I don't think we need BDC for this... Just write a ABAP Report to do this..

To get data from excel onto Internal Table use the function Module

: ALSM_EXCEL_TO_INTERNAL_TABLE

Sample Program With Field Symbols

DATA: L_INTER LIKE TABLE OF ALSMEX_TABLINE WITH HEADER LINE ,

L_INDEX TYPE I.

types: begin of TY_DATA,

MAT_NO(018),

MAKTX(040),

end of TY_DATA.

DATA: RECORD1 TYPE STANDARD TABLE OF TY_DATA,

RECORD TYPE TY_DATA.

FIELD-SYMBOLS <FS>.

parameter P_INFILE LIKE RLGRAP-FILENAME.

at selection-screen on value-request for P_INFILE.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = ' '

IMPORTING

FILE_NAME = P_INFILE.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

FILENAME = P_INFILE

I_BEGIN_COL = 1

I_BEGIN_ROW = 4

I_END_COL = 2

I_END_ROW = 38

TABLES:

INTERN = L_INTER

  • EXCEPTIONS

  • INCONSISTENT_PARAMETERS = 1

  • UPLOAD_OLE = 2

  • OTHERS = 3

.

SORT L_INTER BY ROW COL.

LOOP AT L_INTER .

MOVE L_INTER-COL TO L_INDEX.

ASSIGN COMPONENT L_INDEX OF STRUCTURE RECORD TO <FS>.

MOVE L_INTER-VALUE TO <FS>.

AT END OF ROW.

APPEND RECORD to RECORD1.

clear record.

ENDAT.

ENDLOOP.

Sample Program Without Field Symbols

DATA: BEGIN OF EXCEL OCCURS 0.

INCLUDE STRUCTURE ALSMEX_TABLINE.

DATA: END OF EXCEL.

PARAMETER: FILE TYPE RLGRAP-FILENAME.

at selection-screen on value-request for FILE.

types: begin of TY_DATA,

  • data element: MATNR

MAT_NO(018),

  • data element: MAKTX

MAKTX(040),

end of TY_DATA.

DATA: RECORD1 TYPE STANDARD TABLE OF TY_DATA,

RECORD TYPE TY_DATA.

      • End generated data section ***

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = ' '

IMPORTING

FILE_NAME = FILE

.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

FILENAME = FILE

I_BEGIN_COL = 1

I_BEGIN_ROW = 4

I_END_COL = 2

I_END_ROW = 38

TABLES

INTERN = EXCEL

EXCEPTIONS

INCONSISTENT_PARAMETERS = 1

UPLOAD_OLE = 2

OTHERS = 3.

loop at excel.

case excel-col.

when '001'.

RECORD-MAT_NO = EXCEL-VALUE.

wHEN '002'.

RECORD-MAKTX = EXCEL-VALUE.

endcase.

at end of row.

append RECORD to RECORD1.

clear RECORD.

endat.

endloop.

Regards,

VIjay