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

Former Member
0 Kudos

Hello,

I am working with BDC and I am getting error dump...

file1.txt consists of the following data with seperated tab...

1500-4322 Retail Samples Description CAR

report ZCALLTRANSACTION no standard page heading line-size 255.

                                                      • Defining the Source Internal Table

Data : BEGIN OF itab OCCURS 1,

f1 TYPE MATNR, "Material

f2 TYPE MBRSH, "Industry Sector

f3 TYPE MTART, "Material Type

f4 TYPE MAKTX, "Material Description

f5 TYPE MEINS, "Base Unit of Measure

END OF itab.

                                                  • Defining the Target Internal Table

DATA : jtab TYPE BDCDATA OCCURS 1 WITH HEADER LINE.

                                        • Upload Data from Flat file to Source Internal Table

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:\file1.txt'

FILETYPE = 'DAT'

  • HAS_FIELD_SEPARATOR = ' '

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = ITAB

  • EXCEPTIONS

  • FILE_OPEN_ERROR = 1

  • FILE_READ_ERROR = 2

  • NO_BATCH = 3

  • GUI_REFUSE_FILETRANSFER = 4

  • INVALID_TYPE = 5

  • NO_AUTHORITY = 6

  • UNKNOWN_ERROR = 7

  • BAD_DATA_FORMAT = 8

  • HEADER_NOT_ALLOWED = 9

  • SEPARATOR_NOT_ALLOWED = 10

  • HEADER_TOO_LONG = 11

  • UNKNOWN_DP_ERROR = 12

  • ACCESS_DENIED = 13

  • DP_OUT_OF_MEMORY = 14

  • DISK_FULL = 15

  • DP_TIMEOUT = 16

  • OTHERS = 17

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

*****************Verification

LOOP AT ITAB.

WRITE 😕 ITAB-F1,ITAB-F2,ITAB-F3,ITAB-F4,ITAB-F5.

ENDLOOP.

lOOP AT itab.

REFRESH JTAB.

perform bdc_dynpro using 'SAPLMGMM' '0060'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MTART'.

perform bdc_field using 'BDC_OKCODE'

'=AUSW'.

perform bdc_field using 'RMMG1-MATNR'

itab-f1.

perform bdc_field using 'RMMG1-MBRSH'

itab-f2.

perform bdc_field using 'RMMG1-MTART'

itab-f3.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'MSICHTAUSW-KZSEL(01)'

'/00'.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

perform bdc_field using 'BDC_CURSOR'

'MAKT-MAKTX'.

perform bdc_field using 'MAKT-MAKTX'

itab-f4.

perform bdc_field using 'MARA-MEINS'

itab-f5.

perform bdc_field using 'MARA-MTPOS_MARA'

'/00'.

CALL TRANSACTION 'MM01' USING JTAB MODE 'A'.

ENDLOOP.

  • Start new screen *

----


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR jtab.

jtab-PROGRAM = PROGRAM.

jtab-DYNPRO = DYNPRO.

jtab-DYNBEGIN = 'X'.

APPEND jtab.

ENDFORM.

----


  • Insert field *

----


FORM BDC_FIELD USING FNAM FVAL.

IF FVAL <> SPACE.

CLEAR jtab.

jtab-FNAM = FNAM.

jtab-FVAL = FVAL.

APPEND jtab.

ENDIF.

ENDFORM.

And what will be the difference between ASC and DAT in above program

Please do reply

4 REPLIES 4

Former Member
0 Kudos

Hi

Can you post where it is getting short dump? If you go through all Screen mode check any error message or warning message arises..

Was your bdc recording done properly.

call transaction 'MM01' using jtab mode A

update

messages into i_messages.

check if sy-subrc = 0.

check i_messages with any errors..

thanks,

chaithanya

Former Member
0 Kudos

Hi,

Your Input file data separated by tab means,

u need to pass,

HAS_FIELD_SEPARATOR = ' ' in the function module GUI_UPLOAD.

<b>'DAT'</b>

The components of the internal table are filled from the file. If the table contains several columns, the entries in the file must be separated by tabs. No conversion exits are performed.

The following applies for the different data types:

I or N or P or F

The numbers must be formatted according to the decimal representation

defined in the user settings.

D

The date must be formatted according to the date format defined in the user settings.

T

The time must be formatted as hh:mm:ss.

<b>'ASC'.</b>

The components of the internal table are filled from the file. Only data types with fixed length are allowed. The data must be contained in the file in its full length.

Regards,

Maha

0 Kudos

Hi,

I think the error is in the last instruction in your code.

Because you have

perform bdc_field using 'MARA-MTPOS_MARA'

'/00'.

that means you are sending the value '/00' to the field.

Rgrds

FC

Former Member
0 Kudos

Hi,

I hope this help you:)

You can also use the bapi 'BAPI_MATERIAL_SAVEDATA' .

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = 'C:\file1.txt'

has_field_separator = 'X' "file is TAB delimited

filetype = 'ASC'

TABLES

data_tab = itab.

IF sy-subrc <> 0.

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

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

ENDIF.

*****************Verification

LOOP AT itab.

REFRESH jtab.

PERFORM bdc_dynpro USING 'SAPLMGMM' '0060'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=AUSW'.

  • PERFORM bdc_field USING 'RMMG1-MATNR'

  • itab-f1.

PERFORM bdc_field USING 'RMMG1-MBRSH'

itab-f2.

PERFORM bdc_field USING 'RMMG1-MTART'

itab-f3.

PERFORM bdc_dynpro USING 'SAPLMGMM' '0070'.

  • PERFORM bdc_field USING 'BDC_CURSOR'

  • 'MSICHTAUSW-DYTXT(01)' 'X'.

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

PERFORM bdc_field USING 'BDC_OKCODE'

'=ENTR'.

PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(01)'

'X'.

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

PERFORM bdc_dynpro USING 'SAPLMGMM' '3005'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=BU'.

PERFORM bdc_field USING 'SKTEXT-MAKTX(01)'

itab-f4.

PERFORM bdc_field USING 'MARA-MEINS'

itab-f5.

  • PERFORM bdc_field USING 'MARA-MTPOS_MARA'

  • '/00'.

CALL TRANSACTION 'MM01' USING jtab MODE 'A'.

ENDLOOP.