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

reg:external files

Former Member
0 Likes
511

hi,

how to select the specific rows in excel sheet for gui upload to application server and download for presentation server.

thanks

muthuraman.d

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
492

Hi,

You can use function module ALSM_EXCEL_TO_INTERNAL_TABLE to upload data in to internal table. You can specify specific row/column in the import paramater of the function module. I hope this fm will solve your purpose. If you do not know the row number to be uploaded in to internal table, you will have to get all the data in to the internal table and write logic to get the specfic row you need.

Please let me know if this helps.

Thanks,

Deepthi

4 REPLIES 4
Read only

Former Member
0 Likes
492

You can either upload whole file into internal table and filter data as you need or

record macro of copying needed data and rewrite visual basic statements as ABAP code to do that task.

Read only

0 Likes
492

hi,

how to filter data using anyfunction module or select query

thanks

muthuraman.d

Read only

0 Likes
492

Hai....

below iam sending a sample code for FM ALSM_EXCEL_TO_INTERNAL_TABLE

hope U will get some idea.

          • WORK AREA AND INT TAB FOR DATA

DATA : BEGIN OF WA_DATA,

AUART LIKE VBAK-AUART,

VKORG LIKE VBAK-VKORG,

VTWEG LIKE VBAK-VTWEG,

SPART LIKE VBAK-SPART,

BSTKD LIKE VBKD-BSTKD,

KUNNR LIKE KUAGV-KUNNR,

MABNR LIKE RV45A-MABNR,

KWMENG(20) TYPE C,

WBS(20) TYPE C,

KSCHL LIKE KOMV-KSCHL,

KBETR(20) TYPE C,

END OF WA_DATA.

DATA : IT_DATA LIKE TABLE OF WA_DATA.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETER : P_FILE LIKE PATH.

SELECTION-SCREEN END OF BLOCK B1.

    • TO PROVIDE F4 HELP

DATA : FILE LIKE IBIPPARMS-PATH.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

CALL FUNCTION 'F4_FILENAME'

  • EXPORTING

  • PROGRAM_NAME = SYST-CPROG

  • DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = ' '

IMPORTING

FILE_NAME = FILE

.

P_FILE = FILE.

START-OF-SELECTION.

    • UPLOAD DATA FROM FLAT FILE TO INT TAB

DATA : WA_FILEDATA LIKE ALSMEX_TABLINE,

IT_FILEDATA LIKE TABLE OF WA_FILEDATA.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

FILENAME = FILE

I_BEGIN_COL = '1'

I_BEGIN_ROW = '1'

I_END_COL = '11'

I_END_ROW = '2'

TABLES

INTERN = IT_FILEDATA

  • 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 IT_FILEDATA INTO WA_FILEDATA.

CASE WA_FILEDATA-COL.

WHEN '001'.

WA_DATA-AUART = WA_FILEDATA-VALUE.

WHEN '002'.

WA_DATA-VKORG = WA_FILEDATA-VALUE.

WHEN '003'.

WA_DATA-VTWEG = WA_FILEDATA-VALUE.

WHEN '004'.

WA_DATA-SPART = WA_FILEDATA-VALUE.

WHEN '005'.

WA_DATA-KUNNR = WA_FILEDATA-VALUE.

WHEN '006'.

WA_DATA-BSTKD = WA_FILEDATA-VALUE.

WHEN '007'.

WA_DATA-MABNR = WA_FILEDATA-VALUE.

WHEN '008'.

WA_DATA-KWMENG = WA_FILEDATA-VALUE.

WHEN '009'.

WA_DATA-WBS = WA_FILEDATA-VALUE.

WHEN '010'.

WA_DATA-KSCHL = WA_FILEDATA-VALUE.

WHEN '011'.

WA_DATA-KBETR = WA_FILEDATA-VALUE.

AT END OF ROW.

APPEND WA_DATA TO IT_DATA.

ENDAT.

ENDCASE.

ENDLOOP.

*************************************

Regards

Sekhar.C

Read only

Former Member
0 Likes
493

Hi,

You can use function module ALSM_EXCEL_TO_INTERNAL_TABLE to upload data in to internal table. You can specify specific row/column in the import paramater of the function module. I hope this fm will solve your purpose. If you do not know the row number to be uploaded in to internal table, you will have to get all the data in to the internal table and write logic to get the specfic row you need.

Please let me know if this helps.

Thanks,

Deepthi