Skip to Content
0
Former Member
Mar 13, 2007 at 05:35 PM

BDC Error

61 Views

Hi All,

I did the BDC program for sales order creation and here I read the file as each line seperately to get the data.

The program was working fine for line items < 7, as we are getting more line items in single PO now I changed the program to include this condition also.

The error is program is working for line items > 7 now and for line items <= 7 it is giving the error "No batch input data for screen SAPMV45A 4001" and stuck at the error.

I am sending part of the code, can you please help me what i am doing wrong with this.

Thanks

Veni.

FORM populate_data .
  data: lv_po(35) type c,
        gv_num(5) type n value '00001',
        gv_fname1(132) type c,
        gv_fname2(132) type c,
        gv_fname3(132) type c,
        GV_FNAME4(132) TYPE C,
        lv_price(13) type c.

  Loop at gt_sdata INTO gs_sdata.

    if lv_po ne gs_sdata-bstkd.
      lv_po = gs_sdata-bstkd.

      clear: gv_fname1, gv_fname2, gv_fname3, gv_fname4.

      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' 'OR'.
      perform bdc_field       using 'VBAK-VKORG' '300'.
      perform bdc_field       using 'VBAK-VTWEG' '20'.
      perform bdc_field       using 'VBAK-SPART' '01'.

      perform bdc_dynpro      using 'SAPMV45A' '4001'.
      perform bdc_field       using 'BDC_OKCODE' '=POAN'.
      perform bdc_field       using 'VBKD-BSTKD' gs_sdata-BSTKD.
      perform bdc_field       using 'VBKD-BSTDK' gs_sdata-BSTDK.
      perform bdc_field       using 'KUAGV-KUNNR' '1195'.
      perform bdc_field       using 'KUWEV-KUNNR' gs_sdata-KUNNR1.
      perform bdc_field       using 'RV45A-KETDAT' GS_SDATA-KETDAT.
      perform bdc_field       using 'RV45A-KPRGBZ' 'D'.

    endif.

    concatenate 'RV45A-KWMENG(' gv_num ')' INTO GV_FNAME1.
    concatenate 'VBAP-POSNR(' gv_num ')' INTO GV_FNAME2.
    concatenate 'RV45A-MABNR(' gv_num ')' INTO GV_FNAME3.
    concatenate 'KOMV-KBETR(' gv_num ')' INTO GV_FNAME4.

    SELECT KNUMH FROM A951
    INTO TABLE IT_A951
    WHERE KAPPL = 'V'
    AND KSCHL = 'PR00'
    AND MATNR = gs_sdata-MABNR
    AND DATBI > SY-DATUM.

    READ TABLE IT_A951 INDEX 1.

*    CHECK NOT IT_A951 IS INITIAL.
    If NOT IT_A951 IS INITIAL.

      SELECT KNUMH KBETR FROM KONP
      INTO TABLE IT_KONP
      FOR ALL ENTRIES IN IT_A951
      WHERE KNUMH = IT_A951-KNUMH.

      Read table IT_KONP with key KNUMH = IT_A951-KNUMH.
      clear lv_price.
      if sy-subrc = 0.
        lv_price = IT_KONP-KBETR.
      endif.
    Endif.

    perform bdc_field       using 'BDC_CURSOR' 'KOMV-KBETR(001)'.
    perform bdc_field       using GV_FNAME1 gs_sdata-kwmeng.
    perform bdc_field       using GV_FNAME2 gs_sdata-posnr.
    perform bdc_field       using GV_FNAME3 gs_sdata-mabnr.
    perform bdc_field       using GV_FNAME4 lv_price.

    IF gv_num = 7.
    	gv_num = 1.
      	perform bdc_dynpro      using 'SAPMV45A' '4001'.
      perform bdc_field       using 'BDC_OKCODE' '=KKAU'.

    ENDIF.

    clear gs_sdata.
    clear it_a951.
    clear it_konp.
    gv_num = gv_num + 1.

    AT END of BSTKD.

      perform bdc_dynpro      using 'SAPMV45A' '4002'.
      perform bdc_field       using 'BDC_OKCODE' '=SICH'.
      perform bdc_field       using 'BDC_CURSOR' 'VBAK-GWLDT'.
      perform bdc_field       using 'VBAK-GWLDT' '12/31/2007'.

      perform bdc_transaction using 'VA01'.
      gv_num = 1.
      clear gs_sdata.
      l2_num = l2_num + 1.
    ENDAT.

  Endloop.
ENDFORM.                    " populate_data