Skip to Content

Error in BDC: Amount in 2nd line item is not being filled up...

Hello Experts, 

I am encountering an error in my BDC for t-code F-02 that it doesnt fill up the value for
my 2nd line item somy BDC does not continue. Below is my code guys:

CONCATENATE p_gjahr
                p_monat
                '01'
                INTO lv_first_day.

    CALL FUNCTION 'LAST_DAY_OF_MONTHS'
      EXPORTING
        day_in            = lv_first_day
      IMPORTING
        last_day_of_month = lv_last_day
      EXCEPTIONS
        day_in_no_date    = 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.

    CONCATENATE lv_last_day+4(2) '/' lv_last_day+6(2) '/' lv_last_day+0(4) '/'
           INTO lv_date.
    PERFORM bdc_dynpro      USING 'SAPMF05A' '0100'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'RF05A-NEWKO'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'BKPF-BLDAT'
                                  lv_date.
    PERFORM bdc_field       USING 'BKPF-BLART'
                                  gc_yearend_blart.
    PERFORM bdc_field       USING 'BKPF-BUKRS'
                                  p_bukrs.
    PERFORM bdc_field       USING 'BKPF-BUDAT'
                                  lv_date.
    PERFORM bdc_field       USING 'BKPF-MONAT'
                                  lv_last_day+4(2).
    PERFORM bdc_field       USING 'BKPF-WAERS'
                                  'PHP'.
    PERFORM bdc_field       USING 'FS006-DOCID'
                                  '*'.
    LOOP AT gt_output INTO wa_output.
      CLEAR lv_vat.
      lv_tabix = sy-tabix.
      lv_lifnr = wa_output-lifnr.
      lv_kostl = wa_output-kostl.
      lv_aufnr = wa_output-aufnr.
      lv_sgtxt = wa_output-txz01.
      lv_mwskz = wa_output-mwskz.
      lv_vat   = wa_output-netpr * '0.12'.
      wa_output-netpr = wa_output-netpr + lv_vat.
      ADD wa_output-netpr TO lv_netpr.
      PERFORM bdc_field       USING 'RF05A-NEWBS'
                                    '40'.
      PERFORM bdc_field       USING 'RF05A-NEWKO'
                                    wa_output-sakto.
      if lv_tabix > 1.
      PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'COBL-AUFNR'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=ENTE'.
      PERFORM bdc_field       USING 'COBL-KOSTL'
                                    wa_output-kostl.
      PERFORM bdc_field       USING 'COBL-AUFNR'
                                    wa_output-aufnr.
      PERFORM bdc_dynpro      USING 'SAPMF05A' '0303'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'BSEG-SGTXT'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '/00'.
      endif.
      PERFORM bdc_dynpro      USING 'SAPMF05A' '0300'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'RF05A-NEWUM'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM bdc_field       USING 'BSEG-WRBTR'
                                    '1120'.
      PERFORM bdc_field       USING 'BSEG-MWSKZ'
                                    wa_output-mwskz.
      PERFORM bdc_field       USING 'BKPF-XMWST'
                                    'X'.
      PERFORM bdc_field       USING 'BSEG-EBELN'
                                    wa_output-ebeln.
      PERFORM bdc_field       USING 'BSEG-ZUONR'
                                    wa_output-aufnr.
      PERFORM bdc_field       USING 'BSEG-SGTXT'
                                    wa_output-txz01.
    ENDLOOP.
    PERFORM bdc_field       USING 'RF05A-NEWBS'
                                  '39'.
    PERFORM bdc_field       USING 'RF05A-NEWKO'
                                  lv_lifnr.
    PERFORM bdc_field       USING 'RF05A-NEWUM'
                                  'V'.
    PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'COBL-AUFNR'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=ENTE'.
    PERFORM bdc_field       USING 'COBL-KOSTL'
                                  lv_kostl.
    PERFORM bdc_field       USING 'COBL-AUFNR'
                                  ''.
    PERFORM bdc_dynpro      USING 'SAPMF05A' '0303'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'BSEG-SGTXT'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.

    PERFORM bdc_field       USING 'BSEG-WRBTR'
                                  lv_netpr.
    PERFORM bdc_field       USING 'BSEG-MWSKZ'
                                  lv_mwskz.
    PERFORM bdc_field       USING 'BSEG-ZFBDT'
                                  ''.
    PERFORM bdc_field       USING 'BSEG-ZUONR'
                                  lv_aufnr.
    PERFORM bdc_field       USING 'BSEG-SGTXT'
                                  lv_sgtxt.
    PERFORM bdc_dynpro      USING 'SAPLFWTD' '0100'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'WITH_ITEM-WT_WITHCD(01)'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=GO'.
    PERFORM bdc_dynpro      USING 'SAPMF05A' '0303'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'BSEG-WRBTR'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=BU'.
    PERFORM bdc_field       USING 'BSEG-WRBTR'
                                  lv_netpr.
    PERFORM bdc_field       USING 'BSEG-MWSKZ'
                                  lv_mwskz.
    PERFORM bdc_field       USING 'BSEG-ZFBDT'
                                  ''.
    PERFORM bdc_field       USING 'BSEG-ZUONR'
                                  lv_aufnr.
    PERFORM bdc_field       USING 'BSEG-SGTXT'
                                  lv_sgtxt.
  ENDIF.
  CALL TRANSACTION 'F-02' USING bdcdata
                          MODE 'A'
                          UPDATE 'S'.
  IF sy-subrc = 0.
    COMMIT WORK AND WAIT.
  ENDIF.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Nov 29, 2007 at 08:56 AM

    Hi Viraylab,

    Check with ur interanl table which contains the data for recording whether any field for the second lineitem is blank(not getting fetched) which is mandatory.

    In such cases our recording does not knw wat to do n stops abruptly..

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 29, 2007 at 10:10 AM

    just chk with the recording. might b recording is nt ok and bcoz of which it is not allowing placing data into right field.

    or do send conmplete code with test data .

    plz reward point if helps.

    regards,

    rahul

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 29, 2007 at 10:56 AM

    Hi Viraylab,

    call transaction in 'E' ERROR mode nad check wher it is stopping for second lineitem giv a enter manually n see whether it works...

    Regards,

    Kaveri

    Add comment
    10|10000 characters needed characters exceeded