Division of internal table records

Dear all
How can I observe that how many record my internal table got record and how can I divide into by lines
for ex.
          SELECT SINGLE pvprs FROM ckmlcr INTO sum_pvprs-pvprs
            WHERE poper EQ s_poper AND
               kalnr = itab2-kalnr AND
               bdatj = itab2-bdatj AND
               curtp = itab2-curtp.
          IF sy-subrc = 0.
            APPEND sum_pvprs.
I want to get arithmetic range of this sum_pvprs-pvprs
Actually I want to get number of lines and their summations
pvprs1= 10 pvprs=20 pvprs=30 and then
after I got this results 102030 = 60 /3 =20 I need this operation.
All the best
Message was edited by: yusuf tunay çilesiz

I am not sure what do you mean by arithmetic range...if you mean min and max numbers you can use the below logic.
SELECT SINGLE pvprs FROM ckmlcr INTO sum_pvprs-pvprs
WHERE poper EQ s_poper AND
kalnr = itab2-kalnr AND
bdatj = itab2-bdatj AND
curtp = itab2-curtp.
IF sy-subrc = 0.
APPEND sum_pvprs.
1. you can simply sort the sum_pvprs internal table...on pvprs first ascending and than descending to get the min and max numbers by reading the first record of the internal table.
REad table sum_pvprs index 1.
2. you can have two variables lmin and lmax and initialise the same before you append statement.
if sum_pvprs-pvprs > lmax.
  lmax  = sum_pvprs-pvprs.
endif.
if sum_pvprs-pvprs < lmin.
  lmin  = sum_pvprs-pvprs.
endif.
<u><b>Sum and Average.</b></u>
SELECT SINGLE pvprs FROM ckmlcr INTO sum_pvprs-pvprs
WHERE poper EQ s_poper AND
kalnr = itab2-kalnr AND
bdatj = itab2-bdatj AND
curtp = itab2-curtp.
IF sy-subrc = 0.
<b>l_sum = sum_pvprs-pvprs + l_sum.</b>
APPEND sum_pvprs.
ENDSELECT.
<b>DESCRIBE TABLE sum_pvprs LINES lrec.
lavg = l_sum / lrec.</b>
Message was edited by: Anurag Bankley

Similar Messages

  • Refresh internal table records in web dynpro

    Hi Guru's
    I am facing an issue in web dynpro abap.
    in my application there is a button called OPEN.
    when i click on open button internal table records should be refreshed.
    so i have written code like this
    DATA lo_COMPONENTCONTROLLER TYPE REF TO IG_COMPONENTCONTROLLER .
      lo_COMPONENTCONTROLLER =   wd_this->get_componentcontroller_ctr( ).
      lo_componentcontroller->clear_info_refresh_visible( ).
    but iam getting an error message Method "CLEAR_INFO_REFRESH_VISIBLE" is unknown or PROTECTED or PRIVATE
    Could you please help me to how do i activate and refresh the things.
    Thanks
    Rajue

    wd.rajue wrote:
    Hi Guru's
    >
    > I am facing an issue in web dynpro abap.
    > in my application there is a button called OPEN.
    > when i click on open button internal table records should be refreshed.
    > so i have written code like this
    >
    > DATA lo_COMPONENTCONTROLLER TYPE REF TO IG_COMPONENTCONTROLLER .
    >
    >   lo_COMPONENTCONTROLLER =   wd_this->get_componentcontroller_ctr( ).
    >
    >   lo_componentcontroller->clear_info_refresh_visible( ).
    >
    >
    >
    > but iam getting an error message Method "CLEAR_INFO_REFRESH_VISIBLE" is unknown or PROTECTED or PRIVATE
    >
    >
    > Could you please help me to how do i activate and refresh the things.
    >
    > Thanks
    > Rajue
    Raju,
    Please clarify this.
    Do you have a method clear_info_refresh_visible  in your component controller. I think not.
    I am not able to relate your request and coding.
    You can simply clear the internal table like this
    clear lt_intern_tab[].
    If it is a context node then you can bind a empty table to the node to make it empty.
      lo_nd_data->bind_table(
         new_items            =   lt_intern_tab
         set_initial_elements = abap_true ).

  • How to display the Internal table records in table format?

    Hi Gurus,
    I want to display my print prg internal table records in d appropriate form in a table format, give some solution
    with regards
    Thambe

    There are lot many options to do that
    one way is create template  in the maikn window  and define the line types according to your data  cretae text and put your data in the text and go to output options and give  the line type to be used . You can also select details option to have lines in your output.
    similarly YOU CAN CREATE TABLE IN THE MAIN WINDOW FOR THIS YOU DONT NEED TO DEFINE THE LINE TYPES .
    WHEN YOU ARE IN MAIN WINDOW RIGHT CLICK ON TABLE AND GO TO PATH
    CREATE  -> TABLE
                  -> TEMPLATE
    REWARD IF USEFUL
    Regards,
    Nageswar

  • Function module for move internal table records into MSexcel file

    Hi all,
    Tell me the function module which is used to
    move internal table records in to MSexcel file.
    Give the sample program...

    Please search the forum for FM  "GUI_DOWNLOAD" You will get tons of threads with sample code.
    Also take a look into SAP_CONVERT_TO_XLS_FORMAT
    Thanks

  • Help on Delete Internal table records

    Hi,
    I have a internal table with some records in it.
    I need to delete the contents of this based on the condition as below.
    if product_search-Resp_product_company is not initial.
    SORT i_equi BY zzrefeng.
    DELETE i_equi WHERE zzrefeng <> product_search-Resp_product_company.
    endif.
    when i execute this all the records are getting deleted irrespective of the condition mentioned.
    Can anyone help me on this.
    Regards,
    Ram

    Hi,
    Need to delete the records if <b>ZZREFENG</b> does not have the value of <b>product_search-Resp_product_company</b> .
    Here I have product_search-Resp_product_company value as FI14. And also the internal table contains some records with ZZREFENG = FI14.
    I need to delete the internal table records if ZZREFENG <> FI14. But when i execute the statement it is deletng all the records even ZZREFENG = FI14 records also.
    Regards,
    Ram

  • Reg : Joining the all internal table records into a single internal table

    Hi all
    I am having 5 internal tables and i want to put all these entries in a single intrnal table and my requirement is for each and every record it has to go through all the internal tables and if an entry is missing meand.it has to go through the other internal tables and for missing entries i should leave it as blank and rest of the contents i have to display can any please gimme some logic how to do this??
    Thanks in advance

    Don't have time or will to deliver turnkey solutions, but here is a frame:
    LOOP AT itab1...
      READ TABLE itab2 WITH TABLE KEY... (fields linking itab1 and itab2)
      READ TABLE itab3 WITH TABLE KEY... (fields linking itab1 and itab3)
      LOOP AT itab4 WHERE... (fields linking itab1 and itab4)
        READ TABLE itab5 WITH TABLE KEY... (fields linking itab4 and itab5)
        MOVE-CORRESPONDING... (all five work areas to target work area)
        APPEND itabtarget...
      ENDLOOP.
    ENDLOOP.
    so use READ when there is a 1:1 relationship (e.g. check table entry), and LOOP when there is a 1:N relationship (e.g. items for a header)
    Thomas

  • How to send Internal table records to Idoc Inbound posting FM to create Ido

    Hello Experts,
    I have all the data necessary to create shipments in one internal table inside my ABAP program.
    I can use BAPI_SHIPMENT_CREATE to create shipments. But associated with this BAPi there is one ALE message type SHIPMENT_CREATEFROMDATA. Now my requirement is to use this message type to cretae my shipments via idocs for one scenario for some of the records in the internal table.
    For this message type, I got the inbound function module IDOC_INPUT_SHIPMENT_CREATEFROM from TBDBE table.
    Can anybody please let me know how to send the data from the internal table to this inbound function  module?
    Becasue it has mandatory parameters INPUT_METHOD, MASS_PROCESSING. What values should be passed to these parameters if the data has to be sent to this function module?
    Regards.

    Hi Ravikanth,
    Thankyou very much for your quick reply.
    So If I split my internal table data and populate IDOC_DATA and IDOC_CONTROL and pass to the inbound function module directly in my ABAP program, will that be going to create idocs and post shipments?
    I mean is it enough to call the Inbound posting function module directly in my ABAP program or any other FMs to be called to take care of ALE settings and shipment creation?
    Please confirm.
    REgards.

  • Doubt in internal table record count

    Hi,
    i have an internal table with 5 fields. Last field is flag. In my internal table lot many records are there. i want to count only the records with flag 'E'. How to count the total records with 'E'.
    Mohana

    Try like this,
    Data: c type i.
    Loop at itab into wa.
    if wa-flag = 'E'.
    c = c + 1.
    endif.
    Endloop.
    Write:/ 'Total records', c.
    OR
    LOOP AT itab WHERE flag = 'E'.
      c = c + 1.
    ENDLOOP.
    Edited by: Sap Fan on Apr 3, 2009 5:21 PM

  • Problem in Internal table Record Splitting

    Hi All,
    Plz look into my below requirement and me know your Suggestions.
    My Internal tables :
    1.*Internal table for Infotype 2002 (Attendances)
    DATA : BEGIN OF T_PA2002 OCCURS 0,
           PERNR LIKE PA2002-PERNR,
           BEGDA LIKE PA2002-BEGDA,
           ENDDA LIKE PA2002-ENDDA,
           BEGUZ LIKE PA2002-BEGUZ,
           ENDUZ LIKE PA2002-ENDUZ,
           SUBTY LIKE PA2002-SUBTY,
           END OF T_PA2002.
    1.*Internal table for Infotype 9003 (Custom Attendances)
    DATA : BEGIN OF T_PA9003HRABS OCCURS 0,
           PERNR LIKE PA9003-PERNR,
           BEGDA LIKE PA9003-BEGDA,
           ENDDA LIKE PA9003-ENDDA,
           SHIFT LIKE PA9003-SHIFT,
           OTHOURS LIKE PA9003-OTHOURS,
           BEGUZ LIKE PA2002-BEGUZ,
           ENDUZ LIKE PA2002-ENDUZ,
           NSA LIKE PA9003-NSA,     
           MA  LIKE PA9003-MA,     
           CA  LIKE PA9003-CA,
           END OF T_PA9003HRABS.
    Requirement :
    1.  Internal table T_PA2002
        PERNR     BEGDA          ENDDA          BEGUZ          ENDUZ
         5          27.12.2006     27.12.2006     10:00:00     14:30:00
    2.  Internal table T_PA9003HRABS
        PERNR     BEGDA          ENDDA          BEGUZ          ENDUZ          HRABS     OTHOURS     MA     CA     WA
         5          27.12.2006     27.12.2006     08:00:00     14:30:00     2     2     
    Iam doing comparision between T_PA2002 and T_PA9003HRABS.
    Iam doing some caluculation to get Hourly absence,OT Hours and else ( Fields)
    So my Hourly absence on 27.12.2006 was 2Hours.
    So i need to split my Final table as below how to do that....( It is like In infotypes COPY option i.e 1 record to 3 Record )
    I need the Output like this...
    3.  Final Internal table T_PA9003HRABS
        PERNR     BEGDA          ENDDA          BEGUZ          ENDUZ          HRABS     OTHOURS     MA     CA     WA
         5          25.12.2006     26.12.2006     08:00:00     14:30:00     0     0     
         5          27.12.2006     27.12.2006     08:00:00     14:30:00     2     2     
         5          25.12.2006     26.12.2006     08:00:00     14:30:00     0     0     
    Points will be rewarded.
    Thanks,
    Suresh.U

    you could:
    sort T_PA2002 by pernr.
    sort T_PA9003HRABS by pernr.
    loop at T_PA2002
    read table T_PA9003HRABS with key
    pernr = T_PA2002-pernr
    begda = T_PA2002-begda
    binary search.
    ***here you can specify how you calculate
    ***your absences and apply them to your
    ***final internal table.
    endloop.
    hope this helps.
    Warren

  • Doubt in internal table records

    Hi all,
       I have a one problem, in my internal table have 5 records. i did some correction in my progm after i execute the loop i need the correction in the records. In debug mode it showing in the header level. but it not changing the body records. give some soln.
    Thanks,
    gowri

    hi,
    chk the code below:
    loop at itab.
    modify itab index sy-tabix.
    endloop.
    regards,
    Navneeth K.

  • Internal table record checking (Urgent)

    Hi Experts,
    I have an internal table having records. I want to check each record of the table with every other record to find out if there exist same record for more then one key field.
    Can anybody help me to place the logic for how i can check the records with each record? Like
    lifnr     banks
    1         12
    2         34
    3         12
    4         12
    5          76
    I want to find out 1,3 and 4.
    Thanks a ton in advance

    Hi Moni,
    IF in my First Reply the Second technique was working then this should solve your Problem:
    DATA:
      w_index TYPE i,
      w_lines TYPE i,
      w_duplicate(10) TYPE c.
    DESCRIBE itab LINES w_lines.
    LOOP AT itab INTO wa.
      w_index = sy-tabix + 1.
      DO. 
      READ TABLE itab INTO wa1 INDEX w_index.
        IF w_index <= w_lines.
          IF wa-banks EQ wa1-banks.
            CONCATENATE w_duplicate wa1-lifnr INTO w_duplicate SEPARATED BY SPACE.
            wa-duplicate = w_duplicate.
            MODIFY itab FROM wa.
          ENDIF.
        ELSE.
          EXIT.
        ENDIF.
       ADD 1 TO w_index.
      ENDDO.
    ENDLOOP.
    LOOP AT itab INTO wa.
      write:
        / wa-lifnr,
          wa-banks,
          wa-duplicates.
    ENDLOOP.
    ELSE try the below code it is same as above except one more Internal Table is used:
    DATA:
      w_index        TYPE i,
      w_lines        TYPE i,
      jtab            LIKE itab,
      w_duplicate(10) TYPE c.
    DESCRIBE itab LINES w_lines.
    LOOP AT itab INTO wa.
      w_index = sy-tabix + 1.
      DO. 
      READ TABLE jtab INTO wa1 INDEX w_index.
        IF w_index <= w_lines.
          IF wa-banks EQ wa1-banks.
            CONCATENATE w_duplicate wa1-lifnr INTO w_duplicate SEPARATED BY SPACE.
            wa-duplicate = w_duplicate.
            MODIFY itab FROM wa.
          ENDIF.
        ELSE.
          EXIT.
        ENDIF.
       ADD 1 TO w_index.
      ENDDO.
    ENDLOOP.
    LOOP AT itab INTO wa.
      write:
        / wa-lifnr,
          wa-banks,
          wa-duplicates.
    ENDLOOP.
    Regards,
    Sunil.

  • Internal table Records

    Hi all,
    Can anyone tell, after deletion the records from one internal table itab1 using specific condition  , that  how will insert the single record from another itab2
    into itab1 on the  same index.
    Regards
    Alok

    ok , please find whole  code as shown below for assigning role in su01.
    Code:
    FORM add_roles_user.
      Data: int_agr like bapiagr occurs 0 with header line,
            int_agr1 like bapiagr occurs 0 with header line,
            user_activitygroups like usagr occurs 0 with header line.
      loop at int_role where uname = bname or uname = ''.
         int_agr-agr_name = int_role-agr_name.
         int_agr-from_dat = int_role-begda.
         int_agr-to_dat = int_role-endda.
        append int_agr.
      endloop.
      if not int_agr[] is initial.
        CALL FUNCTION 'SUSR_USER_AGR_ACTIVITYGR_GET'
          EXPORTING
            USER_NAME           = bname
          TABLES
            USER_ACTIVITYGROUPS = user_activitygroups
          EXCEPTIONS
            USER_NAME_NOT_EXIST = 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.
        loop at user_activitygroups.
    Message 371365
          read table int_agr with key agr_name =
             user_activitygroups-agr_name from_dat =
             user_activitygroups-from_dat to_dat =
             user_activitygroups-to_dat org_flag =
             user_activitygroups-ORG_FLAG.
          if sy-subrc <> 0.
            int_agr-agr_name = user_activitygroups-agr_name.
            int_agr-from_dat = user_activitygroups-from_dat.
            int_agr-to_dat = user_activitygroups-to_dat.
            int_agr-ORG_FLAG = user_activitygroups-ORG_FLAG.
            append int_agr.
          endif.
    Message 371365
    Start of changes by P4TK900204
           sort int_agr by agr_name." FROM_DAT to_dat descending.
           delete adjacent duplicates from int_agr comparing agr_name.
    End of changes by P4TK900204
        endloop.
      endif.
    int_agr1[] = int_agr[].
    loop at int_agr1.
       delete int_role where agr_name = int_agr1-agr_name.
    endif.
    endloop.
    append lines of int_role to int_agr1.
    sort int_agr1 by agr_name." FROM_DAT to_dat descending.
      CALL FUNCTION 'SUSR_BAPI_USER_ACTGROUPS_ASSIG'
        EXPORTING
          USERNAME             = bname
          INCL_HR_ASSIGN       = 'X'
        TABLES
          ACTIVITYGROUPS       = int_agr1
          RETURN               = return_int2.
      loop at return_int2.
        case return_int2-number.
          when '048'.
          when others.
            message-msgty = return_int2-type.
            message-msgid = return_int2-id.
            message-msgno = return_int2-number.
            message-msgv1 = return_int2-message_v1.
            message-msgv2 = return_int2-message_v2.
            message-msgv3 = return_int2-message_v3.
            message-msgv4 = return_int2-message_v4.
            perform set_return_message using message changing return_int.
        endcase.
      endloop.
    ENDFORM.                    " add_roles_user

  • How to select and sum  internal table records

    Dear Friends
    I kindly ask you if we have select statement
       if s_mtart = 'z003'
          select single pvprs from ckmlcr into ckmlcr-pvprs
    where poper EQ s_poper and
          kalnr = itab2-kalnr  and
          bdatj = itab2-bdatj and
          curtp = itab2-curtp.
    like this how can I calculate how many record it got and I want to get summation of this field(pvprs).And for all poper's must contain.
      Please  Let me remind you my itab is already open I didn't put any thing for this situation

    it seems to be you written this SELECT in a loop. if so,
    instead of pushing the values into ckmlcr-pvprs ,create an internal table
    data : begin of itab,
         pvprs  type ckmlcr-pvprs ,
        end of itab.
    then just after that SELECT SINGLE,
    select single pvprs from ckmlcr <b>into ITAB-pvprs</b>
    where poper EQ s_poper and
    kalnr = itab2-kalnr and
    bdatj = itab2-bdatj and
    curtp = itab2-curtp.
    IF SY-SUBRC = 0.
      APPEND ITAB.
    here either you can use APPEND OR COLLECT.
    If you use COLLECT,all the values will get summed up and final sum will be in the table ITAB-pvprs.
    ENDIF.
    After all loops your itab will have the totals.
    DESCRIBE TABLE ITAB LINES V_LINES.
    V_LINES Will have total no of lines.
    Regards
    srikanth

  • Internal table records  - print horizontally

    Hi Experts,
    I have an internal table containing handling units(container numbers). I want to print these in a row(s). For example if my internal table has data as
    container1
    container2
    container3
    I want the output as
    container1 / container2 / container3
    Can anyone suggest me a solution
    Regards,
    Abdullah

    what technique are you using? Smartforms or sapscript? or even adobe PDF forms?
    Anyway there are sooooo much ways to achieve this.
    Easiest would be probably to handle that in the driver program.
    loop at itab into wa.
      concatenate lv_line wa-value into lv_line seperated by ' / '.
    endloop.
    in form print lv_line then.
    if it can happen that your itab holds so much records that your values wont fit into one line, you need to think about printing more lines adn creating more lines in your loop.
    you need some criteria then when to start a new line, e.G. every 5 values or so.
    you could as well append your line to a text every 5 values and then save the text using FM SAVE_TEXT.
    Now on form you can print you text.

  • How to add the records of 2 internal table records into one file

    hello experts,
    My scenario is...
    I am retrieving the data for the for the credit, debit and trailer records of the customer into 3 different internal tables and finally i have to append all those records into one file first debit records then credit records finally the trailer record.... how to do that can anyone give some idea plzzzzzzzzz..
    Plz its bit urgent..
    Thanks a lot for your anticipation
    SRI

    Hello,
    Do like this.
    " Assume u have three itab.
    "Itab1 - debit
    "Itab2 - credit
    "Itab3 - Credit.
    REPORT ZV_TEST_SERVER .
    *PARAMETERS: P_FILE TYPE STRING."RLGRAP-FILENAME.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *   BIN_FILESIZE                  =
        FILENAME                      = P_FILE
    *   FILETYPE                      = 'ASC'
       APPEND                        = 'X'  " Check here
    *   WRITE_FIELD_SEPARATOR         = ' '
    *   HEADER                        = '00'
    *   TRUNC_TRAILING_BLANKS         = ' '
    *   WRITE_LF                      = 'X'
    *   COL_SELECT                    = ' '
    *   COL_SELECT_MASK               = ' '
    *   DAT_MODE                      = ' '
    * IMPORTING
    *   FILELENGTH                    =
      TABLES
        DATA_TAB                      = ITAB1
    * EXCEPTIONS
    *   FILE_WRITE_ERROR              = 1
    *   NO_BATCH                      = 2
    *   GUI_REFUSE_FILETRANSFER       = 3
    *   INVALID_TYPE                  = 4
    *   NO_AUTHORITY                  = 5
    *   UNKNOWN_ERROR                 = 6
    *   HEADER_NOT_ALLOWED            = 7
    *   SEPARATOR_NOT_ALLOWED         = 8
    *   FILESIZE_NOT_ALLOWED          = 9
    *   HEADER_TOO_LONG               = 10
    *   DP_ERROR_CREATE               = 11
    *   DP_ERROR_SEND                 = 12
    *   DP_ERROR_WRITE                = 13
    *   UNKNOWN_DP_ERROR              = 14
    *   ACCESS_DENIED                 = 15
    *   DP_OUT_OF_MEMORY              = 16
    *   DISK_FULL                     = 17
    *   DP_TIMEOUT                    = 18
    *   FILE_NOT_FOUND                = 19
    *   DATAPROVIDER_EXCEPTION        = 20
    *   CONTROL_FLUSH_ERROR           = 21
    *   OTHERS                        = 22
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *   BIN_FILESIZE                  =
        FILENAME                      = P_FILE
    *   FILETYPE                      = 'ASC'
       APPEND                        = 'X'  " Check here
    *   WRITE_FIELD_SEPARATOR         = ' '
    *   HEADER                        = '00'
    *   TRUNC_TRAILING_BLANKS         = ' '
    *   WRITE_LF                      = 'X'
    *   COL_SELECT                    = ' '
    *   COL_SELECT_MASK               = ' '
    *   DAT_MODE                      = ' '
    * IMPORTING
    *   FILELENGTH                    =
      TABLES
        DATA_TAB                      = ITAB2  " Check here
    * EXCEPTIONS
    *   FILE_WRITE_ERROR              = 1
    *   NO_BATCH                      = 2
    *   GUI_REFUSE_FILETRANSFER       = 3
    *   INVALID_TYPE                  = 4
    *   NO_AUTHORITY                  = 5
    *   UNKNOWN_ERROR                 = 6
    *   HEADER_NOT_ALLOWED            = 7
    *   SEPARATOR_NOT_ALLOWED         = 8
    *   FILESIZE_NOT_ALLOWED          = 9
    *   HEADER_TOO_LONG               = 10
    *   DP_ERROR_CREATE               = 11
    *   DP_ERROR_SEND                 = 12
    *   DP_ERROR_WRITE                = 13
    *   UNKNOWN_DP_ERROR              = 14
    *   ACCESS_DENIED                 = 15
    *   DP_OUT_OF_MEMORY              = 16
    *   DISK_FULL                     = 17
    *   DP_TIMEOUT                    = 18
    *   FILE_NOT_FOUND                = 19
    *   DATAPROVIDER_EXCEPTION        = 20
    *   CONTROL_FLUSH_ERROR           = 21
    *   OTHERS                        = 22
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *   BIN_FILESIZE                  =
        FILENAME                      = P_FILE
    *   FILETYPE                      = 'ASC'
       APPEND                        = 'X'  " Check here
    *   WRITE_FIELD_SEPARATOR         = ' '
    *   HEADER                        = '00'
    *   TRUNC_TRAILING_BLANKS         = ' '
    *   WRITE_LF                      = 'X'
    *   COL_SELECT                    = ' '
    *   COL_SELECT_MASK               = ' '
    *   DAT_MODE                      = ' '
    * IMPORTING
    *   FILELENGTH                    =
      TABLES
        DATA_TAB                      = ITAB3 " Check here
    * EXCEPTIONS
    *   FILE_WRITE_ERROR              = 1
    *   NO_BATCH                      = 2
    *   GUI_REFUSE_FILETRANSFER       = 3
    *   INVALID_TYPE                  = 4
    *   NO_AUTHORITY                  = 5
    *   UNKNOWN_ERROR                 = 6
    *   HEADER_NOT_ALLOWED            = 7
    *   SEPARATOR_NOT_ALLOWED         = 8
    *   FILESIZE_NOT_ALLOWED          = 9
    *   HEADER_TOO_LONG               = 10
    *   DP_ERROR_CREATE               = 11
    *   DP_ERROR_SEND                 = 12
    *   DP_ERROR_WRITE                = 13
    *   UNKNOWN_DP_ERROR              = 14
    *   ACCESS_DENIED                 = 15
    *   DP_OUT_OF_MEMORY              = 16
    *   DISK_FULL                     = 17
    *   DP_TIMEOUT                    = 18
    *   FILE_NOT_FOUND                = 19
    *   DATAPROVIDER_EXCEPTION        = 20
    *   CONTROL_FLUSH_ERROR           = 21
    *   OTHERS                        = 22
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    If useful reward.
    Vasanth

Maybe you are looking for