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

VF01 BDC PROBLEM

Former Member
0 Likes
1,242

Hi.

I have a BDC code which runs fine using call transaction VF01 and Mode = 'A'.

But when I run it in Mode = N, its not executed. Invoice is not created.

Any idea?

I tried with other options like Update = 'S' and 'A' and 'L'.

My code is as below ::

FORM GET_OPENORDERS.

  • SELECT VBELN ERDAT VKORG LFART FROM LIKP INTO TABLE ITAB_LIKP WHERE VKORG = '3010'.

SELECT VBELN XBLNR FROM VBAK INTO TABLE ITAB_VBAK WHERE

VBELN = '0000000483'.

  • AUART = 'ZCKD' OR

  • AUART = 'ZEXS' OR

  • AUART = 'ZCLM' OR

  • AUART = 'ZISO' OR

  • VKORG = '3010' AND

  • VTWEG = '30' AND

  • SPART = '30' AND

  • ERDAT = SY-DATUM.

IF NOT ITAB_VBAK[] IS INITIAL.

SELECT VBELN VBTYP FROM VBUK INTO TABLE ITAB_VBUK FOR ALL ENTRIES IN ITAB_VBAK

WHERE

VBELN = ITAB_VBAK-VBELN AND

LFSTK = 'C' AND " DELIVERY STATUS : COMPLETED

LFGSK = 'C' AND " OVER ALLDELIVERY STATUS : COMPLETED

FKSAK NE 'C' AND " BILLING STATUS ORDER : NOT COMPLETED

VBTYP = 'C'. " DOC TYPE = ORDERS

ENDIF.

ENDFORM. " GET_OPENORDERS

&----


*& Form CREATE_INVOICE

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM CREATE_INVOICE .

LOOP AT ITAB_VBUK.

  • DO.

  • READ DATASET DATASET INTO RECORD.

  • IF SY-SUBRC <> 0. EXIT. ENDIF.

PERFORM BDC_DYNPRO USING 'SAPMV60A' '0102'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

  • '0000000464'.

ITAB_VBUK-VBELN.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_FIELD USING 'KOMFK-VBELN(01)'

ITAB_VBUK-VBELN.

  • RECORD-VBELN_01_001.

PERFORM BDC_DYNPRO USING 'SAPMV60A' '0104'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'ZESO'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=SICH'.

  • PERFORM BDC_TRANSACTION USING 'VF01'.

  • ENDDO.

WAIT UP TO 1 SECONDS.

CALL TRANSACTION 'VF01' USING BDCDATA MODE 'N'

UPDATE 'S'

MESSAGES INTO MESSTAB.

COMMIT WORK AND WAIT.

CLEAR: BDCDATA, MESSTAB.

REFRESH: BDCDATA, MESSTAB.

ENDLOOP.

  • PERFORM CLOSE_GROUP.

  • PERFORM CLOSE_DATASET USING DATASET.

loop at MESSTAB.

write : Messtab.

endloop.

ENDFORM. " CREATE_INVOICE

----


  • Start new screen *

----


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR BDCDATA.

BDCDATA-PROGRAM = PROGRAM.

BDCDATA-DYNPRO = DYNPRO.

BDCDATA-DYNBEGIN = 'X'.

APPEND BDCDATA.

ENDFORM. "BDC_DYNPRO

----


  • Insert field *

----


FORM BDC_FIELD USING FNAM FVAL.

IF FVAL <> SPACE.

CLEAR BDCDATA.

BDCDATA-FNAM = FNAM.

BDCDATA-FVAL = FVAL.

APPEND BDCDATA.

ENDIF.

ENDFORM. "BDC_FIELD

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
923

used commit work and wait.

6 REPLIES 6
Read only

Former Member
0 Likes
924

used commit work and wait.

Read only

0 Likes
923

Thanks for the reply but I am already it as in the code above.

YOur help onthis would be great .

Read only

Former Member
0 Likes
923

hi pranu,

you were used commit work and wait.

i think thats y..

Read only

0 Likes
923

Shall I use commit work and wait or not?

Read only

0 Likes
923

can any one please send me the sample program for invoice using BDC?

Read only

0 Likes
923

Hi All,

Thanks for the replies.

Just adding my comments here.

We need to do the saperate recording for this problem.

In SHDB, we have to select "Simulate Background Mode"

My problem is solved.

Adding here so that it will appear in teh search results for others....

May be.. cheers,