ASCI to ALV format urgent please.

Hi ;
I have internal table format as  DATA: gt_txtlines(1024) TYPE c OCCURS 0 WITH HEADER LINE. This containes alv lines submitted from external report . So some lines and format of internal table is not usefull .Is there any format to upload
CALL FUNCTION 'LIST_TO_ASCI'
    TABLES
      listobject         = lt_list
      listasci           = lt_txtlines
    EXCEPTIONS
      empty_list         = 1
      list_index_invalid = 2
      OTHERS             = 3.
functions produce asci format data take as an normal internal table format (column design.) I mean take memory data as its original internal table format.
Please find below the code ;
*&      Form  submit_fields
      text
-->  p1        text
<--  p2        text
FORM submit_fields .
  SUBMIT rcs15001  WITH pm_idnrk EQ s_matnr-low
                   WITH pm_werks EQ p_werks
                   WITH pm_stlan EQ p_stlan
                   WITH pm_datuv EQ p_datuv
                   WITH pm_emeng EQ p_emeng
                   WITH pm_rmeng EQ p_rmeng
                   EXPORTING LIST TO MEMORY
                   AND RETURN.
  PERFORM retrieve_list_from_memory TABLES gt_listout
                                           gt_list
                                           gt_txtlines.
ENDFORM.                    " submit_fields
*&      Form  retrieve_list_from_memory
      text
     -->P_LISTOUT  text
FORM retrieve_list_from_memory  TABLES lt_listout STRUCTURE gt_listout
                                       lt_list    STRUCTURE gt_list
                                       lt_txtlines.
  CLEAR lt_list.  REFRESH lt_list.
  CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
      listobject = lt_list
    EXCEPTIONS
      not_found  = 1
      OTHERS     = 2.
  CHECK sy-subrc = 0.
  CALL FUNCTION 'LIST_TO_ASCI'
    TABLES
      listobject         = lt_list
      listasci           = lt_txtlines
    EXCEPTIONS
      empty_list         = 1
      list_index_invalid = 2
      OTHERS             = 3.
  CHECK sy-subrc = 0.
  PERFORM rearrange_list TABLES lt_txtlines.
  CALL FUNCTION 'LIST_FREE_MEMORY'.
ENDFORM.                    " retrieve_list_from_memory
How can I get alv list
Regards.
Message was edited by:
        yanut

Hi ;
I have internal table format as  DATA: gt_txtlines(1024) TYPE c OCCURS 0 WITH HEADER LINE. This containes alv lines submitted from external report . So some lines and format of internal table is not usefull .Is there any format to upload
CALL FUNCTION 'LIST_TO_ASCI'
    TABLES
      listobject         = lt_list
      listasci           = lt_txtlines
    EXCEPTIONS
      empty_list         = 1
      list_index_invalid = 2
      OTHERS             = 3.
functions produce asci format data take as an normal internal table format (column design.) I mean take memory data as its original internal table format.
Please find below the code ;
*&      Form  submit_fields
      text
-->  p1        text
<--  p2        text
FORM submit_fields .
  SUBMIT rcs15001  WITH pm_idnrk EQ s_matnr-low
                   WITH pm_werks EQ p_werks
                   WITH pm_stlan EQ p_stlan
                   WITH pm_datuv EQ p_datuv
                   WITH pm_emeng EQ p_emeng
                   WITH pm_rmeng EQ p_rmeng
                   EXPORTING LIST TO MEMORY
                   AND RETURN.
  PERFORM retrieve_list_from_memory TABLES gt_listout
                                           gt_list
                                           gt_txtlines.
ENDFORM.                    " submit_fields
*&      Form  retrieve_list_from_memory
      text
     -->P_LISTOUT  text
FORM retrieve_list_from_memory  TABLES lt_listout STRUCTURE gt_listout
                                       lt_list    STRUCTURE gt_list
                                       lt_txtlines.
  CLEAR lt_list.  REFRESH lt_list.
  CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
      listobject = lt_list
    EXCEPTIONS
      not_found  = 1
      OTHERS     = 2.
  CHECK sy-subrc = 0.
  CALL FUNCTION 'LIST_TO_ASCI'
    TABLES
      listobject         = lt_list
      listasci           = lt_txtlines
    EXCEPTIONS
      empty_list         = 1
      list_index_invalid = 2
      OTHERS             = 3.
  CHECK sy-subrc = 0.
  PERFORM rearrange_list TABLES lt_txtlines.
  CALL FUNCTION 'LIST_FREE_MEMORY'.
ENDFORM.                    " retrieve_list_from_memory
How can I get alv list
Regards.
Message was edited by:
        yanut

Similar Messages

  • Date format, urgent, Please help

    I'm having problem with date format. In the sql I need get data that greater than
    '05-01-2005' but cannot get it work.the = is Ok but not > or >=.
    Could someone please tell why and how to do it?
    Many thanks
    this one is work.
    select distinct to_char(LAST_MODIFIED_DATE, 'DD/MM/YYYY') start_date
    from ccst_acctsys_account
    where to_char(LAST_MODIFIED_DATE,'DD-MM-YYYY') = '05-01-2005';
    this one is not work
    select distinct to_char(LAST_MODIFIED_DATE, 'DD/MM/YYYY') start_date
    from ccst_acctsys_account
    where to_char(LAST_MODIFIED_DATE,'DD-MM-YYYY') > '05-01-2005'

    since you convert the date to character format you won't be able to use the > or <
    you might want to use the trunc() function and convert the '05-01-2005' in date datatype:
      select distinct to_char(LAST_MODIFIED_DATE, 'DD/MM/YYYY') start_date
        from ccst_acctsys_account
       where trunc(LAST_MODIFIED_DATE) >= to_date('05-01-2005','dd-mon-yyyy');Message was edited by:
    Warren Tolentino
    Jonh has the same solution. You might want to try including the TRUNC() function.

  • OION Transaction-Group formation-URGENT PLEASE

    Dear PM experts,
    when I try to create Number range group in OION transcation in Testing client,it not getting created.Already around 150 groups are formed and objects were assigned.Is there is any restriction in NUMBER OF GROUPS in this Transaction.
    Since its very urgent,Guys pl give solution.
    Regards
    ISWARI

    What do u mean by not getting created?! There must be some message, symptom, result!
    Message was edited by:
            Bala Aluru

  • PNG File format  ------- URGENT Please help

    Hi all
    I am trying to create a file of format type png. my code looks like this could someone help me with this and tell me whats wrong and how should i go about this. The file ofcourse is getting created but there is nothing in the file.
    Thanks in advance
    File file = new File("something.png");
    String filename = "something.png";
    FileOutputStream f = new FileOutputStream(filename);
    java.awt.image.renderable.ParameterBlock pb = new java.awt.image.renderable.ParameterBlock();
    pb.addSource(image);
    //pb.add(DataBuffer.TYPE_BYTE);
    com.sun.media.jai.codec.PNGEncodeParam.RGB encodeParam = new com.sun.media.jai.codec.PNGEncodeParam.RGB();
    com.sun.media.jai.codec.ImageEncoder encoder = com.sun.media.jai.codec.ImageCodec.createImageEncoder("PNG", f, encodeParam);
    encoder.encode(image);
    f.close();
              

    take a look at
    http://www.javaside.com/asp/mfr.asp?page=/us/jspImage.shtml

  • MB5T background schedule ouput in alv format

    Hi all,
    Please help me to get MB5T report ouput of background schedule in ALV.
    I have put that report in bacground scheduling & the output of the same in BEST format but my client want the output in AlV format.
    Please suggest.
    Regards,
    Anant

    Output of MB5T can't be in ALV format in background. In foreground also this is done in two steps., In first system display in BEST format..this can be changed to ALV manually in second step.

  • Change output format of  MC45,key usage value report to ALV format?

    Can someone please help me to change the change the Output of MC45 report to ALV format?
    Please help!!!
    Thanks!!!
    Owais

    I know i have to create a copy of MC45 to some z program but afterwards I am not sure where to look for to change the output format.
    Our ababper is extremely busy so i wanted to do litle bit of chnages by myself. I do have couple of years of java experience several years back, I thought i could help our abaper and learn myself little bit also.
    Thanks!!!
    Owais

  • Date format Problem in OAF R12 Urgent Please help!!!

    We have acustom application in OAF which was developed in 11i. Now we migrated the same to R12.
    In this there are two date fileds getting dispayed on the page and the query for the same is
    SELECT TO_CHAR (SYSDATE, 'dd-mm-yyyy') AS CURRENT_DATE, UPPER (TO_CHAR (SYSDATE - 10, 'mon-yy')) AS g_period, UPPER (TO_CHAR (SYSDATE + 5, 'mon-yy')) AS gnext_period, TO_CHAR (sysdate,'dd-mon-yyyy') as today_date, TO_CHAR (sysdate - 1,'dd-mon-yyyy') as yesterday_date FROM DUAL
    In 11i version the output is dispaying correctly but in R12 the current date is dispayed as
    Start Date 04-Nov-5242
    End Date 04-Nov-5241
    As per logic it should be
    Start Date 09-Feb-2012
    End Date 10-Feb-2012
    Please help..Urgent issue.

    Here are the answers to your problems :
    1. Once u restart , the oracle services and the database is not mounting automatically.That is because, when you install the Oracle Oracle8i Standard Edition Release (8.1.7), the two key services namely
    OracleOraHome81TNSListner and
    OracleService<your SID name>
    are configured as manual start ( check the NT --> start>setting>control panel>services. )
    For the database to start automatically the next time you start your machine, these two services will have to be put into "Automatic Start" mode.
    < for this double click on the respective service, select the "Automatic" radio button and click on ok>.
    Now when you restart the machine, your database will be automatically mounted.
    2. this as explained above is a corollory to the above problem. you can start or stop your database on NT using the "Services" window....
    hope this helps.
    bye.
    Hi All,
    I have installed Oracle Oracle8i Standard Edition Release (8.1.7) from technet site.
    I have installed it on windows NT 4.0 .
    Installation is fine.
    I can access or get into SQL prompt .
    I have created a database also.
    1st problem
    My problem is once I restart the Machine and try to access SQL plus .it gives me an error
    ORA-01034: Oracle not available
    ORA-27101: shared memory realm does not exist.
    2nd problem
    I dont know how to start and stop the database , as there is nothing to do that in the start menu of Oracle .
    How do i do this .
    This is very urgent please help.
    regards,
    Preeti

  • Please send HR ALV format programs

    hai all,
    if any body develop the hr report in alv format pls send the code that wiil be usefull to me.
    thanks,
    lakshma

    Have a look at http://www.sapdevelopment.co.uk/programs/custom/zp_postcode.htm
    *: Report:  ZP_POSTCODE                                                :
    *: Author:  www.SAPDev.co.uk                                           :
    *: Date  :  2004                                                       :
    *: Description: Displays report of employees by postcode area,         :
    *:              includes current travelling allowances (i.e. parking   :
    *:              permit or transport card etc..)                        :
    *: Use:         Help encourage the use of car sharing and public       :
    *:              transport where appropriate.                           :
    REPORT  zp_postcode.
    type-pools: slis.                                      "ALV Declarations
    NODES: pernr.
    INFOTYPES: 0000, 0001, 0002, 0006, 0008, 0014, 0105, 0121.
    SELECTION-SCREEN BEGIN OF BLOCK pcode WITH FRAME TITLE text-s01.
    SELECT-OPTIONS: so_pcode FOR p0006-pstlz.
    SELECTION-SCREEN END OF BLOCK pcode.
    TYPES: BEGIN OF t_output,
      pernr       TYPE p0001-pernr,   "personnel name
      anredtxt    TYPE t522t-atext,   "title (based on p0002-anred)
      fname       TYPE p0002-vorna,   "first name
      lname       TYPE p0002-nachn,   "last name
      orgtx       TYPE t527x-orgtx,   "dept
      fte         TYPE p0008-bsgrd,   "fte
      parking(20) TYPE c,
      payslip     TYPE t526-sachn,        "payslip address
      telno       TYPE p0105-usrid_long,  "tel number(p0105-usrty = 0020)
      email       TYPE p0105-usrid_long,  "email (p0105-usrty = MAIL)
      postcode    type p0006-pstlz,
    END OF t_output.
    DATA: it_output TYPE STANDARD TABLE OF t_output INITIAL SIZE 0,
          wa_output TYPE t_output.
    *ALV data declarations
    data: fieldcatalog   type slis_t_fieldcat_alv with header line,
          gd_tab_group   type slis_t_sp_group_alv,
          gd_layout      type slis_layout_alv,
          gd_repid       like sy-repid,
          gt_events      type slis_t_event,
          gd_prntparams  type slis_print_alv,
          gd_count(6)    type n,
          gd_outtext(70) type c,
          gd_lines       type i.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    clear: gd_count.
    GET pernr.
    Infotype 0121 is used to store multiple contracts for personnel.
    Field p0121-hpern contains the personnel number for the main contract.
      PROVIDE * from p0121 between pn-begda and pn-endda.
      Check if main contract
        if p0121-pernr ne p0121-hpern.
          reject.
        endif.
      ENDPROVIDE.
      add 1 to gd_count.
      concatenate 'Processing personnel data'(m10) gd_count into gd_outtext
                separated by ' '.
    Display indicator for employee count
      perform progress_indicator using gd_outtext.
    Retrieve datd from infotypes
      rp_provide_from_last p0000 space pn-begda pn-endda.
      rp_provide_from_last p0001 space pn-begda pn-endda.
      rp_provide_from_last p0002 space pn-begda pn-endda.
      rp_provide_from_last p0006 space pn-begda pn-endda.
      rp_provide_from_last p0008 space pn-begda pn-endda.
      rp_provide_from_last p0014 space pn-begda pn-endda.
    Check post code
      CHECK p0006-pstlz IN so_pcode.  "cp
    Post code
      wa_output-postcode = p0006-pstlz.
    Personnel number
      wa_output-pernr = pernr-pernr.
    Personnel title
      SELECT SINGLE atext
        FROM t522t
        INTO wa_output-anredtxt
       WHERE sprsl EQ sy-langu AND
             anred EQ p0002-anred.
    First name
      wa_output-fname = p0002-vorna.
    Last name
      wa_output-lname = p0002-nachn.
    Organizational Unit text (dept)
      SELECT SINGLE orgtx
        FROM t527x
        INTO wa_output-orgtx
       WHERE sprsl EQ sy-langu AND
             orgeh EQ p0001-orgeh AND
             endda GE sy-datum.
    FTE
      wa_output-fte = p0008-bsgrd.
    Parking / travel deducted?
      CASE p0014-lgart.
        WHEN '7180' OR '7181' OR '7182'.
          wa_output-parking = text-002.
        WHEN '7183'.
          wa_output-parking = text-001.
        WHEN '7171' OR '7172' or '7173' or '7174' or
             '7175' or '7176' or '7177' or '7178'.
          wa_output-parking = text-003.
      ENDCASE.
    Payslip Address
      SELECT SINGLE sachn
        FROM t526
        INTO wa_output-payslip
       WHERE werks EQ p0001-werks AND
             sachx EQ p0001-sacha.
      PROVIDE * from p0105 between pn-begda and pn-endda.
      Telephone numbers
        if p0105-usrty = '0020'.
           wa_output-telno = p0105-usrid_long.
        endif.
      Email address
        if p0105-usrty = 'MAIL'.
           wa_output-email = p0105-usrid_long.
        endif.
      ENDPROVIDE.
      append wa_output to it_output.
      clear: wa_output.
    *END-OF-SELECTION.
    END-OF-SELECTION.
    describe table it_output lines gd_lines.
    if gd_lines gt 0.
      perform build_fieldcatalog.
      perform build_layout.
      perform display_alv_report.
    else.
      message i003(zp) with 'No records found'.
    endif.
    *&      Form  PROGRESS_INDICATOR
          Displays progress indicator on SAP screen
    form progress_indicator using p_text.
      call function 'SAPGUI_PROGRESS_INDICATOR'
          exporting
            PERCENTAGE = 0
               text       = p_text.
    endform.                    " PROGRESS_INDICATOR
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
      fieldcatalog-fieldname   = 'PERNR'.
      fieldcatalog-seltext_m   = 'Personnel No.'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
    fieldcatalog-emphasize   = 'X'.
    fieldcatalog-key         = 'X'.
    fieldcatalog-do_sum      = 'X'.
    fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'ANREDTXT'.
      fieldcatalog-seltext_m   = 'Title'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'FNAME'.
      fieldcatalog-seltext_m   = 'First Name'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'LNAME'.
      fieldcatalog-seltext_m   = 'Last Name'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'ORGTX'.
      fieldcatalog-seltext_m   = 'Department'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'FTE'.
      fieldcatalog-seltext_m   = 'FTE'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PARKING'.
      fieldcatalog-seltext_m   = 'Parking/Metrocard'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PAYSLIP'.
      fieldcatalog-seltext_m   = 'Payslip Add.'.
      fieldcatalog-col_pos     = 7.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'TELNO'.
      fieldcatalog-seltext_m   = 'Telephone'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EMAIL'.
      fieldcatalog-seltext_m   = 'E-mail'.
      fieldcatalog-col_pos     = 9.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'POSTCODE'.
      fieldcatalog-seltext_m   = 'Post code'.
      fieldcatalog-col_pos     = 10.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
      gd_layout-zebra             = 'X'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
                i_save                  = 'X'
           tables
                t_outtab                = it_output
           exceptions
                program_error           = 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.
    endform.                    " DISPLAY_ALV_REPORT
    Best Regards,
    Vibha
    *Plz mark useful answers

  • Modification in report into ALV Format

    Hi Experts
    How can I modify this report in ALV Format with Top of page and Parameters should be display on runtime.
    Can anyone modify my program please
    Thanks in advanced.
    REPORT FZEL LINE-SIZE  220 LINE-COUNT 75
             NO STANDARD PAGE HEADING.
    TABLES : equi,
             equz,
             imptt,
             imrg,
             eqkt,
             iloa.
    TYPES:  BEGIN OF ty_data  ,
             equnr      type equnr,         " Euipment no
             eqktx      type eqkt-eqktx,    " Equipment Text
             eqfnr       type iloa-eqfnr,     " Equipment Sort field
             idate      type imrg-idate,    " Measuring Date
             recdu      type imrg-recdu,    " Unit of measuring ='KM','L','H'
             recdv      type imrg-recdv,    " Counter reading data
             cancl       type imrg-cancl,
           END OF ty_data.
    TYPES: BEGIN OF ty_final,
             equnr           type equnr,            "  Equipment no
             eqktx           type eqkt-eqktx,       "  Equipment Text
             eqfnr           type iloa-eqfnr,       "  Equipment Sort field
             idate               type imrg-idate,       "  Measuring Date
             min_date_km     type imrg-idate,       "  Min Date
             min_km          type imrg-recdv,       "  Max Km
             max_date_km     type imrg-idate,
             max_km          type imrg-recdv,       "  Min km
             t_max_min_km    type imrg-recdv,       "  Total min_km-max_km
             min_date_hr     type imrg-idate,       "  Max Date
             min_hr          type imrg-recdv,       "  Max hr
             max_date_hr     type imrg-idate,
             max_hr          type imrg-recdv,       "  Min hr
             t_max_min_hr    type imrg-recdv,                "  Total min_hr-max_hr
             min_date_lit    type imrg-idate,
             min_lit         type imrg-recdv,       "  Min lit
             max_date_lit    type imrg-idate,
             max_lit         type imrg-recdv,       "  Max lit
             fuel_con        type imrg-recdv,       "  Total_hrs / t_max_min_hr
             fuel_con2       type imrg-recdv,       "  Total_hrs / t_max_min_hr
             km_l            type imrg-recdv,       "  t max_min_km / t_max_min_lit
             l_p             type imrg-recdv ,          "  t_max_min_lit / t_max_min_hr
             l_p2            type imrg-recdv ,
           END OF ty_final.
    DATA: i_data TYPE TABLE OF ty_data, " internal table
    wa_data TYPE ty_data, " work area
    i_final TYPE TABLE OF ty_final, " internal table
    wa_final TYPE ty_final. " work area
    SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME.
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: p_equnr FOR equi-equnr OBLIGATORY, "no-extension no intervals,
                    p_idate FOR imrg-idate.  "NO-EXTENSION NO INTERVALS OBLIGATORY,
                   "p_recdu FOR imrg-recdu." NO-EXTENSION NO INTERVALS ."default 'M3'" OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
    SELECTION-SCREEN END OF BLOCK blk2.
    SELECTION-SCREEN END OF BLOCK blk.
    TOP-OF-PAGE.
      FORMAT INTENSIFIED ON.
      WRITE:/55(40) ' WAGNERS INVESTMENT LIMITED  '.
      WRITE:/50(40) ' VEHICLE FUEL CONSUMPTION REPORT ' CENTERED   ,
              2 'Page', sy-pagno.
      FORMAT INTENSIFIED OFF.
      WRITE:/50(40) '----
    ' CENTERED .
      FORMAT INTENSIFIED ON.
      WRITE:/2 sy-datum COLOR 3, sy-uzeit .
      "WRITE:/1 S903-SPMON ."p_yearf.
      ULINE.
      "CENTERED.
    write: /2 'Equipment No :'left-justified,p_equnr-low  color 2 , '  to   '  , p_equnr-high color 2.
    write: /2 'Date From    :', p_idate-low color 2 ,  ' to  '  , p_idate-high color 2.
    "write: /2 'Sort Field:'left-justified,p_eqfnr-low  color 2 , '  to   '  , p_eqfnr-high color 2.
    SKIP.
      ULINE.
    WRITE:/1 sy-vline,
        2   ' EQUIP#',                10 sy-vline ,
        11  ' NAME',                  40 sy-vline,
        41  ' SORT',                  60 sy-vline,
        61  ' START DATE',            74 sy-vline,
        75  ' END DATE',               87 sy-vline,
        88  ' START KM',              100 sy-vline,
        101 ' END KM' ,               113 sy-vline,
        114 ' TOTAL KM',              126 sy-vline,
        127 ' START HR',              139 sy-vline,
        140 ' END HR',                152 sy-vline,
        153 ' TOTAL HR',              167 sy-vline,
        168 ' FUEL CON ',             180 sy-vline,
        181 ' KM L',                  193 sy-vline,
        194 ' LIT PER HR ',           206 sy-vline,
        207 ' EQUIP NO',              220 sy-vline,
        223 'KM L',                  232 sy-vline,
        233 'LIT PER KM',            245 sy-vline,
        246 'TOTAL L/HR',            258 sy-vline.
      FORMAT COLOR 3 ON.
      ULINE.
    END-OF-PAGE.
    START-OF-SELECTION.
    select aequnr deqktx feqfnr eidate erecdu erecdv
    into table i_data
    from equi AS a
    inner join equz as b
    on aequnr = bequnr
    inner join iloa as f
    on biloan = filoan
    inner join imptt as c
    on aobjnr = cmpobj
    inner join eqkt as d
    on aequnr = dequnr
    inner join imrg as e
    on epoint = cpoint
    where a~equnr in p_equnr
    and
    e~idate in p_idate and
    e~cancl ne 'X'.
    loop  at i_data into wa_data.
    CLEAR: wa_final.
      READ TABLE i_final into wa_final
               with key equnr = wa_data-equnr." BINARY SEARCH.
        if sy-subrc EQ 0.
          PERFORM F_GET_MAX_DATA.
          PERFORM F_GET_MAX_HOURS.
          PERFORM F_GET_MAX_LIT.
          PERFORM prepare_final_rec USING'M'. " Modify Existing Record
         ElSE.
          PERFORM prepare_final_rec USING'A'. " Append New Record.
        ENDIF.
        ENDLOOP.
        LOOP AT i_final into wa_final.
    on change of wa_final-equnr.
    WRITE:/1 sy-vline,
    2  wa_final-equnr                                                       , 10 sy-vline,
    11 wa_final-eqktx                                                       , 40 sy-vline,
    41 wa_final-eqfnr                                                       , 60 sy-vline,
    61 wa_final-min_date_km  color 2                                        , 74 sy-vline,
    75 wa_final-max_date_km  color 2 LEFT-JUSTIFIED                         , 87 sy-vline,
    88 wa_final-min_km EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED   color 3       , 100 sy-vline,
    101 wa_final-max_km EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED   color 3      , 113 sy-vline,
    114 wa_final-t_max_min_km EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED          , 126 sy-vline,
    127 wa_final-min_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED color 4        , 139 sy-vline,
    140 wa_final-max_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED color 4        , 152 sy-vline,
    153 wa_final-t_max_min_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED          , 167 sy-vline,
    168 wa_final-fuel_con2 EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED             , 180 sy-vline,
    181 wa_final-km_l EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED            ,193 sy-vline,
    194 wa_final-l_p2 EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED  color  2        , 206 sy-vline,
    207 wa_final-equnr                                                      ,220 sy-vline.
    endon.
    endloop.
    refresh i_final.
    clear i_final.
    FORM F_GET_MAX_DATA.
    select single MAX( eidate ) Min( eidate ) MAX( erecdv ) MIN( erecdv )
    into  corresponding fields of (wa_final-max_date_km,wa_final-min_date_km,wa_final-max_km ,wa_final-min_km)
    from equi AS a
    inner join equz as b
    on aequnr = bequnr
    inner join iloa as f
    on biloan = filoan
    inner join imptt as c
    on aobjnr = cmpobj
    inner join eqkt as d
    on aequnr = dequnr
    inner join imrg as e
    on epoint = cpoint
    where a~equnr in p_equnr
    and
    e~idate in p_idate
    and
    e~cancl ne 'X' and
    e~recdu =  'KM'
    AND a~equnr = wa_data-equnr.
    ENDFORM.
    FORM F_GET_MAX_HOURS.
    select single MAX( erecdv ) MIN( erecdv )
    into corresponding fields of (wa_final-max_hr, wa_final-min_hr)
    from equi AS a
    inner join equz as b
    on aequnr = bequnr
    inner join iloa as f
    on biloan = filoan
    inner join imptt as c
    on aobjnr = cmpobj
    inner join eqkt as d
    on aequnr = dequnr
    inner join imrg as e
    on epoint = cpoint
    where a~equnr in p_equnr
    and
    e~idate in p_idate
    and
    e~cancl ne  'X' and
    e~recdu =  'H'
    AND a~equnr = wa_data-equnr  .
    ENDFORM.
    FORM F_GET_MAX_LIT.
    select SUM( e~recdv )
    into corresponding fields of (wa_final-fuel_con2)
    from equi AS a
    inner join eqkt as b
    on bequnr = aequnr
    inner join imptt as c
    on cmpobj = aobjnr
    inner join imrg as e
    on epoint = cpoint
    where a~equnr in p_equnr
    and
    e~idate in p_idate
    and
    e~cancl ne  'X' and
    e~recdu =  'L'
    AND a~equnr = wa_data-equnr.
    ENDFORM.
    FORM prepare_final_rec  USING    p_mode TYPE char1.
    wa_final-t_max_min_km = wa_final-max_km - wa_final-min_km .
    wa_final-t_max_min_hr = wa_final-max_hr - wa_final-min_hr.
    if  wa_final-t_max_min_km <> 0 .
    wa_final-km_l =  ( wa_final-max_km - wa_final-min_km )  /  ( wa_final-fuel_con2 ) .
    ELSE.
    wa_final-km_l = 0.
    endif.
    if  wa_final-t_max_min_hr <> 0  .
    wa_final-l_p2 = ( wa_final-fuel_con2 ) / (  wa_final-t_max_min_hr ) .
    ELSE.
    wa_final-l_p2 = 0.
    endif.
      IF p_mode = 'A'.
        wa_final-equnr = wa_data-equnr.
        wa_final-eqktx = wa_data-eqktx.
        wa_final-eqfnr = wa_data-eqfnr.
        wa_final-t_max_min_km = wa_final-min_km - wa_final-max_km .
        wa_final-t_max_min_hr = wa_final-max_hr - wa_final-min_hr.
        wa_final-km_l =  ( wa_final-max_km - wa_final-min_km ) /  ( wa_final-fuel_con2 ).
        wa_final-l_p2 = ( wa_final-fuel_con2 ) / (  wa_final-t_max_min_hr ) .
        APPEND wa_final TO i_final  .
      ELSE.
        MODIFY i_final FROM wa_final
          TRANSPORTING
              eqfnr
              max_date_km
              min_date_km
              max_date_lit
              min_date_lit
              max_date_hr
              min_date_hr
              max_km
              min_km
              max_hr
              min_hr
              t_max_min_km
              t_max_min_hr
              fuel_con2
              km_l
              l_p2
              where equnr = wa_data-equnr.
      ENDIF.
    ENDFORM.                    " PREPARE_FINAL_REC

    Hi Guys
    Thanks for your reply, I know how to implement the FM for ALV but little confused where to call , See my correction below it is displaying the result in different way that ie...first displaying Equipment no, name,.correctly but the other values such as km,L,HR all are displaying zero first, when I press back then it is displying the value twice thrise........keep on displaying duplicate records continuesly when back back is press can anyone correct this please
    REPORT  XYZ LINE-SIZE  220 LINE-COUNT 75
             NO STANDARD PAGE HEADING.
    TABLES : equi,
             equz,
             imptt,
             imrg,
             eqkt,
             iloa.
    type-pools: slis.                                 "ALV Declarations
    TYPES:  BEGIN OF ty_data  ,
             equnr      type equnr,         " Euipment no
             eqktx      type eqkt-eqktx,    " Equipment Text
             eqfnr       type iloa-eqfnr,     " Equipment Sort field
             idate      type imrg-idate,    " Measuring Date
             recdu      type imrg-recdu,    " Unit of measuring ='KM','L','H'
             recdv      type imrg-recdv,    " Counter reading data
             cancl       type imrg-cancl,
           END OF ty_data.
    TYPES: BEGIN OF ty_final,
             equnr           type equnr,            "  Equipment no
             eqktx           type eqkt-eqktx,       "  Equipment Text
             eqfnr           type iloa-eqfnr,       "  Equipment Sort field
             idate               type imrg-idate,       "  Measuring Date
             min_date_km     type imrg-idate,       "  Min Date
             min_km          type P DECIMALS 2,       "  Max Km
             max_date_km     type imrg-idate,
             max_km          type P DECIMALS 2,       "  Min km
             t_max_min_km    type P DECIMALS 2,       "  Total min_km-max_km
             min_date_hr     type imrg-idate,       "  Max Date
             min_hr          type P DECIMALS 2,       "  Max hr
             max_date_hr     type imrg-idate,
             max_hr          type P DECIMALS 2,       "  Min hr
             t_max_min_hr    type P DECIMALS 2,                "  Total min_hr-max_hr
             min_date_lit    type imrg-idate,
             min_lit         type P DECIMALS 2,       "  Min lit
             max_date_lit    type imrg-idate,
             max_lit         type P DECIMALS 2,       "  Max lit
             fuel_con        type P DECIMALS 2,       "  Total_hrs / t_max_min_hr
             fuel_con2       type P DECIMALS 2,       "  Total_hrs / t_max_min_hr
             km_l            type P DECIMALS 2,       "  t max_min_km / t_max_min_lit
             l_p             type P DECIMALS 2 ,      "  t_max_min_lit / t_max_min_hr
             l_p2            type P DECIMALS 2 ,
           END OF ty_final.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid.
    DATA: i_data TYPE TABLE OF ty_data, " internal table
    wa_data TYPE ty_data, " work area
    i_final TYPE TABLE OF ty_final, " internal table
    wa_final TYPE ty_final. " work area
    SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME.
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: p_equnr FOR equi-equnr OBLIGATORY, "no-extension no intervals,
                    p_idate FOR imrg-idate.  "NO-EXTENSION NO INTERVALS OBLIGATORY,
                   "p_recdu FOR imrg-recdu." NO-EXTENSION NO INTERVALS ."default 'M3'" OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
    SELECTION-SCREEN END OF BLOCK blk2.
    SELECTION-SCREEN END OF BLOCK blk.
    TOP-OF-PAGE.
      FORMAT INTENSIFIED ON.
      WRITE:/55(40) ' WAGNERS INVESTMENT LIMITED  '.
      WRITE:/50(40) ' VEHICLE FUEL CONSUMPTION REPORT ' CENTERED   ,
              2 'Page', sy-pagno.
      FORMAT INTENSIFIED OFF.
      WRITE:/50(40) '----
    ' CENTERED .
      FORMAT INTENSIFIED ON.
      WRITE:/2 sy-datum COLOR 3, sy-uzeit .
      "WRITE:/1 S903-SPMON ."p_yearf.
      ULINE.
      "CENTERED.
    write: /2 'Equipment No :'left-justified,p_equnr-low  color 2 , '  to   '  , p_equnr-high color 2.
    write: /2 'Date From    :', p_idate-low color 2 ,  ' to  '  , p_idate-high color 2.
    END-OF-PAGE.
    START-OF-SELECTION.
    select aequnr deqktx feqfnr eidate erecdu erecdv
    into table i_data
    from equi AS a
    inner join equz as b
    on aequnr = bequnr
    inner join iloa as f
    on biloan = filoan
    inner join imptt as c
    on aobjnr = cmpobj
    inner join eqkt as d
    on aequnr = dequnr
    inner join imrg as e
    on epoint = cpoint
    where a~equnr in p_equnr
    and
    e~idate in p_idate and
    e~cancl ne 'X'.
    loop  at i_data into wa_data.
    CLEAR: wa_final.
      READ TABLE i_final into wa_final
               with key equnr = wa_data-equnr." BINARY SEARCH.
        if sy-subrc EQ 0.
          PERFORM F_GET_MAX_DATA.
          PERFORM F_GET_MAX_HOURS.
          PERFORM F_GET_MAX_LIT.
          PERFORM prepare_final_rec USING'M'. " Modify Existing Record
         ElSE.
          PERFORM prepare_final_rec USING'A'. " Append New Record.
          perform build_fieldcatalog.
          perform build_layout.
          perform display_alv_report.
        ENDIF.
       ENDLOOP.
    refresh i_final.
    clear i_final.
    FORM F_GET_MAX_DATA.
    select single MAX( eidate ) Min( eidate ) MAX( erecdv ) MIN( erecdv )
    into   corresponding fields of (wa_final-max_date_km,wa_final-min_date_km,wa_final-max_km ,wa_final-min_km)
    from equi AS a
    inner join equz as b
    on aequnr = bequnr
    inner join iloa as f
    on biloan = filoan
    inner join imptt as c
    on aobjnr = cmpobj
    inner join eqkt as d
    on aequnr = dequnr
    inner join imrg as e
    on epoint = cpoint
    where a~equnr in p_equnr
    and
    e~idate in p_idate
    and
    e~cancl ne 'X' and
    e~recdu =  'KM'
    AND a~equnr = wa_data-equnr.
    ENDFORM.
    FORM F_GET_MAX_HOURS.
    select single MAX( erecdv ) MIN( erecdv )
    into corresponding fields of (wa_final-max_hr, wa_final-min_hr)
    from equi AS a
    inner join equz as b
    on aequnr = bequnr
    inner join iloa as f
    on biloan = filoan
    inner join imptt as c
    on aobjnr = cmpobj
    inner join eqkt as d
    on aequnr = dequnr
    inner join imrg as e
    on epoint = cpoint
    where a~equnr in p_equnr
    and
    e~idate in p_idate
    and
    e~cancl ne  'X' and
    e~recdu =  'H'
    AND a~equnr = wa_data-equnr  .
    ENDFORM.
    FORM F_GET_MAX_LIT.
    select SUM( e~recdv )
    into corresponding fields of (wa_final-fuel_con2)
    from equi AS a
    inner join eqkt as b
    on bequnr = aequnr
    inner join imptt as c
    on cmpobj = aobjnr
    inner join imrg as e
    on epoint = cpoint
    where a~equnr in p_equnr
    and
    e~idate in p_idate
    and
    e~cancl ne  'X' and
    e~recdu =  'L'
    AND a~equnr = wa_data-equnr.
    ENDFORM.
    FORM prepare_final_rec  USING    p_mode TYPE char1.
    wa_final-t_max_min_km = wa_final-max_km - wa_final-min_km .
    wa_final-t_max_min_hr = wa_final-max_hr - wa_final-min_hr.
    if  wa_final-t_max_min_km <> 0 .
    wa_final-km_l =  ( wa_final-max_km - wa_final-min_km )  /  ( wa_final-fuel_con2 ) .
    ELSE.
    wa_final-km_l = 0.
    endif.
    if  wa_final-t_max_min_hr <> 0  .
    wa_final-l_p2 = ( wa_final-fuel_con2 ) / (  wa_final-t_max_min_hr ) .
    ELSE.
    wa_final-l_p2 = 0.
    endif.
      IF p_mode = 'A'.
        wa_final-equnr = wa_data-equnr.
        wa_final-eqktx = wa_data-eqktx.
        wa_final-eqfnr = wa_data-eqfnr.
        wa_final-t_max_min_km = wa_final-min_km - wa_final-max_km .
        wa_final-t_max_min_hr = wa_final-max_hr - wa_final-min_hr.
        wa_final-km_l =  ( wa_final-max_km - wa_final-min_km ) /  ( wa_final-fuel_con2 ).
      gd_repid = sy-repid.
        wa_final-l_p2 = ( wa_final-fuel_con2 ) / (  wa_final-t_max_min_hr ) .
        APPEND wa_final TO i_final  .
      ELSE.
        MODIFY i_final FROM wa_final
          TRANSPORTING
              eqfnr
              max_date_km
              min_date_km
              max_date_lit
              min_date_lit
              max_date_hr
              min_date_hr
              max_km
              min_km
              max_hr
              min_hr
              t_max_min_km
              t_max_min_hr
              fuel_con2
              km_l
              l_p2
              where equnr = wa_data-equnr.
      ENDIF.
    ENDFORM.                    " PREPARE_FINAL_REC
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
                  I.e. Field type may be required in-order for
                       the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EQUNR'.
      fieldcatalog-seltext_m   = 'Equip no'.
      fieldcatalog-tabname     =  'i_final'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    fieldcatalog-do_sum      = 'X'.
    fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EQKTX'.
      fieldcatalog-seltext_m   = 'Description'.
        fieldcatalog-tabname     =  'i_final'.
      fieldcatalog-col_pos     = 1.
    append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EQFNR'.
      fieldcatalog-seltext_m   = 'Sortfield'.
        fieldcatalog-tabname     =  'i_final'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MIN_DATE_KM'.
      fieldcatalog-seltext_m   = 'Min Date'.
        fieldcatalog-tabname     =  'i_final'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MAX_DATE_KM'.
      fieldcatalog-seltext_m   = 'Max Date'.
        fieldcatalog-tabname     =  'i_final'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MIN_KM' .
      fieldcatalog-seltext_m   = 'Min KM'.
        fieldcatalog-tabname     =  'i_final'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MAX_KM' .
      fieldcatalog-seltext_m   = 'Max KM'.
        fieldcatalog-tabname     =  'i_final'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'T_MAX_MIN_KM' .
        fieldcatalog-tabname     =  'i_final'.
      fieldcatalog-seltext_m   = 'Total KM'.
      fieldcatalog-col_pos     = 7.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    fieldcatalog-fieldname   = 'MIN_HR' .
      fieldcatalog-seltext_m   = 'Min Hr'.
        fieldcatalog-tabname     =  'i_final'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MAX_HR' .
      fieldcatalog-seltext_m   = 'Max Hr'.
        fieldcatalog-tabname     =  'i_final'.
      fieldcatalog-col_pos     = 9.
    append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'T_MAX_MIN_HR' .
      fieldcatalog-seltext_m   = 'Total HR'.
        fieldcatalog-tabname     =  'i_final'.
      fieldcatalog-col_pos     = 10.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'FUEL_CON2' .
      fieldcatalog-seltext_m   = 'Km/L'.
        fieldcatalog-tabname     =  'i_final'.
      fieldcatalog-col_pos     = 11.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'L_P2' .
      fieldcatalog-seltext_m   = 'Lit/HR'.
        fieldcatalog-tabname     =  'i_final'.
      fieldcatalog-col_pos     = 12.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    gd_layout-totals_only        = 'X'.
    gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
                                            "click(press f2)
    gd_layout-zebra             = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text       = 'helllllo'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
               i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
               i_callback_user_command = 'USER_COMMAND'
               i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
               it_special_groups       = gd_tabgroup
               IT_EVENTS                = GT_XEVENTS
                i_save                  = 'X'
               is_variant              = z_template
           tables
                t_outtab                = i_final
                exceptions
                program_error           = 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.
    endform.                    " DISPLAY_ALV_REPORT

  • ABAP Custom Report (ALV Format) in Background Processing

    Hi
    I am not the hardcore ABAP Person. But want to know about the detail fact of the ABAP Custome Reports. The question is can we do the background processing for the ABAP Custome Report in ALV Format.
    If Yes ..do we require to have any additional Function/code to get the spool in ALV Format. I saw the comments that the output will look like the mess.
    Please share your comment or any useful documenation on this. We are in ECC 6.0
    Thanks in advance..and yes it will be rewared by points.
    Navin

    You can use alv's in background using docking containers, but the display wont be interactive. If you search the forum you will see tons of threads which talk about running ALV's in background.
    For the output to be interactive, you can run the report in foreground and do the data processing in background.
    Refer this link:
    Displaying ALV Grid in Background Job

  • Table to be displayed in ALV format in WD.

    Hi Experts,Gurus.
    I want to display data in the ALV format in my web dynpro component. Can any please tell the procedure to achieve this
    Regards,
    Yugesh

    hi Yugesh ,
    refer this article :
    SAP List Viewer (ALV) [original link is broken]
    Configuring ALV
    http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1190424a-0801-0010-84b5-ef03fd2d33d9?overridelayout=true
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/db22242d-0701-0010-28a2-aeaa1fefd706;jsessionid=(J2EE3414800)ID0133346050DB00727847586176044227End?overridelayout=true&bcsi_scan_06B6B0A4B65849C2=0
    using ALV
    http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40794172-b95a-2910-fb98-b86d8a0918b4;jsessionid=(J2EE3417400)ID0488867050DB10849380333905377829End
    hope these basic tutorials help u .
    regards,
    amit

  • Date Difference between two dates which is in String format - Urgent

    Hi,
    My requirement is
    String s1 = "04/24/2008" ; // in "mm/dd/yyyy" format
    String s2 = "08/30/2010" ; // in "mm/dd/yyyy" format
    Now i want to calculate the number of days between the two Strings(Dates).It's urgent.Please help me.

    A late entry:
    If you want to turn a String into a Date, use SimpleDateFormat.
    [Calculating Java dates: Take the time to learn how to create and use dates|http://www.javaworld.com/jw-12-2000/jw-1229-dates.html]
    [Formatting a Date Using a Custom Format|http://www.javaalmanac.com/egs/java.text/FormatDate.html]
    [Parsing a Date Using a Custom Format|http://www.javaalmanac.com/egs/java.text/ParseDate.html]

  • Classical List to ALV format in sap abap report

    Hi All,
    I have a requirement to change the existing abap report in which teh output is dispalyed in classical list format.
    I want to convert this list report output into ALV format.
    COuld anyone please help me how to convert this from Classical list to ALV format?
    Thanks,
    Komal.
    Moderator message: sorry, this not the place to teach the basics, please search for available information. If you understand the classical list and how to use ALV, then you can also do the transfer yourself.
    Edited by: Thomas Zloch on Aug 12, 2011 4:44 PM

    This will be very difficult for you.....
    Since you are getting a time out error....it looks like, you are runnning this report in foreground....................
    Try running it in background it will work...
    ELSE....you have to fetch in small chunks....but the question is how will you do it. Since the USR02 only has BNAME as primary key...
    Either put the BNAME as part of selection screen and fetch the data.....it will solve your problem....
    Only fetch for those BNAME which is entered in the selection screen...
    Hope it helps!

  • MB51 should come in ALV format

    Hi,
    When we are running the Transaction MB51 with a Material, it displayed the output in a standard format. In this screen, one icon is showing i.e. Detail List. After click on it, it shows the output in ALV format.
    We want that when we execute the MB51 transaction, the output should come in ALV format directly.. means standard format must be skip.
    Note: - I try to skip this screen by the SHD0, but there is not any screen number to do so.
    Please tell me, how can i skip that standard screen and open in ALV format directly....
    Regards...

    Hi, Dear
    Check the Sample Program Given Bellow hope will help you to solve out your problem,
    TABLES: mseg, mkpf, makt.
    TYPES:  BEGIN OF ty_mb51,
            werks LIKE mseg-werks,
            matnr LIKE mseg-matnr,
            maktx LIKE makt-maktx,
            budat LIKE mkpf-budat,
            mblnr LIKE mkpf-mblnr,
            shkzg LIKE mseg-shkzg,
            menge LIKE mseg-menge,
            meins LIKE mseg-meins,
            cputm LIKE mkpf-cputm,
            END OF ty_mb51.
    SELECT-OPTIONS: somatnr FOR mseg-matnr OBLIGATORY.
    DATA: it_mb51 TYPE STANDARD TABLE OF ty_mb51,
          wa_mb51 LIKE LINE OF it_mb51.
    SELECT mseg~werks
           mseg~matnr
           makt~maktx
           mkpf~budat
           mkpf~mblnr
           mseg~shkzg
           mseg~menge
           mseg~meins
           mkpf~cputm
      INTO CORRESPONDING FIELDS OF TABLE it_mb51
      FROM mseg INNER JOIN mkpf ON ( mseg~mblnr = mkpf~mblnr AND mseg~mjahr = mkpf~mjahr )
                INNER JOIN makt ON ( mseg~matnr = makt~matnr AND makt~spras = 'E' )
      WHERE mseg~matnr IN somatnr.
    LOOP AT it_mb51 INTO wa_mb51.
      IF wa_mb51-shkzg = 'H'.
        MULTIPLY: wa_mb51-menge BY -1.
        MODIFY it_mb51 FROM wa_mb51 INDEX sy-tabix.
      ENDIF.
    ENDLOOP.
    LOOP AT it_mb51 INTO wa_mb51.
      WRITE: / wa_mb51-werks, wa_mb51-matnr, wa_mb51-maktx, wa_mb51-budat, wa_mb51-mblnr, wa_mb51-menge, wa_mb51-meins, wa_mb51-cputm.
      AT LAST.
        SUM.
        WRITE: /90(15) wa_mb51-menge.
      ENDAT.
    ENDLOOP.
    Best Regards,
    Faisal

  • RFCHKE00 program  output formatting - Urgent

    Hello Friends,
    I am working on the Positive payments - Outgoing payments to Banks.  The standard SAP program is doing the Check extract for the same.  If I run the transaction code FCHX, then this transaction is using the program RFCCHKE00 to produce the output file from SAP.  The format of the output file does not match the Bank format and so I've to reformat the output file to the bank format before transferring the data to the respective banks. 
    Could anybody tell me how to reformat the output file programattically?  Shd I write an ABAP for this or what should I do?  If I've to write an ABAP then could somebody help me with the program?.  Please advise. 
    This is very urgent please.
    Thanks in Advance.

    check below program which was written for the same purpose in one of our client.
    <b>AWARD Points</b>
    REPORT  zfo_positive_pay   LINE-SIZE  120
                               LINE-COUNT 60
                               MESSAGE-ID zf_cd.
    ======================      T A B L E S       =======================
    TABLES: t001,        "Company Codes
            t012,        "House Banks
            tcurc,       "Currency Codes
            payr,        "Payment data
            dfkkcr.      "Repository For Checks
    ======================         T Y P E S      =======================
    TYPES: BEGIN OF ty_boa_format,
            acc_num(10)  TYPE  c,
            void_ind(1)  TYPE  c,
            filler(2)    TYPE  c,
            s_no(10)     TYPE  c,
            amount(12)   TYPE  c,
            add_data(45) TYPE  c,
          END OF ty_boa_format.
    TYPES: BEGIN OF ty_boa_detail_format,
            acc_num(10)  TYPE  c,
            void_ind(1)  TYPE  c,
            filler(2)    TYPE  c,
            s_no(10)     TYPE  c,
            amount(12)   TYPE  c,
            iss_date(8)  TYPE  c,
            add_data(37) TYPE  c,
          END OF ty_boa_detail_format.
    =========        I N T E R N A L   T A B L E S         ==============
    DATA  BEGIN OF it_sap_format OCCURS 0.
            INCLUDE STRUCTURE dtachkp.
    DATA  END OF it_sap_format.
    DATA: it_boa_format TYPE STANDARD TABLE OF ty_boa_format
                                      WITH HEADER LINE,
          it_boa_detail_format TYPE STANDARD TABLE OF ty_boa_detail_format
                                    WITH HEADER LINE.
    internal tables to send E-mail
    DATA: st_doc_chng LIKE  sodocchgi1,
                          "Data of an object which can be changed
          it_objtxt   LIKE STANDARD TABLE OF solisti1   ,
                            "SAPoffice: Single List with Column Length 255
          wa_objtxt   LIKE LINE OF it_objtxt,
          it_objpack  LIKE STANDARD TABLE OF sopcklsti1 ,
                     "SAPoffice: Description of Imported Object Components
          wa_objpack  LIKE LINE OF it_objpack,
          it_objhead  LIKE STANDARD TABLE OF solisti1 ,
                            "SAPoffice: Single List with Column Length 255
          wa_objhead  LIKE LINE OF it_objhead,
          it_reclist  LIKE STANDARD TABLE OF somlreci1  ,
                           "SAPoffice: Structure of the API Recipient List
          wa_reclist  LIKE LINE OF it_reclist,
          it_objbin   LIKE STANDARD TABLE OF solisti1,
                      "SAPoffice: Single List with Column Length 255
          wa_objbin LIKE LINE OF it_objbin.
    =========              C O N S T A N T S               ==============
    CONSTANTS c_flag TYPE c VALUE 'X'.
    =========              V A R I A B L E S               ==============
    DATA: w_flag TYPE c,
          w_str(70) TYPE c,  " To store E-Amil contents
          w_tab_lines TYPE sy-tabix.
    ==========         S E L E C  T I O N  S C R E E N      =============
    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
    SELECTION-SCREEN: SKIP.
    SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME.
    PARAMETERS:     p_bukrs   LIKE payr-zbukr OBLIGATORY DEFAULT '2580',
                    p_hbkid   LIKE payr-hbkid OBLIGATORY DEFAULT 'BOAUS',
                    p_waers   LIKE payr-waers OBLIGATORY DEFAULT 'USD'.
    SELECT-OPTIONS: s_erdat   FOR  dfkkcr-erdat OBLIGATORY.
    "DEFAULT SY-DATUM.
    SELECT-OPTIONS: s_voidr  FOR payr-voidr.
    SELECTION-SCREEN: END OF BLOCK b2.
    SELECTION-SCREEN: BEGIN OF BLOCK b3 WITH FRAME.
    PARAMETERS:     p_sfile   LIKE rlgrap-filename OBLIGATORY,
                    p_opath LIKE rlgrap-filename OBLIGATORY,
                    p_ofile   LIKE rlgrap-filename OBLIGATORY.
    SELECTION-SCREEN: END OF BLOCK b3.
    SELECTION-SCREEN: END OF BLOCK b1.
    ============     I N I T I L I Z A T I O N              =============
    data : w_bukrs like payr-zbukr.
    INITIALIZATION.
      DATA: l_path1 LIKE rlgrap-filename VALUE '/global/data/transfer/',
            l_path2 LIKE rlgrap-filename   VALUE '/3302/pub/out/'.
      CONCATENATE l_path1 sy-sysid l_path2 INTO p_opath.
    ============     A T  S E L E C T I O N  S C R E E N    =============
    AT SELECTION-SCREEN.
    *---to Validate the entered Company code
      PERFORM to_validate_bukrs.
    *---to Validate the entered house bank
      PERFORM to_validate_hbkid.
    *---to Validate the entered currency
      PERFORM to_validate_waers.
    AT SELECTION-SCREEN OUTPUT.
    *--- to populate the default file names if the entered company code and
    *--- house bank id are valid
      PERFORM to_populate_default_file_names.
    ============    S T A R T  O F  S E L E C T I O N       =============
    START-OF-SELECTION.
    *---checking of file CD_POS_COMPLETE for existence
      PERFORM CHECK_FILES.
    *--- to submit the report RFCHKE00
      PERFORM submit_rfchke00.
    *--- to open the unix file and download the data
      PERFORM open_unix_file_and_process.
    *--- to convert the sapfile format to the required BOA format
      PERFORM sap_format_to_boa_format.
    =============    E N D   O F  S E L E C T I O N       ===============
    END-OF-SELECTION.
    *If entered file exists in the Unix directory
      IF w_flag = ' '.
    *--- process the boa internal table to generate the trailer records for
    *--- every new account number
        PERFORM process_boa_for_trailer_record.
    *--- upload data to the unix file which contains the required BOA format
        PERFORM upload_unix_file.
    *---addition of files into server
      PERFORM ADD_FILES.
    *-----Send a E-Mail to the user
        PERFORM send_email.
      ENDIF.
    ===================    S U B R O U T I N E S       ==================
    *&      Form  to_validate_bukrs
          to validate the entered company code at the selection screen
    FORM to_validate_bukrs .
      IF NOT p_bukrs IS INITIAL.
        SELECT SINGLE bukrs
                 FROM t001
                 INTO t001-bukrs
                WHERE bukrs EQ p_bukrs.
        IF sy-subrc NE 0.
          MESSAGE e004 WITH text-e01.
          STOP.
        ENDIF.
      ELSE.
        MESSAGE e004 WITH text-e00.
      ENDIF.
    ENDFORM.                    " to_validate_bukrs
    *&      Form  to_validate_hbkid
          to validate the entered house bank id at the selection screen
    FORM to_validate_hbkid .
      IF NOT p_hbkid IS INITIAL.
        SELECT SINGLE hbkid
                 FROM t012
                 INTO t012-hbkid
                WHERE hbkid EQ p_hbkid.
        IF sy-subrc NE 0.
          MESSAGE e004 WITH text-e02.
          STOP.
        ENDIF.
      ELSE.
        MESSAGE e004 WITH text-e00.
      ENDIF.
    ENDFORM.                    " to_validate_hbkid
    *&      Form  to_validate_waers
    to validate the entered cCurrency at the selection screen
    FORM to_validate_waers .
      IF NOT p_waers IS INITIAL.
        SELECT SINGLE waers
                 FROM tcurc
                 INTO tcurc-waers
                WHERE waers EQ p_waers.
        IF sy-subrc NE 0.
          MESSAGE e004 WITH text-e03.
          STOP.
        ENDIF.
      ELSE.
        MESSAGE e004 WITH text-e00.
      ENDIF.
    ENDFORM.                    " to_validate_waers
    *&      Form  to_populate_default_file_names
      to disable the file name fields and to populate the default values
      into it
    FORM to_populate_default_file_names .
      DATA: l_date LIKE sy-datum.
      l_date = sy-datum.
      IF p_sfile IS INITIAL or w_bukrs <> p_bukrs.
    *---   move the entered company code, house bank id and todays
    *---   date to the sap file name
        CONCATENATE '/tmp/FI_' p_bukrs p_hbkid p_waers sy-datum
                    INTO p_sfile.
      ENDIF.
      IF p_ofile IS INITIAL or w_bukrs <> p_bukrs.
        CONCATENATE '3302-BA-03-'
                       l_date '-' sy-uzeit '-' p_bukrs '-out'
                     INTO p_ofile.
      ENDIF.
      w_bukrs = p_bukrs.
    ENDFORM.                    " to_populate_default_file_names
    *&      Form  open_unix_file_and_process
          opne the unix file and download data to internal table
    FORM open_unix_file_and_process .
      DATA : l_msg(80) TYPE c.
      CLEAR w_flag.
    open the file in text mode
      OPEN DATASET p_sfile FOR       INPUT
                           IN        TEXT MODE
                           MESSAGE   l_msg
                           ENCODING  DEFAULT.
      IF sy-subrc NE 0.
        MESSAGE s004 WITH l_msg '-' p_sfile.
        w_flag = 'X'.
        STOP.
      ENDIF.
    move the downloaded file data record wise to the internal table
    till it reaches to the last record
      DO.
        READ DATASET p_sfile INTO it_sap_format.
        IF sy-subrc = 0.
          APPEND it_sap_format.
        ELSE.
        cursor reached to the last record of the file
          EXIT.
        ENDIF.
      ENDDO.
    remove the header record form the downloaded file data
      DELETE it_sap_format INDEX 1.
    remove the dataset file created by sap standard program
      DELETE DATASET p_sfile.
    close the opened file
      CLOSE DATASET p_sfile.
    ENDFORM.                    " open_unix_file_and_process
    *&      Form  sap_format_to_boa_format
          to convert the sap generated file format to the required Bank Of
          America format
    FORM sap_format_to_boa_format .
      DATA: l_amount(10),
            l_decimal(2),
            l_payee2 LIKE payr-znme2.
      LOOP AT it_sap_format.
        WRITE it_sap_format-bankn  TO it_boa_detail_format-acc_num
                                      RIGHT-JUSTIFIED.
        UNPACK it_boa_detail_format-acc_num TO it_boa_detail_format-acc_num.
        IF NOT it_sap_format-voidr IS INITIAL.
          it_boa_detail_format-void_ind = '2'.
        ELSE.
          CLEAR it_boa_detail_format-void_ind.
        ENDIF.
        it_boa_detail_format-filler   = space.
        WRITE it_sap_format-chect  TO it_boa_detail_format-s_no
                                      RIGHT-JUSTIFIED.
        UNPACK it_boa_detail_format-s_no TO it_boa_detail_format-s_no.
        WRITE it_sap_format-amnt+6(9) TO l_amount.
        WRITE it_sap_format-decm+0(2)  TO l_decimal.
        CONCATENATE '0' l_amount l_decimal INTO it_boa_detail_format-amount.
        it_boa_detail_format-iss_date = it_sap_format-zaldt.
    *addition of payee2 field in version2.
        CLEAR l_payee2.
        SELECT SINGLE znme2
                      INTO l_payee2
                      FROM payr
                      WHERE zbukr = p_bukrs AND
                            hbkid = p_hbkid AND
                            chect = it_sap_format-chect.
    *payee1 and payee2 separated by # symbol.
        it_boa_detail_format-add_data+0(20) = it_sap_format-znme1.
        it_boa_detail_format-add_data+20(1) = '#'.
        it_boa_detail_format-add_data+21(16) = l_payee2.
    *if payee1 is initial , then condenses the name
        CONDENSE it_boa_detail_format-add_data.
        APPEND it_boa_detail_format.
      ENDLOOP.
      CLEAR it_boa_detail_format.
    ENDFORM.                    " sap_format_to_boa_format
    *&      Form  process_boa_for_trailer_record
          to generate the trailer record for every new account number
    FORM process_boa_for_trailer_record .
      DATA: l_cnt     TYPE i,
            l_amt(12) TYPE p DECIMALS 2,
            l_temp(12).
    *--- sort the table on account number
      SORT it_boa_detail_format BY acc_num.
      LOOP AT it_boa_detail_format.
      to get the item line count and the total
        if it_boa_detail_format-void_ind <> '2'.
          l_cnt = l_cnt + 1.
          l_amt = l_amt + it_boa_detail_format-amount.
        endif.
        it_boa_format-acc_num        = it_boa_detail_format-acc_num.
        it_boa_format-void_ind       = it_boa_detail_format-void_ind.
        it_boa_format-filler         = it_boa_detail_format-filler.
        it_boa_format-s_no           = it_boa_detail_format-s_no.
        it_boa_format-amount         = it_boa_detail_format-amount.
        it_boa_format-add_data+0(8)  = it_boa_detail_format-iss_date.
        it_boa_format-add_data+8(37) = it_boa_detail_format-add_data.
        APPEND it_boa_format.
        CLEAR it_boa_format.
      for the new bank account number
        AT END OF acc_num.
          it_boa_format-acc_num        = it_boa_detail_format-acc_num.
          it_boa_format-void_ind       = 'T'.
          it_boa_format-filler         = ''.
          it_boa_format-s_no           = l_cnt.
    *--   unpack is used to add leading zeros
          UNPACK it_boa_format-s_no     TO it_boa_format-s_no.
          l_amt = l_amt / 100.
          UNPACK l_amt                  TO it_boa_format-amount.
          l_temp = it_boa_format-amount.
    *-- Changes as per BOA - no decimals requried ,instead put a 0
    *-- in the start
          CLEAR it_boa_format-amount.
          it_boa_format-amount+0(01)  = '0'.          "Zero at the start
          it_boa_format-amount1(9)   = l_temp1(9).   "9 digits whole amt
          it_boa_format-amount10(2)  = l_temp10(2). "2 decimals amt
          UNPACK it_boa_format-add_data TO it_boa_format-add_data.
          APPEND it_boa_format.
          CLEAR: l_cnt,
                 l_amt,
                 l_temp,
                 it_boa_format.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " process_boa_for_trailer_record
    *&      Form  upload_unix_file
          create unix file with the required BOA format
    FORM upload_unix_file .
      DATA l_msg(80) TYPE c.
    opne the unix file
      CONCATENATE p_opath p_ofile INTO p_ofile.
      OPEN DATASET p_ofile FOR      OUTPUT
                           IN       TEXT MODE
                           MESSAGE  l_msg
                           ENCODING DEFAULT.
      IF sy-subrc NE 0.
        MESSAGE i004 WITH l_msg.
        EXIT.
      ENDIF.
    move the data from internal table to unix file
      LOOP AT it_boa_format.
        TRANSFER it_boa_format TO p_ofile.
      ENDLOOP.
      message about number of records downloaded
      IF sy-subrc EQ 0.
        MESSAGE s004 WITH
                     sy-tfill 'records downloaded to the file'
                     p_ofile.
      ENDIF.
      close file
      CLOSE DATASET p_ofile.
    ENDFORM.                    " upload_unix_file
    *&      Form  submit_rfchke00
          to submit the standard program RFCHKE00 to extract the checks
          for the given company code, House bank and currecncy
    FORM submit_rfchke00 .
      SUBMIT rfchke00 WITH par_zbuk EQ p_bukrs
                      WITH par_hbki EQ p_hbkid
                      WITH par_waer EQ p_waers
                      WITH par_xneu EQ c_flag
                      WITH sel_zald IN s_erdat
                      WITH par_file EQ p_sfile
                      WITH par_dbup EQ c_flag
                      WITH sel_void IN s_voidr
                      AND RETURN.
      IF sy-subrc NE 0.
        MESSAGE i004 WITH text-e04.
        EXIT.
      ENDIF.
    ENDFORM.                    " submit_rfchke00
    *&      Form  send_email
          sends an email in the required format
    FORM send_email .
    Populate the Mail contents
      PERFORM populate_email_ref_data.
    Populate the attachment data
      PERFORM pop_data_objbin.
      CLEAR w_tab_lines.
      DESCRIBE TABLE it_objbin LINES w_tab_lines.
      wa_objhead = text-021.
      APPEND wa_objhead TO it_objhead.
    Creation of the entry
      wa_objpack-transf_bin = 'X'.
      wa_objpack-head_start = 0.
      wa_objpack-head_num   = 0.
      wa_objpack-body_start = 0.
      wa_objpack-body_num   = w_tab_lines.
      wa_objpack-doc_type   = 'txt'.
      wa_objpack-obj_name   = 'POS pay-FI'.
      wa_objpack-obj_descr  = text-022.
      wa_objpack-doc_size   = w_tab_lines * 255.
      APPEND wa_objpack TO it_objpack.
    Populate the User mail ids from the distribution list
      PERFORM receiver_details.
    ENDFORM.                    " send_email
    *&      Form  POPULATE_EMAIL_REF_DATA
         Subroutine to set the Attachment file name ,Mail subject,
         Body of the mail and size of the mail
    FORM populate_email_ref_data .
    Setting up attachment file name
      st_doc_chng-obj_name = text-t02.
    Setting up mail subject
      st_doc_chng-obj_descr = text-t03.
      st_doc_chng-sensitivty = 'P'.
    *Seting up the body of the E-mail
      wa_objtxt = text-t04.
      APPEND wa_objtxt TO it_objtxt.
      DESCRIBE TABLE it_objtxt LINES w_tab_lines.
      READ TABLE it_objtxt INTO wa_objtxt INDEX w_tab_lines.
    *Finding size of the E-mail
    st_doc_chng-doc_size = ( w_tab_lines - 1 ) * 255 + STRLEN( wa_objtxt ).
    Creation of the entry for the compressed document
      CLEAR wa_objpack-transf_bin.
      wa_objpack-head_start = 1.
      wa_objpack-head_num = 0.
      wa_objpack-body_start = 1.
      wa_objpack-body_num = w_tab_lines.
      wa_objpack-doc_type = 'RAW'.
      APPEND wa_objpack TO it_objpack.
    ENDFORM.                    " POPULATE_EMAIL_REF_DATA
    *&      Form  POP_DATA_OBJBIN
    Subroutine to populate the contennts of the attached document
    FORM pop_data_objbin .
      DATA : l_date LIKE sy-datum.
      l_date = sy-datum - 1.
    Populating the message
      CLEAR w_str.
      CONCATENATE text-t06 l_date INTO w_str SEPARATED BY space.
      MOVE w_str TO wa_objbin-line.
      CONCATENATE  cl_abap_char_utilities=>cr_lf w_str INTO  w_str.
      wa_objbin-line = w_str.
      APPEND wa_objbin TO it_objbin.
      CLEAR w_str.
      CLEAR wa_objbin.
    WRITE TEXT-T07 TO W_STR+01(64).   "Message
    MOVE W_STR TO WA_OBJBIN-LINE.
    CONCATENATE  CL_ABAP_CHAR_UTILITIES=>CR_LF W_STR INTO  W_STR.
    WA_OBJBIN-LINE = W_STR.
    APPEND WA_OBJBIN TO IT_OBJBIN.
    CLEAR W_STR.
    CLEAR WA_OBJBIN.
    WRITE TEXT-T06 TO W_STR.
    MOVE W_STR TO WA_OBJBIN-LINE.
    CONCATENATE  CL_ABAP_CHAR_UTILITIES=>CR_LF W_STR INTO  W_STR.
    WA_OBJBIN-LINE = W_STR.
    APPEND WA_OBJBIN TO IT_OBJBIN.
    CLEAR: W_STR,
            WA_OBJBIN.
    *for Company Code and House Bank
      CONCATENATE text-t08 p_bukrs INTO w_str SEPARATED BY space.
      CONCATENATE w_str text-t09 INTO w_str.
      CONCATENATE w_str p_hbkid INTO w_str SEPARATED BY space.
      MOVE w_str TO wa_objbin-line.
      CONCATENATE  cl_abap_char_utilities=>cr_lf w_str INTO  w_str.
      wa_objbin-line = w_str.
      APPEND wa_objbin TO it_objbin.
      CLEAR w_str.
      CLEAR wa_objbin.
      WRITE text-t07 TO w_str+0(62).
      MOVE w_str TO wa_objbin-line.
      CONCATENATE  cl_abap_char_utilities=>cr_lf w_str INTO  w_str.
      wa_objbin-line = w_str.
      APPEND wa_objbin TO it_objbin.
      CLEAR w_str.
      CLEAR wa_objbin.
    Processing output records to send email in attachment
      LOOP AT it_boa_format.
        PERFORM cheque_records_to_objbin.
      ENDLOOP.
      IF it_objbin[] IS INITIAL.
        MOVE 'No data in Positive Payfile for FI'  TO wa_objbin-line.
        CONCATENATE  cl_abap_char_utilities=>cr_lf w_str INTO  w_str.
        wa_objbin-line = w_str.
        APPEND wa_objbin TO it_objbin.
        CLEAR w_str.
        CLEAR wa_objbin.
      ENDIF.
    ENDFORM.                    " POP_DATA_OBJBIN
    *&      Form  CHEQUE_RECORDS_TO_OBJBIN
          Subroutine to populate the output data in attachment
    FORM cheque_records_to_objbin .
      DATA: l_bank_acc_no(10),
            l_check_no(10),
            l_amount(12),
            l_paid_date(8),
            l_status(1).
      l_bank_acc_no = it_boa_format-acc_num.
      l_check_no    = it_boa_format-s_no.
      l_amount      = it_boa_format-amount.
      l_paid_date   = it_boa_format-add_data+0(8).
      l_status      = it_boa_format-void_ind.
    Display only summarised records in Email
      IF it_boa_format+10(1) = 'T'.
        WRITE text-t05 TO w_str+01(80).
        MOVE w_str TO wa_objbin-line.
        CONCATENATE  cl_abap_char_utilities=>cr_lf w_str INTO  w_str.
        wa_objbin-line = w_str.
        APPEND wa_objbin TO it_objbin.
        CLEAR w_str.
        CLEAR wa_objbin.
        WRITE l_bank_acc_no TO w_str+0(18).
        WRITE l_check_no    TO w_str+18(12).
        WRITE l_amount      TO w_str+30(14).
        MOVE w_str TO wa_objbin-line.
        CONCATENATE  cl_abap_char_utilities=>cr_lf w_str INTO  w_str.
        wa_objbin-line = w_str.
        APPEND wa_objbin TO it_objbin.
        CLEAR w_str.
        CLEAR wa_objbin.
        WRITE text-t05 TO w_str+01(80).
        MOVE w_str TO wa_objbin-line.
        CONCATENATE  cl_abap_char_utilities=>cr_lf w_str INTO  w_str.
        wa_objbin-line = w_str.
        APPEND wa_objbin TO it_objbin.
        CLEAR w_str.
        CLEAR wa_objbin.
    ELSE.
      for detail records
       WRITE L_BANK_ACC_NO TO W_STR+0(18).
       WRITE L_CHECK_NO    TO W_STR+18(12).
       WRITE L_AMOUNT      TO W_STR+30(14).
       WRITE L_PAID_DATE   TO W_STR+44(12).
       WRITE L_STATUS      TO W_STR+56(1).
       MOVE W_STR TO WA_OBJBIN-LINE.
       CONCATENATE  CL_ABAP_CHAR_UTILITIES=>CR_LF W_STR INTO  W_STR.
       WA_OBJBIN-LINE = W_STR.
       APPEND WA_OBJBIN TO IT_OBJBIN.
      ENDIF.
      CLEAR: w_str,
             wa_objbin.
    ENDFORM.                    " CHEQUE_RECORDS_TO_OBJBIN
    *&      Form  RECEIVER_DETAILS
       Subroutine to populate the receiver details
    FORM receiver_details .
      wa_reclist-receiver = text-t10.  "'[email protected]'.
      wa_reclist-rec_type = 'U'.
      APPEND wa_reclist TO it_reclist.
      CLEAR  wa_reclist.
    *-- Sending the email with attached document
      PERFORM call_email_function.
    ENDFORM.                    " RECEIVER_DETAILS
    *&      Form  CALL_EMAIL_FUNCTION
          text
    FORM call_email_function .
    Call function to send email
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
            EXPORTING
                 document_data              = st_doc_chng
                 commit_work                = 'X'
                put_in_outbox               = 'X'
          importing
               sent_to_all                = sent_to_all
            TABLES
                 packing_list               = it_objpack
                 object_header              = it_objhead
                 contents_bin               = it_objbin
                 contents_txt               = it_objtxt
                 receivers                  = it_reclist
            EXCEPTIONS
                 too_many_receivers         = 1
                 document_not_sent          = 2
                 operation_no_authorization = 4
                 OTHERS                     = 99.
      CASE sy-subrc.
        WHEN 1.
    *message e004.
        WHEN 2.
    *message e005.
        WHEN 3.
    *message e006.
        WHEN 0.
          SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
    *leave program.
         SET SCREEN 0.
          MESSAGE s004(zf_cd) WITH text-012 ' '  text-t10.
      ENDCASE.
    ENDFORM.                    " CALL_EMAIL_FUNCTION
    *&      Form  CHECK_FILES
    Perform used to check whether FI_POS_COMPLETE file exists on the
    server
    form CHECK_FILES .
      DATA : L_MSG(80) TYPE C,
             L_FILE   LIKE RLGRAP-FILENAME.
      CLEAR : L_FILE.
      CONCATENATE P_OPATH 'FI_POS_COMPLETE_' P_BUKRS INTO L_FILE.
      OPEN DATASET L_FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.
      IF SY-SUBRC = 0.
      CLOSE DATASET L_FILE.
      MESSAGE E054.
      ELSE.
      CLOSE DATASET L_FILE.
      ENDIF.
    endform.                    " CHECK_FILES
    *&      Form  ADD_FILES
    Perform used to create the FI_POS_COMPLETE file on the server with a 0
    byte record
    form ADD_FILES .
      DATA : L_MSG(80) TYPE C,
             L_FILE   LIKE RLGRAP-FILENAME.
      CLEAR : L_FILE.
      CONCATENATE P_OPATH 'FI_POS_COMPLETE_' P_BUKRS INTO L_FILE.
      OPEN DATASET L_FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
      IF SY-SUBRC = 0.
        TRANSFER SPACE TO L_FILE.
      ELSE.
        MESSAGE I055.
      ENDIF.
      CLOSE DATASET L_FILE.
    endform.                    " ADD_FILES

Maybe you are looking for

  • Save As Dialog in Management Studio 2008 not opening

    Hello All, using sql 2008 client tools on windows 7 sp1 SSMS will not give me the Save As dialog when clicking file> Save .....sql as dialog? Any help greatly appreciated. Thanks, gv Sword

  • Creating webi/crystal report on BEx and retrieving data, an error ocured?

    Hi Experts, I have a problem which many couldnt able to provide a better solution and solve it. Need your expert solutions. Installed SAP BI with BO(R/3) integration kit SP3. Created WEBI report on BEx report via Universe. While trying to load/ refre

  • Lsmw header and item.

    Hi experts,            I have problem with uploading data for quatation using lsmw.  in this lsmw, i used recording method. i have two structure . one for header and another for item. when i am mapping, its not showing the item structure. can anyone

  • HT1391 Help

    Is it possible to find my iphone using find my iphone if it was stolen in CUBA ???

  • Imovie will not show new photos from iphoto?

         The imovie project I'm working on needs several photos that I recently downloaded.  However when going into the photo section of imovie these new photos do not appear in the album that they have been placed in. Is there anyway to get them to app