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

Batch input session

HI Gurus!

i want to run a cycle through bdc - VA01 - VL01N - VF01 .

once the user will fill details for VA01 then bdc will generate order [VA01 ] ,then delivery[VL01N] and invoicing [ VF01 ].

so to run multiple Transactions in a bdc we have use call session?

Do in call session , i can record this cycle of multiple transactions?

Plzz help me ! urgent!

Rahul

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2008 at 12:14 PM

    Hi,

    You can call bdc to create order, if successful call bdc to create delivery and if successful call bdc to create billing.

    Alternatively call function BAPI_SALESORDER_CREATEFROMDAT1 to create sales order,

    call function RV_DELIVERY_CREATE to create delivery and call function RV_INVOICE_CREATE to create invoice.

    Cheers.

    ...Reward if useful

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2008 at 09:01 PM

    Hi Rahul,

    Using a BDC session method is preferred for this. But as you are calling 3 Transactions in one program, you need to make a provision so that you check if the call is successful (SY_SUBRC).

    Thanks and Regards,

    Sandeep

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      hi Rahul,

      Please check the following Test Program for Uploading Open Sales orders. This can give you a view on how to deal with your requirement

      &----


      *& Report YSALESORDER

      *&

      &----


      *&

      *&

      &----


      REPORT ysalesorder

      NO STANDARD PAGE HEADING LINE-SIZE 255.

      ************************************************************************

      • D A T A - D E C L A R A T I O N S *

      ************************************************************************

      TABLES: t100.

      DATA: bdc_open.

      DATA: suc_counter TYPE i,

      error_counter TYPE i,

      v_mstring(480).

      DATA: BEGIN OF i_data_tab OCCURS 0,

      ordtyp LIKE vbak-auart, "Order Type

      slsorg LIKE vbak-vkorg, "Sales Org

      distch LIKE vbak-vtweg, "Distribution Channel

      divisn LIKE vbak-spart, "Division

      solpty LIKE kuagv-kunnr, "Sold-to party

      shipty LIKE kuwev-kunnr, "Ship-to party

      matnr LIKE mara-matnr, "Material Number

      ordqty(16) TYPE c, "Cumulative Order Quantity in Sales Units

      werks LIKE marc-werks, "Plant

      ponumb LIKE vbkd-bstkd, "Customer purchase order number

      podate(10) TYPE c, "Customer purchase order date

      deldat LIKE rv45a-ketdat, "Requested delivery date of the document

      END OF i_data_tab.

      DATA: ITAB_HEADER LIKE I_DATA_TAB OCCURS 0 WITH HEADER LINE.

      DATA: ITAB_ITEMS LIKE I_DATA_TAB OCCURS 0 WITH HEADER LINE.

      • Internal table to store the BDC data.

      DATA: BEGIN OF bdcdata OCCURS 0.

      INCLUDE STRUCTURE bdcdata.

      DATA: END OF bdcdata.

      • Internal table to store the messages during Call Transaction.

      DATA: BEGIN OF messtab OCCURS 0.

      INCLUDE STRUCTURE bdcmsgcoll.

      DATA: END OF messtab.

      CONSTANTS : c_del(1) TYPE c VALUE '~'.

      DATA : BEGIN OF i_file OCCURS 0,

      text(1024) TYPE c,

      END OF i_file.

      • Internal Table for CUSTOMERS

      DATA: it_kna1 LIKE kna1 OCCURS 0 WITH HEADER LINE.

      DATA : v_repid TYPE sy-repid,

      zmsg(255) TYPE c.

      DATA: Z_KWMENG TYPE STRING,

      Z_MABNR TYPE STRING,

      n(2) type n.

      DATA: OPT TYPE CTU_PARAMS.

      ***********************************************************************

      • S E L E C T I O N S C R E E N

      ***********************************************************************

      • This is to test the Input File.

      *SELECTION-SCREEN BEGIN OF BLOCK block0 WITH FRAME TITLE text-003.

      *

      *PARAMETERS : p_test RADIOBUTTON GROUP rad1 DEFAULT 'X',

      • p_create RADIOBUTTON GROUP rad1.

      *

      *SELECTION-SCREEN END OF BLOCK block0 .

      • File selection

      SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.

      • TEXT-001 - File Selection.

      PARAMETERS: p_filenm LIKE rlgrap-filename OBLIGATORY MEMORY ID m01.

      SELECTION-SCREEN END OF BLOCK bl1.

      SELECTION-SCREEN BEGIN OF BLOCK bl2 WITH FRAME TITLE text-002.

      • Call Transaction Parameters.

      PARAMETERS: p_mode LIKE rfpdo-allgazmd DEFAULT 'N' NO-DISPLAY.

      PARAMETERS: p_update LIKE rfpdo-allgvbmd DEFAULT 'S' NO-DISPLAY.

      SELECTION-SCREEN END OF BLOCK bl2.

      ***********************************************************************

      • A T S E L E C T I O N S C R E E N

      ***********************************************************************

      • Get the input file from the presentation server.

      AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_filenm.

      CALL FUNCTION 'F4_FILENAME'

      EXPORTING

      program_name = sy-repid

      IMPORTING

      file_name = p_filenm.

      IF sy-subrc <> 0.

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

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

      ENDIF.

      START-OF-SELECTION.

      PERFORM upload_text_file.

      • IF p_create EQ 'X'.

      PERFORM data.

      PERFORM create_materials TABLES messtab.

      • Output messages

      PERFORM output_messtab.

      • Close the BDC session, if it is opened

      PERFORM bdc_close.

      • ENDIF.

      &----


      *& Form upload_text_file

      &----


      • text

      ----


      • --> p1 text

      • <-- p2 text

      ----


      FORM upload_text_file .

      • This routine will upload the file to an internal table.

      • Clear and refresh internal table i_data_tab.

      CLEAR: i_data_tab,

      i_data_tab[].

      CALL FUNCTION 'WS_UPLOAD'

      EXPORTING

      filename = p_filenm

      filetype = 'ASC'

      TABLES

      data_tab = i_file

      EXCEPTIONS

      conversion_error = 1

      file_open_error = 2

      file_read_error = 3

      invalid_type = 4

      no_batch = 5

      unknown_error = 6

      invalid_table_width = 7

      gui_refuse_filetransfer = 8

      customer_error = 9

      OTHERS = 10.

      LOOP AT i_file.

      SPLIT i_file-text AT c_del INTO i_data_tab-ordtyp

      i_data_tab-slsorg

      i_data_tab-distch

      i_data_tab-divisn

      i_data_tab-solpty

      i_data_tab-shipty

      i_data_tab-matnr

      i_data_tab-ordqty

      i_data_tab-werks

      i_data_tab-ponumb

      i_data_tab-podate

      i_data_tab-deldat.

      APPEND i_data_tab.

      CLEAR : i_data_tab,

      i_file.

      ENDLOOP.

      • This is to pull out all the customers from CustomerMaster(Validation)

      • SELECT * FROM kna1 INTO TABLE it_kna1.

      ENDFORM. " upload_text_file

      &----


      *& Form create_materials

      &----


      • text

      ----


      • -->P_MESSTAB text

      ----


      FORM create_materials TABLES p_messtab STRUCTURE bdcmsgcoll.

      DATA: l_podate TYPE string,

      INT TYPE N.

      CLEAR: p_messtab,

      p_messtab[].

      LOOP AT ITAB_HEADER.

      CLEAR: l_podate.

      CLEAR: bdcdata,

      bdcdata[].

      CONCATENATE ITAB_HEADER-podate+0(2)

      ITAB_HEADER-podate+3(2)

      ITAB_HEADER-podate+6(4) INTO l_podate.

      PERFORM bdc_dynpro USING 'SAPMV45A' '0101'.

      PERFORM bdc_field USING 'BDC_CURSOR'

      'VBAK-AUART'.

      PERFORM bdc_field USING 'BDC_OKCODE'

      '/00'.

      PERFORM bdc_field USING 'VBAK-AUART'

      ITAB_HEADER-ordtyp.

      PERFORM bdc_field USING 'VBAK-VKORG'

      ITAB_HEADER-slsorg.

      PERFORM bdc_field USING 'VBAK-VTWEG'

      ITAB_HEADER-distch.

      PERFORM bdc_field USING 'VBAK-SPART'

      ITAB_HEADER-divisn.

      PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.

      PERFORM bdc_field USING 'BDC_OKCODE'

      '/00'.

      PERFORM bdc_field USING 'BDC_CURSOR'

      'VBKD-BSTKD'.

      PERFORM bdc_field USING 'VBKD-BSTKD'

      ITAB_HEADER-ponumb.

      PERFORM bdc_field USING 'VBKD-BSTDK'

      l_podate.

      PERFORM bdc_field USING 'KUAGV-KUNNR'

      ITAB_HEADER-solpty.

      PERFORM bdc_field USING 'KUWEV-KUNNR'

      ITAB_HEADER-shipty.

      PERFORM bdc_field USING 'RV45A-KETDAT'

      ITAB_HEADER-deldat.

      PERFORM bdc_field USING 'RV45A-KPRGBZ'

      'D'.

      LOOP AT ITAB_ITEMS WHERE SOLPTY EQ ITAB_HEADER-SOLPTY AND

      SHIPTY EQ ITAB_HEADER-SHIPTY AND

      PONUMB EQ ITAB_HEADER-PONUMB.

      N = N + 1.

      IF N GT 12.

      • This adds extra space to enter materials

      PERFORM bdc_field USING 'BDC_OKCODE'

      '=POAN'.

      PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.

      N = 2.

      ENDIF.

      CONCATENATE 'RV45A-KWMENG(' N ')' INTO Z_KWMENG.

      CONCATENATE 'RV45A-MABNR(' N ')' INTO Z_MABNR.

      PERFORM bdc_field USING 'BDC_OKCODE'

      '/00'.

      PERFORM bdc_field USING 'BDC_CURSOR'

      Z_KWMENG.

      PERFORM bdc_field USING Z_MABNR

      ITAB_ITEMS-matnr.

      PERFORM bdc_field USING Z_KWMENG

      ITAB_ITEMS-ordqty.

      ENDLOOP.

      INT = N.

      clear N.

      PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.

      PERFORM bdc_field USING 'BDC_OKCODE'

      '=SICH'.

      PERFORM bdc_field USING 'BDC_CURSOR'

      'RV45A-MABNR(01)'.

      CALL TRANSACTION 'VA01' USING bdcdata

      MODE p_mode

      UPDATE p_update

      MESSAGES INTO p_messtab.

      IF sy-subrc EQ 0.

      suc_counter = suc_counter + 1.

      ELSE.

      error_counter = error_counter + 1.

      PERFORM open_bdc.

      PERFORM output_messtab.

      ENDIF.

      • PERFORM output_messtab.

      ENDLOOP.

      ENDFORM. " create_materials

      &----


      *& Form bdc_dynpro

      &----


      • text

      ----


      • -->program

      • -->dynpro

      ----


      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

      ----


      • -->fnam

      • -->fval

      ----


      FORM bdc_field USING fnam

      fval.

      CLEAR bdcdata.

      bdcdata-fnam = fnam.

      bdcdata-fval = fval.

      APPEND bdcdata.

      ENDFORM. " bdc_field

      &----


      *& Form output_messtab

      &----


      • text

      ----


      • --> p1 text

      • <-- p2 text

      ----


      FORM output_messtab .

      • LOOP AT messtab.

      CALL FUNCTION 'FORMAT_MESSAGE'

      EXPORTING

      id = sy-msgid

      lang = '-E'

      no = sy-msgno

      v1 = sy-msgv1

      v2 = sy-msgv2

      v3 = sy-msgv3

      v4 = sy-msgv4

      IMPORTING

      msg = zmsg

      EXCEPTIONS

      not_found = 1

      OTHERS = 2.

      IF sy-subrc <> 0.

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

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

      ENDIF.

      WRITE: / zmsg.

      • ENDLOOP.

      ENDFORM. " output_messtab

      &----


      *& Form open_bdc

      &----


      • text

      ----


      • --> p1 text

      • <-- p2 text

      ----


      FORM open_bdc .

      IF bdc_open = ' '.

      CALL FUNCTION 'BDC_OPEN_GROUP'

      EXPORTING

      client = sy-mandt

      group = 'YSALSORD'

      user = sy-uname

      EXCEPTIONS

      client_invalid = 1

      destination_invalid = 2

      group_invalid = 3

      group_is_locked = 4

      holddate_invalid = 5

      internal_error = 6

      queue_error = 7

      running = 8

      system_lock_error = 9

      user_invalid = 10

      OTHERS = 11.

      IF sy-subrc <> 0.

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

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

      ENDIF.

      bdc_open = 'X'.

      ENDIF.

      PERFORM bdc_insert.

      ENDFORM. " open_bdc

      &----


      *& Form bdc_insert

      &----


      • text

      ----


      • --> p1 text

      • <-- p2 text

      ----


      FORM bdc_insert .

      CALL FUNCTION 'BDC_INSERT'

      EXPORTING

      tcode = 'VA01'

      TABLES

      dynprotab = bdcdata

      EXCEPTIONS

      internal_error = 1

      not_open = 2

      queue_error = 3

      tcode_invalid = 4

      printing_invalid = 5

      posting_invalid = 6

      OTHERS = 7.

      IF sy-subrc <> 0.

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

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

      ENDIF.

      ENDFORM. " bdc_insert

      &----


      *& Form bdc_close

      &----


      • text

      ----


      • --> p1 text

      • <-- p2 text

      ----


      FORM bdc_close .

      IF bdc_open = 'X'.

      CALL FUNCTION 'BDC_CLOSE_GROUP'

      EXCEPTIONS

      not_open = 1

      queue_error = 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.

      ENDIF.

      ENDFORM. " bdc_close

      &----


      *& Form DATA

      &----


      • text

      ----


      • --> p1 text

      • <-- p2 text

      ----


      FORM data .

      DATA: COUNT TYPE I VALUE 1,

      INT TYPE I.

      DELETE ADJACENT DUPLICATES FROM I_DATA_TAB COMPARING solpty shipty ponumb MATNR.

      ITAB_HEADER[] = I_DATA_TAB[].

      ITAB_ITEMS[] = I_DATA_TAB[].

      DELETE ADJACENT DUPLICATES FROM ITAB_HEADER COMPARING SOLPTY SHIPTY PONUMB.

      ENDFORM. " DATA

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

    Hi,

    Still u have the same problem,can u establish the doubt.

    Edited by: Murali Krishna Makineni on Jun 17, 2008 8:42 AM

    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.