07-18-2006 5:43 PM
Hi All,
I am using BDC program to Create PGI automatically from custom development program for CASHTILL . In Vl02n there is one Custom development screen '9999', it will be called when press POSTGOODSISSUE button in VL02n. I am filling this screen also Using BDC. This custom screen is called in USEREXIT SAPMV50A include mv50afz1 in USEREXIT_SAVE_DOCUMENT_PREPARE. This code will update one Custome Table.
Problem is when i run BDC it's updatting the custom table,but it's not creating PGI,but when i run the secondtime my BDC program it's creating PGI. Please help me why i am getting this error? I pasted my code here,
REPORT YVL.
DATA T_CODE(10) TYPE C VALUE 'VL02N'.
DATA: T_BDCDATA TYPE STANDARD TABLE OF BDCDATA WITH HEADER LINE.
DATA: h_bdcdata TYPE STANDARD TABLE OF BDCDATA WITH HEADER LINE.
DATA : L_DATE(10) TYPE C,
L_DATE1(10) TYPE C.
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
DATE_INTERNAL = SY-DATUM
IMPORTING
DATE_EXTERNAL = L_DATE1
EXCEPTIONS
DATE_INTERNAL_IS_INVALID = 1
OTHERS = 2.
perform bdc_dynpro using 'SAPMV50A' '4004'.
perform bdc_field using 'BDC_CURSOR'
'LIKP-VBELN'.
perform bdc_field using 'BDC_OKCODE'
'=WABU_T'.
perform bdc_field using 'LIKP-VBELN'
'80003504'.
perform bdc_dynpro using 'SAPLZSD_PROOF_DELIV' '9999'.
perform bdc_field using 'BDC_CURSOR'
'ZSD_PROOF_DELIV-NAME_LAST'.
perform bdc_field using 'ZSD_PROOF_DELIV-NAME_FIRST'
'cash'.
perform bdc_field using 'ZSD_PROOF_DELIV-NAME_LAST'
'sales'.
perform bdc_field using 'ZSD_PROOF_DELIV-YSDATE'
L_DATE1.
perform bdc_field using 'ZSD_PROOF_DELIV-YSTIME'
'11:14:01'.
perform bdc_field using 'BDC_OKCODE'
'=WABU_T'.
COMMIT WORK.
CALL TRANSACTION T_CODE USING t_bdcdata.
FORM bdc_dynpro USING program dynpro.
CLEAR h_bdcdata.
h_bdcdata-program = program.
h_bdcdata-dynpro = dynpro.
h_bdcdata-dynbegin = 'X'.
APPEND h_bdcdata TO t_bdcdata.
ENDFORM. "BDC_DYNPRO
----
FORM bdc_field USING fnam fval.
CLEAR h_bdcdata.
h_bdcdata-fnam = fnam.
h_bdcdata-fval = fval.
APPEND h_bdcdata TO t_bdcdata.
ENDFORM. "BDC_FIELD
07-18-2006 5:55 PM
Did you try using SHDB, just use that to record your BDC and see if your code differs from what the system suggests.
hith
Sunil Achyut
07-18-2006 5:59 PM
At first, I would suggest you try with VL02 Tcode rather doing for enjoy transactions.
Updation of Z table should be sync with your PGI transaction. Here the INSERT/UPDATE should in PERFORM ON COMMIT so the both transaction and Z table will be in sync.
what is the error you are getting for first time execution? Do you need commit work before call transaction?
Regds
Manohar
07-18-2006 6:10 PM
Hi subha,
use commit statement at the end of your your perform.
Ankur Garg.
07-18-2006 7:01 PM
Does the delivery user exit contain a COMMIT WORK?
If it does, it may cause a problem with the BDC.
07-18-2006 7:50 PM
07-18-2006 8:08 PM
I have not worked with BDC's in many years, but I thought a COMMIT will stop the BDC. It ends the transaction.
It sounds like the first time it hits the COMMIT, it populates your custom table and ends the BDC before getting to the PGI step.
The second time the custom table is already populated and does not hit the COMMIT. This allows the BDC to continue. Just a guess.
07-18-2006 8:21 PM
Hi subha,
please try this "COMMIT WORK after the calling the VVL02'
CALL TRANSACTION T_CODE USING t_bdcdata.
COMMIT WORK.
Thanks
SY