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: 

Problem with Two Selection Screen to run BDC

Former Member
0 Kudos

Hi All,

My requirement is:

<b>step1:</b> i have to create a selection screen for 2 fields

<b>step2:</b>i need to display the output on screen (Basic Output List)

<b>step3:</b>There i have to place a Push Button on Application Tool bar (Named as Transfer)

<b>step4:</b>after clicking the push button it is going to run the BDC program.

<b>step5:</b>we want to display the another selection screen for BDC

<b>step6:</b>here i want to transfer data from one Storage Location to another SLoc through T-code.

<b>step7:</b>at last we have to display no. of error records and successful records.

Normal Report program only.

When i am going to do the program it is displaying two selection screens at a time.

i succeeded for displaying the basis output list and clicking of push button.

from there on wards how i can do the BDC for remaining part

Could you please explain with suitable Example.

i would appreciate an early reply from you

Regards

Prabhakar

9 REPLIES 9

naimesh_patel
Active Contributor
0 Kudos

Hello,

When you define a selection screen, define as

selection-screen begin of screen 100 as subscreen.

Youwhen you want to call the selection screen use

CALL SELECTION-SCREEN 100 STARTING AT 20 5.

regards,

Naimesh

0 Kudos

Hi Nimesh

I don't want to display the 2 selection screens on the same screen by defining it as subscreen.

i want to display the output for first selection screen after that wheh i click the Transfer button it should display another selection screen(BDC selection-screen)

i hope you could understand the same

Regards

Prabhakar

0 Kudos

Hello Prabhakara,

if you define as a subscreen it will not be displayed on the mail selection screen.

You have to call it by

CALL SELECTION-SCREEN 100. where ever you want that screen.

Regards,

Naimesh

former_member181962
Active Contributor
0 Kudos

Hi Prabhakar,

I Think you mis understood Naimesh's post.

1) Enter data in first selection screen and run.

2) Basic list display.Press Transfer.

Write the code call selection-screen '0100' in at user-command section.

3) The above statement calls the 2nd selection screen for the bdc.

4) When he continues from there,

populate the bdc data structures and call the transaction.

REgards,

Ravi

0 Kudos

Now i clear

please explain how i have to perform BDC for the above requirement

Could you please explain in brief / Example

Regards

Prabhakar

0 Kudos

see this example.

http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm

IN Your case you need to fill the bdc structures in the PAI section of the 2nd selection screen.

Regards,

ravi

0 Kudos

Hello Prabhakara,

After calling 2nd screen, check sy-subrc .

if sy-subrc = 0, then user has pressed Ok or enter. Check parameter for name is not initial and do the processing of the BDC.

Regards,

Naimesh

0 Kudos

I am very much thankful to all

now i am going to develop the same, if once i succeeded then i can close the thread. hope i will get the same cooperation in future also

Regards

Prabhakar

0 Kudos

Hi Prabhakar,

Whenever you do a BDC recording and create a program to handle BDC, an include BDCRECX1 is added automatically in the program. It contains the code for processing BDC.

In the include, you have code for subroutines like BDC_DYNPRO,BDC_FIELD. And in the main program , you have to call these functions in order to perform BDC.

Since your requirement is to do BDC processing when an event occurs, you have to hard code it.

Copy paste the code for BDC_DYNPRO and BDC_FIELD like this in the screen like this.

FORM bdc_dynpro USING program

dynpro.

CLEAR bdcdata.

bdcdata-program = program.

bdcdata-dynpro = dynpro.

bdcdata-dynbegin = 'X'.

APPEND bdcdata.

ENDFORM. " bdc_dynpro

&----


*& Form bdc_field

&----


  • text

----


  • -->P_0075 text

  • -->P_0076 text

----


FORM bdc_field USING fnam

fval.

DATA : nodata VALUE '/'.

IF fval <> nodata.

CLEAR bdcdata.

bdcdata-fnam = fnam.

bdcdata-fval = fval.

APPEND bdcdata.

ENDIF.

ENDFORM.

So what you have to do is

1) First do the BDC recording using SHDB and create a program , which contains automatically generated code for the recording.

2) In the previous program where you need to code for BDC handling corresponding to events, just copy paste the code in the newly created program like

perform bdc_dynpro using 'SAPLMGMM' '0060'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MATNR'.

3) If you want the processing to be in foreground ,

write the statement

ws_mode = 'A'.

CALL TRANSACTION 'MM02' USING bdcdata MODE ws_mode

MESSAGES INTO messtab.

(In this case , the transaction is MM02).

This will work.

Regards,

SP.