Managing and Executing Batch Input Transactions English

From Theobald Software

Jump to: navigation, search

German Version: Batch Input Transaktionen


The class Transaction offers the possibility of executing SAP transactions in the foreground as well as in a background process. This technique is called Batch Input. By executing in a background process, you will be able to process mass data and transfer it to the SAP system. This technique is often used if no BAPI exists.

Another possibility is to jump directly to an SAP transaction from your .NET application. The example below covers this.

The user is able to enter a material number and the name of a plant. After doing so, she/he can click the button and the SAP GUI is launched with transaction MMBE (stock overview). A special tool, the TransactionRecorder, is also included in the installation package to record such transactions and implement them easily in you own program code.

Enlarge

Sample Coding

The code below shows how add batch steps with the method AddStep. It is important to set the UseGui property to true. The SAP GUI will be launched by the method Execute.

[C#]

private void button1_Click(object sender, System.EventArgs e)
{
    // Reset the batch steps
    transaction1.BatchSteps.Clear();
 
    // fill new steps
    transaction1.ExecutionMode =    ERPConnect.Utils.TransactionDialogMode.ShowOnlyErrors;
    transaction1.TCode = "MMBE";
    transaction1.AddStepSetNewDynpro("RMMMBEST","1000");
    transaction1.AddStepSetOKCode("ONLI");
    transaction1.AddStepSetCursor("MS_WERKS-LOW");
    transaction1.AddStepSetField("MS_MATNR-LOW",textBox1.Text);
    transaction1.AddStepSetField("MS_WERKS-LOW",textBox2.Text);
 
    // connect to SAP
    r3Connection1.UseGui = true;
 
    if (r3Connection1.AskUserAndOpen(true))
     // Run
     transaction1.Execute();
 
}

[VB]

Private Sub button1_Click(ByVal sender As System.Object, _
         ByVal e As System.EventArgs) Handles button1.Click
 
        ' Reset the batch steps
        transaction1.BatchSteps.Clear()
 
        ' fill new steps
        transaction1.ExecutionMode = ERPConnect.Utils.TransactionDialogMode.ShowOnlyErrors
        transaction1.TCode = "MMBE"
        transaction1.AddStepSetNewDynpro("RMMMBEST", "1000")
        transaction1.AddStepSetOKCode("ONLI")
        transaction1.AddStepSetCursor("MS_WERKS-LOW")
        transaction1.AddStepSetField("MS_MATNR-LOW", textBox1.Text)
        transaction1.AddStepSetField("MS_WERKS-LOW", textBox2.Text)
 
        ' connect to SAP
        r3Connection1.UseGui = True
 
        If r3Connection1.AskUserAndOpen(True) Then
            ' Run
            transaction1.Execute()
        End If
 
    End Sub

The screenshot below shows the sample program in action.

If you only want to open the SAP GUI and execute a single transaction without adding several batch steps, it is sufficient to set the property TCode and execute.

Image:MMBE1_kl.jpg

DeutschEnglish
Personal tools
Navigation
XtractQL Provider
Xtract RS