Simple Addition programs using Subroutine in SAP ABAP


Code :
REPORT ZVP_SUBROUTINE.

DATA: NUM1 TYPE I,
      NUM2 TYPE I,
      SUM TYPE I.

NUM1 = 60.
NUM2 = 40.

PERFORM ADDITION USING NUM1 NUM2.
WRITE:/ 'SUM = ', SUM, 'NUM1 = ', NUM1, 'NUM2 = ', NUM2.

FORM ADDITION USING A1 A2.
  SUM = A1 + A2.
ENDFORM.

Output :
SUM = 100 NUM1 = 60 NUM2 = 40

IDE Used To Test This Code : SAP Login 750.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Simple Macro program in SAP ABAP


Code :
REPORT ZVP_MOD_MACRO.

*------------------------------START OF MACRO DEFINITION--------------------------------------*
DEFINE MAC_NAME.
  WRITE: 'YOU HAVE CLICKED WITH MACRO : &1'.
END-OF-DEFINITION.
*------------------------------END OF MACRO DEFINITION--------------------------------------*

PARAMETERS: RB1 RADIOBUTTON GROUP RBG DEFAULT 'X',
            RB2 RADIOBUTTON GROUP RBG,
            RB3 RADIOBUTTON GROUP RBG.

START-OF-SELECTION.
  IF RB1 = 'X'.
    MAC_NAME 1.
  ELSEIF RB2 = 'X'.
    MAC_NAME 2.
  ELSEIF RB3 = 'X'.
    MAC_NAME 3.
  ENDIF.

Output :
YOU HAVE CLICKED WITH MACRO : 1

IDE Used To Test This Code : SAP GUI 750

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Centigrade to Fahrenheit conversion using function in CPP program


Code :
#include<iostream>
#include<conio.h>
using namespace std;

int TempConvert(int);

int main() {
    int celsius, fahrenheit;
    cout<<"Enter the temperature in Celsius : ";
    cin>>celsius;
    TempConvert(celsius);
}

int TempConvert(int x) {
    int output;
    output = (( 9 * x ) / 5 ) + 32;
    cout<<"Fahrenheit value is: "<<output;
   
}


Output :
Enter the temperature in Celsius : 40
Fahrenheit value is: 104

IDE Used To Test This Code : DEV C++

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Centigrade to Fahrenheit conversion CPP program


Code : 
#include<iostream>
#include<conio.h>
using namespace std;
int main() {
    int celsius, fahrenheit;
    cout<<"Enter the temperature in Celsius : ";
    cin>>celsius;
    fahrenheit = (( 9 * celsius ) / 5 ) + 32;
    cout<<"Fahrenheit value is : "<<fahrenheit;
}


Output :
Enter the temperature in Celsius : 40
Fahrenheit value is : 104

IDE Used To Test This Code : DEV C++.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

How to Autocomplete TextBox in C#


Code:
void AutoCompleteText() {
            string myconnstrng = ConfigurationManager.ConnectionStrings["connstrng"].ConnectionString;
            SqlConnection conn = new SqlConnection(myconnstrng);
            string sql = "SELECT product_code FROM ProductMaster";
                SqlCommand cmd = new SqlCommand(sql, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                AutoCompleteStringCollection Collection = new AutoCompleteStringCollection();
                while (reader.Read()) {
                    Collection.Add(reader["product_code"].ToString());
                }
                txtInvoiceProductCode.AutoCompleteMode=AutoCompleteMode.SuggestAppend;
                txtInvoiceProductCode.AutoCompleteSource = AutoCompleteSource.CustomSource;
                txtInvoiceProductCode.AutoCompleteCustomSource = Collection;
                conn.Close();
        }

After that call AutoCompleteText() function within Load function in a form.

IDE Used To Test This Code : Microsoft Visual Studio.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

How to random number generator in C#


Code :
 private void RandomNumberGenerator() {
            Random r = new Random();
            for (int i = 1; i < 10; i++) {
                int n = r.Next();
                txtRandomNumber.Text = "INV"+n.ToString();
            }
        }

IDE Used To Test This Code : Microsoft Visual Studio.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

How to clear TextBox data in C#


To find TextBox name go to TextBox properties section and find the name under Design section.

Code :
private void Clear() {
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox5.Text = "";
textBox6.Text = "";
textBox7.Text = "";
textBox8.Text = "";
}

after that call the Clear() function in a button event for function calling.

IDE Used To Test This Code : Microsoft Visual Studio

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

How to custom name of DataGridView Columns in C#


First select the data from database table and load it to datagridview.

Below code dgvPurchaseStockEntry is a DataGridView and ["................."] is a table column name which will be replaced by custom HeaderText provided in below code.

Code :
dgvPurchaseStockEntry.Columns["product_code"].HeaderText = "HSN CODE";
dgvPurchaseStockEntry.Columns["product_name"].HeaderText = "PRODUCT NAME";
dgvPurchaseStockEntry.Columns["product_description"].HeaderText = "DESCRIPTION";
dgvPurchaseStockEntry.Columns["product_unit_price"].HeaderText = "UNIT PRICE";
dgvPurchaseStockEntry.Columns["product_category_name"].HeaderText = "CATEGORY";
dgvPurchaseStockEntry.Columns["product_quantity"].HeaderText = "QUANTITY";
dgvPurchaseStockEntry.Columns["product_purchased_date"].HeaderText = "PURCHASED DATE";
dgvPurchaseStockEntry.Columns["product_purchased_from"].HeaderText = "PURCHASED FROM";
dgvPurchaseStockEntry.Columns["product_invoice_number"].HeaderText = "INVOICE NUMBER";
dgvPurchaseStockEntry.Columns["product_cgst"].HeaderText = "CGST";
dgvPurchaseStockEntry.Columns["product_sgst"].HeaderText = "SGST";
dgvPurchaseStockEntry.Columns["product_igst"].HeaderText = "IGST";
dgvPurchaseStockEntry.Columns["product_total_price"].HeaderText = "TOTAL PRICE";

IDE Used To Test This Code : Microsoft Visual Studio.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

SAP ABAP calculator program using dropdown


Code :
REPORT ZVP_CALCULATOR_DROPDOWN.

PARAMETERSA_VAR TYPE CHAR10,
            B_VAR TYPE CHAR10,
            DD_VAR TYPE CHAR10 AS LISTBOX VISIBLE LENGTH 10.

DATAOUTPUT_VAR TYPE CHAR10.

TYPE-POOLSVRM.

DATANAME  TYPE VRM_ID,
      LIST  TYPE VRM_VALUES,
      VALUE LIKE LINE OF LIST.

AT SELECTION-SCREEN OUTPUT.

  NAME 'DD_VAR'.
  VALUE-KEY '1'.
  VALUE-TEXT '+'.
  APPEND VALUE TO LIST.

  VALUE-KEY '2'.
  VALUE-TEXT '-'.
  APPEND VALUE TO LIST.

  VALUE-KEY '3'.
  VALUE-TEXT '*'.
  APPEND VALUE TO LIST.

  VALUE-KEY '4'.
  VALUE-TEXT '/'.
  APPEND VALUE TO LIST.

  CALL FUNCTION 'VRM_SET_VALUES' EXPORTING ID NAME VALUES LIST.

START-OF-SELECTION.

IF DD_VAR '1'.
  OUTPUT_VAR A_VAR + B_VAR.
  WRITE'CALCULATED VALUE IS : 'OUTPUT_VAR.

  ELSEIF DD_VAR '2'.
  OUTPUT_VAR A_VAR B_VAR.
  WRITE'CALCULATED VALUE IS : 'OUTPUT_VAR.

  ELSEIF DD_VAR '3'.
  OUTPUT_VAR A_VAR * B_VAR.
  WRITE'CALCULATED VALUE IS : 'OUTPUT_VAR.

  ELSEIF DD_VAR '4'.
  OUTPUT_VAR A_VAR / B_VAR.
  WRITE'CALCULATED VALUE IS : 'OUTPUT_VAR.

  ELSE.
  WRITE'ONLY + - * / SIGNS ARE ALLOWED'.

ENDIF.

Output :
  IDE Used To Test This Code : SAP GUI Login 750

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

What is Non Linear Data Structure?


 

Non Linear Data Structure
A non linear data structure where data element or items arranged hierarchy way or non linear way. Here nodes or data elements we cannot always traverse through sequentially. This type of data structure is complex. Non linear data structure doesn't use pointer.

Example - Tree, Graph.

Advantages
1. Memory utilization is efficient.

Disadvantages
1. Difficult to implement.

What is Linear Data Structure?


 

Linear Data Structure
A linear data structure where data element or items arranged one after another or linear sequence and data elements or items can traversed in a single run. Here nodes or data elements we traverse through sequentially. This type of data structure is simpler and easy to implement. Linear data structure use pointer.

Example - Array, Stack, Queue, Linked List.

Advantages
1. Very easy to implement and very easy to understand.
2. Algorithm concept and programming is easy.

Disadvantages
1. Wastage of memory area.
2. Execution time is high.

Factorial of a number using function in CPP


Code :
#include<iostream>
#include<conio.h>
using namespace std;
int factorial(int);

int main(){
    int number;
    cout<<"Enter a number: ";
    cin>>number;
    factorial(number);
}

int factorial(int x) {
    int fact = 1, i;
    for(i=1;i<=x;i++) {
    fact = fact *i;
    }
 cout<<"Factorial is: "<<fact;
 return 0;
   
}


Output : 
Enter a number: 3
Factorial is: 6

IDE Used To Test This Code : DEV C++

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Simple Function calling program in CPP


Code :
#include<iostream>
#include<conio.h>
using namespace std;

void function() {
    //function body declaration
    cout<<"Hello World."<<endl;
}

int main() {
    //function call 3 times
    function();
    function();
    function();
    return 0;
}


Output :
Hello World.
Hello World.
Hello World.
  
IDE Used To Test This Code : DEV C++.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.