<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SY-DBCNT QUESTION ? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519406#M570129</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The system field sy-dbcnt is always set to the number of rows that were actually selected.&lt;/P&gt;&lt;P&gt;After SELECT statement you can use it.&lt;/P&gt;&lt;P&gt;select....&lt;/P&gt;&lt;P&gt;endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-dbcnt = 0.&lt;/P&gt;&lt;P&gt;No rows selected.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if useful!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 23 Jul 2007 05:49:01 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-23T05:49:01Z</dc:date>
    <item>
      <title>SY-DBCNT QUESTION ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519404#M570127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;CAN ANYONE TELL ME HOW TO USE SY-DBCNT AFTER THE SELECT STATEMENT ? I NEED THIS TO KNOW HOW MY RECORDS MY SELECT QUERY IS RETURNING ? THKS!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      select * from ekbe into ekbe where&lt;/P&gt;&lt;P&gt;                 ebeln = it_out-ebeln&lt;/P&gt;&lt;P&gt;             and ebelp = it_out-ebelp&lt;/P&gt;&lt;P&gt;             and ebeln = it_out-ebeln_ekpo&lt;/P&gt;&lt;P&gt;             and ebelp = it_out-ebelp_ekpo&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;            and buzei = it_out-buzei&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;             and lfbnr = it_out-lfbnr&lt;/P&gt;&lt;P&gt;             and lfpos = it_out-lfpos&lt;/P&gt;&lt;P&gt;             and menge = it_out-menge&lt;/P&gt;&lt;P&gt;             and bewtp = 'E'&lt;/P&gt;&lt;P&gt;             and bwart = 101.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AFTER THIS ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2007 05:46:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519404#M570127</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-23T05:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: SY-DBCNT QUESTION ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519405#M570128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
select * from ekbe
         into table it_ekbe 
         where ebeln = it_out-ebeln
           and ebelp = it_out-ebelp
           and ebeln = it_out-ebeln_ekpo
           and ebelp = it_out-ebelp_ekpo
           * and buzei = it_out-buzei
           and lfbnr = it_out-lfbnr
           and lfpos = it_out-lfpos
           and menge = it_out-menge
           and bewtp = 'E'
           and bwart = 101.
    " after this use the describe statement like this
    data : N type I.
    describe table it_ekbe lines N.
    " N is the number of records in your internal table
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Gopi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2007 05:48:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519405#M570128</guid>
      <dc:creator>gopi_narendra</dc:creator>
      <dc:date>2007-07-23T05:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: SY-DBCNT QUESTION ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519406#M570129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The system field sy-dbcnt is always set to the number of rows that were actually selected.&lt;/P&gt;&lt;P&gt;After SELECT statement you can use it.&lt;/P&gt;&lt;P&gt;select....&lt;/P&gt;&lt;P&gt;endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-dbcnt = 0.&lt;/P&gt;&lt;P&gt;No rows selected.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if useful!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2007 05:49:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519406#M570129</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-23T05:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: SY-DBCNT QUESTION ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519407#M570130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;after select query use this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;l_count  = sy-dbcnt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Niyaz&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2007 05:49:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519407#M570130</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-23T05:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: SY-DBCNT QUESTION ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519408#M570131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

select * from ekbe into table i_ekbe where
ebeln = it_out-ebeln
and ebelp = it_out-ebelp
and ebeln = it_out-ebeln_ekpo
and ebelp = it_out-ebelp_ekpo
* and buzei = it_out-buzei
and lfbnr = it_out-lfbnr
and lfpos = it_out-lfpos
and menge = it_out-menge
and bewtp = 'E'
and bwart = 101.

DESCRIBE TABLE i_ekbe LINES l_count.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in l_count u will get the no of lines,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aRs&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2007 05:50:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519408#M570131</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2007-07-23T05:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: SY-DBCNT QUESTION ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519409#M570132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;u can just read the system field sy-dbcnt to check how many lines it contains.&lt;/P&gt;&lt;P&gt;the system automatically sets this field after the select statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward points plz&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2007 05:50:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519409#M570132</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-23T05:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: SY-DBCNT QUESTION ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519410#M570133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It will return the number of records that satisfy ur where clause.So in SE11 give the table name as EKBE and then specify the values in se11 and check the entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;nagaraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2007 05:51:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519410#M570133</guid>
      <dc:creator>former_member404244</dc:creator>
      <dc:date>2007-07-23T05:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: SY-DBCNT QUESTION ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519411#M570134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Refer code below and u will get idea:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data : begin of itab occurs 0,
         DMBTR like BSEG-DMBTR,
         End of itab.
  data : v_count type i.
  data : total type i.
  
  select DMBTR
   from BSEG
   into TABLE itab
   .
*Now Sy-dbcnt gives the number of records retrieved.
   v_count = sy-dbcnt.
   loop at itab.
   AT LAST. 
*All the numeric fields are added at last
    SUM.
    total = itab-DMBTR.
   ENDAT.
   Endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not going to change ur code so that u may get a practice for urself using above code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls reward points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ameet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2007 05:58:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519411#M570134</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-23T05:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: SY-DBCNT QUESTION ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519412#M570135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this sample code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: idoc_control like EDIDC,
      NUMBER_OF_DATA_RECORDS like sy-dbcnt,
      NUMBER_OF_STATUS_RECORDS like sy-dbcnt,
      INT_EDIDS like edids occurs 0 with header line,
      INT_EDIDD like edidd occurs 0 with header line.

TYPE-POOLS :  LEDID.

data: STRUCT_TYPE TYPE  LEDID_STRUCT_TYPE ,
      IDOC_STRUCT TYPE  LEDID_T_IDOC_STRUCT,
      SEGMENTS TYPE  LEDID_T_SEGMENT,
      SEGMENT_STRUCT TYPE  LEDID_T_SEGMENT_STRUCT,
      excel_tab(2000) occurs 0 with header line.



parameter: DOCNUM like edidc-docnum obligatory, ""Idoc Number
           sap_rel like SY-SAPRL default SY-SAPRL obligatory,
           pi_ver like EDI_VERREC-VERSION default '3' obligatory,
           d_excel as checkbox default 'X'. ""Download ?

start-of-selection.
  perform read_idoc.
  perform process_idoc.
  if d_excel = 'X'.
    perform download_to_excel.
  endif.

end-of-selection.

FORM read_idoc.
  CALL FUNCTION 'IDOC_READ_COMPLETELY'
       EXPORTING
            DOCUMENT_NUMBER          = docnum
       IMPORTING
            IDOC_CONTROL             = idoc_control
            NUMBER_OF_DATA_RECORDS   = NUMBER_OF_DATA_RECORDS
            NUMBER_OF_STATUS_RECORDS = NUMBER_OF_STATUS_RECORDS
       TABLES
            INT_EDIDS                = INT_EDIDS
            INT_EDIDD                = INT_EDIDD
       EXCEPTIONS
            DOCUMENT_NOT_EXIST       = 1
            DOCUMENT_NUMBER_INVALID  = 2
            OTHERS                   = 3.
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

ENDFORM.                    "" read_idoc

FORM process_idoc.
  perform read_idoc_structure.
  perform display_data_records.
ENDFORM.                    "" process_idoc

FORM display_data_records.

  data: PE_seg_HEADER like EDI_SAPI01,
        segname like EDI_IAPI12-SEGMENTTYP,
        prev_segname like EDI_IAPI12-SEGMENTTYP value ' ',
        pt_fields2 like EDI_IAPI12 occurs 0 with header line,
        PT_FVALUES2 like EDI_IAPI14 occurs 0 with header line,
        byte_first type i,
        byte_last type i,
        field_val(50),
        tmp_str(15),
        tmp_str3(15),
        seg_repeats type i value 0,
        tmp_str2(15),
        tab_cr(1) type x value '09',
        tot_ctr type i value 0,
        ctr type i value 0,
        msg(40) type c.

  data: IDOC_STRUCT_wa TYPE  LEDID_IDOC_STRUCT.

  sort int_edidd by segnum.
  describe table int_edidd lines tot_ctr.
  loop at int_edidd.
    move int_edidd-segnam to segname.
    clear msg.
    concatenate 'Reading segment ' segname
                into msg separated by space.
    if tot_ctr &amp;lt;&amp;gt; 0.
      ctr = ( 100 * sy-tabix ) / tot_ctr.
    endif.
    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = ctr
              TEXT       = msg.
    add 1 to seg_repeats.
    clear tmp_str2.
    if int_edidd-segnam &amp;lt;&amp;gt; prev_segname.
      seg_repeats = 1.
      clear: pe_seg_header, pt_fields2, pt_fvalues2.
      refresh: pt_fields2, pt_fvalues2.
      CALL FUNCTION 'SEGMENT_READ_COMPLETE'
           EXPORTING
                PI_SEGTYP                 = segname
                PI_RELEASE                = sap_rel
                PI_VERSION                = pi_ver
           IMPORTING
                PE_HEADER                 = pe_seg_header
           TABLES
                PT_FIELDS                 = pt_fields2
                PT_FVALUES                = pt_fvalues2
           EXCEPTIONS
                SEGMENT_UNKNOWN           = 1
                SEGMENT_STRUCTURE_UNKNOWN = 2
                OTHERS                    = 3.
      IF SY-SUBRC &amp;lt;&amp;gt; 0.
        MESSAGE ID SY-MSGID TYPE 'I' NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      prev_segname = int_edidd-segnam.
    endif.
    read table idoc_struct into idoc_struct_wa with key
                           segment_type = int_edidd-segnam.
    if sy-subrc = 0.
      IF IDOC_STRUCT_WA-SYNTAX_ATTRIB-MUSTFL = 'X'.
        TMP_STR = 'Mandatory'.                  ""Mandatory
      ELSE.
        TMP_STR = 'Optional'.                  ""Optional
      ENDIF.
      if IDOC_STRUCT_wa-SEGMENT_TYPE_ATTRIB-QUALIFIER = 'X'.
        tmp_str3 = 'Qualified'.
      else.
        tmp_str3 = 'Non-Qualified'.
      endif.
      shift IDOC_STRUCT_wa-SYNTAX_ATTRIB-OCCMAX
                                 left deleting leading '0'.
      move seg_repeats to tmp_str2.
      condense: IDOC_STRUCT_wa-SYNTAX_ATTRIB-OCCMAX, tmp_str2.
      concatenate tmp_str2 'of'  IDOC_STRUCT_wa-SYNTAX_ATTRIB-OCCMAX
          into tmp_str2 separated by space.

      write :/ IDOC_STRUCT_wa-SEGMENT_TYPE,
           tmp_str,
           TMP_STR3,
           tmp_str2,
           IDOC_STRUCT_wa-SYNTAX_ATTRIB-HLEVEL,
           IDOC_STRUCT_wa-SEGMENT_TYPE_ATTRIB-plast,
           IDOC_STRUCT_wa-SEGMENT_TYPE_ATTRIB-DESCRP.
      if d_excel = 'X'.
        concatenate 'Segment Name' tab_cr
                    'Mand / Opt ' tab_cr
                    'Qual / non-Qual' tab_cr
                    'Seq of Max' tab_cr
                    'Level' tab_cr
                    'Owner' tab_cr
                    'Description'
                    into excel_tab.
        append excel_tab.
        concatenate IDOC_STRUCT_wa-SEGMENT_TYPE tab_cr
              tmp_str tab_cr
              TMP_STR3 tab_cr
              tmp_str2 tab_cr
              IDOC_STRUCT_wa-SYNTAX_ATTRIB-HLEVEL tab_cr
              IDOC_STRUCT_wa-SEGMENT_TYPE_ATTRIB-plast tab_cr
              IDOC_STRUCT_wa-SEGMENT_TYPE_ATTRIB-DESCRP
              into excel_tab.
        append excel_tab.
        concatenate tab_cr
                    'Field Nma' tab_cr
                    'Type' tab_cr
                    'Length' tab_cr
                    'Byte From' tab_cr
                    'Byte To' tab_cr
                    'Description' tab_cr
                    'Value' tab_cr
                    'Qualifier Meaning'
                    into excel_tab.
        append excel_tab.
      endif.
    endif.
    sort pt_fields2 by field_pos.
    byte_first = 0.
    loop at pt_fields2.
      clear: field_val.
      byte_last = pt_fields2-EXTLEN.
      write int_edidd-sdata+byte_first(byte_last) to
            field_val left-justified.
      shift pt_fields2-EXTLEN left deleting leading '0'.
      shift pt_fields2-byte_first left deleting leading '0'.
      shift pt_fields2-byte_last left deleting leading '0'.
      write:/ '   ', pt_fields2-fieldname,
              pt_fields2-datatype,
              pt_fields2-EXTLEN,
              pt_fields2-byte_first ,
              pt_fields2-byte_last,
              pt_fields2-descrp,
              field_val.
      read table pt_fvalues2 with key fieldname = pt_fields2-fieldname
                    fldvalue_l = field_val.
      add byte_last to byte_first.
      if sy-subrc = 0.
        write : pt_fvalues2-descrp.
      else.
        clear pt_fvalues2-descrp.
      endif.
      if d_excel = 'X'.
        concatenate tab_cr pt_fields2-fieldname tab_cr
                pt_fields2-datatype tab_cr
                pt_fields2-EXTLEN tab_cr
                pt_fields2-byte_first tab_cr
                pt_fields2-byte_last tab_cr
                pt_fields2-descrp tab_cr
                field_val tab_cr
                pt_fvalues2-descrp
                into excel_tab.
        append excel_tab.
      endif.
    endloop.
  endloop.
ENDFORM.                    "" display_data_records

FORM read_idoc_structure.
  data: idoctype type LEDID_IDOCTYPE.

  if not idoc_control-cimtyp is initial.
    STRUCT_TYPE = 'E'. ""Extended
    idoctype = idoc_control-cimtyp.
  else.
    STRUCT_TYPE = 'B'. ""Basic
    idoctype = idoc_control-idoctp.
  endif.

  CALL FUNCTION 'IDOC_TYPE_COMPLETE_READ'
       EXPORTING
            RELEASE              = sap_rel
            STRUCT_TYPE          = STRUCT_TYPE
            IDOCTYPE             = idoctype
            VERSION              = pi_ver
*       IMPORTING
*            IDOC_TYPE            = idoctype
       TABLES
            IDOC_STRUCT          = idoc_struct
            SEGMENTS             = segments
            SEGMENT_STRUCT       = segment_struct
       EXCEPTIONS
            IDOCTYPE_UNKNOWN     = 1
            IDOCSTRUCT_UNKNOWN   = 2
            SEGMENT_DATA_MISSING = 3
            ILLEGAL_STRUCT_TYPE  = 4
            OTHERS               = 5.
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

ENDFORM.                    "" read_idoc_structure

FORM download_to_excel.
  data: name like RLGRAP-FILENAME.

  shift docnum left deleting leading '0'.
  concatenate docnum '-' idoc_control-idoctp '.xls'
              into name.



  CALL FUNCTION 'RH_START_EXCEL_WITH_DATA'
   EXPORTING
     DATA_NAME                 = name
     DATA_TYPE                 = 'ASC'
     WAIT                      = ' '
   TABLES
     DATA_TAB                  = excel_tab
   EXCEPTIONS
     NO_BATCH                  = 1
     EXCEL_NOT_INSTALLED       = 2
     WRONG_VERSION             = 3
     INTERNAL_ERROR            = 4
     INVALID_TYPE              = 5
     CANCELLED                 = 6
     DOWNLOAD_ERROR            = 7
     OTHERS                    = 8
            .
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

ENDFORM.                    "" download_to_excel&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward all helpfull answers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2007 06:03:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519412#M570135</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-23T06:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: SY-DBCNT QUESTION ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519413#M570136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;lt;b&amp;gt;SY-DBCNT  describes Number of processed table rows&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this sample code...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT ZBCTCB92.&lt;/P&gt;&lt;P&gt;TABLES: T000.&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF T OCCURS 0,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            FIELD(10),&lt;/P&gt;&lt;P&gt;      END OF T.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: NUM TYPE N.&lt;/P&gt;&lt;P&gt;DETAIL.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;sy-linct and sy-linsz describes a page of the list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;WRITE: / 'Example of sy-linct and sy-linsz'.&lt;/P&gt;&lt;P&gt;SKIP.&lt;/P&gt;&lt;P&gt;WRITE: / SY-LINCT, 'line and', (3) SY-LINSZ, 'column is a page'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;sy-index works in do-enddo and while-endwhile loops.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;it contains the number of loop passes.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;WRITE: /'Example of sy-index'.&lt;/P&gt;&lt;P&gt;SKIP.&lt;/P&gt;&lt;P&gt;DO 5 TIMES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      WRITE: SY-INDEX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;sy-tabix is the index number of the currently processed row&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;for an internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;SKIP.&lt;/P&gt;&lt;P&gt;WRITE: /'Example of sy-tabix'.&lt;/P&gt;&lt;P&gt;SKIP.&lt;/P&gt;&lt;P&gt;T-FIELD = 'One'. APPEND T.&lt;/P&gt;&lt;P&gt;T-FIELD = 'Two'. APPEND T.&lt;/P&gt;&lt;P&gt;T-FIELD = 'Three'. APPEND T.&lt;/P&gt;&lt;P&gt;T-FIELD = 'Four'. APPEND T.&lt;/P&gt;&lt;P&gt;T-FIELD = 'Five'. APPEND T.&lt;/P&gt;&lt;P&gt;WRITE: /'Example of sy-tabix I'.&lt;/P&gt;&lt;P&gt;SKIP.&lt;/P&gt;&lt;P&gt;LOOP AT T.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      WRITE: / SY-TABIX, T-FIELD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;*sy-fdpos contains off-set after string comparison and search operations&lt;/P&gt;&lt;P&gt;SKIP.&lt;/P&gt;&lt;P&gt;WRITE: /'Example of sy-fdpos'.&lt;/P&gt;&lt;P&gt;SKIP.&lt;/P&gt;&lt;P&gt;CLEAR T.&lt;/P&gt;&lt;P&gt;SEARCH T FOR 're'.&lt;/P&gt;&lt;P&gt;READ TABLE T INDEX SY-TABIX.&lt;/P&gt;&lt;P&gt;WRITE: / SY-TABIX, T-FIELD.&lt;/P&gt;&lt;P&gt;SKIP.&lt;/P&gt;&lt;P&gt;WRITE: /9 'At the example of sy-tabix, Row', (3) SY-TABIX, ',' ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      'keyword ''re'' found at off-set position:', (3) SY-FDPOS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SKIP.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;sy-dbcnt contains the number of selected records.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;sy-subrc is 0 if an operation was successful.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;WRITE: /'Example of sy-dbcnt and sy-subrc I'.&lt;/P&gt;&lt;P&gt;SKIP.&lt;/P&gt;&lt;P&gt;SELECT * FROM T000 WHERE MANDT BETWEEN '000' AND '066'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      WRITE: /10 'Mandant:', T000-MANDT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;WRITE: /12 'Number of selected records:', SY-DBCNT CENTERED.&lt;/P&gt;&lt;P&gt;WRITE: /12 'Return code: ' RIGHT-JUSTIFIED, SY-SUBRC .&lt;/P&gt;&lt;P&gt;SKIP.&lt;/P&gt;&lt;P&gt;WRITE: /'Example of sy-dbcnt and sy-subrc II: don't find records'.&lt;/P&gt;&lt;P&gt;SKIP.&lt;/P&gt;&lt;P&gt;SELECT * FROM T000 WHERE MANDT EQ -1.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;WRITE: /12 'Number of selected records:', SY-DBCNT CENTERED.&lt;/P&gt;&lt;P&gt;WRITE: /12 'Return code: ' RIGHT-JUSTIFIED, SY-SUBRC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2007 06:10:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519413#M570136</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-23T06:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: SY-DBCNT QUESTION ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519414#M570137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;THANKS A LOT GUYS! THIS WILL HELP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2007 06:13:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519414#M570137</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-23T06:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: SY-DBCNT QUESTION ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519415#M570138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think that u required code for sy-dbcnt then why u require alternative for the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls be clear when mentioning subject frm next time.&lt;/P&gt;&lt;P&gt;I think that was not good as regards to points for our effort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ameet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2007 06:53:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519415#M570138</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-23T06:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: SY-DBCNT QUESTION ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519416#M570139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Was looking for sy-dbcnt code, but then got a better way in this thread. Sorry in case any confusion caused - this being my first post. Very much appreciate your answer and help. &lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2007 08:18:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sy-dbcnt-question/m-p/2519416#M570139</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-23T08:18:13Z</dc:date>
    </item>
  </channel>
</rss>

