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: 

User interaction in Back ground Job

Former Member
0 Kudos
306

Hi All,

I have some data extraction based on the select parameters in the selection screen. After doing some validations on those extraction data, I have some records which need to go for BDC for a particulat transaction. But user wants is, first he wants all records to display as report and once he press OK button, then all success records should go to BDC. But this will run well foreground. But he requires the same in background. How can we allow user to interact with button clicking in back ground.

Please let me know if anyone have any idea on this.

Many Thanks

raghu

1 ACCEPTED SOLUTION

Former Member
0 Kudos
194

This is practically impossible unless you implement work flow

6 REPLIES 6

Former Member
0 Kudos
195

This is practically impossible unless you implement work flow

ibrahim_u
Active Participant
0 Kudos
194

at user-command.
  case sy-ucomm.
      when 'BDC'.
        data: bdcdata    type table of bdcdata.
        data: itab       type table of bdcmsgcoll.
        data: program    like sy-repid,
              wa_bdcdata type bdcdata.

        wa_bdcdata-program  = 'YCUHD'.
        wa_bdcdata-dynpro   = '0100'.
        wa_bdcdata-dynbegin = 'X'.
        append wa_bdcdata to bdcdata.

        clear wa_bdcdata.
        wa_bdcdata-fnam     = 'YCUHED-EDB'.
        wa_bdcdata-fval     = cmik.
        append wa_bdcdata to bdcdata.

        call transaction 'YBA01'  using bdcdata mode 'N'.


  endcase.

former_member404244
Active Contributor
0 Kudos
194

Hi,

The main purpose of background is to avoid user interaction..What u can do is first dispaly an alv report with the records and then put a button on application tool bar .when he presses the button then u submit to another program where BDC was written and then u can schedule the program..that means u schedule the bdc program in background..

Regards,

Nagaraj

0 Kudos
194

HI Nag,

Thanks for the useful information.

Can you please elobarate bit more and if you have any snippet of code, it will help me very much.

Many Thanks,

Raghu.

0 Kudos
194

Hi,

First display ur report..then when the user selects the OK button...then

u write

FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

  • Check function code

CASE r_ucomm.

WHEN '&IC1'.

IF rs_selfield-fieldname = 'OK'.

submit <give the program name where u wrote the BDC> and return.

ENDIF.

ENDCASE.

Now it will call ur BDC program ....and update the tables....by BDC....

or else u can do one more thing

Record the transaction SM36 and then there pass the BDC program in the program name and then call the SM36 BDC program in ur first program instead of BDC program...Now what happens when the user selects on OK button,it will call SM36 porgram and then process ur BDC program in background...which actually meets ur requirement..ALL the best

FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

  • Check function code

CASE r_ucomm.

WHEN '&IC1'.

IF rs_selfield-fieldname = 'OK'.

submit <give the program name for recording SM36> and return.

ENDIF.

ENDCASE.

I hope u got my point..

Regards,

Nagaraj

Former Member
0 Kudos
194

you can try like this..

after finishing write statements in main report
check sy-batch.
If batch job then output goes to spool then call bdc program

if sy-batch eq 'X'.
PERFORM bdc_program.
ENDIF.

same thing you check in at user-command as well for
foreground processing.

AT USER-COMMAND.
  IF sy-batch NE 'X'.
    CASE sy-ucomm.
      WHEN 'SBDC'.        "bdc button
        PERFORM bdc_program.
        -----
        -----
        endif.