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

BDC

Former Member
0 Likes
1,724

Hi gurus,

how can i prepare the flat file in bdc for uploading the data using the BDC ...recording technique for session method....for the transaction MM01 ..can any one give me the suggetion with clear descrtiption if possible with example.... very urgent for me..

I have prepared the file but iam getting the gap(tab space) b/w the fields as more than one tab...can any one give me the suggestion for this.....

thx & regards,

rk.

Message was edited by:

ramakrishna masetty

13 REPLIES 13
Read only

Former Member
0 Likes
1,690

Hi Ramakrishna,

Here is a sample code i used for recording MM01, but I have used ~ as a seperator instead of tab space.

&----


*& Report ZCN_MM_MATMASTER_BASICVIEW

*&

&----


*&

*&

&----


REPORT zcn_mm_matmaster_basicview.

DATA: BEGIN OF it_data OCCURS 0,

mat_type LIKE mara-mtart,

ind_sec LIKE mara-mbrsh,

plant LIKE bapi_marc-plant,

stge_loc LIKE bapi_mard-stge_loc,

mat_desc LIKE makt-maktx,

base_uom LIKE mara-meins,

old_matno LIKE mara-bismt,

matl_group LIKE mara-matkl,

document LIKE mara-zeinr,

po_unit LIKE bapi_mara-po_unit,

pur_valkey LIKE bapi_mara-pur_valkey,

mfr_no LIKE bapi_mara-mfr_no,

manu_mat LIKE bapi_mara-manu_mat,

vendor_lookup(10) TYPE c,

mrp_type LIKE bapi_marc-mrp_type,

mrp_ctrler LIKE bapi_marc-mrp_ctrler,

sm_key LIKE bapi_marc-sm_key,

proc_type LIKE bapi_marc-proc_type,

sloc_exprc LIKE bapi_marc-sloc_exprc,

stge_bin LIKE bapi_mard-stge_bin,

issue_unit LIKE bapi_marc-issue_unit,

cc_ph_inv LIKE bapi_marc-cc_ph_inv,

price_ctrl LIKE bapi_mbew-price_ctrl,

val_class LIKE bapi_mbew-val_class,

moving_pr,

price_unit,

profit_ctr LIKE bapi_marc-profit_ctr,

matnr LIKE mara-matnr,

END OF it_data,

is_data LIKE it_data.

DATA: bdc_tab LIKE bdcdata OCCURS 0 WITH HEADER LINE.

DATA : g_file TYPE string.

DATA : BEGIN OF data_mat OCCURS 0,

datastring(120),

END OF data_mat.

DATA: record(500).

*******************----SELECTION SCREEN--*************************

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

PARAMETERS: p_file TYPE ibipparms-path.

PARAMETERS: r_local RADIOBUTTON GROUP radi,

r_apps RADIOBUTTON GROUP radi.

SELECTION-SCREEN END OF BLOCK b1.

*******************AT SELECTION SCREEN *********************

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

IMPORTING

file_name = p_file.

----


  • S T A R T O F S E L E C T I O N

----


START-OF-SELECTION.

g_file = p_file.

PERFORM upload USING g_file. "Upload takes the file from the presentation

PERFORM bdc_opengroup.

PERFORM bdc_processing.

PERFORM bdc_closegroup.

&----


*& Form upload

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM upload USING lv_file .

IF r_apps = 'X'.

OPEN DATASET lv_file

FOR INPUT IN TEXT MODE

ENCODING DEFAULT.

IF sy-subrc <> 0.

WRITE: / text-002, sy-subrc.

STOP.

ELSE.

DO.

READ DATASET lv_file INTO record.

SPLIT record AT '~' INTO

it_data-mat_type

it_data-ind_sec

it_data-plant

it_data-stge_loc

it_data-mat_desc

it_data-base_uom

it_data-old_matno

it_data-matl_group

it_data-document

it_data-po_unit

it_data-pur_valkey

it_data-mfr_no

it_data-manu_mat

it_data-vendor_lookup

it_data-mrp_type

it_data-mrp_ctrler

it_data-sm_key

it_data-proc_type

it_data-sloc_exprc

it_data-stge_bin

it_data-issue_unit

it_data-cc_ph_inv

it_data-price_ctrl

it_data-val_class

it_data-moving_pr

it_data-price_unit

it_data-profit_ctr

it_data-matnr.

APPEND it_data.

CLEAR it_data.

ENDDO.

CLOSE DATASET lv_file.

ENDIF.

ELSEIF r_local = 'X'.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = lv_file

filetype = 'ASC'

has_field_separator = '~'

header_length = 0

read_by_line = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

ignore_cerr = 'X'

replacement = '#'

  • CHECK_BOM = ' '

  • VIRUS_SCAN_PROFILE =

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

data_tab = data_mat

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

ELSE.

LOOP AT data_mat.

SPLIT data_mat-datastring AT '~' INTO

it_data-mat_type

it_data-ind_sec

it_data-plant

it_data-stge_loc

it_data-mat_desc

it_data-base_uom

it_data-old_matno

it_data-matl_group

it_data-document

it_data-po_unit

it_data-pur_valkey

it_data-mfr_no

it_data-manu_mat

it_data-vendor_lookup

it_data-mrp_type

it_data-mrp_ctrler

it_data-sm_key

it_data-proc_type

it_data-sloc_exprc

it_data-stge_bin

it_data-issue_unit

it_data-cc_ph_inv

it_data-price_ctrl

it_data-val_class

it_data-moving_pr

it_data-price_unit

it_data-profit_ctr

it_data-matnr.

APPEND it_data.

CLEAR it_data.

ENDLOOP.

ENDIF.

ENDIF.

ENDFORM. " upload

&----


*& Form bdc_opengroup

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM bdc_opengroup .

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

client = sy-mandt

group = 'Z_MAT_BASIC'

  • HOLDDATE = sy-datum

keep = 'X'

user = sy-uname

  • RECORD = FILLER1

prog = sy-cprog

EXCEPTIONS

client_invalid = 1

destination_invalid = 2

group_invalid = 3

group_is_locked = 4

holddate_invalid = 5

internal_error = 6

queue_error = 7

running = 8

system_lock_error = 9

user_invalid = 10

OTHERS = 11.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. " bdc_opengroup

&----


*& Form bdc_processing

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM bdc_processing .

LOOP AT it_data INTO is_data.

IF is_data-document <> ' '.

PERFORM dynpro USING: 'X' 'SAPLMGMM' '0060',

' ' 'BDC_OKCODE' '/00',

' ' 'RMMG1-MBRSH' is_data-ind_sec,

' ' 'RMMG1-MTART' is_data-mat_type,

'X' 'SAPLMGMM' '0070',

' ' 'BDC_OKCODE' '=ENTR',

' ' 'MSICHTAUSW-KZSEL(01)' 'X',

' ' 'MSICHTAUSW-KZSEL(02)' 'X',

'X' 'SAPLMGMM' '5004',

' ' 'BDC_OKCODE' '=SP02',

' ' 'MAKT-MAKTX' is_data-mat_desc,

' ' 'MARA-MEINS' is_data-base_uom,

' ' 'MARA-MATKL' is_data-matl_group,

' ' 'MARA-BISMT' is_data-old_matno,

'X' 'SAPLMGMM' '5004',

' ' 'BDC_OKCODE' '=BU',

' ' 'MARA-ZEINR' is_data-document.

ELSE.

PERFORM dynpro USING: 'X' 'SAPLMGMM' '0060',

' ' 'BDC_OKCODE' '/00',

' ' 'RMMG1-MBRSH' is_data-ind_sec,

' ' 'RMMG1-MTART' is_data-mat_type,

'X' 'SAPLMGMM' '0070',

' ' 'BDC_OKCODE' '=ENTR',

' ' 'MSICHTAUSW-KZSEL(01)' 'X',

'X' 'SAPLMGMM' '5004',

' ' 'BDC_OKCODE' '=BU',

' ' 'MAKT-MAKTX' is_data-mat_desc,

' ' 'MARA-MEINS' is_data-base_uom,

' ' 'MARA-MATKL' is_data-matl_group,

' ' 'MARA-BISMT' is_data-old_matno.

ENDIF.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

tcode = 'MM01'

TABLES

dynprotab = bdc_tab

EXCEPTIONS

internal_error = 1

not_open = 2

queue_error = 3

tcode_invalid = 4

printing_invalid = 5

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

refresh bdc_tab.

clear is_data.

ENDLOOP.

ENDFORM. " bdc_processing

&----


*& Form dynpro

&----


  • text

----


  • -->P_0270 text

  • -->P_0271 text

  • -->P_0272 text

----


FORM dynpro USING dynbegin name value.

CLEAR bdc_tab.

IF dynbegin = 'X'.

MOVE: name TO bdc_tab-program,

value TO bdc_tab-dynpro,

'X' TO bdc_tab-dynbegin.

APPEND bdc_tab.

ELSE.

MOVE name TO bdc_tab-fnam.

MOVE value TO bdc_tab-fval.

APPEND bdc_tab.

ENDIF.

ENDFORM. " dynpro

&----


*& Form bdc_closegroup

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM bdc_closegroup .

CALL FUNCTION 'BDC_CLOSE_GROUP'

EXCEPTIONS

not_open = 1

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

ENDFORM. " bdc_closegroup

Reward if useful.

Get back to me if you got any more doubts.

Thanks

Aneesh.

Read only

0 Likes
1,690

Hi ...thx ...for ur reply ...and can u send me a flat file example how u took and how u arranged the fields and can u send it to my id rksap2007@yahoo.com

Message was edited by:

ramakrishna

Read only

amit_khare
Active Contributor
0 Likes
1,690

Welcome to SDN.

How about using BAPI instead of BDC for more flexibility.

Check the blog & the thread -

/people/kathirvel.balakrishnan2/blog/2006/05/08/data-upload-into-sap-from-microsoft-excel-150-abap-part

Regards,

Amit

Reward all helpful replies.

Read only

Former Member
0 Likes
1,690

for mm01 transaction it is very difficult work with bdc

so it is best to use bapi to upload data into mm01 transaction code

Read only

0 Likes
1,690

canu send me an example how can i do that ....with explanation

thx & Regards,

rk

Read only

0 Likes
1,690

Hi,

For Material master, it would be good to use LSMW with the foll.

Object 0020 Material master

Method 0000

Program Name RMDATIND

Program Type D Direct Input

Read only

0 Likes
1,690

hii,

can u give me any idea thru BDC ...bcoz...i need it very urgent in BDC only..

Read only

Former Member
0 Likes
1,690

Prepare ur internal table as like what are the fields in your file,

let us assume like your file has material no,material type,industrial sector,material description,unit of measure,material group.i mean you are selecting only one view is basic data. your file is tab limited.

  • Internal table is

data : begin of i_data occurs 0,

matnr(18) type c,

mbrsh(1) type c,

mtart(4) type c,

maktx(40) type c,

meins(3) type c,

maktl(3) type c,

end of i_data.

use this internal table in fm like GUI_UPLOAD or WS_UPLOAD,now you will get exact values.

Populate these value into bdcdata.

Reward Points if it is helpful

Thanks

Seshu

Read only

Former Member
0 Likes
1,690

hi,

for MM01 it's better to use DIrect Input method.

example using BDC Recording:

TABLES : IBIPPARMS.

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

*& Types

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

TYPES : BEGIN OF TY_ITAB,

MATNR TYPE MATNR, "MATERIAL NO

WERKS TYPE WERKS, "PLANT

STLAN TYPE STLAN, "BOM USAGE

DATUV TYPE DATUV, "VALID DATE

BMENG TYPE BMENG, "BASE QUANTITY

IDNRK TYPE IDNRK, "COMPONENT

MENGE TYPE RC29P-MENGE, "QUANTITY

MEINS TYPE MEINS, "UNIT

POSTP TYPE POSTP, "ITEM CATEGORY

END OF TY_ITAB.

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

*& DATA Declaration

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

DATA : IT_ITAB TYPE TABLE OF TY_ITAB WITH HEADER LINE.

DATA : IT_BDCDATA TYPE TABLE OF BDCDATA WITH HEADER LINE.

DATA : IT_BDCMSGCOLL TYPE TABLE OF BDCMSGCOLL WITH HEADER LINE.

DATA : P_FILE1 TYPE STRING ,"FILE NAME

V_LINES TYPE I.

DATA : IT1_ITAB like IT_ITAB occurs 0 with header line.

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

*& SELECTION-SCREEN DECLARATION

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

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

PARAMETERS : P_FILE TYPE LOCALFILE OBLIGATORY."FILE NAME

SELECTION-SCREEN END OF BLOCK B1 .

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

  • AT-SELECTION-SCREEN DECALRATION *

  • *

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

----


AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

----


clear : P_FILE.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

IMPORTING

FILE_NAME = P_FILE.

IF P_FILE IS NOT INITIAL.

  • VALIDATE FILE TYPE

PERFORM SUB_VALIDATE_txt_TYPE.

ENDIF.

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

  • START-OF-SELECTION

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

start-of-selection.

perform upload.

perform bdc.

&----


*& Form upload

&----


FORM upload .

clear : P_FILE1.

P_FILE1 = P_FILE.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = P_FILE1

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = IT_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.

endif.

ENDFORM. " upload

form bdc.

*COPY DATA FROM IT_ITAB INTO IT_ITAB1

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

IT1_ITAB[] = IT_ITAB[].

*IF SY-SUBRC <> 0 OR IT_ITAB IS INITIAL.

    • UNABLE TO UPLOAD DATA FROM FLAT FILE

*MESSAGE I003(ZMSG).

*ENDIF.

&----


*& Form bdc

&----


LOOP AT IT_ITAB.

REFRESH IT_BDCDATA .

*FIRST SCREEN

perform bdc_dynpro using 'SAPLCSDI' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RC29N-DATUV'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RC29N-MATNR'

IT_ITAB-MATNR.

perform bdc_field using 'RC29N-WERKS'

IT_ITAB-WERKS.

perform bdc_field using 'RC29N-STLAN'

IT_ITAB-STLAN.

perform bdc_field using 'RC29N-DATUV'

IT_ITAB-DATUV.

*SECOND SCREEN

perform bdc_dynpro using 'SAPLCSDI' '0110'.

perform bdc_field using 'BDC_CURSOR'

'RC29K-BMENG'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RC29K-BMENG'

IT_ITAB-BMENG.

perform bdc_field using 'RC29K-STLST'

'1'.

*THIRD SCREEN

LOOP AT IT1_ITAB WHERE MATNR = IT_ITAB-MATNR.

perform bdc_dynpro using 'SAPLCSDI' '0111'.

perform bdc_field using 'BDC_CURSOR'

'RC29K-LABOR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPLCSDI' '0140'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-POSTP(02)'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

*perform bdc_field using 'RC29P-IDNRK(01)'

  • IT_ITAB-IDNRK.

perform bdc_field using 'RC29P-IDNRK(SY-TABIX)'

IT_ITAB-IDNRK.

perform bdc_field using 'RC29P-IDNRK(02)'

'100017'.

perform bdc_field using 'RC29P-MENGE(SY-TABIX)'

IT_ITAB-MENGE.

perform bdc_field using 'RC29P-MENGE(02)'

'200'.

perform bdc_field using 'RC29P-MEINS(SY-TABIX)'

IT_ITAB-MEINS.

perform bdc_field using 'RC29P-MEINS(02)'

'kg'.

perform bdc_field using 'RC29P-POSTP(SY-TABIX)'

IT_ITAB-POSTP.

perform bdc_field using 'RC29P-POSTP(02)'

'l'.

ENDLOOP.

perform bdc_dynpro using 'SAPLCSDI' '0130'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-POSNR'.

perform bdc_field using 'RC29P-POSNR'

'0010'.

perform bdc_field using 'RC29P-IDNRK'

'100012'.

perform bdc_field using 'RC29P-MENGE'

'150'.

perform bdc_field using 'RC29P-MEINS'

'KG'.

perform bdc_dynpro using 'SAPLCSDI' '0131'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-POTX1'.

perform bdc_field using 'RC29P-SANKA'

'X'.

perform bdc_dynpro using 'SAPLCSDI' '0130'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-POSNR'.

perform bdc_field using 'RC29P-POSNR'

'0020'.

perform bdc_field using 'RC29P-IDNRK'

'100017'.

perform bdc_field using 'RC29P-MENGE'

'200'.

perform bdc_field using 'RC29P-MEINS'

'KG'.

perform bdc_dynpro using 'SAPLCSDI' '0131'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-POTX1'.

perform bdc_field using 'RC29P-SANKA'

'X'.

perform bdc_dynpro using 'SAPLCSDI' '0140'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-POSNR(01)'.

perform bdc_field using 'BDC_OKCODE'

'=FCBU'.

CALL TRANSACTION 'CS01' USING IT_BDCDATA MODE 'N'

UPDATE 'S'

MESSAGES INTO IT_BDCMSGCOLL.

CLEAR IT_ITAB.

ENDLOOP.

endform.

&----


*& Form SUB_VALIDATE_TXT_TYPE

&----


FORM SUB_VALIDATE_txt_TYPE .

DATA : STR1 TYPE LOCALFILE,

STR2 TYPE CHAR3.

SPLIT P_FILE AT '.' INTO STR1 STR2.

TRANSLATE STR2 TO LOWER CASE.

IF STR2 NE 'txt'.

  • please enter '.txt' file format

MESSAGE I001(ZMSG).

LEAVE LIST-PROCESSING.

ENDIF.

ENDFORM. " SUB_VALIDATE_TXT_TYPE

&----


*& Form bdc_dynpro

&----


FORM bdc_dynpro USING PROGRAM DYNPRO.

CLEAR IT_BDCDATA.

IT_BDCDATA-PROGRAM = PROGRAM.

IT_BDCDATA-DYNPRO = DYNPRO.

IT_BDCDATA-DYNBEGIN = 'X'.

APPEND IT_BDCDATA.

ENDFORM. " bdc_dynpro

&----


*& Form bdc_field

&----


FORM bdc_field USING FNAM FVAL.

CLEAR IT_BDCDATA. .

IT_BDCDATA-FNAM = FNAM.

IT_BDCDATA-FVAL = FVAL.

APPEND IT_BDCDATA.

ENDFORM. " bdc_field

Flat file:

Maintain flatfile with internal table fileds.

Read only

0 Likes
1,690

Hi,

can u send me clear description.....for this how u r doing in this...i need its very urgent ..if posible mail me with flat file what u have taken....rksap2007@yahoo.com

thx & Regards,

rk

Message was edited by:

ramakrishna

Read only

Former Member
0 Likes
1,690

hi,

After recording, create an excel file with mandatory fields for which u create internal table structure. provide the column width exactly what is declared in sap table for each field. 'Save' as excel file & 'Save As' in Formatted Text(space delimited) format -->it will save as" .prn" file. this file must be given while executing the BDC program.

Example:

REPORT ZK_BDC_MM01 NO STANDARD PAGE HEADING LINE-SIZE 255.

INCLUDE BDCRECX1.

DATA: BEGIN OF ITAB occurs 0,

MATNR LIKE MARA-MATNR,

MAKTX LIKE MAKT-MAKTX,

END OF ITAB.

START-OF-SELECTION.

PERFORM GET-DATA.

PERFORM OPEN_GROUP.

LOOP AT ITAB.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0060'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'RMMG1-AENNR'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_FIELD USING 'RMMG1-MATNR'

ITAB-MATNR. " '100-10'.

PERFORM BDC_FIELD USING 'RMMG1-MBRSH'

'F'.

PERFORM BDC_FIELD USING 'RMMG1-MTART'

'FGTR'.

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)'

'X'.

  • PERFORM BDC_DYNPRO USING 'SAPLSHL2' '1600'.

  • PERFORM BDC_FIELD USING 'BDC_CURSOR'

  • 'HELP_INFO-DYNPPROG'.

  • PERFORM BDC_FIELD USING 'BDC_OKCODE'

  • '=TCAL'.

  • PERFORM BDC_DYNPRO USING 'SAPLSHL2' '1600'.

  • PERFORM BDC_FIELD USING 'BDC_CURSOR'

  • 'HELP_INFO-DYNPPROG'.

  • PERFORM BDC_FIELD USING 'BDC_OKCODE'

  • '=TCAL'.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4004'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_FIELD USING 'MAKT-MAKTX'

ITAB-MAKTX. " 'maaza'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'MARA-MEINS'.

PERFORM BDC_FIELD USING 'MARA-MEINS'

'EA'.

PERFORM BDC_FIELD USING 'MARA-MTPOS_MARA'

'NORM'.

PERFORM BDC_DYNPRO USING 'SAPLSPO1' '0300'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=YES'.

PERFORM BDC_TRANSACTION USING 'MM01'.

REFRESH BDCDATA.

ENDLOOP.

PERFORM CLOSE_GROUP.

&----


*& Form GET-DATA

&----


  • text

----


FORM GET-DATA .

CALL FUNCTION 'UPLOAD'

EXPORTING

CODEPAGE = ' '

FILENAME = ' '

FILETYPE = ' '

TABLES

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

ENDFORM. " GET-DATA

Read only

0 Likes
1,690

HI,

Canu tell me the idea how can i select the Accounting view in that list ...give an idea..

Read only

Former Member
0 Likes
1,690

Hi,

If you are creating the flatfile in notepad you should create your flat file with single tab in between the fields.

If you field having length 8 then your value contains only 4 values give space for remaining 4 values as blank.

I think u get this point clearly.Make sure all the field should be given with a single tab.

Dont forget to give space for filling up the default value.

Take for e.g your pernr field have 8 characters length the your flat file value having only 4 values for e.g 4444.

Then you should give value like this "4444 " That is after enterign the value give 4 space and a single tab.

First find out the length of each and every field and give space to empty values according to the lenght of the field.

Make sure you wont give additional space.

Thanks,

Sakthi

*Rewards if usefull*