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: 

Problem in BDC

Former Member
0 Kudos
299

Hi all,

Im facing a problem in uploading a file from presentation server to SAP.

The program was coded to upload the file using Function module "UPLOAD".

I know this FM is obsolete,,but still my client uses the same system.

When I check it in debugging..it shows some bytes have been trasfered..but when checkd the internal table..the internal table does nt contain any data..its getting some junk value like " ÿþI "

Pls help me to understand why its getting the error.

Thanks in advance.

Rgs,

Priya

Moderator message: please use more descriptive subject lines from now on.

Edited by: Thomas Zloch on Sep 13, 2010 1:24 PM

19 REPLIES 19

SimoneMilesi
Active Contributor
0 Kudos
197

You cannot change the report using GUI_UPLOAD?

I suspect your problem is due by the FM itself.

I never heard about FM UPLOAD (the oldest i used was WS_UPLOAD).

0 Kudos
197

Hi Simone,

Thanks for your reply!

Ofcourse I can change it to gui_upload.

But my requirement is just to investigate why the internal table is nt populated.

The system is of 4.6 version.

Any idea why the internal table hasnt getting populated?

Any idea pls share....

Thnxs

Priya

Former Member
0 Kudos
197

Hi Priya,

Please check the file if the data is correct, then check with the file extension which is used for the file and the type mentioned in the pop-up window provided by the Upload FM are same.

Former Member
0 Kudos
197

Hi,

The data_tab parameter is sufficient enough to pass the data to SAP. Check if the table type you pass to this parameter is of type c.

Sujay

0 Kudos
197

Hi,

Here is how the itnternal table has been declared.

data: begin of t_itab occurs 0,
        BUKRS like BKPF-BUKRS,            "  4
        BLDAT(10) TYPE C,                 " 10
        budat(10) type c,                 " 10
        HKONT LIKE BSEG-HKONT,            " 10
        SHKZG LIKE BSEG-SHKZG,            " 1
        WRBTR(14) type c, "bseg-WRBTR,    " 14
        KOSTL LIKE BSEG-KOSTL,            " 10
        SGTXT LIKE BSEG-SGTXT,            " 50
      end of t_itab.

CALL FUNCTION 'UPLOAD'
     EXPORTING
*   CODEPAGE                      = ' '
      FILENAME                      = 'C:\WINDOWS\DESKTOP\UPLOADst.txt'
      FILETYPE                      = 'ASC'
*   ITEM                          = ' '
*   FILEMASK_MASK                 = ' '
*   FILEMASK_TEXT                 = ' '
*   FILETYPE_NO_CHANGE            = ' '
*   FILEMASK_ALL                  = ' '
*   FILETYPE_NO_SHOW              = ' '
*   LINE_EXIT                     = ' '
*   USER_FORM                     = ' '
*   USER_PROG                     = ' '
*   SILENT                        = 'S'
* IMPORTING
*   FILESIZE                      =
*   CANCEL                        =
*   ACT_FILENAME                  =
*   ACT_FILETYPE                  =
    TABLES
      data_tab                      = t_itab
* EXCEPTIONS
*   CONVERSION_ERROR              = 1
*   INVALID_TABLE_WIDTH           = 2
*   INVALID_TYPE                  = 3
*   NO_BATCH                      = 4
*   UNKNOWN_ERROR                 = 5
*   GUI_REFUSE_FILETRANSFER       = 6
*   OTHERS                        = 7
            .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

0 Kudos
197

Hi Priya,

Change the value of FILETYPE from ASC to DAT, it will work.

Regards

Abhii

0 Kudos
197

Hi,

In the data do you have tab delimited etc. For your current code, you should get it without gaps to make it work.

100001/01/201001/01/20102323232322H15000231000005522222India

If they will provide a delimited file,

then declare the internal table with

data: begin of t_itab occurs 0,

total(109),

end of t_itab.

Then split with in the loop into the other internal table.

Also, occurs 0 is also obsolete. You should declare a type, internal table and work area.

Sujay

0 Kudos
197

Hi Priya,

In your case you have an internal table with the fields known just change the value of FILETYPE from ASC to DAT it will definitely work.

Regards

Abhii

0 Kudos
197

Hi Abhii,

Nope it does nt work..even when i chng it to DAT.

@Sujay..yes the flat file does have any delimiter.

Have tested the FM Upload seperately in SE37..the same error im getting here also.

But Tables result..its showing 12 entries..when chkd it's showing the only one entry with junk value.

-Priya

Edited by: Priya agarwal on Sep 13, 2010 12:31 PM

0 Kudos
197

Hi,

Pass it to the internal table and delimit it after getting in the internal table. Then it should work

Sujay

0 Kudos
197

Hi,

Here is sample flat file.

IN0224.08.201024.08.20101430001   S00000000008.00IN020001  JV For August Salary
IN0224.08.201024.08.20101430001   S00000000008.00IN020003  JV For August Salary
IN0224.08.201024.08.20101430001   S00000000008.00IN020012  JV For August Salary
IN0224.08.201024.08.20101430001   S00000000008.00IN020088  JV For August Salary

There is no delimiter among the fields..earlier the same code used to work fine..

dont know where it is going wrong..

Pls suggest possilble solution..

Thnxs,

Priya

0 Kudos
197

Hi,

Same code works for me. Enable the exceptions and check if it points the problem. Copy some of the records into a new file and check if it works?

Sujay

0 Kudos
197

Hi Sujay,

The same code works fine in my system also( of ECC 6.0).

Dont know why it is not populating the internal table in 4.6, earlier which used to.

To enable the expections at this point is of no use..there is some value coming in the internal table ..(ÿþI)

--Priya

Former Member
0 Kudos
197

Hi Priya,

PFB the code snippet for uploading the data from presentation server text file into an internal table.

TYPES : BEGIN OF tp_bkpf,

bukrs TYPE bkpf-bukrs,

belnr TYPE bkpf-belnr,

END OF tp_bkpf.

DATA : t_bkpf TYPE STANDARD TABLE OF tp_bkpf,

l_file TYPE string.

PARAMETERS: p_file TYPE rlgrap-filename.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

*--Get the presentation server path of the file

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

CHANGING

file_name = p_file.

IF sy-subrc <> 0.

ENDIF.

START-OF-SELECTION.

l_file = p_file.

*--Get the file data into an internal table

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = l_file

filetype = 'ASC'

has_field_separator = 'X'

TABLES

data_tab = t_bkpf.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

(Note : in yout text file separate the fields using tab.)

Eg. 8000 1600000001

8000 1600000002

Regards,

Pranjali

0 Kudos
197

Hope you are aware of What OP is asking?

Regards

Abhii

Former Member
0 Kudos
197

Hello,

Try to remove the comment from:

  • IMPORTING

Regards,

Per Rune

kesavadas_thekkillath
Active Contributor
0 Kudos
197

@Sujay..yes the flat file does have any delimiter.

may be this is the problem.

You can try this.

declare a internal table like

data:itab type table of string.

Use this fm to get the data from the fm UPLOAD.

After this call the fm TEXT_CONVERT_XLS_TO_SAP, mark has field seperator and get the data to your itab.

In GUI_UPLOAD the interface itself has a parameter to specify whether there is any field seperator in the file.

Former Member
0 Kudos
197

try using the parameter CODEPAGE:

4110-> UTF8

1100-> ISO8859_1

1140-> ISO8859_1

1401-> ISO8859_2

1500-> ISO8859_5

1610-> ISO8859_9

1700-> ISO8859_7

1800-> ISO8859_8

1900-> ISO8859_4

8200-> ISO2022JP

8700-> ISO8859_4

0120-> Cp500

1103-> Cp850

1160-> windows-1252

1404-> Cp1250

1504-> Cp1251

1614-> Cp1254

1704-> Cp1253

1804-> Cp1255

1904-> Cp1257

8604-> Cp874

8704-> Cp1256

8000-> SJIS

8100-> EUC_JP

8300-> Big5

8600-> TIS620

0 Kudos
197

Hi,,

None of the inputs has worked out.

Just need a clarification from you that,,whether UPLOAD FM works in 4.6 envirorment or not?

Because it is working fine for same flat file in ECC 6.0..but failed in 4.6

any one pls kindly help.

Regards,

Priys