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

This BDC won't run

Former Member
0 Likes
617

Dear all:

This simple code here runs with normal excution (it's called from a output type directly), but when I schedule it into a background job it never run as it supposed to. Can anyone please let me know if I'm missin something major here. Thanks biggy...

code as below

-


REPORT ZRTLABELO MESSAGE-ID WJ.

INCLUDE bdcrecx1.

*TYPE-POOLS: LABEL.

TABLES: NAST.

FORM PRODUCT_LABEL USING RETURN_CODE SCREEN_FLAG.

types: begin of ty_mseg,

matnr like mseg-matnr,

werks like mseg-werks,

ebeln like mseg-ebeln,

end of ty_mseg.

data: wa_mseg type ty_mseg,

charg type charg_d,

mat_doc(10) type c,

year(4) type c,

item(4) type c.

mat_doc = nast-objky(10).

year = nast-objky+10(4).

item = nast-objky+14(4).

select single * into corresponding fields of wa_mseg from mseg

where mblnr = mat_doc

and mjahr = year

and zeile = item.

select single charg into charg from mcha

where charg = wa_mseg-ebeln.

if sy-subrc <> 0.

PERFORM OPEN_GROUP.

perform bdc_dynpro using 'SAPLCHRG' '1000'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'DFBATCH-MATNR'

wa_mseg-matnr.

perform bdc_field using 'DFBATCH-WERKS'

wa_mseg-werks.

perform bdc_field using 'DFBATCH-CHARG'

wa_mseg-ebeln.

perform bdc_dynpro using 'SAPLCHRG' '1000'.

perform bdc_field using 'BDC_OKCODE'

'=SAVE'.

perform bdc_transaction using 'MSC1N'.

PERFORM CLOSE_GROUP.

endif.

Dear all:

This simple code here runs with normal excution (it's called from a output type directly), but when I schedule it into a background job it never run as it supposed to. Can anyone please let me know if I'm missin something major here. Thanks biggy...

code as below

-


REPORT ZRTLABELO MESSAGE-ID WJ.

INCLUDE bdcrecx1.

*TYPE-POOLS: LABEL.

TABLES: NAST.

FORM PRODUCT_LABEL USING RETURN_CODE SCREEN_FLAG.

types: begin of ty_mseg,

matnr like mseg-matnr,

werks like mseg-werks,

ebeln like mseg-ebeln,

end of ty_mseg.

data: wa_mseg type ty_mseg,

charg type charg_d,

mat_doc(10) type c,

year(4) type c,

item(4) type c.

mat_doc = nast-objky(10).

year = nast-objky+10(4).

item = nast-objky+14(4).

select single * into corresponding fields of wa_mseg from mseg

where mblnr = mat_doc

and mjahr = year

and zeile = item.

select single charg into charg from mcha

where charg = wa_mseg-ebeln.

if sy-subrc <> 0.

PERFORM OPEN_GROUP.

perform bdc_dynpro using 'SAPLCHRG' '1000'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'DFBATCH-MATNR'

wa_mseg-matnr.

perform bdc_field using 'DFBATCH-WERKS'

wa_mseg-werks.

perform bdc_field using 'DFBATCH-CHARG'

wa_mseg-ebeln.

perform bdc_dynpro using 'SAPLCHRG' '1000'.

perform bdc_field using 'BDC_OKCODE'

'=SAVE'.

perform bdc_transaction using 'MSC1N'.

PERFORM CLOSE_GROUP.

endif.

3 REPLIES 3
Read only

Former Member
0 Likes
583

Can you give us your code for the form bdc_transaction? Are you checking the status of your OPEN_GROUP, bdc_transaction and CLOSE_GROUP? What do they say?

You are calling a transaction from an output, which will cause runtime errors if for some reason an error is thrown out in your call transaction.

Srinivas

Read only

Former Member
0 Likes
583

Hi,

are you passign single screen? because in your code the screnn numbers are same(1000), if so, just comment these line and do..

perform bdc_dynpro using 'SAPLCHRG' '1000'.
perform bdc_field using 'BDC_OKCODE' '=ENTR'.

this might works you,

if not just give us the code, and the error messages,

Regards

Sudheer

Read only

Former Member
0 Likes
583

Jim,

How are you getting the data for BDC? Is is coming from a file, if so where is the file - App server or Presenation server?

How are you uploading the data into internal table?

WS_UPLOAD or OPEN DATASET.

WS_UPLOAd will not work in the background mode !!

Regards,

Ravi

Note : Please reward the posts that help you.