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: 

How to handle screen changes in bdc

Former Member
0 Kudos
349

Hi all,

I have a requirement where i need to create contract using transaction ME31k using BDC. The problem is that the screen sequences and infact the screen appearance is dependent on the Agreement type that is specified in the initial screen.

How can i handle this? Please help me.

Thanks & Regards,

Lakshmi

1 ACCEPTED SOLUTION

Former Member
0 Kudos
151

Hi,

If I understand correctly, for each agreement type you will be going through seperate screens. The example code above tells you how to create the bdc table.

However to determine what screens you will call, you will need to know the agreement type that you will be recording so that you know what screens to call (and hence to put in the bdc table).

Are you doing a file upload followed by BDC? If the agreement type is indicated by the file, then you will be able to map out what screens to use based on that.

Regards,

Guan

8 REPLIES 8

Former Member
0 Kudos
151

hi Lakshimi

First record your transaction based on all the Agreement Type in separate programs.

Then create a custom program based on the aggrement type i.e the call the required screen for the particular aggrement type. the screen will be called using

perform bdc_dynpro

for ex.

perform bdc_dynpro using 'SAPLMGMM' '0060'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MTART'.

perform bdc_field using 'BDC_OKCODE'

'=AUSW'.

perform bdc_field using 'RMMG1-MATNR'

record-MATNR_001.

perform bdc_field using 'RMMG1-MBRSH'

record-MBRSH_002.

perform bdc_field using 'RMMG1-MTART'

record-MTART_003.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'MSICHTAUSW-KZSEL(01)'

record-KZSEL_01_004.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

perform bdc_field using 'MAKT-MAKTX'

record-MAKTX_005.

perform bdc_field using 'BDC_CURSOR'

'MARA-SPART'.

perform bdc_field using 'MARA-MEINS'

record-MEINS_006.

perform bdc_field using 'MARA-MATKL'

record-MATKL_007.

perform bdc_field using 'MARA-SPART'

record-SPART_008.

perform bdc_transaction using 'MM01'.

in this code it calls three screens 0060,0070 & 4004.

so based on your condition you call your screens

regards

kishore

0 Kudos
151

Hi Kishore,

Thanks for your reply. If there are only few agreement types to be considered i can maintain the screen sequence as per the condition. But I would like to know if there is any other method to follow if many values are there instead of specifying condition.

Regards,

Lakshmi

0 Kudos
151

HI lakshimi

By using BDC there is no other method for doing this.

that's why SAP has developed BAPI's for creating the contracts like BAPI_CONTRACT_CREATEFROMDATA

you have to use this for loading the data.

if you want to use BDC then there is no other choice.

regards

kishore

0 Kudos
151

Hi Kishore,

Thanks. I'll try it using BAPI as i dont want to use conditions with the hard code values.

Regards,

Lakshmi

0 Kudos
151

Hi,

The BAPI bapi_contract_createfromdata is not useful for my requirement as this is for customer contract(bapi having sales data not the required purchasing data).

I tried to search for the right bapi but couldnot find it. The contract creation should be using ME31K. Please let me know if you find the right bapi for this requirement.

Regards,

Lakshmi

Former Member
0 Kudos
152

Hi,

If I understand correctly, for each agreement type you will be going through seperate screens. The example code above tells you how to create the bdc table.

However to determine what screens you will call, you will need to know the agreement type that you will be recording so that you know what screens to call (and hence to put in the bdc table).

Are you doing a file upload followed by BDC? If the agreement type is indicated by the file, then you will be able to map out what screens to use based on that.

Regards,

Guan

Former Member
0 Kudos
151

Hi lakshmi,

Use BAPI BAPI_AGREEMENT_MAINTAIN for your requirement.

That should resolve your requirement.

Thank you.

Regards,

Karun M

0 Kudos
151

Hi Karun,

This BAPI seems to be working for my requirement as it has the necessary tables i require. Thanks for the help.

Regards,

Lakshmi