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

Regarding BDC

Former Member
0 Likes
595

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

Or is there any FM or BAPI for Invoice?

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
564

CHK BREAK POINT BOTH NO SCREEN DIPLAY MODE AND DISPLAY MODE..COMPARE.

FIND WHAT IS THE ERROR.

4 REPLIES 4
Read only

Former Member
0 Likes
565

CHK BREAK POINT BOTH NO SCREEN DIPLAY MODE AND DISPLAY MODE..COMPARE.

FIND WHAT IS THE ERROR.

Read only

0 Likes
564

Hello agian,

In both the cases, the return type is 'S' .

But when I create inscreen modes, I get the invoice number and I can see it in VF03.

While with No screens, the return is 'S' but get any invoice number.

Please help.

Read only

0 Likes
564

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,

Read only

JozsefSzikszai
Active Contributor
0 Likes
564

hi Pranu,

==> MESSAGES INTO MESSTAB.

what do you see in table messtab after the CALL TRANSACTION?

ec