Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Add billing date in existing prog when goes through VF01

How do I add the billing date as sy-datum in my program that uses BDC to create billing documenst for the sales order in the output . I would like this to take te billing date as sy-datum. I know if if I add the billing date as todays date while generating biling documenst for multiple selections of sales order it will process and create a billing doc for it, right now which si not happening as billing date is missing. I want to add the billing date in BDC. Could I get some help please. In the below case only for p_rdos.

*&      Form  process_vf01
*       Call transaction VF01 and fill screen table with order values
FORM process_vf01.
  DATA: ln_index(2) TYPE n,
        lc_field(20) TYPE c,
        lc_fkart TYPE vbrk-fkart,
        li_lines TYPE i,
        lc_msgtxt(99) TYPE c,
        lwa_bdcoptions TYPE ctu_params,
        lwa_mess LIKE LINE OF it_bdcmess,
*        lc_date like vbrk-fkdat.
        lc_date like sy-datum.

  REFRESH: it_bdcmess.

  lwa_bdcoptions-dismode = cns_mode.
  lwa_bdcoptions-updmode = cns_upd.

  CASE 'X'.
    WHEN p_rdff.
      lc_fkart = cns_fkff.
    WHEN p_rdos.
      lc_fkart = cns_fkos.
      lc_date = sy-datum.

  DESCRIBE TABLE it_vbeln LINES li_lines.

  REFRESH: bdc_tab.
  PERFORM update_bdc USING: 'X' 'SAPMV60A'    '0102',
                            ' ' 'BDC_CURSOR'  'RV60A-FKART',
                            ' ' 'RV60A-FKART' lc_fkart,
                            ' ' 'BDC_OKCODE' '/00'.

  LOOP AT it_vbeln INTO wa_vbeln.
    ln_index = sy-tabix.

*   Up to the second delivery of the BDC add the Delivery to the screen,
*   after that click the More Documents for every entry.  logic changed for DEVK902353
*   changed again in added for every line DEVK910604
    CASE ln_index.
      WHEN 1.
        CONCATENATE 'KOMFK-VBELN' '(' ln_index ')' INTO lc_field.
        IF li_lines = 1.
          PERFORM update_bdc USING: ' ' lc_field wa_vbeln.

          PERFORM update_bdc USING: ' ' lc_field wa_vbeln,
                                    ' ' 'BDC_OKCODE' 'FKAN'.
*        IF p_rdos  <> 'X'.
        CONCATENATE 'KOMFK-VBELN' '(2)' INTO lc_field.

        PERFORM update_bdc USING: ' ' lc_field wa_vbeln,
                                  'X' 'SAPMV60A'   '0102',
                                  ' ' 'BDC_OKCODE' 'FKAN'.



* VF01 will go to a different screen if only one line selected
  IF li_lines EQ 1.
    PERFORM update_bdc USING: 'X' 'SAPMV60A' '0104',
                              ' ' 'BDC_OKCODE' '=SICH'.
    PERFORM update_bdc USING: 'X' 'SAPMV60A' '0102',
                              ' ' 'BDC_OKCODE' '=SICH'.


  CALL TRANSACTION 'VF01'  USING bdc_tab OPTIONS FROM lwa_bdcoptions
                          MESSAGES INTO it_bdcmess.

  WRITE: / 'BDC Messages:'.
  LOOP AT it_bdcmess INTO lwa_mess.

        arbgb             = 'VF'
        msgnr             = lwa_mess-msgnr
        msgv1             = lwa_mess-msgv1
        msgv2             = lwa_mess-msgv2
        msgv3             = lwa_mess-msgv3
        msgv4             = lwa_mess-msgv4
        msgtext           = lc_msgtxt
        message_not_found = 1
        OTHERS            = 2.

    WRITE: /5 lc_msgtxt.


ENDFORM.                    " process_vf01


Hi aarav,

Please follow the kartik instructions....if you still want BDC.... the error you are getting its may be becoz of date format.

declare variable like

date : lv_fkdat type sy-datum.

     write sy-datum to lv_fkdat.

     and pass the lv_fkdat to screen field.
    'RV60A-FKDAT'  lv_fkdat


Sreenivasa Sarma K

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question