Skip to Content
0
Former Member
Feb 20, 2009 at 10:14 PM

Report not generated when one item selected but when more then one selected

51 Views

IN my report output which shows the contacts with checkbox selection when one item si selected it gives error output but when more than one slected it gives the correcet output.

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.

  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.
  ENDCASE.

  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.
        ELSE.
          PERFORM update_bdc USING: ' ' lc_field wa_vbeln,
*                          'X' 'SAPMV60A'   '0102',
                          ' ' 'BDC_OKCODE' 'FKAN'.
        ENDIF.
      WHEN OTHERS.
*        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'..
*        endif.
    ENDCASE.

  ENDLOOP.

* 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'.
  ELSE.
    PERFORM update_bdc USING: 'X' 'SAPMV60A' '0102',
                              ' ' 'BDC_OKCODE' '=SICH'.
  ENDIF.

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

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

    CALL FUNCTION 'RH_MESSAGE_GET'
      EXPORTING
        arbgb             = 'VF'
        msgnr             = lwa_mess-msgnr
        msgv1             = lwa_mess-msgv1
        msgv2             = lwa_mess-msgv2
        msgv3             = lwa_mess-msgv3
        msgv4             = lwa_mess-msgv4
      IMPORTING
        msgtext           = lc_msgtxt
      EXCEPTIONS
        message_not_found = 1
        OTHERS            = 2.

    WRITE: /5 lc_msgtxt.

  ENDLOOP.


ENDFORM.                    " process_vf01

Can someone please help out on this issue.

Thanks