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 help

Former Member
0 Likes
818

Hi,

I am woking on an BDC report to enter data from file.

When I run the report, it does not create the output directly.

Instead I should go to SM35 and process it from there for it to create output.

My question is how can I negelect the SM35 process and I want the data to be directly created.

Thanks.

Oscar.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
791

hi for this you can use the call transaction but when ever an error occured in call transaction method that should be processed by the session method only..means through sm35

regards,

venkat

7 REPLIES 7
Read only

Former Member
0 Likes
791

Hi,

use the follwing syntax.

*****

submit RSBDCSUB and return.

*******

Regards,

Read only

0 Likes
791

Thank you... But still its scheduled in SM35..

Read only

Former Member
0 Likes
791

Hi,

submit program RSBDCSUB after closing the batch session.

This should be the final call which will then process batch sessions.


 submit rsbdcsub
    with mappe = v_group
    with z_verarb = 'X'
    with fehler = ' '
    with logall = 'X'
exporting list to memory
     and return.

Cheers,

Vikram

Read only

0 Likes
791

Its getting sceduled for background job when I use this code. And the data is not inserted.

Read only

Former Member
0 Likes
792

hi for this you can use the call transaction but when ever an error occured in call transaction method that should be processed by the session method only..means through sm35

regards,

venkat

Read only

0 Likes
791

No Venkat I should use BDC only as I need to read the errors to process it further.Thanks.

Read only

0 Likes
791

hi,

in bdc u have 2 methods.

call transaction and session method.u try to use call transaction method which will allow u to run in program itself directly when u execute instead of processing in sm35.

check this example for mb1c transaction.in the same way do for ur transaction .

report Zmm_BDC

no standard page heading line-size 255.

tables:

mseg,

mkpf.

data:begin of itab occurs 0,

bldat type mkpf-bldat, "document date

budat type mkpf-budat, "posting date

bwart type mseg-bwart, "movement type

werks type mseg-werks, "plant

lgort type mseg-lgort, "storage location,

kunnr type mseg-kunnr, "customer

matnr type mseg-matnr, "material

erfmg type c, "mseg-erfmg, "quantity

val type c,

end of itab.

data:begin of itab1 occurs 0,

line(50),

end of itab1.

data:bdcdata type bdcdata occurs 0 with header line.

call function 'GUI_UPLOAD'

exporting

filename = 'C:\Documents and Settings\reliance.RGS-1-Z21\Desktop\SRINU.TXT'

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • VIRUS_SCAN_PROFILE =

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

tables

data_tab = itab1

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

*include bdcrecx1.

*start-of-selection.

*perform open_group.

loop at itab1.

if itab1-line+0(1) = 'H'.

split itab1 at ',' into itab-val itab-bldat itab-budat itab-bwart itab-werks itab-lgort itab-kunnr.

perform bdc_dynpro using 'SAPMM07M' '0400'.

perform bdc_field using 'BDC_CURSOR'

'RM07M-LGORT'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MKPF-BLDAT'

ITAB-BLDAT.

perform bdc_field using 'MKPF-BUDAT'

ITAB-BUDAT.

perform bdc_field using 'RM07M-BWARTWA'

ITAB-BWART.

perform bdc_field using 'RM07M-WERKS'

ITAB-WERKS.

perform bdc_field using 'RM07M-LGORT'

ITAB-LGORT.

perform bdc_field using 'BDC_OKCODE'

'/00'.

*perform bdc_field using 'XFULL'

  • 'X'.

*perform bdc_field using 'RM07M-WVERS2'

  • 'X'.

perform bdc_dynpro using 'SAPMM07M' '0421'.

*perform bdc_field using 'BDC_CURSOR'

  • 'MSEG-ERFMG(01)'.

*perform bdc_field using 'BDC_OKCODE'

  • '/00'.

perform bdc_field using 'MSEGK-KUNNR'

ITAB-KUNNR.

*endif.

else. if itab1-line+0(1) = 'I'.

split itab1 at ',' into itab-val itab-matnr itab-erfmg.

perform bdc_dynpro using 'SAPMM07M' '0421'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MSEG-MATNR(01)'

ITAB-MATNR.

perform bdc_field using 'MSEG-ERFMG(01)'

ITAB-ERFMG.

*perform bdc_field using 'DKACB-FMORE'

  • 'X'.

*perform bdc_dynpro using 'SAPLKACB' '0002'.

*perform bdc_field using 'BDC_CURSOR'

  • 'COBL-GSBER'.

*perform bdc_field using 'BDC_OKCODE'

  • '=ENTE'.

*perform bdc_field using 'COBL-GSBER'

  • '1000'.

*perform bdc_dynpro using 'SAPLKACB' '0002'.

*perform bdc_field using 'BDC_CURSOR'

  • 'COBL-GSBER'.

*perform bdc_field using 'BDC_OKCODE'

  • '=ENTE'.

*perform bdc_field using 'COBL-GSBER'

  • '1000'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

endif.

endif.

*perform bdc_dynpro using 'SAPMM07M' '0421'.

*perform bdc_field using 'BDC_CURSOR'

  • 'MSEG-ERFMG(01)'.

*perform bdc_field using 'DKACB-FMORE'

  • 'X'.

*

*

*perform bdc_dynpro using 'SAPLKACB' '0002'.

*perform bdc_field using 'BDC_CURSOR'

  • 'COBL-GSBER'.

*perform bdc_field using 'BDC_OKCODE'

  • '=ENTE'.

*perform bdc_transaction using 'MB1C'.

*endif.

*perform close_group.

endloop.

call transaction 'MB1C' using bdcdata mode 'A'.

refresh bdcdata.

----


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

CLEAR BDCDATA.

BDCDATA-FNAM = FNAM.

BDCDATA-FVAL = FVAL.

APPEND BDCDATA.

  • ENDIF.

ENDFORM.