How to create a ztable using program?

Hi ,
How to create a ztable using programs for SQL database?
Can anyone plz explain it with a program!
Thanks in advance.

hi,
Your purpose can be achieved through BDC programming too..
data:
t_bdcdata type table of bdcdata with header line.
start-of-selection.
perform bdc_dynpro      using 'SAPMSRD0' '0102'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ADD'.
perform bdc_field       using 'RSRD1-TBMA'
                              'X'.
perform bdc_field       using 'RSRD1-TBMA_VAL'
                              'ztable_demo'.
perform bdc_dynpro      using 'SAPLSD41' '2200'.
perform bdc_field       using 'BDC_OKCODE'
                              '=CHANGE_MAINTFLAG'.
perform bdc_field       using 'DD02D-DDTEXT'
                              'Ztable'.
perform bdc_field       using 'DD02D-CONTFLAG'
                              'A'.
perform bdc_field       using 'DD02D-MAINFLAG'
                              'X'.
perform bdc_dynpro      using 'SAPLSD41' '2200'.
perform bdc_field       using 'BDC_OKCODE'
                              '=DEF'.
perform bdc_field       using 'DD02D-DDTEXT'
                              'Ztable'.
perform bdc_field       using 'DD02D-CONTFLAG'
                              'A'.
perform bdc_field       using 'DD02D-MAINFLAG'
                              'X'.
perform bdc_dynpro      using 'SAPLSD41' '2200'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'DD02D-DDTEXT'
                              'Ztable'.
perform bdc_field       using 'DD03D-ROLLNAME(01)'
                              'mandt'.
perform bdc_field       using 'DD03D-FIELDNAME(01)'
                              'mandt'.
perform bdc_field       using 'DD03P-KEYFLAG(01)'
                              'X'.
perform bdc_field       using 'DD03P-NOTNULL(01)'
                              'X'.
perform bdc_dynpro      using 'SAPLSD41' '2200'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'DD02D-DDTEXT'
                              'Ztable'.
perform bdc_field       using 'DD03D-ROLLNAME(02)'
                              'S_CARR_ID'.
perform bdc_field       using 'DD03D-FIELDNAME(02)'
                              'carrid'.
perform bdc_field       using 'DD03P-KEYFLAG(02)'
                              'X'.
perform bdc_field       using 'DD03P-NOTNULL(02)'
                              'X'.
perform bdc_dynpro      using 'SAPLSD41' '2200'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'DD02D-DDTEXT'
                              'Ztable'.
perform bdc_field       using 'DD03D-ROLLNAME(03)'
                              'S_CONN_ID'.
perform bdc_field       using 'DD03D-FIELDNAME(03)'
                              'connid'.
perform bdc_dynpro      using 'SAPLSD41' '2200'.
perform bdc_field       using 'BDC_OKCODE'
                              '=SE13'.
perform bdc_field       using 'DD02D-DDTEXT'
                              'Ztable'.
perform bdc_dynpro      using 'SAPLSPO1' '0300'.
perform bdc_field       using 'BDC_OKCODE'
                              '=YES'.
perform bdc_dynpro      using 'SAPLSTRD' '0100'.
perform bdc_field       using 'BDC_CURSOR'
                              'KO007-L_DEVCLASS'.
perform bdc_field       using 'BDC_OKCODE'
                              '=TEMP'.
perform bdc_field       using 'KO007-L_AUTHOR'
                              'SAPDEV02'.
perform bdc_dynpro      using 'SAPMSEDS' '0050'.
perform bdc_field       using 'BDC_OKCODE'
                              '=SICH'.
perform bdc_field       using 'DD09V-TABART'
                              'APPL0'.
perform bdc_field       using 'DD09V-TABKAT'
                              '0'.
perform bdc_field       using 'ALLOWSTATE-NOT_ALLOWED'
                              'X'.
perform bdc_dynpro      using 'SAPMSEDS' '0050'.
perform bdc_field       using 'BDC_OKCODE'
                              '=BACK'.
perform bdc_field       using 'DD09V-TABART'
                              'APPL0'.
perform bdc_field       using 'DD09V-TABKAT'
                              '0'.
perform bdc_field       using 'ALLOWSTATE-NOT_ALLOWED'
                              'X'.
perform bdc_dynpro      using 'SAPLSD41' '2200'.
perform bdc_field       using 'BDC_OKCODE'
                              '=WB_ACTIVATE'.
perform bdc_field       using 'DD02D-DDTEXT'
                              'Ztable'.
perform bdc_dynpro      using 'SAPLSEWORKINGAREA' '0205'.
perform bdc_field       using 'BDC_OKCODE'
                              '=WEIT'.
perform bdc_dynpro      using 'SAPLSPO1' '0300'.
perform bdc_field       using 'BDC_OKCODE'
                              '=NO'.
perform bdc_dynpro      using 'SAPLSD41' '2200'.
perform bdc_field       using 'BDC_OKCODE'
                              '=WB_BACK'.
perform bdc_field       using 'DD02D-DDTEXT'
                              'Ztable'.
perform bdc_dynpro      using 'SAPMSRD0' '0102'.
perform bdc_field       using 'BDC_OKCODE'
                              '=BACK'.
perform bdc_field       using 'RSRD1-TBMA'
                              'X'.
perform bdc_field       using 'RSRD1-TBMA_VAL'
                              'ZTABLE_DEMO'.
call transaction 'SE11' using t_bdcdata..
form BDC_DYNPRO  using    value(p_program)
                          value(p_num).
clear t_bdcdata.
t_bdcdata-program = p_program.
t_bdcdata-dynpro = p_num.
append t_bdcdata.
endform.                    " BDC_DYNPRO
form BDC_FIELD  using    value(p_fnam)
                         value(p_fval).
clear t_bdcdata.
t_bdcdata-fnam = p_fnam.
t_bdcdata-fval = p_fval.
append t_bdcdata.
endform.                    " BDC_FIELD
Thanks
Sharath

Similar Messages

  • How to create a procedure using program unit

    Hai All
    Ii have created a procedure like this
    PROCEDURE Duty_calc
    IS
    procedure w_Time
    is
    begin
    update dail_att set wtime= (select lpad((to_number(to_char(outtime,'hh24mi')-to_char(intime,'hh24mi'))),4,0) from dail_att where attend_date=f_date);
    end w_time;
    begin
    if wtime >0830 then
    update dail_att set etime= (select lpad(wtime-0830) from dail_att where attend_date=f_date);
    else
         null;
    end if;
    duty_calc;
    end duty_calc;
    And i have declare in the program unit as Duty_calc and while i am executing my procedure i had an error
    is it must i need to declare a my inner procedure in my program unit
    Regards
    Srikkanth.M

    the same question you asked 2 month ago and same mistake you are doing
    - Procedure name can only be one.
    - Count proper BEGIN ENDs
    PROCEDURE Duty_calc
    IS
    BEGIN
    begin
    update dail_att set wtime= (select lpad((to_number(to_char(outtime,'hh24mi')-to_char(intime,'hh24mi'))),4,0) from dail_att where attend_date=f_date);
    end;
    begin
      if wtime >0830 then
      update dail_att set etime= (select lpad(wtime-0830) from dail_att where attend_date=f_date);
    else
      null;
    end if;
    end;
    END;

  • How to create documentation for report programs and how to use it

    how to create documentation for report programs and how to use it in the selection screen by placing an icon in the Applicatin Tool bar. If i click this icon the help documentation has to display.
      Note: Exaple <b>RSTXSCRP</b> programs selection screen

    Hi
    1 goto SE38 transaction, give the program name
    2 Click on documentation radiobutton & then press change
    3 Write your PURPOSE, PREREQUISITES etc details
    4 Save the same & Activae it.
    The icon will come automatically on selection screen
    Thanks
    Sandeep
    Reward if useful

  • HOW TO creat  BAR CHART using ABAP Programming

    DEAR ALL,
    I want some help as to how to creat GRAPHICAL display using ABAP programing (BAR CHART) any sample codes Example will be very helpful.
    Regards,
    VJ

    On earlier versions, you can do something like this.
    [code]
    REPORT ZRICH_0005 .
    DATA: BEGIN OF ITAB_DATA OCCURS 0,
               DATANAME(15),
               QUANTITY1 TYPE I,
               QUANTITY2 TYPE I,
               QUANTITY3 TYPE I,
          END OF ITAB_DATA.
    Data: BEGIN OF ITAB_OPTIONS OCCURS 0,
               OPTION(20),
          END OF ITAB_OPTIONS.
    ITAB_DATA-DATANAME = 'Maple'.
    ITAB_DATA-QUANTITY1 = 5500.
    ITAB_DATA-QUANTITY2 = 6200.
    ITAB_DATA-QUANTITY3 = 5900.
    APPEND ITAB_DATA.
    ITAB_DATA-DATANAME = 'Oak'.
    ITAB_DATA-QUANTITY1 = 3500.
    ITAB_DATA-QUANTITY2 = 5200.
    ITAB_DATA-QUANTITY3 = 4400.
    APPEND ITAB_DATA.
    ITAB_DATA-DATANAME = 'Cherry'.
    ITAB_DATA-QUANTITY1 = 1800.
    ITAB_DATA-QUANTITY2 = 2200.
    ITAB_DATA-QUANTITY3 = 1900.
    APPEND ITAB_DATA.
    CALL FUNCTION 'GRAPH_MATRIX_3D'
         EXPORTING
              COL1        = 'Jan'
              COL2        = 'Feb'
              COL3        = 'Mar'
              TITL        = 'Lumber Usage in $'
         TABLES
              DATA        = ITAB_DATA
              OPTS        = ITAB_OPTIONS
         EXCEPTIONS
              OTHERS      = 1.
    [/code]
    Regards,
    Rich Heilman

  • How to update the ztable using screen.

    hi experts,
    i have one ztable with 8 fields
    and i created one screen with 8 fields
    how to update the ztable using this screen menas when i press the some push button in my screen the table should update.
    Devi

    hi
    check the link shown below
    Coding & screen shots of how to update a database table from screen(Module poool)
    http://www.scribd.com/doc/15628693/moduleprog090311165111phpapp011
    in the attachment u will find
    data  : begin of i_ysrtmm occurs 0,
            sno type ysrtmm-sno,
            sname type ysrtmm-sname,
            scity type ysrtmm-scity,
            sedu type ysrtmm-sedu,
            spercent type ysrtmm-spercent,
            select(1),
            end of i_ysrtmm.
    in the SE51 click on layout & in that menu goto - secwindow- enter the internal table i_ysrtmm
    and click on get from program.u will get all the fields of the internal table select all of them except
    SELECT  field  and then drag and drop on table control . double click on the table control u see the attributes screen there in the w/colselect enter i_ysrtmm-select for tab selection of table control.
    Regards

  • How to create purchase order using VA01 for BAPI?

    how to create purchase order using VA01 for BAPI?

    Hi Arun,
    Please check this link
    Example Program for BAPI_PO_CREATE1
    Re: BAPI_PO_CREATE1
    Questions in BAPI_PO_CREATE1
    Problem with BAPI_PO_CREATE1
    *& Report BAPI_PO_CREATE *
    REPORT bapi_po_create.
    Input File Declaration
    TYPES: BEGIN OF ty_input_file,
    column1 TYPE char50,
    column2 TYPE char50,
    column3 TYPE char50,
    column4 TYPE char50,
    column5 TYPE char50,
    column6 TYPE char50,
    column7 TYPE char50,
    column8 TYPE char50,
    column9 TYPE char50,
    column10 TYPE char50,
    column11 TYPE char50,
    column12 TYPE char50,
    column13 TYPE char50,
    column14 TYPE char50,
    column15 TYPE char50,
    column16 TYPE char50,
    column17 TYPE char50,
    column18 TYPE char50,
    END OF ty_input_file.
    DATA: i_input_file TYPE STANDARD TABLE OF ty_input_file,
    wa_input_file TYPE ty_input_file.
    CONSTANTS: c_path TYPE char20 VALUE 'C:\',
    c_mask TYPE char9 VALUE ',.,..',
    c_mode TYPE char1 VALUE 'O',
    c_filetype TYPE char10 VALUE 'ASC',
    c_x TYPE char01 VALUE 'X'.
    PARAMETERS : p_fname LIKE rlgrap-filename.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
    Browse Presentation Server
    PERFORM f4_presentation_file.
    START-OF-SELECTION..
    Read presentation server file
    PERFORM f1003_upload_file.
    IF NOT i_input_file[] IS INITIAL.
    PERFORM split_data.
    ENDIF.
    *& Form f4_presentation_file
    *& F4 Help for presentation server
    FORM f4_presentation_file .
    CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
    def_path = c_path
    mask = c_mask
    mode = c_mode
    title = text-001
    IMPORTING
    filename = p_fname
    EXCEPTIONS
    inv_winsys = 1
    no_batch = 2
    selection_cancel = 3
    selection_error = 4
    OTHERS = 5.
    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. " f4_presentation_file
    *& Form f1003_upload_file
    *& Upload File
    FORM f1003_upload_file .
    DATA: lcl_filename TYPE string.
    lcl_filename = p_fname.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = lcl_filename
    filetype = c_filetype
    has_field_separator = c_x
    TABLES
    data_tab = i_input_file
    EXCEPTIONS
    file_open_error = 1
    file_read_error = 2
    no_batch = 3
    gui_refuse_filetransfer = 4
    invalid_type = 5
    no_authority = 6
    unknown_error = 7
    bad_data_format = 8
    header_not_allowed = 9
    separator_not_allowed = 10
    header_too_long = 11
    unknown_dp_error = 12
    access_denied = 13
    dp_out_of_memory = 14
    disk_full = 15
    dp_timeout = 16
    OTHERS = 17.
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    EXIT.
    ENDIF.
    ENDFORM. " f1003_upload_file
    *& Form split_data
    Collect data for creating Purchase Order
    FORM split_data .
    DATA: i_poitem TYPE STANDARD TABLE OF bapimepoitem,
    i_poitemx TYPE STANDARD TABLE OF bapimepoitemx,
    i_poitem_sch TYPE STANDARD TABLE OF bapimeposchedule,
    i_poitem_schx TYPE STANDARD TABLE OF bapimeposchedulx,
    i_acct_*** TYPE STANDARD TABLE OF bapimepoaccount,
    i_acct_assx TYPE STANDARD TABLE OF bapimepoaccountx,
    i_services TYPE STANDARD TABLE OF bapiesllc ,
    i_srvacc TYPE STANDARD TABLE OF bapiesklc,
    i_return TYPE STANDARD TABLE OF bapiret2,
    wa_header TYPE bapimepoheader,
    wa_headerx TYPE bapimepoheaderx,
    wa_poitem TYPE bapimepoitem,
    wa_poitemx TYPE bapimepoitemx,
    wa_poitem_sch TYPE bapimeposchedule,
    wa_poitem_schx TYPE bapimeposchedulx,
    wa_acct_*** TYPE bapimepoaccount,
    wa_acct_assx TYPE bapimepoaccountx,
    wa_services TYPE bapiesllc,
    wa_srvacc TYPE bapiesklc,
    wa_return TYPE bapiret2,
    ws_po TYPE bapimepoheader-po_number.
    break gbpra8.
    wa_services-pckg_no = 10.
    wa_services-line_no = 1.
    wa_services-outl_no = '0'.
    wa_services-outl_ind = c_x.
    wa_services-subpckg_no = 20.
    APPEND wa_services TO i_services.
    wa_srvacc-pckg_no = 10.
    wa_srvacc-line_no = 1.
    wa_srvacc-serno_line = 01.
    wa_srvacc-serial_no = 01.
    wa_srvacc-percentage = 100.
    APPEND wa_srvacc TO i_srvacc.
    LOOP AT i_input_file INTO wa_input_file.
    IF wa_input_file-column2 EQ 'HD'.
    wa_header-doc_type = wa_input_file-column3.
    wa_header-creat_date = sy-datum.
    wa_header-created_by = sy-uname.
    wa_header-vendor = wa_input_file-column4.
    PERFORM conversion_output USING wa_header-vendor
    CHANGING wa_header-vendor.
    wa_header-comp_code = 'DE03'.
    wa_header-purch_org = 'DE03'.
    wa_header-pur_group = 'DE1'.
    wa_header-vper_start = wa_input_file-column9.
    wa_header-vper_end = wa_input_file-column10.
    wa_headerx-comp_code = c_x.
    wa_headerx-doc_type = c_x.
    wa_headerx-creat_date = c_x.
    wa_headerx-created_by = c_x.
    wa_headerx-vendor = c_x.
    wa_headerx-purch_org = c_x.
    wa_headerx-pur_group = c_x.
    wa_headerx-vper_start = c_x.
    wa_headerx-vper_end = c_x.
    ENDIF.
    IF wa_input_file-column2 EQ 'IT'.
    wa_poitem-po_item = wa_input_file-column3.
    wa_poitem-short_text = wa_input_file-column6.
    wa_poitem-plant = wa_input_file-column8.
    wa_poitem-quantity = '1'.
    wa_poitem-tax_code = 'V0'.
    wa_poitem-item_cat = 'D'.
    wa_poitem-acctasscat = 'K'.
    wa_poitem-matl_group = wa_input_file-column7.
    wa_poitem-pckg_no = '10'.
    APPEND wa_poitem TO i_poitem .
    wa_poitemx-po_item = wa_input_file-column3.
    wa_poitemx-po_itemx = c_x.
    wa_poitemx-short_text = c_x.
    wa_poitemx-plant = c_x.
    wa_poitemx-quantity = c_x.
    wa_poitemx-tax_code = c_x.
    wa_poitemx-item_cat = c_x.
    wa_poitemx-acctasscat = c_x.
    wa_poitemx-matl_group = c_x.
    wa_poitemx-pckg_no = c_x.
    APPEND wa_poitemx TO i_poitemx.
    wa_poitem_sch-po_item = wa_input_file-column3.
    wa_poitem_sch-delivery_date = sy-datum.
    APPEND wa_poitem_sch TO i_poitem_sch.
    wa_poitem_schx-po_item = wa_input_file-column3.
    wa_poitem_schx-po_itemx = c_x.
    wa_poitem_schx-delivery_date = c_x.
    APPEND wa_poitem_schx TO i_poitem_schx.
    wa_acct_***-po_item = 10.
    wa_acct_***-serial_no = 01.
    wa_acct_***-gl_account = '0006360100'.
    wa_acct_***-co_area = '1000'.
    wa_acct_***-costcenter = 'KC010000'.
    APPEND wa_acct_*** TO i_acct_***.
    wa_acct_***-po_item = 10.
    wa_acct_***-serial_no = 02.
    wa_acct_***-gl_account = '0006360100'.
    wa_acct_***-co_area = '1000'.
    wa_acct_***-costcenter = 'KC010000'.
    APPEND wa_acct_*** TO i_acct_***.
    wa_acct_assx-po_item = 10.
    wa_acct_assx-serial_no = 01.
    wa_acct_assx-po_itemx = c_x.
    wa_acct_assx-serial_nox = c_x.
    wa_acct_assx-gl_account = c_x.
    wa_acct_assx-co_area = c_x.
    wa_acct_assx-costcenter = c_x.
    APPEND wa_acct_assx TO i_acct_assx.
    wa_acct_assx-po_item = 10.
    wa_acct_assx-serial_no = 02.
    wa_acct_assx-po_itemx = c_x.
    wa_acct_assx-serial_nox = c_x.
    wa_acct_assx-gl_account = c_x.
    wa_acct_assx-co_area = c_x.
    wa_acct_assx-costcenter = c_x.
    APPEND wa_acct_assx TO i_acct_assx.
    wa_services-pckg_no = 20.
    wa_services-line_no = 2.
    wa_services-service = wa_input_file-column9.
    wa_services-quantity = '100'.
    wa_services-gr_price = '100'.
    wa_services-userf1_txt = wa_input_file-column13.
    APPEND wa_services TO i_services.
    wa_srvacc-pckg_no = 20.
    wa_srvacc-line_no = 1.
    wa_srvacc-serno_line = 02.
    wa_srvacc-serial_no = 02.
    wa_srvacc-percentage = 100.
    APPEND wa_srvacc TO i_srvacc.
    ENDIF.
    ENDLOOP.
    CALL FUNCTION 'BAPI_PO_CREATE1'
    EXPORTING
    poheader = wa_header
    poheaderx = wa_headerx
    POADDRVENDOR =
    TESTRUN =
    MEMORY_UNCOMPLETE =
    MEMORY_COMPLETE =
    POEXPIMPHEADER =
    POEXPIMPHEADERX =
    VERSIONS =
    NO_MESSAGING =
    NO_MESSAGE_REQ =
    NO_AUTHORITY =
    NO_PRICE_FROM_PO =
    IMPORTING
    exppurchaseorder = ws_po
    EXPHEADER =
    EXPPOEXPIMPHEADER =
    TABLES
    return = i_return
    poitem = i_poitem
    poitemx = i_poitemx
    POADDRDELIVERY =
    poschedule = i_poitem_sch
    poschedulex = i_poitem_schx
    poaccount = i_acct_***
    POACCOUNTPROFITSEGMENT =
    poaccountx = i_acct_assx
    POCONDHEADER =
    POCONDHEADERX =
    POCOND =
    POCONDX =
    POLIMITS =
    POCONTRACTLIMITS =
    poservices = i_services
    posrvaccessvalues = i_srvacc
    POSERVICESTEXT =
    EXTENSIONIN =
    EXTENSIONOUT =
    POEXPIMPITEM =
    POEXPIMPITEMX =
    POTEXTHEADER =
    POTEXTITEM =
    ALLVERSIONS =
    POPARTNER =
    break gbpra8.
    LOOP AT i_return INTO wa_return.
    ENDLOOP.
    ENDFORM. " split_data
    *& Form conversion_output
    Conversion exit input
    FORM conversion_output USING p_ip
    CHANGING p_op.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = p_ip
    IMPORTING
    output = p_op.
    ENDFORM. " conversion_output
    Best regards,
    raam

  • How to create a module pool program

    Dear Guru
    I want to know know how to create a module pool program from se80 step by step. I want to know the steps where i will get the four includes like form routines, PAI, PBO, and global data please its very urgent.
    Thanks & regards
    Saifur Rahaman

    hi Saifur Rahaman,
    goto se80 then click find program,
    next u want any name of the program enter as,
    Attribute type as find Module pool click it.
    next u want any package and save and activate.
    program name with create screen with any number then
    click layout and u want any object and save , actived.
    click flow logic , four types as PBO and PAI and POV, POH.
    PBO---> Trigger is before screen.
    its applied for display screen and inactive or no display screen only
    PAI--->Trigger is after screen
    when u want button then its processed.
    POV--> Value requested for F4.
    POH-->Help requested for F1.
    Reward if useful,
    S.Suresh.

  • How to create material doc using bapi

    hi all,
    pls tell me how to create material doc using bapi ,
    if i give po no , it will create material doc no .
    advance thanks ,

    Hi venu,
    Please go thru this example, it will help u.
    REPORT ZBAPIMM01 LINE-SIZE 255 NO STANDARD PAGE HEADING
    LINE-COUNT 065(001).
    TABLES: T001L, "Storage Locations
    MARA, "General Material Data
    MAKT, "Material Descriptions
    MBEW, "Material Valuation
    MARC. "Plant Data for Material
    DATA: BAPI_HEAD LIKE BAPIMATHEAD,
    BAPI_MAKT LIKE BAPI_MAKT, "Material Description
    BAPI_MARA1 LIKE BAPI_MARA, "Client Data
    BAPI_MARAX LIKE BAPI_MARAX,
    BAPI_MARC1 LIKE BAPI_MARC, "Plant View
    BAPI_MARCX LIKE BAPI_MARCX,
    BAPI_MBEW1 LIKE BAPI_MBEW, "Accounting View
    BAPI_MBEWX LIKE BAPI_MBEWX,
    BAPI_RETURN LIKE BAPIRET2.
    DATA: BEGIN OF INT_MAKT OCCURS 100.
    INCLUDE STRUCTURE BAPI_MAKT.
    DATA: END OF INT_MAKT.
    DATA: BEGIN OF INT_MAT OCCURS 100,
    WERKS(4), "Plant
    MTART(4), "Material type
    MATNR(18), "Material number
    MATKL(9) , "Material group
    MBRSH(1), "Industry sector
    MEINS(3), "Base unit of measure
    GEWEI(3), "Weight Unit
    SPART(2), "Division
    EKGRP(3), "Purchasing group
    VPRSV(1), "Price control indicator
    STPRS(12), "Standard price
    PEINH(3), "Price unit
    SPRAS(2), "Language key
    MAKTX(40), "Material description
    END OF INT_MAT.
    SELECT-OPTIONS:
    PLANT FOR MARC-WERKS OBLIGATORY MEMORY ID PLT,
    MATERIAL FOR MARA-MATNR MEMORY ID MAT,
    MATLTYPE FOR MARA-MTART MEMORY ID MTY,
    DIVISION FOR MARA-SPART MEMORY ID DIV.
    PARAMETERS: F_FILE LIKE RLGRAP-FILENAME
    DEFAULT 'C:\DATA\ZMATERIAL.XLS' MEMORY ID F_FILE,
    GETDATA AS CHECKBOX, "Tick to download materials data to local harddisk
    UPDDATA AS CHECKBOX. "Tick to update date to Materials Master
    IF GETDATA = 'X'.
    PERFORM DOWNLOAD_DATA.
    PERFORM DOWNLOAD_FILE.
    ENDIF.
    IF UPDDATA = 'X'.
    PERFORM UPLOAD_FILE.
    PERFORM UPDATE_MM.
    ENDIF.
    FORM DOWNLOAD_DATA.
    SELECT * FROM MARC WHERE LVORM EQ ' '
    AND WERKS IN PLANT
    AND MATNR IN MATERIAL.
    CLEAR MARA.
    SELECT SINGLE * FROM MARA WHERE MATNR = MARC-MATNR.
    CHECK MATLTYPE.
    CHECK DIVISION.
    CLEAR MBEW.
    SELECT SINGLE * FROM MBEW WHERE MATNR = MARC-MATNR
    AND BWKEY = MARC-WERKS.
    CLEAR MAKT.
    SELECT SINGLE * FROM MAKT WHERE SPRAS = 'EN'
    AND MATNR = MARC-MATNR.
    WRITE:/ MARC-WERKS, "Plant
    MARA-MTART, "Material type
    MARA-MATNR, "Material number
    MARA-MATKL, "Material group
    MARA-MBRSH, "Industry sector
    MARA-MEINS, "Base unit of measure
    MARA-GEWEI, "Weight Unit
    MARA-SPART, "Division
    MARC-EKGRP, "Purchasing group
    MBEW-VPRSV, "Price control indicator
    MBEW-STPRS, "Standard price
    MBEW-PEINH, "Price unit
    MAKT-SPRAS, "Language key
    MAKT-MAKTX. "Material description
    INT_MAT-WERKS = MARC-WERKS. "Plant
    INT_MAT-MTART = MARA-MTART. "Material type
    INT_MAT-MATNR = MARA-MATNR. "Material number
    INT_MAT-MATKL = MARA-MATKL. "Material group
    INT_MAT-MBRSH = MARA-MBRSH. "Industry sector
    INT_MAT-MEINS = MARA-MEINS. "Base unit of measure
    INT_MAT-GEWEI = MARA-GEWEI. "Weight Unit
    INT_MAT-SPART = MARA-SPART. "Division
    INT_MAT-EKGRP = MARC-EKGRP. "Purchasing group
    INT_MAT-VPRSV = MBEW-VPRSV. "Price control indicator
    INT_MAT-STPRS = MBEW-STPRS. "Standard price
    INT_MAT-PEINH = MBEW-PEINH. "Price unit
    INT_MAT-SPRAS = MAKT-SPRAS. "Language key
    INT_MAT-MAKTX = MAKT-MAKTX. "Material description
    APPEND INT_MAT.
    CLEAR INT_MAT.
    ENDSELECT.
    ENDFORM.
    FORM DOWNLOAD_FILE.
    call function 'WS_DOWNLOAD'
    EXPORTING
    FILENAME = F_FILE
    FILETYPE = 'DAT'
    FILETYPE = 'WK1'
    tables
    data_tab = INT_MAT
    EXCEPTIONS
    FILE_OPEN_ERROR = 1
    FILE_WRITE_ERROR = 2
    INVALID_FILESIZE = 3
    INVALID_TYPE = 4
    NO_BATCH = 5
    UNKNOWN_ERROR = 6
    INVALID_TABLE_WIDTH = 7
    GUI_REFUSE_FILETRANSFER = 8
    CUSTOMER_ERROR = 9
    OTHERS = 10.
    IF SY-SUBRC = 0.
    FORMAT COLOR COL_GROUP.
    WRITE:/ 'Data Download Successfully to your local harddisk'.
    SKIP.
    ENDIF.
    ENDFORM.
    FORM UPLOAD_FILE.
    call function 'WS_UPLOAD'
    EXPORTING
    FILENAME = F_FILE
    FILETYPE = 'DAT'
    FILETYPE = 'WK1'
    tables
    data_tab = INT_MAT
    EXCEPTIONS
    FILE_OPEN_ERROR = 1
    FILE_WRITE_ERROR = 2
    INVALID_FILESIZE = 3
    INVALID_TYPE = 4
    NO_BATCH = 5
    UNKNOWN_ERROR = 6
    INVALID_TABLE_WIDTH = 7
    GUI_REFUSE_FILETRANSFER = 8
    CUSTOMER_ERROR = 9
    OTHERS = 10.
    IF SY-SUBRC = 0.
    FORMAT COLOR COL_GROUP.
    WRITE:/ 'Data Upload Successfully from your local harddisk'.
    SKIP.
    ENDIF.
    ENDFORM.
    FORM UPDATE_MM.
    LOOP AT INT_MAT.
    Header
    BAPI_HEAD-MATERIAL = INT_MAT-MATNR.
    BAPI_HEAD-IND_SECTOR = INT_MAT-MBRSH.
    BAPI_HEAD-MATL_TYPE = INT_MAT-MTART.
    BAPI_HEAD-BASIC_VIEW = 'X'.
    BAPI_HEAD-PURCHASE_VIEW = 'X'.
    BAPI_HEAD-ACCOUNT_VIEW = 'X'.
    Material Description
    REFRESH INT_MAKT.
    INT_MAKT-LANGU = INT_MAT-SPRAS.
    INT_MAKT-MATL_DESC = INT_MAT-MAKTX.
    APPEND INT_MAKT.
    Client Data - Basic
    BAPI_MARA1-MATL_GROUP = INT_MAT-MATKL.
    BAPI_MARA1-BASE_UOM = INT_MAT-MEINS.
    BAPI_MARA1-UNIT_OF_WT = INT_MAT-GEWEI.
    BAPI_MARA1-DIVISION = INT_MAT-SPART.
    BAPI_MARAX-MATL_GROUP = 'X'.
    BAPI_MARAX-BASE_UOM = 'X'.
    BAPI_MARAX-UNIT_OF_WT = 'X'.
    BAPI_MARAX-DIVISION = 'X'.
    Plant - Purchasing
    BAPI_MARC1-PLANT = INT_MAT-WERKS.
    BAPI_MARC1-PUR_GROUP = INT_MAT-EKGRP.
    BAPI_MARCX-PLANT = INT_MAT-WERKS.
    BAPI_MARCX-PUR_GROUP = 'X'.
    Accounting
    BAPI_MBEW1-VAL_AREA = INT_MAT-WERKS.
    BAPI_MBEW1-PRICE_CTRL = INT_MAT-VPRSV.
    BAPI_MBEW1-STD_PRICE = INT_MAT-STPRS.
    BAPI_MBEW1-PRICE_UNIT = INT_MAT-PEINH.
    BAPI_MBEWX-VAL_AREA = INT_MAT-WERKS.
    BAPI_MBEWX-PRICE_CTRL = 'X'.
    BAPI_MBEWX-STD_PRICE = 'X'.
    BAPI_MBEWX-PRICE_UNIT = 'X'.
    WRITE:/ BAPI_HEAD, BAPI_MARC1.
    call function 'BAPI_MATERIAL_SAVEDATA'
    exporting
    HEADDATA = BAPI_HEAD
    CLIENTDATA = BAPI_MARA1
    CLIENTDATAX = BAPI_MARAX
    PLANTDATA = BAPI_MARC1
    PLANTDATAX = BAPI_MARCX
    FORECASTPARAMETERS =
    FORECASTPARAMETERSX =
    PLANNINGDATA =
    PLANNINGDATAX =
    STORAGELOCATIONDATA =
    STORAGELOCATIONDATAX =
    VALUATIONDATA = BAPI_MBEW1
    VALUATIONDATAX = BAPI_MBEWX
    WAREHOUSENUMBERDATA =
    WAREHOUSENUMBERDATAX =
    SALESDATA = BAPI_MVKE1
    SALESDATAX = BAPI_MVKEX
    STORAGETYPEDATA =
    STORAGETYPEDATAX =
    IMPORTING
    RETURN = BAPI_RETURN
    TABLES
    MATERIALDESCRIPTION = INT_MAKT
    UNITSOFMEASURE =
    UNITSOFMEASUREX =
    INTERNATIONALARTNOS =
    MATERIALLONGTEXT =
    TAXCLASSIFICATIONS =
    RETURNMESSAGES =
    PRTDATA =
    PRTDATAX =
    EXTENSIONIN =
    EXTENSIONINX =
    IF BAPI_RETURN-TYPE = 'E'.
    WRITE:/ 'Error Message ', BAPI_RETURN.
    ENDIF.
    ENDLOOP.
    ENDFORM.
    *---End of Program
    Reagrds,
    Kumar

  • How to create a session using call transaction method.

    hi , this is nagaraju,
    How to create a session using call transaction method.

    Hi,
    About Data Transfer In R/3 System
    When a company decides to implement the SAP R/3 to manage business-critical data, it usually does not start from a no-data situation. Normally, a SAP R/3 project comes into replace or complement existing application.
    In the process of replacing current applications and transferring application data, two situations might occur:
    •     The first is when application data to be replaced is transferred at once, and only once.
    •     The second situation is to transfer data periodically from external systems to SAP and vice versa.
    •     There is a period of time when information has to be transferred from existing application, to SAP R/3, and often this process will be repetitive.
    The SAP system offers two primary methods for transferring data into SAP systems. From non-SAP systems or legacy system. These two methods are collectively called “batch input” or “batch data communication”.
    1. SESSION METHOD
    2. CALL TRANSACTION
    3. DIRECT INPUT
    First step for both the methods is to upload the data to internal table. From Internal Table, the data is transferred to database table by two ways i.e., Session method and Call transaction.
    Session is intermediate step between internal table and database table. Data along with its action is stored in session i.e., data for screen fields, to which screen it is passed, the program name behind it, and how the next screen is processed.
    When the program has finished generating the session, you can run the session to execute the SAP transactions in it. Unless session is processed, the data is not transferred to database table.
    A technique similar to SESSION method, while batch input is a two-step procedure, Call Transaction does both steps online, one after the other. In this method, you call a transaction from your program.
    SESSION METHOD
    Data is not updated in database table unless Session is processed.
    No sy-subrc is returned.
    Error log is created for error records.
    Updation in database table is always synchronous
    CALL TRANSACTION
    Immediate updation in database table.
    Sy-subrc is returned.
    Errors need to be handled explicitly
    Updation in database table can be synchronous Or Asynchronous.
    Regards,
    Sruthi.

  • How to update the Ztable using modulepool Tablecontrol...

    Hi All,
    could anyone help me how to update the Ztable using modulepool Tablecontrol...
    if it is possible give me a example with code..
    Many thanks in advance...!!
    Rajesh

    Hi,
    For that pls refer to the link:
    http://help.sap.com/saphelp_nw70/helpdata/en/9f/dbac3735c111d1829f0000e829fbfe/frameset.htm
    Also refer the sample program:
    RSDEMO02
    Then for updating:
    modify the internal table(which u used to populate the tabcntrl) from the table control.
    Then update database table like:
    update dbtab from table itab.
    Regards,
    Renjith Michael.

  • How to create tcode for modulepool program with selection screen?

    hi,
       How to create tcode for modulepool program with selection screen?
    thanks,
    sagar

    Hi,
    We need to goto SE80.
    In our program we right click on object name and goto create
    -> transaction. Enter the module pool program and screen number and save and activate.
    Or by SE93 also we can create a transaction code for our program.
    Hope ths helps.
    plz reward if useful.
    thanks,
    dhanashri..
    Edited by: Dhanashri Pawar on Jul 22, 2008 8:29 AM

  • How to Create Shared Storage using VM-Server 2.1 Red Hat Enterprise Linux 5

    Thanks in advance.
    Describe in sequence how to create shared storage for a two guest/node Red Hat Linux Enterprise using Oracle 2.1 VM Server on Red Hat Linux Enterprise 5 using command line or appropriate interface.
    How to create Shared Storage using Oracle 2.1 VM Server?
    How to configure Network for two node cluster (oracle clusterware)?

    Hi Suresh Kumar,
    Oracle Application Server 10g Release 2, Patch Set 3 (10.1.2.3) is required to be fully certified on OEL 5.x or RHEL 5.x.
    Oracle Application Server 10g Release 2 10.1.2.0.0 or 10.1.2.0.1 versions are not supported with Oracle Enterprise Linux (OEL) 5.0 or Red Hat Enterprise Linux (RHEL) 5.0. It is recommended that version 10.1.2.0.2 be obtained and installed.
    Which implies Oracle AS 10.1.2.x is some what certified on RHEL 5.x
    I think it would be better if you get in touch with Oracle Support regarding this .
    Sorry , I am not aware of any document on migration from Sun Solaris to RH Linux 5.2 .
    Thanks,
    Sutirtha

  • How to create an array using reflection.

    How to create an array using reflection.
    I want to achive something like this,Object o;
    o = (Object)(new TestClass[10]);but by use of reflection.
    To create a single object is simple:Object o;
    o = Class.forName("TestClass").newInstance();But how do I create an array of objects, when the class of objects is known only by name? (Can't use Object[] because even though an Object[] array can be filled with "TestClass" elements only, it Cannot be casted to a TestClass[] array)
    Anybody knows?":-)
    Ragnvald Barth
    Software enigneer

    Found it!
    the java.lang.reflect.Array class solves it!
    Yes !!!

  • How to create a table using Text Layout Framework?

    How to create a table using Text Layout Framework? I meen real tables - like in HTML.

    Cell as indipendant TLF should work, I have created my table using same approach and works fine for me ... this is where it is
    http://apps.live-documents.com/docs/openWebDoc.do?docId=1480607
    Regards
    Raf

  • How to create Handling Unit using Process Order no. & Packing Instruction

    Hi experts,
    Please guide me how to create Handling Unit using Process Order number & Packing Instruction reference?Noramlly this is done using standard transaction 'COWBPACK'.
    ANY FUNCTION MODULE OR BAPI TO DO THIS.
    if any solution please explain with proper example..
    Thanks In advance
    Thanks,
    Yogesh

    Hi experts,
    Please guide me how to create Handling Unit using Process Order number & Packing Instruction reference?Noramlly this is done using standard transaction 'COWBPACK'.
    ANY FUNCTION MODULE OR BAPI TO DO THIS.
    if any solution please explain with proper example..
    Thanks In advance
    Thanks,
    Yogesh

Maybe you are looking for