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 from Mod Pool

kiran_k8
Active Contributor
0 Kudos
187

Hi Folks,

I have a ZMod Pool Program with 3 Zscreens.

from screen 2 i have to call VF11.

If VF11 is success i need to call VF02.

Currently I am dealing with calling VF11.

The data which has to be uploaded into VF11 is the data from certain creen fields of screen 2 pertaining to certain conditions.

The data from the screen fields which had satisfied specified conditions should be filled in an internal table which is used for BDC.

Do anyone of you have any program to satisfy the above said requirements.Atleast some example.

Thanks,

K.Kiran.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
116

Hi Kiran

I hope after filling the first screen, you are saving to complete VF11 transaction.

If that is the case, bring the fields of screen2 which is required for VF11 to Screen1 and in screen 2 make those fields only display.

Let me know, if you have further clarifications

Regards

MD

7 REPLIES 7

Former Member
0 Kudos
117

Hi Kiran

I hope after filling the first screen, you are saving to complete VF11 transaction.

If that is the case, bring the fields of screen2 which is required for VF11 to Screen1 and in screen 2 make those fields only display.

Let me know, if you have further clarifications

Regards

MD

Former Member
0 Kudos
116

Hi Kiran

I hope after filling the first screen, you are saving to complete VF11 transaction.

If that is the case, bring the fields of screen2 which is required for VF11 to Screen1 and in screen 2 make those fields only display.

Let me know, if you have further clarifications

Regards

MD

Former Member
0 Kudos
116

Hi Kiran,

What you can do is wait until screen 2 is also processed and populate a global internal table (global to the entire module pool).

Hence at the end of screen 2, you would have built your internal table fro updating VF11 as well as VF12 and finally, perform call transaction on VF11 and then VF12.

Wont this work?!?!?!

-Aditya

kiran_k8
Active Contributor
0 Kudos
116

Hi Folks,

Thanks to everybody.

A slight correction here.If VF11 is success i need to call VA02 and not VF12.

Coming to the point coding is more tougher i think so.I will be glad if any one here can provide me with some similar code.

One more thing is how to find vbeln with respect to the condition type so that i can go ahead with only waranty claims when dealing with va02.

thanks,

kiran.

kiran_k8
Active Contributor
0 Kudos
116

Hi Folks,

Can anyone here provide me an example of doing Concatenation for line items in VF11 and VA02 using BDC Call transaction.

K.Kiran

kiran_k8
Active Contributor
0 Kudos
116

Hi Folks,

I think it is mandatory to concatenate if we have a line item data.Am I right?

If so kindly do the necessary changes for the below so that I can upload the line item data corresponding to a VBELN.

VBELN is going to be passed from a DYNPRO.So here you can ignore the declarations of the internal table regarding the declarations regarding to that.

just help me the declaration of variables needed to concatenate the POSNR and the actual code for concatenation at the exact place..

REPORT ZAB11 NO STANDARD PAGE HEADING

LINE-SIZE 255

MESSAGE-ID ZA.

*INCLUDE BDCRECX1.

TABLES:VBRK,

VBRP,

VBAP,

ZA34T.

DATA: W_VBELN TYPE VBRK-VBELN.

DATA: BEGIN OF ITAB_BDC OCCURS 0,

VBELN LIKE VBRK-VBELN,

FKDAT LIKE VBRK-FKDAT,

POSNR LIKE VBRP-POSNR,

NETWR LIKE VBRP-NETWR,

TXFKSTA LIKE RV60A-TXFKSTA,

FAKSP LIKE VBAP-FAKSP,

KMILE LIKE VBAP-ZMENG,

OFAKSP LIKE VBAP-FAKSP,

OTHERS LIKE VBAP-ARKTX,

FLG TYPE FLAG,

END OF ITAB_BDC.

data:bdcdata like bdcdata occurs 0 with header line.

data:messtab like bdcmsgcoll occurs 0 with header line.

data:icounter type n.

data:istring type string.

START-OF-SELECTION.

IF NOT DYN9200_1-A_PRIME-MATNR IS INITIAL.

IF DYN9200_1-A_PRIME-FAKSP = 'WB'.

SELECT SINGLE POSNR FROM VBRP

INTO ITAB_BDC-POSNR

WHERE VBELN = W_VBELN AND

ARKTX = DYN9200_1-A_PRIME-MATNR.

APPEND ITAB_BDC.

ENDIF.

ENDIF.

IF NOT DYN9200_1-B_PRIME-MATNR IS INITIAL.

IF DYN9200_1-B_PRIME-FAKSP = 'WB'.

SELECT SINGLE POSNR FROM VBRP

INTO ITAB_BDC-POSNR

WHERE VBELN = W_VBELN AND

ARKTX = DYN9200_1-A_PRIME-MATNR.

APPEND ITAB_BDC.

ENDIF.

ENDIF.

IF NOT DYN9200_1-C_PRIME-MATNR IS INITIAL.

IF DYN9200_1-C_PRIME-FAKSP = 'WB'.

SELECT SINGLE POSNR FROM VBRP

INTO ITAB_BDC-POSNR

WHERE VBELN = W_VBELN AND

ARKTX = DYN9200_1-A_PRIME-MATNR.

APPEND ITAB_BDC.

ENDIF.

ENDIF.

IF NOT DYN9200_1-A_PRIME-MATNR IS INITIAL.

IF DYN9200_2-T_FAKSP = 'WB'.

SELECT SINGLE POSNR FROM VBRP

INTO ITAB_BDC-POSNR

WHERE VBELN = W_VBELN AND

ARKTX = DYN9200_1-A_PRIME-MATNR.

APPEND ITAB_BDC.

ENDIF.

ENDIF.

if NOT DYN9200_2-T_KM_OR_MILE IS INITIAL.

if DYN9200_2-T_FAKSP = 'WB'.

select SINGLE POSNR

from VBAP

into ITAB_BDC-POSNR

where VBELN = W_VBELN AND

ARKTX = 'ZAMILEAGE'.

APPEND ITAB_BDC.

endif.

endif.

if NOT DYN9200_2-OTHERS IS INITIAL.

if DYN9200_2-O_FAKSP = 'WB'.

select SINGLE POSNR

from VBAP

into ITAB_BDC-POSNR

where VBELN = W_VBELN AND

ARKTX = DYN9200_2-OTHERS.

APPEND ITAB_BDC.

endif.

endif.

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

W_VBELN.

READ TABLE ITAB_BDC INDEX 1.

loop at itab_bdc.

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

READ TABLE ITAB_BDC INDEX 1.

PERFORM BDC_FIELD USING 'RV45A-POSNR'

  • '12'.

ITAB_BDC-POSNR.

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

endloop.

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.

IF SY-SUBRC = 0.

MESSAGE E906.

ENDIF.

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.

----


  • Start new screen *

----


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR BDCDATA.

BDCDATA-PROGRAM = PROGRAM.

BDCDATA-DYNPRO = DYNPRO.

BDCDATA-DYNBEGIN = 'X'.

APPEND BDCDATA.

ENDFORM.

----


  • Insert field *

----


FORM BDC_FIELD USING FNAM FVAL.

  • IF FVAL <> NODATA.

CLEAR BDCDATA.

BDCDATA-FNAM = FNAM.

BDCDATA-FVAL = FVAL.

APPEND BDCDATA.

  • ENDIF.

ENDFORM.

Thanks,

K.Kiran.

kiran_k8
Active Contributor
0 Kudos
116

thnks