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

PROBLEM IN BDC FOR WHILE CREATING PGI

Former Member
0 Likes
1,229

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

7 REPLIES 7
Read only

Former Member
0 Likes
969

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

Read only

Manohar2u
Active Contributor
0 Likes
969

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

Read only

Former Member
0 Likes
969

Hi subha,

use commit statement at the end of your your perform.

Ankur Garg.

Read only

0 Likes
969

Does the delivery user exit contain a COMMIT WORK?

If it does, it may cause a problem with the BDC.

Read only

0 Likes
969

Yes, It's having COMMIT Statement in the USEREXIT.

Read only

0 Likes
969

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.

Read only

Former Member
0 Likes
969

Hi subha,

please try this "COMMIT WORK after the calling the VVL02'

CALL TRANSACTION T_CODE USING t_bdcdata.

COMMIT WORK.

Thanks

SY