Batch Input Program for Transaction VA01

Written by Reddy
Saturday, 10 November 2007 23:11 - Last Updated Tuesday, 06 November 2007 23:17

How do you Create a batch input program for transaction VA01.

The scenerio is

Input fields: Manditory fields to create a new Sales Order using VA01.

Hint: Take an existing Sales Order and use the master data which was previously used.

Conditions:
1)Upload the input data from a text file stored in your note pc.
2)Use call transaction method.
3)Your program should allow to input the file path and file name to select the data.

Here I'm attaching BDC Code for  'VA01'.

report ZBDC3_VA01
       no standard page heading line-size 255.
  include bdcrecx1.

types : begin of ty_head,
        auart(4),
        vkorg(4),
        vtweg(2),
        spart(2),
        kunnr(10),
        bstkd(10),
        end of ty_head.
   

1/4

  *************** HEADER ************************   CALL FUNCTION 'GUI_UPLOAD'     EXPORTING       filename                      = w_file2      filetype                      = 'ASC'     has_field_separator           = 'X'     TABLES       data_tab                      = it_head. PARAMETERS: filenam1 LIKE rlgrap-filename.      v_mabnr(30) type c. DATA: VAL(2) TYPE N VALUE 01.      w_file2 = filename.    START-OF-SELECTION.     CALL FUNCTION 'F4_FILENAME'     IMPORTING       file_name = filenam1.     data:v_kwmeng(30) type c.         matnr(18) type c.     CALL FUNCTION 'F4_FILENAME'     IMPORTING       file_name = filename.   &quot.        w_file1 TYPE string.    data: it_head type table of ty_head.Batch Input Program for Transaction VA01 Written by Reddy Saturday.  &quot.         end of ty_item.         kwmeng(13) type c. 10 November 2007 23:11 . Header data: wa_head like line of it_head.     data: it_item type table of ty_item.Last Updated Tuesday. 06 November 2007 23:17 types: begin of ty_item. Item data: wa_item like line of it_item.    *************** Item *******************      CALL FUNCTION 'GUI_UPLOAD'     EXPORTING 2/4 . DATA : w_file2 TYPE string.   w_file1 = filenam1.     AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.     AT SELECTION-SCREEN ON VALUE-REQUEST FOR filenam1. PARAMETERS: filename LIKE rlgrap-filename.

perform bdc_field       using 'VBAK-AUART'                                 WA_HEAD-AUART.01. perform bdc_field       using 'VBAK-VKORG'                                 WA_HEAD-VKORG. perform bdc_field       using 'RV45A-KETDAT'                               '30. perform bdc_field       using 'VBKD-INCO1'                               'CIF'. perform bdc_field       using 'BDC_CURSOR'                               'VBAK-AUART'. loop at it_item into wa_item . CONCATENATE 'RV45A-MABNR(' '0' VAL ')' INTO v_MABNR. perform bdc_field       using 'BDC_OKCODE'                               '/00'. perform bdc_dynpro      using 'SAPMV45A' '4001'.Last Updated Tuesday. perform bdc_field       using 'VBKD-ZTERM'                               '0001'. perform bdc_field       using 'VBKD-BSTDK'                               '30. perform bdc_field       using 'VBKD-INCO2'                               'COST INSUSRABCE FRIEGHT'. perform bdc_dynpro      using 'SAPMV45A' '0101'.01. 06 November 2007 23:17       filename                      = w_file1      filetype                      = 'ASC'     has_field_separator           = 'X'     TABLES       data_tab                      = it_item. perform bdc_field       using 'VBAK-SPART'                                 WA_HEAD-SPART. perform bdc_field       using 'BDC_OKCODE'                               '/00'.2006'. CONCATENATE 3/4 .    perform open_group.   loop at it_head into wa_head. perform bdc_field       using 'VBAK-VTWEG'                                 WA_HEAD-VTWEG. perform bdc_field       using 'VBKD-BSTKD'                                 WA_HEAD-BSTKD.2006'. perform bdc_field       using 'KUAGV-KUNNR'                                 WA_HEAD-KUNNR. .Batch Input Program for Transaction VA01 Written by Reddy Saturday. 10 November 2007 23:11 . perform bdc_field       using 'RV45A-KPRGBZ'                               'D'.

   perform bdc_dynpro      using 'SAPMV45A' '4001'.    perform bdc_dynpro   using 'SAPMV45A' '4001'.    perform bdc_field       using 'BDC_CURSOR'                               v_kwmeng. perform bdc_field       using v_kwmeng                               wa_item-kwmeng.    VAL = 5. VAL = 01. endloop. perform bdc_field       using 'BDC_OKCODE'                               '=SICH'. 4/4 . ENDIF.    VAL = VAL + 1.Batch Input Program for Transaction VA01 Written by Reddy Saturday. IF VAL >   5. 10 November 2007 23:11 . 06 November 2007 23:17 'RV45A-KWMENG(' '0' VAL ')' INTO v_kwmeng. perform bdc_field       using v_mabnr                                 wa_item-matnr.Last Updated Tuesday. perform close_group. perform bdc_field       using 'BDC_OKCODE'                               '/00'.   endloop. perform bdc_transaction using 'VA01'.

Sign up to vote on this title
UsefulNot useful