3 Replies Latest reply: Nov 29, 2007 5:08 AM by Murugesh Arcot RSS

LSMW with Coding

Anil Kumar
Currently Being Moderated

Hi All,

 

I want to do <b>LSMW with Coding</b>, only with coding.....plz help....from which step, we can go to ABAP Editor...in LSMW....

 

Regards,

<b>Anil Kumar</b>

  • Re: LSMW with Coding
    Currently Being Moderated

    ************************************************************************

    • LSM Workbench: Data Import Program

    • Program:      /1CADMC/SAP_LSMW_READ_00000008

    • Date:         2006/03/02

    • Time:       18:40:30

    • User:          KARTHIK.P

    • Project:       ZVRSDZ

    • Subproject:    ZVRSD

    • Object:        ZVRSD

    ************************************************************************

    report /1CADMC/SAP_LSMW_READ_00000008

      message-id /sapdmc/lsmw_obj_070.

     

    • Additional data definitions and table declarations

    include:

      /sapdmc/sap_lsmw_read_data.

     

    • Source structure definitions

    data:

      begin of LSMW_DEST,

        TABLENAME(030) type C,

        OBJTYPE(004) type C,

        OBJNAME(110) type C,

        VERSNO(005) type C,

        KORRNUM(020) type C,

        AUTHOR(012) type C,

        DATUM(010) type C,

        ZEIT(008) type C,

        LOEKZ(001) type C,

        ORIGIN(001) type C,

        VERSMODE(001) type C,

        LASTVERS(005) type N,

        FIRSTVER(005) type N,

        RELS(004) type C,

        MANDT(003) type C,

        KEYLEN(005) type C,

        TABLEN(005) type C,

        DEFVERSN(005) type C,

        FULL_VER(001) type C,

        ARCHIVED(001) type C,

      end of LSMW_DEST.

     

    data:

      begin of TRAN_DEST,

        __record__(30).

            include structure LSMW_DEST.

    data:

      end of TRAN_DEST.

     

    data:

      begin of str_DEST.

            include structure LSMW_DEST.

    data:recnr_000001 type i.

    data:

      end of str_DEST.

     

    data:

      DEST like sorted table

          of str_DEST

          with non-unique key

                          recnr_000001

          with header line.

     

    • Internal Table(s) for field names

    data:

      begin of top_DEST occurs 0,

        f000001(30),

        f000002(30),

        f000003(30),

        f000004(30),

        f000005(30),

        f000006(30),

        f000007(30),

        f000008(30),

        f000009(30),

        f000010(30),

        f000011(30),

        f000012(30),

        f000013(30),

        f000014(30),

        f000015(30),

        f000016(30),

        f000017(30),

        f000018(30),

        f000019(30),

        f000020(30),

      end of top_DEST.

     

    data:

      begin of upl_0007 occurs 0,

        record(000266),

      end of upl_0007.

     

    data:

      begin of upl_bin occurs 0,

        record(72),

      end of upl_bin.

     

    • Internal Table(s) for split at delimiter

    data:

      tab_spl(000110) occurs 0 with header line.

     

    • Buffer of maximum length

    data:

      g_max_buffer(000286).

     

    • Select-option for wildcard value in file names

    selection-screen begin of block selopts3

                     with frame title text-003.

    select-options:

      so_wldcd for /sapdmc/lsofiw-wildcardvalue no-display.

    selection-screen end of block selopts3.

     

    initialization.

     

      g_project = 'ZVRSDZ         '.

      g_subproj = 'ZVRSD          '.

      g_object = 'ZVRSD          '.

     

    start-of-selection.

     

    • Read object data

      perform read_object_data.

     

    • Reset counters

      perform reset_counters.

     

    • Reset tables

      perform reset_tables.

     

    • Open output file

      perform open_output_file.

     

    • Write header record

      perform write_header_record.

     

    • Read content of files into internal tables

      perform read_frontend_file using '0007'.

     

      loop at DEST .

        add 1 to g_cnt_records_read.

        add 1 to g_cnt_transactions_read.

        check so_tcntr.

        add 1 to g_cnt_transactions_transferred.

        move-corresponding DEST

          to tran_DEST                          .

        tran_DEST-__record__ =

          'DEST'.

        assign tran_DEST to <g_buffer_char>

              casting type c.

        g_record_length = strlen( <g_buffer_char> ).

        g_hex_record_length = g_record_length.

        transfer g_hex_record_length to g_filename.

        if g_record_length > 0.

          assign g_max_buffer(g_record_length) to <g_buffer>.

          <g_buffer> = <g_buffer_char>.

          transfer <g_buffer> to g_filename.

          perform update_statistics_used using 'DEST '.

        endif.

        add 1 to g_cnt_records_transferred.

        perform indicate_progress.

      endloop.

     

    • Final message

      perform final_message.

     

    • Close output file

      close dataset g_filename.

     

    • End program

      exit.

     

    • Form routines

      include:

        /sapdmc/sap_lsmw_read_forms.

     

    &----


    *&      Form  check_user_select_options

    &----


    •       text

    ----


    •      -->P_FLG_TRANSFER  text

    ----


    form check_user_select_options changing p_flg_transfer.

      p_flg_transfer = no.

      p_flg_transfer = yes.

    endform.                    "check_user_select_options

  • Re: LSMW with Coding
    nagaraj patil
    Currently Being Moderated

    Hi Anil,

     

    u can do dcoding in LSMW .

     

    in 5th step u can do coding

    there is one button called RULE  double click on that button u can get the pup window in that there one options called ABAP-CODEselect thata button .once u select that button it will opens the ABAP editor intila screen .you can write the code accodring to your requirment.

     

     

    thanks.

    <b>Reward is usefull</b>

  • Re: LSMW with Coding
    Murugesh Arcot
    Currently Being Moderated

    Hi,

     

    You can see the editor in step: Maintain field mapping and conversion rules.

     

    in this step, you can enable the menu option: Extras->Display Variant and all the check boxes.

     

    after you enable this, you can double click on Field Mapping screen to get ABAP editor & introduce the ABAP coding whereever you need.

     

    Hope this helps.

     

    Best Regards, Murugesh

Actions