2007 May 07 12:54 PM
hello,
I have a requirement in which i need to upload .csv file. I tried using GUI_UPLOAD and TEXT_CONVERT_CSV_TO_SAP. But the values are getting appending as a single value seperated by cama.
for example, If there are 5 columns and 10 rows in my test.csv file. when i am using GUI_UPLOAD and TEXT_CONVERT_CSV_TO_SAP. I am getting data in 1 column and 10 rows. each row has 5 values seperated by column. the other 4 columns in the internal table are not populated.
can anyone help me.
Thanks and Regards,
gautham
Hi Gautham,
Declare ur table like this :
TYPES : BEGIN OF T_TAB,
EMP_ID(8),
P1,
NAME(10),
P2,
SURNAME(10),
P3,
PRACTICE(10),
P4,
MOB(11),
P5,
END OF T_TAB.
Use FM 'gui_upload' and pass this internal table to FM.
Here P1 ,P2 ,P3..... are variables for containting ,(coma) or |(pipe)
Now populate this internal table data to another table using move command.
the structure of new table will be as per ur requirement.
Reward points if helpful.
Regards,
Hemant
2007 May 07 12:56 PM
hello,
I have a requirement in which i need to upload .csv file. I tried using GUI_UPLOAD and TEXT_CONVERT_CSV_TO_SAP. But the values are getting appending as a single value seperated by cama.
for example, If there are 5 columns and 10 rows in my test.csv file. when i am using GUI_UPLOAD and TEXT_CONVERT_CSV_TO_SAP. I am getting data in 1 column and 10 rows. each row has 5 values seperated by comma. the other 4 columns in the internal table are not populated.
can anyone help me.
Thanks and Regards,
gautham
2007 May 07 1:04 PM
Hi Gautham,
Good Check the following function module,
PARAMETERS: P_BEGCOL TYPE I DEFAULT 1 NO-DISPLAY,
P_BEGROW TYPE I DEFAULT 1 NO-DISPLAY,
P_ENDCOL TYPE I DEFAULT 100 NO-DISPLAY,
P_ENDROW TYPE I DEFAULT 32000 NO-DISPLAY.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_FILE
I_BEGIN_COL = P_BEGCOL
I_BEGIN_ROW = P_BEGROW
I_END_COL = P_ENDCOL
I_END_ROW = P_ENDROW
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.
Good Luck and thanks
AK
2007 May 07 1:08 PM
Hi Gautham,
Declare ur table like this :
TYPES : BEGIN OF T_TAB,
EMP_ID(8),
P1,
NAME(10),
P2,
SURNAME(10),
P3,
PRACTICE(10),
P4,
MOB(11),
P5,
END OF T_TAB.
Use FM 'gui_upload' and pass this internal table to FM.
Here P1 ,P2 ,P3..... are variables for containting ,(coma) or |(pipe)
Now populate this internal table data to another table using move command.
the structure of new table will be as per ur requirement.
Reward points if helpful.
Regards,
Hemant
2007 May 07 1:08 PM
2007 May 07 1:11 PM
hi,
use the Function module 'ALSM_EXCEL_TO_INTERNAL_TABLE'.
REPORT ZSR_BDC_XL
NO STANDARD PAGE HEADING LINE-SIZE 255.
TABLES : LFA1,RF02K.
DATA : BEGIN OF ITAB OCCURS 0,
LIFNR LIKE RF02K-LIFNR,
KTOKK LIKE RF02K-KTOKK,
NAME1 LIKE LFA1-NAME1,
SORTL LIKE LFA1-SORTL,
LAND1 LIKE LFA1-LAND1,
SPRAS LIKE LFA1-SPRAS,
END OF ITAB.
DATA : ITAB1 LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
DATA : B1 TYPE I VALUE 1,
C1 TYPE I VALUE 1,
B2 TYPE I VALUE 10,
C2 TYPE I VALUE 99.
INCLUDE BDCRECX1.
START-OF-SELECTION.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = 'C:\xl1.csv'
I_BEGIN_COL = B1
I_BEGIN_ROW = C1
I_END_COL = B2
I_END_ROW = C2
TABLES
INTERN = ITAB1
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.
PERFORM ORGANIZE_UPLOADED_DATA.
----
PERFORM OPEN_GROUP.
LOOP AT ITAB.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0100'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RF02K-KTOKK'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'RF02K-LIFNR'
ITAB-LIFNR.
PERFORM BDC_FIELD USING 'RF02K-KTOKK'
ITAB-KTOKK.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0110'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFA1-SPRAS'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'LFA1-NAME1'
ITAB-NAME1.
PERFORM BDC_FIELD USING 'LFA1-SORTL'
ITAB-SORTL.
PERFORM BDC_FIELD USING 'LFA1-LAND1'
ITAB-LAND1.
PERFORM BDC_FIELD USING 'LFA1-SPRAS'
ITAB-SPRAS.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0120'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFA1-KUNNR'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0130'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFBK-BANKS(01)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
PERFORM BDC_DYNPRO USING 'SAPLSPO1' '0300'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=YES'.
PERFORM BDC_TRANSACTION USING 'XK01'.
PERFORM CLOSE_GROUP.
ENDLOOP.
FORM ORGANIZE_UPLOADED_DATA .
SORT ITAB1 BY ROW
COL.
LOOP AT ITAB1.
CASE ITAB1-COL.
....................................................
WHEN 1.
ITAB-LIFNR = ITAB1-VALUE.
WHEN 2.
ITAB-KTOKK = ITAB1-VALUE.
WHEN 3.
ITAB-NAME1 = ITAB1-VALUE.
WHEN 4.
ITAB-SORTL = ITAB1-VALUE.
WHEN 5.
ITAB-LAND1 = ITAB1-VALUE.
WHEN 6.
ITAB-SPRAS = ITAB1-VALUE.
....................................................
ENDCASE.
AT END OF ROW.
APPEND ITAB.
CLEAR ITAB.
ENDAT.
ENDLOOP.
ENDFORM. " ORGANIZE_UPLOADED_DATA
if helpful reward points
2007 May 07 1:21 PM
When i call FM 'ALSM_EXCEL_TO_INTERNAL_TABLE', the data is coming into an internal table having 3 columns (row, column and value). So again i need to move data into the required internal table.. but i want data to directly come into the required internal table.
2007 Oct 30 11:35 AM
Hi Gautham,
Did you get any solution for this issue. B'coz i am also facing same problem.Plz let me know th solution if you have.
Thank you...
Regards.
Srikanth T.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |