DATA l_date TYPE sy-datum. CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL' EXPORTING date = sy-datum days = 0 months = 30 signum = '-' years = 0 IMPORTING calc_date = l_date EXCEPTIONS OTHERS = 1.
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { //var buffer1 = new BlockingCollection<int>(10); //Qtd maxima de 10 na pilha //var buffer2 = new BlockingCollection<int>(10); var buffer1 = new BlockingCollection<int>(); //Sem qtd maxima na pilha var buffer2 = new BlockingCollection<int>(); var f = new TaskFactory(TaskCreationOptions.LongRunning, TaskContinuationOptions.None); //List<Task> t = new List<Task>(); //t.Add(f.StartNew(() => CreateInitialRange(buffer1))); Task[] tasks = new Task[3]; //Start the phases of the pipeline //Task stage1 = f.StartNew(() => CreateInitialRange(buffer1)); //Task stage2 = f.StartNew(() => DoubleTheRange(buffer1, buffer2)); //Task stage3 = f.StartNew(() => WriteResults(buffer2)); tasks[0] = f.StartNew(() => CreateInitialRange(buffer1)); tasks[1] = f.StartNew(() => DoubleTheRange(buffer1, buffer2)); tasks[2] = f.StartNew(() => WriteResults(buffer2)); //wait for the phases to complete //Task.WaitAll(stage1, stage2, stage3); Task.WaitAll(tasks); Console.WriteLine("Pressione uma tecla..."); Console.ReadLine(); } static void CreateInitialRange(BlockingCollection<int> output) { try { for (int i = 1; i <= 50; i++) { Console.WriteLine("Inicio {0}, qtd {1}", i, output.Count()); //Console.WriteLine("CreateInitialRange {0}", i); Thread.Sleep(200); output.Add(i); } } finally { output.CompleteAdding(); } } static void DoubleTheRange(BlockingCollection<int> input, BlockingCollection<int> output) { try { foreach (var number in input.GetConsumingEnumerable()) { Console.WriteLine("Meio {0}, qtd input {1}, qtd output {2}", number * number, input.Count(), output.Count()); Thread.Sleep(400); output.Add(number * number); } } finally { output.CompleteAdding(); } } static void WriteResults(BlockingCollection<int> input) { foreach (var squaredNumber in input.GetConsumingEnumerable()) { //Console.WriteLine("Result is {0}", squaredNumber); Console.WriteLine("Fim {0}, qtd {1}", squaredNumber, input.Count()); Thread.Sleep(800); } } } }
Fonte: Link
REPORT zemail. DATA: send_request TYPE REF TO cl_bcs, text TYPE bcsy_text, document TYPE REF TO cl_document_bcs, sender TYPE REF TO cl_cam_address_bcs, recipient TYPE REF TO cl_cam_address_bcs, bcs_exception TYPE REF TO cx_bcs, sent_to_all TYPE os_boolean. BREAK-POINT. TRY. send_request = cl_bcs=>create_persistent( ). APPEND '<!doctype html public "-//w3c//dtd html 3.2 final//en">' TO text. APPEND '<html>' TO text. APPEND ' <head>' TO text. APPEND ' <title>Título</title>' TO text. APPEND ' </head>' TO text. APPEND ' <body>' TO text. APPEND ' <p align="center">' TO text. APPEND ' Corpo do e-mail' TO text. APPEND ' </p>' TO text. APPEND ' <br />' TO text. APPEND ' Em HTML' TO text. APPEND ' </body>' TO text. APPEND '</html>' TO text. document = cl_document_bcs=>create_document( i_type = 'HTM' i_text = text i_subject = 'Assunto E-MAIL' ). send_request->set_document( document ). sender = cl_cam_address_bcs=>create_internet_address( 'email@de.com.br' ). recipient = cl_cam_address_bcs=>create_internet_address( 'email@para.com.br' ). send_request->set_sender( sender ). send_request->add_recipient( EXPORTING i_recipient = recipient i_express = 'X' ). send_request->send( EXPORTING i_with_error_screen = 'X' RECEIVING result = sent_to_all ). IF sent_to_all = 'X'. MESSAGE 'E-mail enviado com sucesso' TYPE 'I'. ENDIF. COMMIT WORK. CATCH cx_bcs INTO bcs_exception. MESSAGE bcs_exception->error_type TYPE 'E'. ENDTRY.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace split { class Program { static void Main(string[] args) { if (args.Length == 2) { string arquivo = args[0]; string destino = args[1]; int qtd = 0; StreamWriter writer = null; try { using (StreamReader inputfile = new System.IO.StreamReader(arquivo)) { int count = 0; string line; while ((line = inputfile.ReadLine()) != null) { //800.000 linhas if (writer == null || count >= 800000) { count = 0; if (writer != null) { writer.Close(); writer = null; } writer = new System.IO.StreamWriter(Path.GetDirectoryName(arquivo) + "\\" + Path.GetFileNameWithoutExtension(arquivo) + "_" + qtd.ToString() + ".txt", true); qtd++; } writer.WriteLine(line.ToLower()); ++count; } } } finally { if (writer != null) writer.Close(); Console.WriteLine("Split concluido."); } } else { Console.WriteLine("Split diretorio_e_arquivo diretorio_destino"); } Console.WriteLine("Pressione uma tecla para continuar . . ."); Console.ReadKey(); } } }
REPORT zmatch. TYPES: BEGIN OF ty_t001w, werks TYPE t001w-werks, sep TYPE c LENGTH 3, name1 TYPE t001w-name1, END OF ty_t001w. DATA: t_t001w TYPE TABLE OF ty_t001w, "#EC NEEDED w_t001w TYPE ty_t001w, l_index TYPE sy-tabix. "#EC NEEDED SELECTION-SCREEN BEGIN OF BLOCK b1. PARAMETERS: p1 TYPE c LENGTH 4. SELECT-OPTIONS: p2 FOR w_t001w-werks NO INTERVALS NO-EXTENSION. SELECTION-SCREEN END OF BLOCK b1. AT SELECTION-SCREEN ON VALUE-REQUEST FOR p1. SELECT werks name1 INTO CORRESPONDING FIELDS OF TABLE t_t001w FROM t001w WHERE vtweg = '10'. w_t001w-sep = ' - '. MODIFY t_t001w FROM w_t001w TRANSPORTING sep WHERE sep IS INITIAL. CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY' EXPORTING endpos_col = 70 endpos_row = 20 startpos_col = 43 startpos_row = 1 titletext = 'SELECIONAR O CENTRO' IMPORTING choise = l_index TABLES valuetab = t_t001w EXCEPTIONS break_off = 1 OTHERS = 2. IF sy-subrc IS NOT INITIAL. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. IF l_index IS NOT INITIAL. READ TABLE t_t001w INTO w_t001w INDEX l_index. * MESSAGE w_t001w-name1 TYPE 'I'. p1 = w_t001w-werks. ENDIF. START-OF-SELECTION. * CLEAR: t_t001w, t_t001w[], w_t001w. * SELECT werks name1 * INTO CORRESPONDING FIELDS OF TABLE t_t001w * FROM t001w * WHERE werks = p1. * READ TABLE t_t001w INTO w_t001w INDEX 1. WRITE: / w_t001w-name1. END-OF-SELECTION.