Skip to Content
author's profile photo Former Member
Former Member

Process bdc session in Background

Hi all,

I have created a BDC Session, Now i want to process it in Foreground not in Background.

I know taht we use report RSBDCSUB for background processing but don't know the procedure for Forground.

Sugess.

Points will be sured for valuable answers.

Thanks

Sanket sethi

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 11:31 AM

    Actaully I want to know the process for Forground.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 11:32 AM

    Hi,

    if u want a session to run in foreground..then fill the bdcdata and create a session using this bdcdata...goto sm35 and from here pick the session which u have created and click on process. check the process/foreground radio button and press enter...the session will run in foreground.

    Thanks

    Vikranth

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 11:35 AM

    Hi Sanket,

    u can do it with the help of tcode SM35.

    Regards,

    S.Gangi reddy

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Saketh,

      i want u to do that i will give you the clue..

      Do bdc recording for the same of processing through session method and add it in your code (bdc recording what u have done should be in foreground) and that solve your probelm

      Reward points if useful

      regards

      sas

  • author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 11:39 AM

    hi,

    for processing the session in foreground

    see the below example i have used the session method for vendor master using excel file

    TABLES: LFA1,

    RF02K.

    TYPES: BEGIN OF TY_ITAB,

    LIFNR LIKE RF02K-LIFNR,

    KTOKK LIKE RF02K-KTOKK,

    NAME1 LIKE LFA1-NAME1,

    SORTL LIKE LFA1-SORTL,

    LAND1 LIKE LFA1-LAND1,

    SPRAS LIKE LFA1-SPRAS,

    END OF TY_ITAB.

    DATA: T_ITAB TYPE TABLE OF TY_ITAB,

    W_ITAB TYPE TY_ITAB.

    DATA: I_BDCDATA TYPE TABLE OF BDCDATA,

    WA_BDCDATA TYPE BDCDATA.

    DATA : ITAB1 LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.

    DATA: R1 TYPE I VALUE 1,

    C1 TYPE I VALUE 1,

    R2 TYPE I VALUE 4,

    C2 TYPE I VALUE 8,

    FILEPATH LIKE RLGRAP-FILENAME.

    SELECTION-SCREEN: BEGIN OF BLOCK B1.

    PARAMETERS:P_SRCFIL LIKE RLGRAP-FILENAME.

    SELECTION-SCREEN: END OF BLOCK B1.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_SRCFIL.

    PERFORM SELECT_FILE USING P_SRCFIL.

    START-OF-SELECTION.

    FILEPATH = P_SRCFIL.

    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

    EXPORTING

    FILENAME = FILEPATH

    I_BEGIN_COL = 1

    I_BEGIN_ROW = 1

    I_END_COL = 8

    I_END_ROW = 4

    TABLES

    INTERN = ITAB1

    • EXCEPTION

    • INCONSISTENT_PARAMETERS = 1

    • UPLOAD_OLE = 2

    • OTHERS = 3

    .

    IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    PERFORM ORGANIZE_UPLOADED_DATA.

    CALL FUNCTION 'BDC_OPEN_GROUP'

    EXPORTING

    CLIENT = SY-MANDT

    • DEST = FILLER8

    GROUP = 'XK01'

    • HOLDDATE = FILLER8

    KEEP = 'X'

    USER = sy-uname.

    • RECORD = FILLER1

    • PROG = SY-CPROG

    • DCPFM = '%'

    • DATFM = '%'

    LOOP AT T_ITAB INTO W_ITAB.

    PERFORM BDC_DYNPRO USING 'SAPMF02K' '0100'.

    PERFORM BDC_FIELD USING 'BDC_CURSOR'

    'RF02K-KTOKK'.

    PERFORM BDC_FIELD USING 'BDC_OKCODE'

    '/00'.

    PERFORM BDC_FIELD USING 'RF02K-LIFNR'

    W_ITAB-LIFNR.

    PERFORM BDC_FIELD USING 'RF02K-KTOKK'

    W_ITAB-KTOKK.

    PERFORM BDC_DYNPRO USING 'SAPMF02K' '0110'.

    PERFORM BDC_FIELD USING 'BDC_CURSOR'

    'LFA1-SPRAS'.

    PERFORM BDC_FIELD USING 'BDC_OKCODE'

    '/00'.

    PERFORM BDC_FIELD USING 'LFA1-NAME1'

    W_ITAB-NAME1.

    PERFORM BDC_FIELD USING 'LFA1-SORTL'

    W_ITAB-SORTL.

    PERFORM BDC_FIELD USING 'LFA1-LAND1'

    W_ITAB-LAND1.

    PERFORM BDC_FIELD USING 'LFA1-SPRAS'

    W_ITAB-SPRAS.

    PERFORM BDC_DYNPRO USING 'SAPMF02K' '0120'.

    PERFORM BDC_FIELD USING 'BDC_CURSOR'

    'LFA1-KUNNR'.

    PERFORM BDC_FIELD USING 'BDC_OKCODE'

    '/00'.

    PERFORM BDC_DYNPRO USING 'SAPMF02K' '0130'.

    PERFORM BDC_FIELD USING 'BDC_CURSOR'

    'LFBK-BANKS(01)'.

    PERFORM BDC_FIELD USING 'BDC_OKCODE'

    '=ENTR'.

    PERFORM BDC_DYNPRO USING 'SAPMF02K' '0380'.

    PERFORM BDC_FIELD USING 'BDC_CURSOR' 'KNVK-NAMEV(01)'.

    PERFORM BDC_FIELD USING 'BDC_OKCODE' '=ENTR'.

    *REFRESH I_BDCDATA.

    clear w_itab.

    CALL FUNCTION 'BDC_INSERT'

    EXPORTING

    TCODE = 'XK01'

    TABLES

    DYNPROTAB = i_bdcdata.

    REFRESH I_BDCDATA.

    ENDLOOP.

    CALL FUNCTION 'BDC_CLOSE_GROUP' .

    &----


    *& Form ORGANIZE_UPLOADED_DATA

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM ORGANIZE_UPLOADED_DATA .

    SORT ITAB1 BY ROW COL.

    LOOP AT ITAB1.

    CASE ITAB1-COL.

    WHEN 1.

    W_ITAB-LIFNR = ITAB1-VALUE.

    WHEN 2.

    W_ITAB-KTOKK = ITAB1-VALUE.

    WHEN 3.

    W_ITAB-NAME1 = ITAB1-VALUE.

    WHEN 4.

    W_ITAB-SORTL = ITAB1-VALUE.

    WHEN 5.

    W_ITAB-LAND1 = ITAB1-VALUE.

    WHEN 6.

    W_ITAB-SPRAS = ITAB1-VALUE.

    ENDCASE.

    AT END OF ROW.

    APPEND W_ITAB TO T_ITAB.

    CLEAR W_ITAB.

    ENDAT.

    ENDLOOP.

    ENDFORM. " ORGANIZE_UPLOADED_DATA

    &----


    *& Form select_file

    &----


    • text

    ----


    • -->P_P_SRCFIL text

    ----


    FORM SELECT_FILE USING P_SRCFIL.

    CALL FUNCTION 'F4_FILENAME'

    EXPORTING

    PROGRAM_NAME = SYST-CPROG

    DYNPRO_NUMBER = SYST-DYNNR

    FIELD_NAME = ' '

    IMPORTING

    FILE_NAME = P_SRCFIL

    .

    ENDFORM. " select_file

    &----


    *& Form bdc_dynpro

    &----


    • text

    ----


    • -->P_0131 text

    • -->P_0132 text

    ----


    FORM BDC_DYNPRO USING PROGRAM LIKE BDCDATA-PROGRAM DYNPRO LIKE BDCDATA-DYNPRO.

    CLEAR WA_BDCDATA.

    WA_BDCDATA-PROGRAM = PROGRAM.

    WA_BDCDATA-DYNPRO = DYNPRO.

    WA_BDCDATA-DYNBEGIN = 'X'.

    APPEND WA_BDCDATA TO I_BDCDATA.

    ENDFORM. " bdc_dynpro

    &----


    *& Form bdc_field

    &----


    • text

    ----


    • -->P_0136 text

    • -->P_0137 text

    ----


    FORM BDC_FIELD USING FNAM LIKE BDCDATA-FNAM FVAL TYPE ANY .

    CLEAR WA_BDCDATA.

    WA_BDCDATA-FNAM = FNAM.

    WA_BDCDATA-FVAL = FVAL.

    APPEND WA_BDCDATA TO I_BDCDATA.

    ENDFORM. " bdc_field

    after you execute the program you specify the file path where the flat file is located after that excute it.

    then go to the tcode sm35. there u identify the session name you have given (in the above example the session name i have given is group = 'XK01') then select the session name and then click process. then it will ask for the mode of processing whether a,e or n select it and continue .

    if there are any errors those will be created in the log file. you can check that by selecting the session name and click on log

    then you get the status

    reward if useful,

    thanks and regards

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 11:58 AM

    hi,

    if you want it to be done by program then try this which is done through program

    TABLES: LFA1,

    RF02K.

    TYPES: BEGIN OF TY_ITAB,

    LIFNR LIKE RF02K-LIFNR,

    KTOKK LIKE RF02K-KTOKK,

    NAME1 LIKE LFA1-NAME1,

    SORTL LIKE LFA1-SORTL,

    LAND1 LIKE LFA1-LAND1,

    SPRAS LIKE LFA1-SPRAS,

    END OF TY_ITAB.

    DATA: T_ITAB TYPE TABLE OF TY_ITAB,

    W_ITAB TYPE TY_ITAB.

    DATA: I_BDCDATA TYPE TABLE OF BDCDATA,

    WA_BDCDATA TYPE BDCDATA.

    DATA : ITAB1 LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.

    DATA : JOBNAME(32) TYPE C,

    JOBCOUNT(8) TYPE C.

    DATA: R1 TYPE I VALUE 1,

    C1 TYPE I VALUE 1,

    R2 TYPE I VALUE 4,

    C2 TYPE I VALUE 8,

    FILEPATH LIKE RLGRAP-FILENAME.

    SELECTION-SCREEN: BEGIN OF BLOCK B1.

    PARAMETERS:P_SRCFIL LIKE RLGRAP-FILENAME.

    SELECTION-SCREEN: END OF BLOCK B1.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_SRCFIL.

    PERFORM SELECT_FILE USING P_SRCFIL.

    START-OF-SELECTION.

    FILEPATH = P_SRCFIL.

    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

    EXPORTING

    FILENAME = FILEPATH

    I_BEGIN_COL = 1

    I_BEGIN_ROW = 1

    I_END_COL = 8

    I_END_ROW = 4

    TABLES

    INTERN = ITAB1.

    PERFORM ORGANIZE_UPLOADED_DATA.

    CALL FUNCTION 'BDC_OPEN_GROUP'

    EXPORTING

    CLIENT = SY-MANDT

    • DEST = FILLER8

    GROUP = 'XK01'

    • HOLDDATE = FILLER8

    KEEP = 'X'

    USER = SY-UNAME.

    LOOP AT T_ITAB INTO W_ITAB.

    PERFORM BDC_DYNPRO USING 'SAPMF02K' '0100'.

    PERFORM BDC_FIELD USING 'BDC_CURSOR'

    'RF02K-KTOKK'.

    PERFORM BDC_FIELD USING 'BDC_OKCODE'

    '/00'.

    PERFORM BDC_FIELD USING 'RF02K-LIFNR'

    W_ITAB-LIFNR.

    PERFORM BDC_FIELD USING 'RF02K-KTOKK'

    W_ITAB-KTOKK.

    PERFORM BDC_DYNPRO USING 'SAPMF02K' '0110'.

    PERFORM BDC_FIELD USING 'BDC_CURSOR'

    'LFA1-SPRAS'.

    PERFORM BDC_FIELD USING 'BDC_OKCODE'

    '/00'.

    PERFORM BDC_FIELD USING 'LFA1-NAME1'

    W_ITAB-NAME1.

    PERFORM BDC_FIELD USING 'LFA1-SORTL'

    W_ITAB-SORTL.

    PERFORM BDC_FIELD USING 'LFA1-LAND1'

    W_ITAB-LAND1.

    PERFORM BDC_FIELD USING 'LFA1-SPRAS'

    W_ITAB-SPRAS.

    PERFORM BDC_DYNPRO USING 'SAPMF02K' '0120'.

    PERFORM BDC_FIELD USING 'BDC_CURSOR'

    'LFA1-KUNNR'.

    PERFORM BDC_FIELD USING 'BDC_OKCODE'

    '/00'.

    PERFORM BDC_DYNPRO USING 'SAPMF02K' '0130'.

    PERFORM BDC_FIELD USING 'BDC_CURSOR'

    'LFBK-BANKS(01)'.

    PERFORM BDC_FIELD USING 'BDC_OKCODE'

    '=ENTR'.

    PERFORM BDC_DYNPRO USING 'SAPMF02K' '0380'.

    PERFORM BDC_FIELD USING 'BDC_CURSOR' 'KNVK-NAMEV(01)'.

    PERFORM BDC_FIELD USING 'BDC_OKCODE' '=ENTR'.

    CLEAR W_ITAB.

    CALL FUNCTION 'BDC_INSERT'

    EXPORTING

    TCODE = 'XK01'

    TABLES

    DYNPROTAB = I_BDCDATA.

    REFRESH I_BDCDATA.

    ENDLOOP.

    CALL FUNCTION 'BDC_CLOSE_GROUP' .

    JOBNAME = 'JOB'.

    CALL FUNCTION 'JOB_OPEN'

    EXPORTING

    • DELANFREP = ' '

    • JOBGROUP = ' '

    JOBNAME = JOBNAME

    IMPORTING

    JOBCOUNT = JOBCOUNT

    • CHANGING

    • RET =

    • EXCEPTIONS

    • CANT_CREATE_JOB = 1

    • INVALID_JOB_DATA = 2

    • JOBNAME_MISSING = 3

    • OTHERS = 4

    .

    IF SY-SUBRC = 0.

    MESSAGE I000(0) WITH 'SUCCESSFUL JOB OPENING'.

    SUBMIT RSBDCSUB

    WITH MAPPE = 'XK01'

    WITH VON = SY-DATUM

    *WITH Z_VERARB = 'X'

    WITH ERR = 'X'

    WITH LOGALL = 'X'

    AND RETURN EXPORTING LIST TO MEMORY.

    ENDIF.

    CALL FUNCTION 'JOB_CLOSE'

    EXPORTING

    JOBCOUNT = JOBCOUNT

    JOBNAME = JOBNAME

    EXCEPTIONS

    CANT_START_IMMEDIATE = 1

    INVALID_STARTDATE = 2

    JOBNAME_MISSING = 3

    JOB_CLOSE_FAILED = 4

    JOB_NOSTEPS = 5

    JOB_NOTEX = 6

    LOCK_FAILED = 7

    INVALID_TARGET = 8

    OTHERS = 9

    .

    IF SY-SUBRC <> 0.

    MESSAGE I000(0) WITH 'JOBCLOSE'.

    ENDIF.

    &----


    *& Form ORGANIZE_UPLOADED_DATA

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM ORGANIZE_UPLOADED_DATA .

    SORT ITAB1 BY ROW COL.

    LOOP AT ITAB1.

    CASE ITAB1-COL.

    WHEN 1.

    W_ITAB-LIFNR = ITAB1-VALUE.

    WHEN 2.

    W_ITAB-KTOKK = ITAB1-VALUE.

    WHEN 3.

    W_ITAB-NAME1 = ITAB1-VALUE.

    WHEN 4.

    W_ITAB-SORTL = ITAB1-VALUE.

    WHEN 5.

    W_ITAB-LAND1 = ITAB1-VALUE.

    WHEN 6.

    W_ITAB-SPRAS = ITAB1-VALUE.

    ENDCASE.

    AT END OF ROW.

    APPEND W_ITAB TO T_ITAB.

    CLEAR W_ITAB.

    ENDAT.

    ENDLOOP.

    ENDFORM. " ORGANIZE_UPLOADED_DATA

    &----


    *& Form select_file

    &----


    • text

    ----


    • -->P_P_SRCFIL text

    ----


    FORM SELECT_FILE USING P_SRCFIL.

    CALL FUNCTION 'F4_FILENAME'

    EXPORTING

    PROGRAM_NAME = SYST-CPROG

    DYNPRO_NUMBER = SYST-DYNNR

    FIELD_NAME = ' '

    IMPORTING

    FILE_NAME = P_SRCFIL

    .

    ENDFORM. " select_file

    &----


    *& Form bdc_dynpro

    &----


    • text

    ----


    • -->P_0131 text

    • -->P_0132 text

    ----


    FORM BDC_DYNPRO USING PROGRAM LIKE BDCDATA-PROGRAM DYNPRO LIKE BDCDATA-DYNPRO.

    CLEAR WA_BDCDATA.

    WA_BDCDATA-PROGRAM = PROGRAM.

    WA_BDCDATA-DYNPRO = DYNPRO.

    WA_BDCDATA-DYNBEGIN = 'X'.

    APPEND WA_BDCDATA TO I_BDCDATA.

    ENDFORM. " bdc_dynpro

    &----


    *& Form bdc_field

    &----


    • text

    ----


    • -->P_0136 text

    • -->P_0137 text

    ----


    FORM BDC_FIELD USING FNAM LIKE BDCDATA-FNAM FVAL TYPE ANY .

    CLEAR WA_BDCDATA.

    WA_BDCDATA-FNAM = FNAM.

    WA_BDCDATA-FVAL = FVAL.

    APPEND WA_BDCDATA TO I_BDCDATA.

    ENDFORM. " bdc_field

    reward if useful,

    thanks and regards

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.