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
801

using bdc through FM. not working ,what should be entered in the elements list tell me in detail.

9 REPLIES 9
Read only

Former Member
0 Likes
776

Hi Naval,

Can you send detail of your Problum please.

Ankur Garg.

Read only

Former Member
0 Likes
776

are u passing all the fields for the BDCDATA table?

1. PROGRAM: Name of module pool program associated with the screen. Set this field only for the first record for the screen.

2. DYNPRO: Screen Number. Set this field only in the first record for the screen.

3. DYNBEGIN: Indicates the first record for the screen. Set this field to X, only for the first record for the screen. (Reset to ‘ ‘ (blank) for all other records.)

4. FNAM: Field Name. The FNAM field is not case-sensitive.

5. FVAL: Value for the field named in FNAM. The FVAL field is case-sensitive. Values assigned to this field are always padded on the right, if they are less than 132 characters. Values must be in character format.

check if the screen flow is correct. Also execute in the ALL screen mode and also debug to see where the error is occuring!

-Aarthi.

Read only

Former Member
0 Likes
776

report ZAB_PURCHASE no standard page heading line-size 255.

tables: ekko, ekpo, t100.

DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

DATA: MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

DATA: BEGIN OF T_MSG OCCURS 0.

INCLUDE STRUCTURE T100.

DATA: END OF T_MSG.

*include bdcrecx1.

*SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW.

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

PARAMETERS : Vendor like Ekko-lifnr OBLIGATORY,

Order_ty like RM06E-BSART obligatory,

Pur_org like ekko-ekorg obligatory value check,

Pur_grp like ekko-ekgrp obligatory value check,

Material like ekpo-ematn obligatory value check,

Quantity(13) type n,

Plant like ekpo-werks obligatory value check.

SELECTION-SCREEN END OF BLOCK salesblock.

*SELECTION-SCREEN END OF SCREEN 500.

*CALL SELECTION-SCREEN 500.

TOP-OF-PAGE.

WRITE :/40 'Creating Purchase Order' COLOR 4 INTENSIFIED ON INVERSE ON

.

ULINE.

FORMAT COLOR 7 INVERSE ON.

WRITE :/1(20) 'Mesaage Type',

25(20) 'Message'.

ULINE.

start-of-selection.

*perform open_group.

perform bdc_dynpro using 'SAPMM06E' '0100'.

perform bdc_field using 'BDC_CURSOR'

'EKKO-EKGRP'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'EKKO-LIFNR'

Vendor.

perform bdc_field using 'RM06E-BSART'

Order_ty.

perform bdc_field using 'RM06E-BEDAT'

'05-30-2005'.

perform bdc_field using 'EKKO-EKORG'

Pur_org.

perform bdc_field using 'EKKO-EKGRP'

Pur_grp.

perform bdc_field using 'RM06E-LPEIN'

'T'.

perform bdc_dynpro using 'SAPMM06E' '0120'.

perform bdc_field using 'BDC_CURSOR'

'EKPO-WERKS(01)'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

perform bdc_field using 'EKPO-EMATN(01)'

Material.

perform bdc_field using 'EKPO-MENGE(01)'

Quantity.

perform bdc_field using 'EKPO-WERKS(01)'

Plant.

*perform bdc_transaction using 'ME21'.

*CALL TRANSACTION 'ME21' USING BDCDATA

  • MODE 'A'

  • UPDATE 'A'

  • MESSAGES INTO MESSTAB.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

  • DEST = FILLER8

GROUP = 'ZAP3'

  • HOLDDATE = FILLER8

KEEP = 'X'

USER = SY-UNAME

  • RECORD = FILLER1

  • IMPORTING

  • QID =

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

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'ME21'

  • POST_LOCAL = NOVBLOCAL

  • PRINTING = NOPRINT

TABLES

dynprotab = BDCDATA

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

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.

end-of-selection.

loop at messtab.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = messtab-MSGID

LANG = 'EN'

NO = messtab-msgnr

V1 = messtab-MSGV1

V2 = messtab-MSGV2

V3 = messtab-MSGV3

V4 = messtab-MSGV4

IMPORTING

MSG = T_MSG

  • EXCEPTIONS

  • NOT_FOUND = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

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

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

ENDIF.

if messtab-msgtyp = 'S'.

FORMAT COLOR 5 inverse on.

elseif messtab-msgtyp = 'E'.

FORMAT COLOR 6 inverse on.

else.

FORMAT COLOR 3 inverse on.

ENDIF.

WRITE : /1(20) messtab-msgtyp ,

25(60) t_msg.

endloop.

*perform close_group.

----


  • Start new screen *

----


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR BDCDATA.

BDCDATA-PROGRAM = PROGRAM.

BDCDATA-DYNPRO = DYNPRO.

BDCDATA-DYNBEGIN = 'X'.

APPEND BDCDATA.

ENDFORM.

----


  • Insert field *

----


FORM BDC_FIELD USING FNAM FVAL.

IF FVAL <> ' '.

CLEAR BDCDATA.

BDCDATA-FNAM = FNAM.

BDCDATA-FVAL = FVAL.

APPEND BDCDATA.

ENDIF.

ENDFORM.

Read only

Former Member
0 Likes
776

Hi Naval,

Chk the prg below.But before tht u need to go to transaction shdb for recording the transactiuon u want to run ur session.Here i used MM01 transaction but the procedure is the same.

report ZBDC_SESSION no standard page heading line-size 255.

TABLES: MARA,MAKT.

DATA: BEGIN OF ITAB OCCURS 10,

MATNR LIKE MARA-MATNR,

MBRSH LIKE MARA-MBRSH,

MTART LIKE MARA-MTART,

MAKTX LIKE MAKT-MAKTX,

MEINS LIKE MARA-MEINS,

END OF ITAB.

DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

*include bdcrecx1.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

FILENAME = 'C:/H1.TXT'

FILETYPE = 'DAT'

TABLES

data_tab = ITAB

.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

GROUP = 'SESHR'

  • HOLDDATE = SY-DATUM

KEEP = 'X'

USER = SY-UNAME.

LOOP AT ITAB.

PERFORM FILL_BDCDATA.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'MM01'

TABLES

dynprotab = BDCDATA.

REFRESH BDCDATA.

ENDLOOP.

CALL FUNCTION 'BDC_CLOSE_GROUP'.

&----


*& Form FILL_BDCDATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form FILL_BDCDATA.

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

perform bdc_field using 'RMMG1-MBRSH'

ITAB-MBRSH.

perform bdc_field using 'RMMG1-MTART'

ITAB-MTART.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

perform bdc_field using 'BDC_OKCODE'

'=DEF_SAVE'.

perform bdc_field using 'MSICHTAUSW-KZSEL(01)'

'X'.

*perform bdc_field using 'MSICHTAUSW-KZSEL(01)'

  • 'X'.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'USRM1-AAUSW'.

perform bdc_field using 'BDC_OKCODE'

'=DEF_SKIP'.

perform bdc_field using 'USRM1-AAUSW'

'X'.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'USRM1-SISEL'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'USRM1-AAUSW'

'X'.

perform bdc_field using 'USRM1-SISEL'

'X'.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

'=BABA'.

perform bdc_field using 'MAKT-MAKTX'

ITAB-MAKTX.

perform bdc_field using 'BDC_CURSOR'

'MARA-MEINS'.

perform bdc_field using 'MARA-MEINS'

ITAB-MEINS.

perform bdc_field using 'MARA-MTPOS_MARA'

'NORM'.

endform. " FILL_BDCDATA

----


  • Insert field *

----


FORM BDC_FIELD USING FNAM FVAL.

IF FVAL <> SPACE.

CLEAR BDCDATA.

BDCDATA-FNAM = FNAM.

BDCDATA-FVAL = FVAL.

APPEND BDCDATA.

ENDIF.

ENDFORM.

----


  • Start new screen *

----


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR BDCDATA.

BDCDATA-PROGRAM = PROGRAM.

BDCDATA-DYNPRO = DYNPRO.

BDCDATA-DYNBEGIN = 'X'.

APPEND BDCDATA.

ENDFORM.

Reward Points for the same.

Regards,

Harini

Read only

sushant_singh
Participant
0 Likes
776

hi naval,

enter the field names of the internal table with corresponding type definition in the element list ,

ithink that will make it run properly.

regards

sushant.

Read only

Former Member
0 Likes
776

hi,

in BDC,the function modules are

BDC_OPEN_GROUP

BDC_INSERT

BDC_CLOSE_GROUP,

study these function modules,pass the parameters,

you will get it,

best of luck,

regards,

kcc

Read only

Former Member
0 Likes
776

hi naval

hope this code help u:

are u passing all the fields for the BDCDATA table?

1. PROGRAM: Name of module pool program associated with the screen. Set this field only for the first record for the screen.

2. DYNPRO: Screen Number. Set this field only in the first record for the screen.

3. DYNBEGIN: Indicates the first record for the screen. Set this field to X, only for the first record for the screen. (Reset to ‘ ‘ (blank) for all other records.)

4. FNAM: Field Name. The FNAM field is not case-sensitive.

5. FVAL: Value for the field named in FNAM. The FVAL field is case-sensitive. Values assigned to this field are always padded on the right, if they are less than 132 characters. Values must be in character format.

check if the screen flow is correct. Also execute in the ALL screen mode and also debug to see where the error is occuring!

Read only

Former Member
0 Likes
776

hi naval,

maybe it will give u a shortdump

'Unable to interpret / as a number,

so to get rid of this shortdump u should

enter any int value in that field.

Reward points if helpful.

Read only

Former Member
0 Likes
776

Try this

CALL FUNCTION 'ZFM_BDCS'

EXPORTING

  • CTU = 'X'

MODE = 'N'

UPDATE = 'A'

  • GROUP =

  • USER =

  • KEEP =

  • HOLDDATE =

  • NODATA = ' '

LIFNR_001 = EKKO-LIFNR

  • BSART_002 = 'NB'

  • BEDAT_003 = '05-29-2005'

EKORG_004 = EKKO-EKORG

EKGRP_005 = EKKO-EKGRP

  • LPEIN_006 = 'T'

WERKS_007 = EKPO-WERKS

EMATN_01_008 = EKPO-EMATN

  • TXZ01_01_009 = 'ISTENTRY'

MENGE_01_010 = ZVIKK-ZMEN

  • IMPORTING

  • SUBRC =

TABLES

MESSTAB = MESSTAB

.