SAP Abap programming & SAP Modules SD,MM,HR,PP...
Search this site
Saturday, April 2, 2011
Read and write file in SAP ABAP
Function module
3)Step 3 Create interface parameters
4)Step 4
5)Step 5 Create table parameter
6)Step 6 Create exceptions
7)step 7 Source code in function module
Friday, April 1, 2011
Subroutines
Include Programs
Using Include Programs
***INCLUDE ZTEST_INC.
WRITE: / 'Program started date:', SY-DATUM.
We can then include this program in any other ABAP program to display a standard list header.
PROGRAM ZTEST.
INCLUDE ZTEST_INC.
-------------------------------
The result:
Program started
date: 04/01/2011
Include Programs
Using Include Programs
***INCLUDE ZTEST_INC.
WRITE: / 'Program started date:', SY-DATUM.
We can then include this program in any other ABAP program to display a standard list header.
PROGRAM ZTEST.
INCLUDE ZTEST_INC.
-------------------------------
The result:
Program started
date: 04/01/2011
Macros
REPORT demo_mod_tech_macros.
DATA: result TYPE i,
n1 TYPE i VALUE 5,
n2 TYPE i VALUE 6.
DEFINE operation.
result = &1 &2 &3.
output &1 &2 &3 result.
END-OF-DEFINITION.
DEFINE output.
write: / 'The result of &1 &2 &3 is', &4.
END-OF-DEFINITION.
operation 4 + 3.
operation 2 ** 7.
operation n2 - n1.
This produces the following output:
The result of 4 + 3 is 7
The result of 2 ** 7 is 128
The result of N2 - N1 is 1
In this example, the two macros operation and output are defined. output is nested in operation. operation is called three times with different parameters. Note how the placeholders &1, &2,... are replaced in the macros.
Check a string is number or not
REPORT Z_TEST.
LW_CREDIT_TEMP TYPE BSEG-DMBTR.
PARAMETER: p_input TYPE char14.
FIND ALL OCCURRENCES OF ',' IN p_input MATCH COUNT count.
Write: ' occurance of the , = ', count.
IF p_input CO '1234567890, ' and count <= 1.
WRITE: /'Yes, valid', p_input.
write: lw_credit_temp.
Else.
WRITE: /'invalid', p_input.
write: lw_credit_temp.
ENDIF.