Application Development 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: 

BDC Line Item-Call transaction VF11

kiran_k8
Active Contributor
0 Kudos

Hi Folks,

Can anyone here pprovide me an ex with code for uploading data into VF11.

Thanks,

K.Kiran.

14 REPLIES 14

Former Member
0 Kudos

Hi Kiran,

Instead of writing a program using BDC you could use transaction SCAT (CATT) or STWBM (eCatt in higher releases) to do the job.

Regards,

John.

0 Kudos

John,

Can you please let me know more details regarding SCATT.

K.Kiran.

0 Kudos

Kiran,

The SAP Help is an excellent starting point. For 2004s the link is:

http://help.sap.com/saphelp_nw2004s/helpdata/en/d4/80023c59698908e10000000a11402f/frameset.htm

Regards,

John.

kiran_k8
Active Contributor
0 Kudos

John,

Can you please provide me the code for VF11 using call transcation and not using CATT.

K.Kiran

Former Member
0 Kudos

Kiran,

No Kiran I can't, I don't use BDC.

If you still want to use BDC I suggest to use transaction SHDB to record VF11 and use the code generated from the recorded.

Regards,

John.

kiran_k8
Active Contributor
0 Kudos

John,

What is Code Gene?

The Req is like this.

Cancelling the Billing Document.

I am using VF11 and fields vbeln,posnr,fkdat.

when the status process changes,the items for which the status process is changed should get upload into the internal table used for this purpose.

Partly I did.Kindly Go through the code and let me know what changes needed to be made and what more to be added.

REPORT ZAB11 NO STANDARD PAGE HEADING

LINE-SIZE 255

MESSAGE-ID ZA.

INCLUDE BDCRECX1.

TABLES:VBRK,

VBAP.

DATA: BEGIN OF REC_VBRK OCCURS 0,

VBELN LIKE VBRK-VBELN,

FKDAT LIKE VBRK-FKDAT,

END OF REC_VBRK.

DATA: BEGIN OF REC_VBAP OCCURS 0,

POSNR LIKE VBAP-POSNR,

END OF REC_VBAP.

DATA: BEGIN OF ITAB_BDC OCCURS 0,

VBELN LIKE VBRK-VBELN,

FKDAT LIKE VBRK-FKDAT,

POSNR LIKE VBAP-POSNR,

END OF ITAB_BDC.

DATA:V_FILE TYPE string.

DATA: REC(200).

START-OF-SELECTION.

V_FILE = 'E:/VF.TXT'.

SELECT VBELN FKDAT INTO TABLE REC_VBRK

FROM VBRK WHERE FKDAT = SY-DATUM.

IF SY-SUBRC <> 0.

MESSAGE S265.

EXIT.

ELSE.

READ TABLE REC_VBRK INDEX 1.

SELECT POSNR INTO TABLE REC_VBAP

FROM VBAP

WHERE VBELN = REC_VBRK-VBELN.

ENDIF.

READ TABLE REC_VBRK INDEX 1.

ITAB_BDC-VBELN = REC_VBRK-VBELN.

ITAB_BDC-FKDAT = REC_VBRK-FKDAT.

APPEND ITAB_BDC.

READ TABLE REC_VBAP INDEX 1.

ITAB_BDC-POSNR = REC_VBAP-POSNR.

APPEND ITAB_BDC.

LOOP AT ITAB_BDC.

PERFORM OPEN_GROUP.

PERFORM BDC_DYNPRO USING 'SAPMV60A' '0102'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'KOMFK-VBELN(01)'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=PICK'.

PERFORM BDC_FIELD USING 'RV60A-FKDAT'

  • '2007/02/06'.

ITAB_BDC-FKDAT.

PERFORM BDC_FIELD USING 'KOMFK-VBELN(01)'

  • '19000594'.

ITAB_BDC-VBELN.

READ TABLE ITAB_BDC INDEX 1.

PERFORM BDC_DYNPRO USING 'SAPLV60P' '4413'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'%#AUTOTEXT001'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=POPO'.

PERFORM BDC_DYNPRO USING 'SAPLV60P' '0251'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'RV45A-POSNR'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=POSI'.

PERFORM BDC_FIELD USING 'RV45A-POSNR'

  • '12'.

ITAB_BDC-POSNR.

READ TABLE ITAB_BDC INDEX 1.

PERFORM BDC_DYNPRO USING 'SAPLV60P' '4413'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'%#AUTOTEXT001'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=MARK'.

PERFORM BDC_DYNPRO USING 'SAPLV60P' '4413'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'%#AUTOTEXT001'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=RUEB'.

PERFORM BDC_DYNPRO USING 'SAPMV60A' '0102'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'KOMFK-VBELN(01)'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=BACK'.

PERFORM BDC_FIELD USING 'RV60A-FKDAT'

'2007/02/06'.

PERFORM BDC_FIELD USING 'RV60A-SELKZ(01)'

'X'.

PERFORM BDC_TRANSACTION USING 'VF11'.

PERFORM CLOSE_GROUP.

CALL TRANSACTION 'VF11' USING BDCDATA

MODE 'N'

UPDATE 'S'

MESSAGES INTO MESSTAB.

ENDLOOP.

CLEAR:BDCDATA, MESSTAB,ITAB_BDC.

REFRESH:BDCDATA, MESSTAB.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = SY-MSGID

LANG = 'EN'

NO = SY-MSGNO

V1 = SY-MSGV1

V2 = SY-MSGV2

V3 = SY-MSGV3

V4 = SY-MSGV4

IMPORTING

MSG = MESSTAB

EXCEPTIONS

NOT_FOUND = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

If not able to provide the solutions kindly opine on what you interpret from the

above so that I can check the errors.

Thanks,

K.Kiran.

Former Member
0 Kudos

Kiran,

The strangest thing I notice in your program is that you are reading table VBAP (which are ORDER positions) with the key VBELN of table VBRK (which are INVOICE headers). I guess you would like to have invoice positions (which is table VBRP).

What is going wrong anyway? It is very hard to just read some coding and guessing what might go wrong....

Regards,

John.

kiran_k8
Active Contributor
0 Kudos

John,

Yeah you are right.I will correct it.

The main objective is to cancel the item level data with respect to a billing document.

At the same time kindly give me the code to extract data vbeln and fkdat from vbrp and posnr from vbap using innerjoin.

Thanks,

K.Kiran.

kiran_k8
Active Contributor
0 Kudos

John,

So I should be using vbrk and vbrp and not vbrk and vbap.right?

K.Kiran.

Former Member
0 Kudos

Hi,

You can also use the BAPI BAPI_BILLINGDOC_CANCEL for cancelling the billing document..

THanks,

Naren

kiran_k8
Active Contributor
0 Kudos

narendra,

If possible can you please give me the code.

K.Kiran.

kiran_k8
Active Contributor
0 Kudos

thnks

kiran_k8
Active Contributor
0 Kudos

thnks

kiran_k8
Active Contributor
0 Kudos

thnks