cancel
Showing results for 
Search instead for 
Did you mean: 

BDC Programming

Former Member
0 Kudos

Hi All,

I had a Table it has about 1500 Entries so i had to modify one Entry in that table by SM30 i have to do this for all entries in the table i want to do this by using BDC but when i amcreting a BDC program for that and making the modification i am not able to do that .

can some one please provide me the Steps or the Sample code to do the required change.

Thanks in advance

Regards,

Himanshu Sharma

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

do u want to modify table or a view.

it is better to use direct modify or update for table in a program.

i think this is one time job

Former Member
0 Kudos

Hi,Check this sample code:

tables:skat.

types: begin of acc,
       mandt type skat-mandt,
       ktopl type skat-ktopl,
       saknr type skat-saknr,
       txt20 type skat-txt20,
       txt50 type skat-txt50,
       mcod1 type skat-mcod1,
       end of acc.

data: glmaster type skat,
      saknr type ska1-saknr,
      bilkt type ska1-bilkt.


data: acc1 type standard table of acc,
      acc2 type acc.

data: conv type acc.

data: xl_acc1 type alsmex_tabline occurs 1 with header line.



CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
  EXPORTING
    FILENAME                      = 'C:\Documents and Settings\pri\Desktop\gltext1.xls'
    I_BEGIN_COL                   = 1
    I_BEGIN_ROW                   = 3
    I_END_COL                     = 5
    I_END_ROW                     = 182
  TABLES
    INTERN                        = xl_acc1.
* EXCEPTIONS
*   INCONSISTENT_PARAMETERS       = 1
*   UPLOAD_OLE                    = 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.

 loop at xl_acc1.

    case xl_acc1-col.
      when '1'.
        acc2-ktopl = xl_acc1-value.
      when '2'.
        acc2-saknr = xl_acc1-value.
      when '3'.
        acc2-txt20 = xl_acc1-value.
      when '4'.
        acc2-txt50 = xl_acc1-value.
      when '5'.
        acc2-mcod1 = xl_acc1-value.
        append acc2 to acc1.
    endcase.
  endloop.







*delete from skat.


loop at acc1 into acc2.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    INPUT         = acc2-saknr
 IMPORTING
   OUTPUT        = saknr.
          .

 move saknr to acc2-saknr.
 move sy-mandt to acc2-mandt.
          .
 move-corresponding acc2 to glmaster.

.
update skat from glmaster. " here the master table gets updated

endloop.

Regards,

Vishwa.