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 problem

aris_hidalgo
Contributor
0 Likes
609

Hello guys, currently I am modifying a report that deals with BDC. My problem is I can't seem to fin where to put my code that makes the a certain field have a value of '0'. I have posted below the code. Please help me on where and what code to put. The code below has to subroutines mainly PERFORM GENERATE_BDC_ABAA and PERFORM GENERATE_BDC_DATA_ABAA. What I want is that ANEP-ANBTR and i_anbtr to have a value of 0. Thanks guys!

PERFORM GENERATE_BDC_ABAA.

FORM GENERATE_BDC_ABAA.

DATA: I_ANBTR LIKE ANEP-ANBTR.

DATA: C_ANBTR(16), C_ANBTR2(16), C_DMBTR(16).

i_anbtr = anep-anbtr.

DATA: V_MODE(1).

CLEAR IT_REC.

LOOP AT IT_REC.

*AVH

it_rec-dmbtr = '0'.

I_ANBTR = '0'.

DI_LOOP = DI_LOOP + 1.

REFRESH BDCDATA.

PERFORM GENERATE_BDC_DATA_ABAA.

V_MODE = 'E'.

CALL TRANSACTION 'ABAA' USING BDCDATA MODE V_MODE

MESSAGES INTO IT_BDCMSGCOLL.

IF SY-SUBRC EQ 0.

ADD 1 TO SUC_CTR.

PERFORM INSERT_SUCCESS_MSG.

ELSE.

READ TABLE IT_BDCMSGCOLL INDEX DI_LOOP.

MOVE IT_BDCMSGCOLL TO WA_BDCMSGCOLL.

ADD 1 TO ERR_CTR.

PERFORM INSERT_ERROR_MSG.

ENDIF.

ENDLOOP.

ENDFORM. " GENERATE_BDC_ABAA

PERFORM GENERATE_BDC_DATA_ABAA.

FORM GENERATE_BDC_DATA_ABAA.

DATA: I_ANBTR LIKE ANEP-ANBTR.

DATA: C_ANBTR(16), C_ANBTR2(16), C_DMBTR(16).

i_anbtr = anep-anbtr.

PERFORM BDC_DYNPRO USING 'SAPMA01B' '0100'.

PERFORM BDC_FIELD USING:

'BDC_OKCODE' '/00',

'ANBZ-BUKRS' 'GLOB',

'ANBZ-ANLN1' IT_REC-ANLN1,

'ANBZ-ANLN2' IT_REC-ANLN2,

'ANEK-BLDAT' IT_REC-BLDAT,

'ANEK-BUDAT' IT_REC-BUDAT,

'ANBZ-PERID' IT_REC-PERID,

'ANBZ-BWASL' IT_REC-BWASL.

*AVH

it_rec-dmbtr = '0'.

I_ANBTR = '0'.

PERFORM BDC_DYNPRO USING 'SAPMA01B' '0110'.

PERFORM BDC_FIELD USING:

'BDC_OKCODE' '/00',

'ANBZ-DMBTR' IT_REC-DMBTR,

'ANBZ-BZDAT' IT_REC-BUDAT,

'ANEK-SGTXT' IT_REC-SGTXT.

*AVH

I_ANBTR = '0'. "IT_REC-DMBTR * -1.

C_ANBTR = I_ANBTR.

it_rec-dmbtr = '0'.

perform bdc_dynpro using 'SAPMA01B' '0285'. " '0600'.

perform bdc_field using 'BDC_CURSOR'

'ANEP-ANBTR'.

perform bdc_field using 'BDC_OKCODE'

'=AUSF'.

PERFORM BDC_DYNPRO USING 'SAPMA01B' '0285'. " '0600'.

PERFORM BDC_FIELD USING:

'BDC_CURSOR' 'ANEP-ANBTR',

'BDC_OKCODE' '=AUSF'.

*AVH

it_rec-dmbtr = '0'.

I_ANBTR = '0'.

PERFORM BDC_DYNPRO USING 'SAPMA01B' '0110'.

PERFORM BDC_FIELD USING:

'BDC_OKCODE' '=UPDA',

'ANBZ-DMBTR' IT_REC-DMBTR,

'ANBZ-BZDAT' IT_REC-BUDAT,

'ANEK-SGTXT' IT_REC-SGTXT.

*AVH

it_rec-dmbtr = '0'.

I_ANBTR = '0'.

PERFORM BDC_DYNPRO USING 'SAPMA01B' '0285'. " '0600'.

PERFORM BDC_FIELD USING:

'BDC_CURSOR' 'ANEP-ANBTR',

'BDC_OKCODE' '=AUSF'.

*AVH

it_rec-dmbtr = '0'.

I_ANBTR = '0'.

PERFORM BDC_DYNPRO USING 'SAPMA01B' '0285'. " '0600'.

PERFORM BDC_FIELD USING:

'BDC_CURSOR' 'ANEP-ANBTR',

'BDC_OKCODE' '=AUSF'.

*AVH

it_rec-dmbtr = '0'.

I_ANBTR = '0'.

PERFORM BDC_DYNPRO USING 'SAPMA01B' '0110'.

PERFORM BDC_FIELD USING:

'BDC_OKCODE' '=UPDA'.

ENDFORM. " GENERATE_BDC_DATA_ABAA

4 REPLIES 4
Read only

Former Member
0 Likes
569

Hi viraylab,

Try clearing i_anbtr and then move the value 0 to i_anbtr. This should solve ur probs...

Cheers

JK

PS: Award points if this helps you...

Read only

0 Likes
569

try:

data c_btr type bbseg-wrbtr.

data btr type bseg-wrbtr.

write btr to c_btr currency 'EUR'.

write: c_btr.

Read only

0 Likes
569

Hi!

Are you sure, this BDC can change anbtr? Of course there is a variable with this name - but in your BDC it is never used.

ANBTR is found 4 times (in screen 285) in the BDC, but always just as 'place cursor in field' anbtr information. There is no value assignment to this field. I did not look at transaction ABAA, so I don't know if this field can be changed manually. If so, make a new recording (or add the field filling direct in your report).

Regards,

Christian

Read only

0 Likes
569

hi

in your code

PERFORM BDC_DYNPRO USING 'SAPMA01B' '0285'. " '0600'.

PERFORM BDC_FIELD USING:'BDC_CURSOR' 'ANEP-ANBTR',

comments:

      • set here the code for i_anbtr to zero as the cursor is on 'ANEP-ANBTR' before the ok_code.

'BDC_OKCODE' '=AUSF'.

*AVH

it_rec-dmbtr = '0'.

I_ANBTR = '0'.

1.u hav initialised more than i_anbtr almost four(than required ) in the code to zero this is causing u confusion .

2.first use only one value i.e i_anbtr to zero at the given location i.e set the code when the cursor is at 'ANEP-ANBTR'.

3.place a break point near that .

4. run the transaction and check the value .

i think this should give u the clear picture .

regards,

vijay.