Friday, September 11, 2020

Types of Views and explain in SAP ABAP.

What are the types of Views and explain about them?



View in SAP ABAP.

Ans: - Views are the virtual/imaginary tables. It does not contain the data permanently.

View contains the data at Run time only.

1) Database View: - 

It is used to combine the multiple tabled data by joining them. It can be used to extract the data in the programs.

2) Maintenance View: - 

It is used to maintain multiple tables data using the T-code SM30 (TMG).

3) Help View: 

- It is used in the selection method in an Elementary Search Help to provide the

list of possible entries from the multiple tables.

4) Projection View

: - It is used to HIDE the unwanted fields of the table. It can be

defined using one table only.

Thursday, September 10, 2020

Explain about Constants, Text Symbols, Selection Texts and Variants in SAP ABAP.

 Explain about Constants, Text Symbols, Selection Texts and Variants?



Constants:

-They are used to avoid the hard coded text in the programs and improve the reusability in the program. The ABAP statement ‘CONSTANTS’ is used to define constants.

Text Symbols: 

- The ABAP Statement TEXT followed by the symbol number (XXX) can used to define or call the text symbol.

Selection texts:

 - They are used to maintain the Field labels (descriptions) of the input fields of the selection screen. The T-code SE63 is used to translate the text elements.

Variants: 

- They are used to save the input data for further execution in the selection screen. They can also be used to avoid the data entry errors & schedule a program in the back ground.

Some Keywords in SAP ABAP.

Some Keywords in SAP ABAP.



Some Keywords in SAP ABAP.

Ans: 

Append:

It is the keyword used to append record by record from work area to at last record of the

internal table. Syntax: APPEND <gs_dbtab> TO <gt_dbtab>.

Insert:

This statement is used to insert a new record at any position of an internal table.

Syntax : INSERT <gs_final> INDEX <n>? SY-TABIX.

Collect:

It also used like an APPEND statement. This statement is used to compare character/string

fields data & summarizes the numeric field data. It is used to display sub-totals .

Syntax : COLLECT <gs_source> INTO <gs_collect>.

Lines:

It is the keyword which returns no of records available in the internal table.

Occurs:

It is the keyword; it allocates 8KB of memory for the internal table by default. If the data in the

Internal table exceeds 8KB then it will bring one more 8KB of memory & so on up to 2GB.

Clear: 

It clears the contents of the work area & internal table with header line ITAB[ ] & variables

Refresh: 

It clears the contents of the internal table only.

Free: 

It clears the contents of internal table along with allocated memory.

Different types of internal tables and explain about them in SAP ABAP.

What are the different types of internal tables and explain about them?



Different types of internal tables and explain about them in SAP ABAP.

Ans :- Internal Tables: - They are the intermediate tables to hold the multiple records at run time.

 There are 3 types of internal tables.

1. STANDARD Internal tables: - The standard Internal Tables are filled using the ABAP statement 'APPEND'/’INSERT’. It accepts the duplicate records. Searching of a record is Linear Search. It is the default index table. Standard internal table can be sorted explicitly.

Syntax: - DATA: <gt_dbtab> TYPE STANDARD TABLE OF <typ_dbtab/dbstr.....>.

2. SORTED Internal table: - The ABAP statement 'INSERT/APPEND' is used to fill Sorted Internal Table. It does not accept the Duplicate records. Searching of a record is Binary Search. Sorted internal table cannot be sorted explicitly. An

additional statement with UNIQUE/NON-UNIQ UE key must be used to declare Sorted Internal Tables.

Syntax :- DATA: <gt_dbtab> TYPE SORTED TABLE OF <dbtab/dbstr.....> WITH

UNIQUE/NON-UNIQUE KEY <k-f1> <k-f2>.

3. HASHED Internal tables: - They are Non Index tables. The Hashed Internal Tables holds huge amount of data than Standard & Sorted internal tables since they follow ‘Hashed Algorithm’. The ABAP statement ‘WITH UNIQUE KEY' must be used to declare Hashed Internal Tables.

It holds huge amount of data (2 GB) than standard & sorted internal tables.

Syntax:- DATA: <gt_dbtab> TYPE HASHED TABLE OF <dbtab/dbstr.....> WITH UNIQUE KEY <k-f1> <k-f2>.

Differences between Work Area and Field Symbol in SAP ABAP.

What are the differences between Work Area and Field Symbol?


Differences between Work Area and Field Symbol in SAP ABAP.

Work Area

Field Symbol

-----------

1. It is the data variable.

1. It is a Pointer.

--------------

2. The ABAP statement is DATA is used to declare

or define work areas.

2. The ABAP statement FIELD-SYMBOLS is used to declare Field symbols.

------------------

3. The ABAP statement INTO is used to process record by record through work area .

3. The ABAP statement ASSIGNING is used to assign the FIELD-SYMBOLS .

------------------

4. The ABAP statement MODIFY must be used to

modify the internal table .

4.No need to use MODIFY , Since it is a pointer .

---------------------

5. No need to specify within the Angular brackets (< >).

5. It Must be specify within the Angular brackets (< >) .

Differences between Work area and internal tables In SAP ABAP.

 Differences between Work area and internal tables?



Work area and internal tables in SAP ABAP.

1. It Holds single record at a time. Work Area

1. Holds Multiple records.Internal Tables

2. It doesn't have BODY.Work Area

2. It has BODY [].Internal Tables

3.The Record by record is processed through the work area.Work Area

3. In case of internal table with header line the record by record is processed through header line.Internal Tables

NACE transaction code in SAP ABAP.

Explain about NACE transaction code?..



Ans: - NACE: - It is used to maintain the Output types and find the form name and print

program names. If you create the output type using NACE then it will be

automatically visible in table NAST and TNAPR.

The standard program TNAPR can also be used to find the form & print program name. 

 Execute the T-code NACE.

 Select an appropriate required application. 

 Click on output button on tool bar 

 Click on position button. 

 Enter the required Output type: NEU & Press Enter button. 

 Select the font Output type (NEU). 

 Double click on processing routines folder. 

 Click on display/change icon. 

 Change processing routine details such are print program, form routine, form name etc. 

 Click on save & click on create request icon. 

 Enter short description as per the project standards. 

 Click on save icon & click on Yes button.

What are the steps involved in handling Application server in SAP ABAP.

What are the steps involved in handling Application server?



Ans :- The T-Code AL11 is used to work with the Application server.

 The below ABAP statements are used to Download/Transfer the data from an internal table into the specified file path of an application server.

1. OPEN DATASET FOR OUTPUT: This statement is used to open the required files in write mode in application server.

2. TRANSFER: This statement is used to transfer the concatenated data into the opened file.

3. CLOSE DATASET: It is used to close the opened file in the server.

 The below ABAP statements are used to Upload/Read the data from file in application server into an internal table of the program.

1. OPEN DATASET FOR INPUT: This statement is used to open files in read mode.

2. READ DATA SET: This statement is used to read record by record from the opened file in Application server.

Details about LSMW in SAP ABAP.

 LSMW in SAP ABAP.

What is LSMW?

Ans :- Legacy System Migration Workbench .

 It is the system provided tool to migrate or convert the legacy system data.

 The T-Code 'LSMW' is used to work with this tool.

 An icon export is used to download the recording into Local PC.

 An option read from file is used to generate a program using the given recording file.

What are the steps for LSMW?

Ans: There are totally 14 steps in LSMW.

1. Maintain object attributes

2. Maintain source structures

3. Maintain source fields

4. Maintain structure relations

5. Maintain field mapping conversion rules

6. Maintain fixed values, translations & user-defined routines

7. Specify files

8. Assign files

9. Read data

10. Display read data

11. Convert data

12. Display converted data

13. Create batch input session

14. Run batch input session

Differences between Session Method and Call Transaction Method in SAP ABAP.

What are the differences between Session Method and Call Transaction Method?.


Session Method and Call Transaction Method in SAP ABAP.

Ans :-

Session

Call Transaction

1. The standard Function modules 'BDC_OPEN_GROUP’, 'BDC_INSERT' and 'BDC_CLOSE_GROUP' are used to work with the session method.

1. The ABAP statement CALL TRANSACTION ….is used.

2. The data is updated in Synchronously mode (Record by Record).

2. The data is updated in both synchronous and Asynchronous modes.

3. An Error LOG File is generated by the system to handle the errors.

3. The messages/errors are manually handled explicitly using the structure BDCMSGCOLL & the function modules 'FORMAT_MESSAGE’ or 'WRITE_MESSAGE’ or the table T100.

4. Session method can process any no of transactions at a time.

4. Call Transaction can process only one transaction at a time.

5. After processing the session through SM35 only, the database is updated.

5. Immediate database updation.

6. Session method is slower.

6. Call transaction method is faster

7. We can schedule the session method in background.

7. We can’t schedule the call transaction in background.

Differences between LSMW and BDC in SAP ABAP.

What are the differences between LSMW and BDC?.


Differences between LSMW and BDC in SAP ABAP.

Ans :-

LSMW

BDC

1. It is the system provided tool.

1. It is the Utility to develop a program.

2. Doesn’t require any programming knowledge.

2. It requires programming knowledge..

3. The data can be imported in different import methods such are Batch Input Recording, BAPI and IDOC.

3. The data is processed or migrated in Batch Input Method only

4. The Field mapping is done automatically by the System.

4. The Field mapping should be done manually by passing the Flat data.

5. The T-Code LSMW is used.

5. The T-Code SM35 is used to develop BDC program

6. Mostly used for both Huge & small amount (Master) of data.

6. BDC can be used for Small amount of data only.

7. LSMW is possible for custom screens/standard with custom fields of applications.

7. BDC can be used custom screens/custom fields of application also.

Transaction Codes associated with ALE, IDOCs in SAP ABAP.

 What are the Transaction Codes associated with ALE, IDOCs?


Transaction Codes associated with ALE, IDOC.

Ans :-

T-code

Description

SALE

Basic configuration of ALE/IDOC

WE30

Maintain(create & display) IDOC’s

WE31

Maintain(create & display) Segments

WE20

Maintain partner profiles

WE21

Maintain ports in IDCO processing

WE41

Maintain process codes (Outbound system)

WE42

Maintain process codes (Inbound system)

WE81

Maintain Logical Message Types

WE82

Assign message type to IDOC type

NACE

Maintain output type.

 Most of the T-codes which are related to ALE/IDOC starts with WE* & BD*.

 The T-code WE30 is used to create & display the different types of IDOC’s such as Basic

IDOC & Extended IDOC.

 The T-Code WE05/WE02 is used to list out the IDOC.

 The T-code WE19 is used to check the IDOC.

How to check the IDOCs In SAP ABAP.

How to check the IDOCs?


How to check the IDOCs.

WE19 is the T-code to check the IDOC’s.

1. Execute WE02/WE05

2. Provide the Message type: CREMAS (Logical Sys), Partner no: LS810 & Click on Execute

3. After we get the status code 03, if we want to know the IDOC is reached to destination or

not then we execute RBDMOIND standard program.

4. The status of an IDOC (3) use in Green color (turn 10 to12) means it is delivered

Successfully. Yellow traffic light indicates/the status code remains same, IDOC is in

Progress or in the Transaction RFC & Red traffic light/the status code turns 10 to 11

indicates the Error/the IDOC is damaged.

5. Expand the Data Records folder & click on each segment to see the data to be distributed.

What are the Transaction Codes/Reports to send/generate and receive the data to an IDOCs?

Transaction Codes/Reports to send/generate and receive the data to an IDOCs in SAP ABAP.


Transaction Codes/Reports to send/generate and receive the data to an IDOCs in SAP ABAP.

Ans :-

T-code

Description

BD10

Send Material

BD11

Get Material

BD12

Send Customer

BD13

Get Customer

BD14

Send Vendor

BD15

Get Vendor

BD16

Send Cost center

BD17

Get Cost center

BD87

Reprocess IDOC

What are Authorization Objects in SAP ABAP.

Authorization Objects in SAP ABAP. 



Authorization Objects in SAP ABAP.

 These are used to protect/prevent user access to the data & T-codes/Tables.
 The authorization objects are maintained by BASIS consultants.
 The T-code: SU24 is used to find authorization objects in the system.
 The ABAP statement ‘AUTHORITY_CHECK’ or the standard Function Modules ‘AUTHORITY_CHECK*…’ are used to check the authorizations.


What are the differences between BAPI and normal BDC IN SAP ABAP

What are the differences between BAPI and normal BDC IN SAP ABAP.



Differences between BAPI and normal BDC IN SAP ABAP.

BAPI BDC BAPI is faster than BDC. BDC is relatively slower than BAPI.

BAPI’s are used to upload the data from the flat file to SAP system directly.

BDC’s are used to upload the data from file to SAP system via screens hence it is slower. No such processing options are available in BAPI. Background and Foreground processing options are available for BDC.

BAPI would generally used for small data uploads.

BDCs would be preferred for large volumes of data upload since background processing option is available. 

BAPI never cause to terminate the program. Whenever an error occurred in the BAPI, it returns those errors through Return parameter. This parameter returns exception messages or success messages to the calling program. Errors can be processed in SM35 for session method and in the batch input program for Call Transaction method.

In BAPI recording is not required

In BDC, recording is required

Deleting adjacent duplicates comparing multiple fields in SAP ABAP.

 

Deleting duplicates comparing multiple fields in SAP ABAP.



Deleting adjacent duplicates comparing multiple fields in SAP ABAP.

SORT It_itab BY fieldA fieldB fieldC .

DELETE ADJACENT DUPLICATES FROM It_itab
       COMPARING fieldA fieldB fieldC .

Monday, August 31, 2020

Event in ABAP report in SAP

ABAP Programming EVENTS in SAP.

https://sapabap100.blogspot.com/2020/08/event-in-abap-report-in-sap.html


Below are some of the events avalable within ABAP programming. 

1.LOAD-OF-PROGRAM
2.INITIALIZATION
3.AT SELECTION SCREEN OUTPUT

LOOP AT SCREEN.
  IF SCREEN-name = 'P_FIELd1'.
    SCREEN-INTENSIFIED = '1'.
    MODIFY SCREEN.
    CONTINUE.
  ENDIF.
ENDLOOP.

4.AT SELECTION-SCREEN.

5.AT SELECTION-SCREEN ON
<parameter1>
AT SELECTION-SCREEN ON Block <block1>
AT SELECTION-SCREEN ON HELP-REQUEST for <parameter1> (i.e. When press F1)
AT SELECTION-SCREEN ON VALUE-REQUEST for <parameter1> (i.e. When press F4)
AT SELECTION-SCREEN ON RADIOBUTTON for <parameter1> (i.e. When press F4)

AT SELECTION-SCREEN ON P_FIELD1.
AT SELECTION-SCREEN ON help-request for P_FIELD1.

6.TOP-OF-PAGE
7.TOP-OF-PAGE During LINE_SELECTION
8.END-OF-PAGE
ORT demo_rep NO STANDARD PAGE HEADING

                            LINE-COUNT 0(1). 

9.START-OF-SELECTION
10.END-OF-SELECTION
   

Friday, August 28, 2020

VOFM Routine Create in SAP

 VOFM Routine Create in SAP step by step.





   Go to ->VOFM T-Code

A. Once the Menu Select as per your requirements 
B. After that you Enter any Number in between 600 to 999 this is for  Custom Developments.
C. When you  entering Pop Screen appears ask for Access Key(We have to remember that Every New Routine needs an Access Key)


D. Once the Access Key is get you can do modification.
E. After that enter the routine number ,description and insert the Access Key
F. Next new  ABAP Editor will open and required code can be copied from Standard SAP Routine and Custom Code Can be developed.
G. Next the coding is completed you  have to Activate the Routine
H. Select the Routine and Go to Edit – Activate
I. Ensure that Active check box is ticked upon Activation of the Routine.
J. Double click on the routine will enter into ABAP Editor, You  have to generate the Routine
K. Go to Program and select Generate
L.A screen pops up with the related Main Programs  and select all required main programs wherever the Routine is being called.
M. Next the Routine is Generated and Activated, You need to configure the Routine in the config.

Batch Validation COR1 in PP Module In SAP

Enhancement COR1 for Batch Validation In SAP  PP Module.



Include Name: ZXCO1U06 COR1 for Batch Validation.


IF sy-tcode =  'COR1' OR sy-tcode =  'COR2' ).
  IF header_imp-auart 'ZA02' OR header_imp-auart 'ZU02'
  OR header_imp-auart 'ZA01' OR header_imp-auart 'ZA03'
  OR header_imp-auart 'ZU01' OR header_imp-auart 'ZU10'.
*************************
    FIELD-SYMBOLS <fs_afpo1> TYPE any.
*************************
    DATA ls_afpo1 TYPE afpod.
    TYPESBEGIN OF ty_mch11,
              matnr TYPE matnr,     "Material
              charg TYPE charg_d,   "Batch No
              lvorm TYPE lvoc1,
              ersda TYPE ersda,     "Date
              END OF ty_mch11.
    TYPESBEGIN OF ty_batch11,
            charg TYPE charg_d,
            atwtb TYPE ersda,
            END OF ty_batch11.
    DATA wa_mch11 TYPE ty_mch11,
           wa_mch21 TYPE ty_mch11,
           i_mch11 TYPE STANDARD TABLE OF ty_mch11.
    DATAv_mcha1 TYPE mcha,
          class1 TYPE klah-class,
          w_batch2 TYPE clbatch,
          i_batch2 TYPE STANDARD TABLE OF clbatch,
          w_batch11 TYPE ty_batch11,
          i_batch11 TYPE STANDARD TABLE OF ty_batch11.
    DATAv_date1 TYPE sy-datum.
    DATArec1 TYPE i.
    DATAv_count1 TYPE i.   " counter for loop
    ASSIGN ('(SAPLCOKO)AFPOD'TO <fs_afpo1>.
    ls_afpo1 <fs_afpo1>.
    SELECT matnr
           charg
           lvorm
           ersda
           
           charg
           lvorm
           ersda
           FROM mch1 INTO TABLE i_mch11
           
           WHERE matnr header_imp-plnbez.
    DATA:lv_lvorm1 TYPE lvoc1.
    CLEAR:lv_lvorm1.
    SELECT SINGLE matnr
                  charg
                  lvorm
                  ersda
                  
                  charg
                  lvorm
                  ersda
                  FROM mch1 INTO wa_mch21
                  
                  WHERE matnr header_imp-plnbez
                    
                    AND charg ls_afpo1-charg.
    IF wa_mch21-lvorm 'X'.
      MESSAGE  e005(zbtch_msgWITH ls_afpo1-charg header_imp-plnbez.
    ENDIF.
  ENDIF.
ENDIF.