Application Development 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: 

bdc uploading: how avoid headings in excel sheet while uploading the data using BDC calltransaction?

Former Member
0 Kudos

Hi All,

i am uploading the data using BDC call transaction using excel file, that file looking like following

CUSTAGRNAMESORTSTRTCITYCNTRYLANGPIN
251624JKILhgfECBANGALOREINEN123457
251634NANICFRBELLANDURCHENNAIINEN234567
251644NILIMAGHTTNAGARCHENNAIINEN234567

IN THAT FILE I DONT WANT TO UPLOAD "FIRST ROW" WHICH HAVING  HEADINGS. just I want to update values of those fields?

1 ACCEPTED SOLUTION

pavanm592
Contributor
0 Kudos

Hi,

after reading the data using 'TEXT_CONVERT_XLS_TO_SAP' FM

delete the first record of the internal table

delete t_output where index  1.

if you want to read only from second record then use the FM

ALSM_EXCEL_TO_INTERNAL_TABLE

Thanks ,

Pavan.

12 REPLIES 12

Former Member
0 Kudos

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
     EXPORTING
       i_field_seperator    = space
       i_line_header        = space
       i_tab_raw_data       = lt_raw
       i_filename           = p_path
     TABLES
       i_tab_converted_data = t_output
     EXCEPTIONS
       conversion_failed    = 1
       OTHERS               = 2.
   IF sy-subrc NE 0.
     MESSAGE e002.
     LEAVE SCREEN.
   ENDIF.

SuDEESH

0 Kudos

using that FM we just convert excel file to internal table. but my question is , i want to skip the headings while uploading the records.

0 Kudos

Yes.. But this FM will ignore the Heading.. Internal Table will have only the Items..

Sorry ignore my previous message.

Constant : c_x Type char01 value 'X'.

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
     EXPORTING
       i_field_seperator    = space
       i_line_header        = c_x
       i_tab_raw_data       = lt_raw
       i_filename           = p_path
     TABLES
       i_tab_converted_data = t_output
     EXCEPTIONS
       conversion_failed    = 1
       OTHERS               = 2.
   IF sy-subrc NE 0.
     MESSAGE e002.
     LEAVE SCREEN.
   ENDIF.

SuDEESH

pavanm592
Contributor
0 Kudos

Hi,

after reading the data using 'TEXT_CONVERT_XLS_TO_SAP' FM

delete the first record of the internal table

delete t_output where index  1.

if you want to read only from second record then use the FM

ALSM_EXCEL_TO_INTERNAL_TABLE

Thanks ,

Pavan.

former_member209120
Active Contributor
0 Kudos

Hi  hai vai ,

Just put  'X'   in   I_LINE_HEADER 


CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

      EXPORTING

        i_field_seperator          = 'X'

        I_LINE_HEADER              = 'X'

        i_tab_raw_data             = i_text_data

        i_filename                 = p_file

      TABLES

        i_tab_converted_data       = it_final

      EXCEPTIONS

        conversion_failed          = 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.

VijayaKrishnaG
Active Contributor
0 Kudos

Hi,

You have to pass value X for I_LINER_HEADER in function module.

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

   EXPORTING

*   I_FIELD_SEPERATOR          = 'X'

    I_LINE_HEADER              = 'X'

     I_TAB_RAW_DATA             = L_RAWD

     I_FILENAME                 = P_FILE

   TABLES

     I_TAB_CONVERTED_DATA       = G_TAB

  EXCEPTIONS

    CONVERSION_FAILED          = 1

    OTHERS                     = 2.

IF SY-SUBRC <> 0.

* Implement suitable error handling here

ENDIF.

Thanks & Regards,

Vijay

0 Kudos

ok thanks 4 your reply,

and also 1 more doubt,

excel sheet contains 4 records, i want to skip the 3rd record in MODE 'N'

0 Kudos

Hi,

Your internal table will have 4 records.

You can use:

Move the data to another internal table while running in N mode and delete the 3rd record as required.

DELETE G_TAB INDEX 3.

Populate BDCDATA for all other records and run the BDC.

Please let me know if it helped.

Thanks,

Anupam

0 Kudos

Hi hai vai,

Use this Function Module use to select rows you want from excel sheet...

********** Selection Screen

SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETER: p_file TYPE rlgrap-filename OBLIGATORY.

SELECTION-SCREEN : END OF BLOCK b1.

SELECTION-SCREEN : BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

PARAMETER: p1 TYPE i OBLIGATORY,

                          p2 TYPE i OBLIGATORY.

SELECTION-SCREEN : END OF BLOCK b2.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

    EXPORTING

      filename    = p_file

      i_begin_col = '001'

      i_begin_row = p1                              " Select Row From

      i_end_col   = '008'

      i_end_row   = p2                               " Select Row To

    TABLES

      intern      = it_intern

* 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.

vigneshwar_reddy
Active Participant
0 Kudos

Hi Vai,

Ramesh T has provided correct solution please use that code.

Regards.

Vigneshwar.D

Former Member
0 Kudos

THANKS 4 ALL, FOR  SHARING YOUR VALUABLE KNOWLEDGE

0 Kudos

Hi,

If your issue solved please close the thread.

Thanks,

-Vijay