HI ABAP EXPERTS

in a include i am getting a syntax error  as below
"DD03P is not defined in the ABAP Dictionary as a table, projection view or database view." but DD03P  is a structure
so, i hve checked by declaring  the DD03P  in the tables wa  like this TABLES : DD03P.
even then the same error is coming how can i eliminate the error .
it is used in the select statement like this
SELECT SINGLE * FROM DD03P                        
               WHERE TABNAME = AREA_NM.   
IF SY-SUBRC = 0.                                  
          MOVE 'S' TO AREA_USED.     
          EXIT.
Message was edited by:
        jai
Message was edited by:
        jai

hi Jai,
Before that...
delcare it on top in this way ..
i.e,
TABLES : DD03P.
Reward if it helps,
Regards,
Santosh

Similar Messages

  • HR ABAP Expert - PCL2-CLUSTD

    I can easily read PCL2 data by using "IMPORT blah blah.... FROM DATABASE PCL2(RU)".
    Somehow, someway, SAP takes what is strored in PCL2-CLUSTD and converts it into meaningful variables via the "IMPORT ... FROM DATABASE" syntax.
    [[I want to see the code SAP uses to do this]]
    Actually, what I really want is to take normal data say, employee name and say payroll dollars for a given period and then convert it back into PCL2-CLUSTD without updating PCL2.
    IDEAS?

    hi goldstein,
    pls refer the below liks once.u may get clear idea about wat u want.
    sap.ionelburlacu.ro/abap/sap2/SAP_Reports.html - 26k
    www.experts-exchange.com/Database/Software/HR_HCM/SAP/Q_23189513.html - 112k -
    www.sap-img.com/hr021.htm - 8k -
    www.sapbrainsonline.com/REFERENCES/StandardReports/SAP_standard_reports_list.html - 39k
    Best PDF file to learn HR Programming
    http://www.melayu.plus.com/SAP%20HR%20Programming.pdf
    HR deals with the INFOTYPES which are similar to Tables in General ABAP.
    There are different ways of fetching data from these infotypes.
    There are different areas in HR LIKE Personal Admn, Orgn Management, Benefits, Time amangement, Event Management, Payroll etc
    Infotypes for these areas are different from one another area.
    storing of records data in each type of area is different
    LDBS like PNP are used in HR programing.
    Instead of Select.. we use some ROUTINES and PROVIDE..ENDPROVIDE.. etc
    and in the case of Pay roll we use Clusters and we Import and Export them for data fetching.
    On the whole Normal ABAP is different from HR abap.
    For Personal Admn the Infotypes start with PA0000 to PA1999
    Time Related Infotypes start with PA2000 to PA2999.
    Orgn related Infotypes start with HRP1000 to HRP1999.
    All custom developed infotypes stsrat with PA9000 onwards.
    In payroll processing we use Clusters like PCL1,2,3 and 4.
    Instead of Select query we use PROVIDE and ENDPROVIDE..
    You have to assign a Logical Database in the attributes PNP.
    Go through the SAp doc for HR programming and start doing.
    http://www.sapdevelopment.co.uk/hr/hrhome.htm
    See:
    http://help.sap.com/saphelp_46c/helpdata/en/4f/d5268a575e11d189270000e8322f96/content.htm
    sites regarding hr-abap:
    http://www.sapdevelopment.co.uk/hr/hrhome.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PAPA/PAPA.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PAPD/PAPD.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PYINT/PYINT_BASICS.pdf
    http://www.atomhr.com/training/Technical_Topics_in_HR.htm
    http://www.planetsap.com/hr_abap_main_page.htm
    You can see some Standard Program examples in this one ...
    http://www.sapdevelopment.co.uk/programs/programshr.htm
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci1030179,00.html?Offer=SAlgwn12604#Certification
    http://www.erpgenie.com/faq/hr.htm.
    http://www.planetsap.com/hr_abap_main_page.htm
    http://www.sapbrain.com/TUTORIALS/FUNCTIONAL/HR_tutorial.html
    These are the FAQ's that might helps you as well.
    http://www.sap-img.com/human/hr-faq.htm
    http://www.sapgenie.com/faq/hr.htm
    http://www.planetsap.com/hr_abap_main_page.htm
    http://www.atomhr.com/library_full.htm
    HR Long texts Upload
    Look at the below link
    HR
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PAPA/PAPA.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PAPD/PAPD.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PYINT/PYINT_BASICS.pdf
    http://www.atomhr.com/training/Technical_Topics_in_HR.htm
    http://www.planetsap.com/hr_abap_main_page.htm
    you can see some Standard Program examples in this one..
    http://www.sapdevelopment.co.uk/programs/programshr.htm
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci1030179,00.html?Offer=SAlgwn12604#Certification
    These are the FAQ's that might helps you
    http://www.sap-img.com/human/hr-faq.htm
    http://www.sapgenie.com/faq/hr.htm
    http://www.erpgenie.com/faq/hr.htm.
    www.sap-img.com
    http://www.planetsap.com/hr_abap_main_page.htm
    http://www.sapbrain.com/TUTORIALS/FUNCTIONAL/HR_tutorial.html
    http://www.sapfans.com/forums/viewtopic.php?p=498530&sid=d7ec5866e3fb26880da129de45ce79de
    http://www.sapcookbook.com/preview_hr_questions.htm
    http://www.atomhr.com/library_full.htm
    http://www.sapdevelopment.co.uk/hr/hrhome.htm
    http://www.planetsap.com/hr_abap_main_page.htm
    http://expertanswercenter.techtarget.com/eac/knowledgebaseAnswer/0,295199,sid63_gci983590,00.html
    http://www.allsaplinks.com/HRmaterial.html
    http://www.allsaplinks.com/timemanagement.html
    http://www.allsaplinks.com/payrollcompletefunctional.html
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/HRINF/HRINF.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PYXXFORM/PYINT_FORMBUILDER.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCBMTWFMPA/BCBMTWFMPA.pdfhttp://help.sap.com/printdocu/core/Print46c/en/data/pdf/MYSAP/SR_HR.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PAPA/PAPA.pdf
    http://www.planetsap.com/hr_abap_main_page.htm
    Regards,
    karthik
    <REMOVED BY MODERATOR>
    Few notes are below:
    InfoSets in the HR Application
    You can use SAP Query in HR to report on HR data. Queries are maintained as described in Creating Queries. The special features of queries created for HR are described in Maintaining Queries in the Human Resources Application. The maintenance procedure for HR InfoSets differs from the described procedure inasmuch as HR data fields are grouped together in infotypes.
    InfoSet management in SAP Query is also used for InfoSet Query. For further information, see Functions for Managing InfoSets.
    If you want to create InfoSets for HR, you can use logical databases PNP, PNPCE, PAP, and PCH (see HR Logical Databases). The database you must use to create your InfoSet depends on the component in which the data you want to report on is stored.
    The reports you can execute using InfoSets based on logical databases PNP (or PNPCE) or PCH are similar, but differ in that they can select different objects. The following table describes the connection between the logical database, and the infotypes you can include in an InfoSet. It also provides you with one or two examples of reports that you can execute using the appropriate InfoSets.
    Logical database PNP/PNPCE* PCH PAP
    Selection of Persons Objects from Personnel Planning Applicants
    Infotypes that can be included in the InfoSet Infotypes for· Personnel Administration (0000-0999) · Time Management (2000-2999) · Payroll infotypes · Infotypes for Personnel Planning objects that can be related to persons If the object type is specified:· Infotypes for the object type · Infotypes for objects that can be related to the specified object typeIf the object type is not specified:· All infotypes · Infotypes for Recruitment (4000-4999)· Some infotypes for Personnel Administration (such as 0001 and 0002)
    · Customer infotypes
    Reporting examples · Selection of all persons who participated in a specific business event, output of prices for reserved business events · Selection of all persons assigned to a specific personnel area, output of qualifications held by these persons · Selection of all business events held in London in March, output of all persons who participated in these business events · Selection of all positions assigned to a specific organizational unit, output of all persons assigned to the positions · Selection of all applicants hired last year to work on special projects, output of addresses for the applicants selected
    Logical database PNPCE (PNP Concurrent Employment) functions just like logical database PNP. The procedure for creating InfoSets is also the same. It only becomes significant if you work with Concurrent Employment.
    Creating InfoSets
    The maintenance procedure for HR InfoSets differs from the procedure described so far in this section inasmuch as HR data fields are grouped together in infotypes. To set up an InfoSet for the HR application, proceed as follows:
    1. On the initial screen for maintaining InfoSets, enter a name for the InfoSet and choose Create.
    2. On the next screen, enter a name for the InfoSet and select one of the HR logical databases in accordance with your reporting requirements.
    Customer infotypes can be created on all HR logical databases. In each individual case, therefore, you must decide which database to select so that you can report on customer infotypes.
    This screen enables you to enter an authorization group. All of the queries that are subsequently created using this InfoSet can only be executed by persons who have this authorization group.
    3. Choose .
    This takes you to the Infotype Selection for InfoSet .
    Fill data object
    Export record
    EXPORT TABLE1 TO DATABASE PCLn (xy) ID xy-KEY.
    IF SY-SUBRC EQ 0.
    WRITE: / 'Update successful'.
    ENDIF.
    Export Cluster data using the macro
    . Export data using macro RP-EXP-Cn-xy.
    • When data records are exported using macro, they are not written to the database but to a main memory buffer.
    • To save data, use the PREPARE_UPDATE routine with the USING parameter 'V'.
    REPORT ZHREXPRT.
    *Buffer definition
    INCLUDE RPPPXD00. INCLUDE RPPPXM00. "Buffer management
    DATA: BEGIN OF COMMON PART 'BUFFER'.
    INCLUDE RPPPXD10.
    DATA: END OF COMMON PART 'BUFFER'.
    RP-EXP-Cn-xy.
    IF SY-SUBRC EQ 0.
    PERFORM PREPARE_UPDATE USING ‘V’.
    ENDIF.
    Importing Cluster Data using standard include
    • The IMPORT command causes data objects with the specified key values to be read from PCLn.
    • If the import is successful, SY-SUBRC is 0; if not, it is 4.
    REPORT RPIMPORT.
    TABLES: PCLn.
    INCLUDE RPCnxxy0. "Cluster definition
    Fill cluster Key
    Import record
    IMPORT TABLE1 FROM DATABASE PCLn (xy) ID xy-KEY.
    IF SY-SUBRC EQ 0.
    Display data object
    ENDIF.
    Importing Cluster data using Macro
    • Import data using macro RP-IMP-Cn-xy.
    • Check return code SY-SUBRC. If 0, it is successful. If 4, error.
    • Need include buffer management routines RPPPXM00
    Example
    REPORT RPIMPORT.
    *Buffer definition
    INCLUDE RPPPXD00.
    DATA: BEGIN OF COMMON PART 'BUFFER'.
    INCLUDE RPPPXD10.
    DATA: END OF COMMON PART 'BUFFER'.
    *Import data to buffer
    RP-IMP-Cn-xy.
    *Buffer management routines
    INCLUDE RPPPXM00.
    Cluster Authorization
    Simple EXPORT/IMPORT statement does not check for cluster authorization.
    Use EXPORT/IMPORT via buffer, the buffer management routines check for cluster
    authorization.
    How to read the Payroll Results
    • Payroll results are stored in cluster Rn of PCL2 as field string and internal tables.
    n - Country identifier.
    • Standard reports read the results from cluster Rn. Report RPCLSTRn lists all payroll results;
    • Report RPCEDTn0 lists the results on a payroll form.
    • The cluster definition of payroll results is stored in two INLCUDE reports:
    include: rpc2rx09. "Definition Cluster Ru (I)
    include: rpc2ruu0.”Definition Cluster Ru (II)
    o This first INCLUDE defines the country-independent part; the second
    INCLUDE defines the country-specific part (US).
    o The cluster key is stored in the field string RX-KEY.
    • All the field string and internal tables stored in PCL2 are defined in the ABAP/4 dictionary. This allows you to use the same structures in different definitions and nonetheless maintain data consistency.
    • The structures for cluster definition comply with the name convention PCnnn
    Unfortunately 'nnn' can be any set of alphanumeric characters.
    *Key definition
    DATA: BEGIN OF RX-KEY.
    INCLUDE STRUCTURE PC200.
    DATA: END OF RX-KEY.
    *Payroll directory
    DATA: BEGIN OF RGDIR OCCURS 100.
    INCLUDE STRUCTURE PC261.
    DATA: END OF RGDIR.
    • How to retrieve Payroll results
    o To read payroll results, you need two keys: pernr and seqno
    o You can get SEQNO by importing the cluster directory (CD) first.
    Example
    REPORT ZHRIMPRT.
    TABLES: PERNR, PCL1, PCL2.
    INLCUDE: rpc2cd09. "Definition cluster CD
    PARAMETERS: PERSON LIKE PERNR-PERNR.
    RP-INIT-BUFFER.
    *Import cluster Directory
    CD-KEY-PERNR = PERNR-PERNR.
    RP-IMP-C2-CU.
    CHECK SY-SUBRC = 0.
    LOOP AT RGDIR.
    RX-KEY-PERNR = PERSON.
    UNPACK RGDIR-SEQNR TO RX-KEY-SEQNO.
    *Import data from PCL2
    RP-IMP-C2-RU.
    ENDLOOP.
    o Reading records from the Payroll directory
    after importing the payroll directory, which record to read is up to the programmer
    o Each payroll result has a status.
    'P' - previous result
    'A' - current (actual) result
    'O' - old result
    o Function module CD_EVALUATION_PERIODS will restore the payroll result status for a period when that payroll is initially run. It also will select all the relevant periods to be evaluated.
    Example
    Call function 'CD_EVALUATION_PERIODS'
    exporting
    bonus_date = ref_periods-bondt
    inper_modif = pn-permo
    inper = ref_periods-inper
    pay_type = ref_periods-payty
    pay_ident = ref_periods-payid
    tables
    rgdir = rgdir
    evpdir = evp
    iabkrs = pnpabkrs
    exceptions
    no_record_found = 1.
    Authorization Check
    Authorization for Persons
    • In the authorization check for persons, the system determines whether the user has the authorizations required for the organizational features of the employees selected with GET PERNR.
    • Recruits for which the user has no authorization are skipped and appear in a list at the end of the report.
    • Authorization object: 'HR: Master data'
    Authorization for Data
    • In the authorization check for data, the system determines whether the user is authorized to read the infotypes specified in the report.
    • If the authorization for a particular infotype is missing, the evaluation is terminated and an error message is displayed.
    Deactivating the Authorization Check
    • In certain reports, it may be useful to deactivate the authorization check in order to improve performance. (E.g. when running payroll)
    • You can store this information in the object 'HR: Reporting'.
    2.1.6 Concepts of Macros (Import/Export etc.)
    Macros:
    Introduction
    Programs that process the cluster data (for example, RX) do not access the cluster independently. The data is accessed using a defined interface created with macros.
    Macro contains some part of source code, which it will be useful for number of applications. Macro is module, which is stored
    Naming Conventions of Macro:
    RP-aaa-bb-cc
    • aaa is the type of Macro. It takes two values
    o IMP Import Macro
    o EXP Export Macro
    • bb is the Database table where the data is saved:
    o C1 Database object PCL1
    o C2 Database object PCL2
    o C3 Database object PCL3
    o C4 Database object PCL4
    • Cc is the cluster, it may take
    o RX Cluster object RX
    o RD Cluster object RD
    o B2 Cluster object B2 and so on.
    Defining and Calling the Macros
    Defining:
    There are two options for defining the Macros
    • Macros are defined using the ABAP Commands DEFINE…. END-OF-DEFINITION. A macro can be used within a report or within include. If a macro is used in a report, and the macro is defined in include with the DEFINE command, include must be integrated.
    • Macros can also be defined as RMAC macros. The source code of these modules is stored in the function section of the control table TRMAC. The coding is grouped under a specific name in the table key.
    According to conventions, the first two letters of the name must stand for the application. The rest of the name is freely definable.
    Difference between the two methods is:
    • If a macro is changed, each report using this macro is automatically regenerated when it is executed.
    • When you change a RMAC macro in the table TRMAC, the reports that use this macro are not regenerated automatically. You must regenerate them manually.
    Standard HR Macros
    o The macro RP-PROVIDE-FROM-FRST retrieves the first (start) data record, which is valid in the data selection period.
    o The macro RP-PROVIDE-FROM-LAST retrieves the last (latest) data record, which is valid in the data selection period.
    o The macro RP-READ-INFOTYPE retrieves the data record(s), which is valid in the data selection period.
    How to check whether the macro operation is successful or not
    For every macro, whether the operation was successful or not will be checked with
    PNP-SW-FOUND.
    If PNP-SW-FOUND = 1, then the operation is successful.
    Where exactly the Macrocode is stored
    The program code pertaining to this macro is stored in the control table RMAC
    Guidelines for how and when to use the Standard Macros
    o RP_PROVIDE_FROM_FRST
    Use macro RP_PROVIDE_FROM_FRST in programs for the logical databases PNP and PAP where the first data record for a period (can be a subtype) is read from an infotype table. The infotype table has been filled earlier (for example, with GET PERNR or RP_READ_INFOTYPE). This macro is only helpful if the infotype has time constraint 1 or 2.
    Prerequisites
    • The validity begin date of the time period must be before or the same as the validity end date.
    • Validity start and end dates are correct (preferably of the type DATE).
    • The infotype table is sorted in ascending order. Otherwise, you would receive the first fitting table entry that might not necessarily correspond to the first time entry.
    Features
    The first entry for a specified period is placed in the table header entry from an internal infotype table.
    Parameters
    RP_PROVIDE_FROM_FRST inftytab subty beg end
    IN: 1) Name of the internal table
    2) Subtype required or SPACE if no subtype is being specified
    3) Validity start date of the time interval
    4) Validity end date of the time interval
    OUT: 1) PNP-SW-FOUND: has the value 0 if there is no matching entry in the infotype table in the given time period. Otherwise it has the value 1.
    2) The matching table header entry if PNP-SW-FOUND = 1 or
    the initial table header entry if PNP-SW-FOUND = 0
    Example
    (RP_PROVIDE_FROM_FRST inftytab subty beg end)
    RP_PROVIDE_FROM_FIRST P0021 '1' PN-BEGDA PN-ENDDA.
    IF PNP-SW-FOUND EQ '1'.
    ENDIF.
    or
    RP_PROVIDE_FROM_FRST P0001 SPACE PN-BEGDA PN-ENDDA.
    IF PNP-SW-FOUND EQ '0'.
    WRITE: / 'Error: Org. assignment is missing' REJECT.
    ENDIF.
    o RP_PROVIDE_FROM_LAST
    You use macro RP_PROVIDE_FROM_LAST in programs for the logical databases PNP and PAP where the last data record for a period (can be a subtype) is read from an infotype table. The infotype table has been filled earlier (for example, with GET PERNR or RP_READ_INFOTYPE). This macro is only helpful if the infotype (or subtype) has time constraint 1 or 2.
    Prerequisites
    • The validity begin date of the time period must be before or the same as the validity end date.
    • Validity start and end dates are correct (preferably of the type DATE).
    • The infotype table is sorted in ascending order. Otherwise, you would receive the last fitting table entry that might not necessarily correspond to the last time entry.
    Features
    The macro RP_PROVIDE_FROM_LAST makes sure that the last entry for a specified period is placed in the table header entry of the report output list.
    Parameters
    RP_PROVIDE_FROM_LAST inftytab subty beg end
    IN: 1) Name of the internal table
    2) Subtype required or SPACE if no subtype is being specified
    3) Validity begin date of the time interval
    4) Validity end date of the time interval
    OUT: 1) PNP-SW-FOUND: has the value 0 if there is no matching entry in the infotype table in the given time period. Otherwise it has the value 1.
    2) The matching table header entry if PNP-SW-FOUND = 1 or
    the cleared table header entry if PNP-SW-FOUND = 0
    Example:
    RP_PROVIDE_FROM_LAST P0021 '1' PN-BEGDA PN-ENDDA.
    IF PNP-SW-FOUND EQ '1'.
    ENDIF.
    OR
    RP_PROVIDE_FROM_LAST P0001 SPACE PN-BEGDA PN-ENDDA.
    IF PNP-SW-FOUND EQ '0'.
    WRITE: / 'Error: Org. assignment is missing'. REJECT.
    ENDIF.
    • RP_READ_INFOTYPE
    You can use the macro in all programs at any point. You can also use it in function modules. In database PNP, an infotype is usually read with GET PERNR. Using macro RP_READ_INFOTYPE is an exception.
    You can also use the function module HR_READ_INFOTYPE. For information on how to use the function module, see the documentation on Function Modules.
    Prerequisites
    • The validity begin date of the time period must be before or the same as the validity end date.
    • Validity begin and end are correct date specifications (preferably of the type DATE).
    • The infotype table must match the infotype number.
    • The program using the macro must contain the include DBPNPMAC.
    Features
    The macro RP_READ_INFOTYPE makes sure that all data records for a person for the specified period are placed in an internal infotype table.
    Parameters
    RP_READ_INFOTYPE pernr infty inftytab beg end
    IN: 1) Personnel number of the person requested
    2) Infotype number of the required infotype
    3) Name of the internal infotype table
    4) Validity start date of the time interval
    5) Validity end date of the time interval
    OUT: 1) PNP-SW-FOUND = 0, if there is no matching record in the dataset
    PNP-SW-FOUND = 1, if there is no matching record in the dataset
    2) PNP-SW-AUTH-SKIPPED-RECORD = 0, if the HR authorization check has not retained any records due to incorrect authorizations.
    PNP-SW-AUTH-SKIPPED-RECORD = 1 , if the HR authorization check has retained at least one record due to lack of authorization
    3) Internal infotype table, containing all matching records for which the user is authorized (this table can also be empty).
    Example
    (RP_READ_INFOTYPE pernr infty inftytab beg end)
    INFOTYPES: 0001.
    RP-LOWDATE-HIGHDATE.
    DATA: PERNR LIKE P0001-PERNR.
    DATA: BEGDA LIKE P0001-BEGDA, ENDDA LIKE P0001-ENDDA.
    PERNR = '12345678'.
    BEGDA = LOW-DATE + 15
    ENDDA = HIGH-DATE - 5.
    RP-READ-INFOTYPE PERNR 0001 P0001 BEGDA ENDDA.
    IF PNP-SW-AUT-SKIPPED-RECORD EQ '1'.
    WRITE: / 'Insufficient authorization'. STOP.
    ENDIF.
    IF PNP-SW-FOUND EQ '0'.
    WRITE: / 'Infotype 0001 missing'. STOP.
    ENDIF.
    2.1.7 Retrieval of data using LDBs (PNP/PAP/APP/PCH) without LDBs.
    Logical database
    A logical database is a special ABAP/4 program which combines the contents of certain database tables. Using logical databases facilitates the process of reading database tables.
    HR Logical Database is PNP
    Main Functions of the logical database PNP:
    • Standard Selection screen
    • Data Retrieval
    • Authorization check
    To use logical database PNP in your program, specify in your program attributes.
    Standard Selection Screen
    • Date selection
    Date selection delimits the time period for which data is evaluated. GET PERNR retrieves all records of the relevant infotypes from the database. When you enter a date selection period, the PROVIDE loop retrieves the infotype records whose validity period overlaps with at least one day of this period.
    • Person selection
    Person selection is the 'true' selection of choosing a group of employees for whom the report is to run.
    • Sorting Data
    • The standard sort sequence lists personnel numbers in ascending order.
    • SORT function allows you to sort the report data otherwise. All the sorting fields are from infotype 0001.
    • Report Class
    • You can suppress input fields, which are not used on the selection screen by assigning a report class to your program.
    • If SAP standard delivered report classes do not satisfy your requirements, you can create your own report class through the IMG.
    Data Retrieval from LDB
    1. Create data structures for infotypes.
    INFOTYPES: 0001, "ORG ASSIGNMENT
    0002, "PERSONAL DATA
    0008. "BASIC PAY
    2. Fill data structures with the infotype records.
    Start-of-selection.
    GET PERNR.
    End-0f-selection.
    Read Master Data
    • Infotype structures (after GET PERNR) are internal tables loaded with data.
    • The infotype records (selected within the period) are processed sequentially by the PROVIDE - ENDPROVIDE loop.
    GET PERNR.
    PROVIDE * FROM Pnnnn BETWEEN PN/BEGDA AND PN/ENDDA
    If Pnnnn-XXXX = ' '. write:/ Pnnnn-XXXX. Endif.
    ENDPROVIDE.
    • Period-Related Data
    All infotype records are time stamped.
    IT0006 (Address infotype)
    01/01/1990 12/31/9999 present
    Which record to be read depends on the date selection period specified on the
    selection screen. PN/BEGDA PN/ENDDA.
    • Current Data
    IT0006 Address - 01/01/1990 12/31/9999 present
    RP-PROVIDE-FROM-LAST retrieves the record, which is valid in the data selection period.
    For example, pn/begda = '19990931' pn/endda = '99991231'
    IT0006 subtype 1 is resident address
    RP-PROVIDE-FROM-LAST P0006 1 PN/BEGDA PN/ENDDA.
    2.2 Personnel Administration (PA)
    PA involves administrating employee data, commonly referred to Master Data. Master Data contains all employee data used in HR processing. Master Data includes Personal (E.g. address), Organizational (Position description), Benefits (Insurance, Pension), Time & Payroll.
    Master Data is stored in Infotypes. Infotypes are tables (for user Data entry screen) that contain logically related employee data. Data can be stored for specific periods, which includes current and historical.
    Components of PA:
    Personnel Area: represents a division of a company code into subunits. It is an organizational entity representing an area within an organization defined by specific aspects of personnel administration, time management and payroll. Personnel areas are subdivided into personnel subareas. Personnel area is specific to HR and is a four character alphanumeric identification. E.g. Personnel area 100 is for employees in Karnataka, 200 is for Chennai.
    Personnel Subarea: is a further subdivision of Personnel area. It may represent geographical locations. Functions include:
    1. Set groupings for Time Management, so that work schedules, substitution and absence and leave types can be setup for individual personnel subareas.
    2. Generate default pay scale type and area for an employee's basic pay.
    3. Define public holiday calendar.
    Employee Groups: divides or groups employees into various categories. E.g. Active employees, Retired employees, Contractors Employee groups are used to generate default values for payroll accounting area and basic pay.
    Employee Subgroups: are further differentiated within the employee group. E.g. Salaried employees, Hourly employees, unionized employees, Executives The employee subgroup grouping for the payroll rule allows you to define different payroll procedures for different employee subgroups. For e.g. you can specify whether an employee's pay should be determined on hourly or monthly basis. The employee subgroup grouping for the work schedule defines the validity of work schedule, and the attendance or absence quota type determines the validity of time quotas.
    Here a Data Model
    2.2.1 Importance of Dates and periods in payroll
    Here is a simple ABAP example of reading DATE types stored in infotype 0041.
    There can be a maximum of 12 dates stored in this infotype. Here is an example of an infotype 0041 record:
    The date types are stored in PA0041-DAR01, PA0041-DAR02, etc.
    In the example above, PA0041-DAR01 is “01”, PA0041-DAR02 is “09”.
    The dates themselves are stored in PA0041-DAT01, PA0041-DAT02, etc
    To read through this in ABAP, the easiest way is to use the DO VARYING statement. Here is a simple demonstration ABAP:
    Note: to print the text of the date type, e.g. “Leave year entry” select from table T548T.
    REPORT ZDATES1.
    TABLES: PERNR.
    DATA: BEGIN OF MYDATES,
    DAR LIKE P0041-DAR01,
    DAT LIKE P0041-DAT01,
    END OF MYDATES.
    INFOTYPES 0041.
    GET PERNR.
    WRITE: PERNR-PERNR, PERNR-ENAME. "Show employee number and name
    RP-PROVIDE-FROM-LAST P0041 SPACE PN-BEGDA PN-ENDDA.
    IF PNP-SW-FOUND = 1.
    DO 12 TIMES VARYING MYDATES
    FROM P0041-DAR01
    NEXT P0041-DAR02.
    If mydates-dar ne space.
    WRITE: /, MYDATES-DAR, MYDATES-DAT.
    Endif.
    ENDDO.
    ENDIF.
    2.2.2 Overview of date fields and period-Ex. for period/in-period/ payroll
    FOR-PERIOD: Payroll period (start and end date of a period) for which a payroll result is created or generated.
    IN-PERIOD: The payroll period (start and end date of a period) in which a payroll result is created or generated.
    Example: For every employee payroll should be run, it may be bi-weekly, monthly, or quarterly. Say it is monthly, then for an employee a payroll should be run for this month and it is run next month then. For-period start date is 01/9/2003 and end date is 30 and in-period end date will be the date it is run 15/10/2003.
    In-Period View
    An in-period view is a selection of payroll results from the payroll directory (for example, RPCLSTRD Payroll Result for Germany,) for a number of in-periods. The payroll results that were generated for the required number of payroll periods in the selected period are selected.
    Payroll Result
    For-Period View
    A for-period view is a selection of payroll results from the payroll directory (for example, RPCLSTRC Payroll Result for Switzerland) for a number of for-periods. The payroll results that were generated in the required number of payroll periods for the selected period are selected.
    Example: For-Period View / In-Period View
    Payroll
    result For-period
    view Start date
    for-per. view End date
    for-per. view In-period
    view End date
    in-per. view
    1 01/1997 01.01.1997. 31.01.1997 02/1997 28.02.1997
    2 02/1997 01.02.1997 28.02.1997 02/1997 28.02.1997
    Explanation
    The payroll result 1 for the payroll period (for-period) 01/1997 has the start date 01.01.1997 and the end date 31.01.1997. This payroll result was generated in the payroll period (in-period) 02/1997.
    2.2.3 Repetitive Structures processing
    In many master data infotypes the data is stored in the form of repetitive structures. For example infotype 0008, the structure wage type line is available for 20 times, that is an employee is eligible for having 20 different wage types based on his benefits. When evaluating repeat structures, you must ensure that all fields are entered. In the case of the Basic Pay infotype, 20 * 5 = 100 fields are queried.
    To use this method of evaluation, define a field string whose structure corresponds to the fields in one line of the repetitive structure.
    Example for understanding the repetitive Structure
    Say, for an employee you want to know that for what all wage types an employee is eligible for the latest period you mentioned on the selection screen.
    Using LDB (PNP)
    Program:
    Report zhk_repstru.
    Tables Pernr.
    Infotypes 0008.
    • You have to declare a structure same as repetitive structure in the 0008 infotype
    Data: begin of s_wagetypes,
    Wagetype type p0008-lga01,
    Amount type p0008-bet01,
    Hours type p0008-anz01,
    Unit type p0008-ein01,
    Ind type p0008-opk01,
    End of s_wagetypes,
    • Selecting data from the Data base Get pernr
    • Getting the latest record based on the selection period.
    RP_PROVIDE_FROM_LAST P0008 SPACE PN-BEGDA PN-ENDDA.
    • Now knowing for what all wage types the employee is eligible.
    Do 20 times varying s_wagetypes from p0008-lga01 next p0008-lga02. If s_wagetypes-wagetype is initial.
    o Here the data is stored sequentially, i.e., if the employee is eligible for 5 wage types then all the 5 wage types are stored sequentially in lga01 to lga05 respectively. So, if say the lga05 is initial then it is understood that, employee is eligible for only 4 wage types and from lga05 to lga20 structures will be empty so, we need not process further
    Exit.
    Else.
    Write: / s_wagetypes-wagetype,
    S_wagetypes-amount.
    Endif.
    Enddo.
    2.2.4 Guidelines to retrieve Payroll data (Mainly US/UK/Ireland)
    Before directly going into the Guidelines to retrieve Payroll Data let us look in to the basic concepts of the Payroll.
    Introduction to Payroll
    To calculate the remuneration for work done for each employee
    Payroll does not just involve the calculation of remuneration, but consists of a variety of processes that are becoming increasingly important due to the employer’s increased obligation to supply benefits and medical welfare. These benefits are products of:
    • Labor law
    • Tax law
    • Contribution law
    • Benefits law
    • Civil law
    • Reporting law
    • Information law
    • Statistics law
    Payroll in the SAP System: In the SAP Human Resources Management System, payroll accounting is executed using the Payroll driver.
    Process Flow:
    When you access Payroll, the payroll driver calls the accompanying payroll schema, which consists of a sequence of functions. For each activity, the individual functions import data from internal tables and payroll relevant files.
    Payroll Integration:
    Payroll can be integrated in Personnel Administration, Time Management, Incentive Wages and Accounting:
    Standardized data retention enables you to use master data and other payroll relevant data from Personnel Administration.
    Time data, entered via Time Management, is automatically included in the Payroll and is valuated during the payroll run. Data from the Incentive Wages component is used to calculate piecework wages and premium wages directly in Payroll.
    Information on expenses and payables from Payroll is posted for accounting directly in Financial Accounting, and you assign the costs to the appropriate cost center. You can also control the financial system of third-party providers.
    Payroll Driver
    Payroll driver is a special report for Payroll.
    SAP has developed country-specific payroll drivers, which are based on report RPCALCx0.
    The country-specific net calculation of pay must be developed explicitly for every country.
    Separate country programs, which meet the tax and insurance requirements of the respective country, can be created from the basic report RPCALCx0. Since the payroll driver has a modular structure, you can use the Customizing functions to quickly modify the payroll procedure to meet the particular requirements of your enterprise.
    Integration
    Calculation rules and other reports are stored in an accompanying schema, which also contains the activities carried out by the payroll driver during payroll. All data is stored in internal tables and saved in files with a cluster structure.
    When you access Payroll, the payroll driver calls the accompanying payroll schema, which consists of a sequence of functions. For each activity, the individual functions import data from internal tables and payroll relevant files.
    Payroll Schema:
    It contains calculation rules to be used by the payroll driver during payroll.
    SAP has developed country-specific schemas, which are based on schema X000.
    With country-specific reports, the first character in the name refers to the country indicator.
    For example,
    D for Germany
    F for France
    U for USA
    Schema Structure A schema consists of the following parts:
    1. Initialization
    Where system performs the following steps:
    Updates the databases
    Imports required infotypes
    2. Gross calculation of pay
    Where system performs the following steps:
    Processes basic data and time data
    Reads payroll account of the last period accounted
    Processes time data and calculate the individual gross values
    Performs factoring
    3. Net calculation of pay
    where system performs the following steps:
    Calculates net remuneration
    Performs bank transfers
    Example:
    The classic example is the payroll for salaried employees at the end of the month in contrast to the wage accounting of hourly workers in the middle of the following month.
    Enter the organizational assignment of employees to a payroll accounting area (ABKRS) in Infotype 0001. Payroll accounting area also determines the two functions necessary for payroll accounting:
    • The summarization of personnel numbers to be accounted and
    • The determination of the exact payroll period.
    Select Personnel Numbers:
    Personnel numbers are selected for payroll accounting by specifying a payroll area in the payroll driver. Infotype 0001 Organizational Assignment enables you to assign an employee to the appropriate payroll area.
    These Pernrs are locked during Payroll Run.
    Determine Payroll Period:
    On the Selection screen, you can give Payroll Period Parameter as per the requirement else you can give Payroll Area, by which system calculates the payroll period.
    Finding Payroll Results for a Specific Query:
    Payroll results are stored in cluster Rx of the PCL2. The cluster key is not mnemonic; it contains only the PERNR (personnel number) and SEQNO (sequential number) fields.
    The internal table RGDIR (PC261 - Cluster Directory for Export and Import of Payroll Results) contains a directory entry for each payroll result.
    This entry is a sequential number (RGDIR-SEQNR), which uniquely identifies the payroll result.
    Payroll results can only be imported if the payroll cluster key (PC200) contains the personnel number and sequential number.
    Function Modules for Selecting Payroll Results
    You will probably always have the same queries when importing payroll records. For example, "Which payroll results (original and retroactively accounted records) were written for a specific payroll run (defined by IN payroll category, IN payroll area, IN period)"? To save programmers from having to write their own reports for this functionality, standard modules are available for the most important queries. The employee's payroll directory is always transferred to the function modules using the table RGDIR (PC261). The modules then transfer the payroll records, which satisfy the specified selection criteria using a table whose type corresponds to that of the RGDIR (PC261) but which has a different name.
    Exporting Pernr – Personal Number
    Importing Molga – Country
    Tables Rgdir – Payroll Results Directory
    This Function Module populates payroll results of all employees with PERNR & SEQNR as key.
    Macro Modules:
    We have populated Results Directory & retrieved Sequential Number, we need to call an import macro module for retrieving the required payroll results. For this we need to pass the unique identification of an Employee payroll Result i.e. rx-key-pernr = v_pernr.
    rx-key-seqno = v_seqnr.
    To that import macro.
    Calling Import Module: RP-imp-c2-RU.
    This Macro populates all the cluster tables required for Payroll, by importing from PCL2 Cluster Directory. After that we can loop through these cluster tables for required fields.
    Guideline to write a program, which retrieves the data for, specified country
    • Use Logical Database As per the Requirement.
    • Include Payroll Driver with reference to Country- Specific modules which inturn includes Country-specific Schemas etc.
    • Get the PERNRs for which you want to obtain payroll results.
    • Populate Results Directory RGDIR with PERNR & Molga (Country) calling FM CU_READ_RGDIR.
    • Get the Unique Sequential Number with PERNR, From Date & Last Date calling CD_READ_LAST.
    • Pass these KEY Field (PERNR, SEQNR) to IMPORT MACRO
    RP-IMP-C2- RU to import all the relevant field entries from PCL2
    DIRECTORY to all the cluster tables
    • Get the required fields by looping through cluster tables.
    Integration
    All data is stored in internal tables and saved in files with a cluster structure.
    Internal Tables: Internal tables store data during payroll.
    The system imports data to these tables and used them to calculate new data. This data is then also saved in internal tables.
    At the start of the payroll run, the system reads the values from the results tables to the old results table (ORT). Data from the previous period is, therefore, available in the current payroll period.
    The most important internal tables are:
    • Input table (IT)
    Table IT contains data that can be edited. The table exists only during processing.
    •• Output table (OT)
    Table OT contains the results of an activity. These results are written to the input table for further processing. The table exists only during processing.
    •• Results table (RT)
    Table RT contains the results of the period for which payroll has been run. The system saves this data in the PCL2 file in cluster RX.
    Interaction of IT, OT and RT:
    The necessary data for the respective processing step is loaded into the input table and is thus available for various processing procedures. The results of a processing step are stored either in the output table or the results table. At the end of a processing step, the data from the OT is loaded back into the IT, where it is available for further processing steps. The IT and OT are only temporarily filled, whereas the RT is stored on the database. In one of the first processing steps, the RT of the last payroll accounting period is imported into the old results table (ORT) and can consequently be used for further processing.
    Payroll Relevant Files:
    Payroll files contain data for payroll and payroll results.
    Structure
    The system requires the following files for payroll:
    • Pnnnn (nnnn = number of the infotype)
    The Pnnnn files contain data that has been entered in the respective infotypes for an employee.
    Example
    P0000 - Actions Infotype
    P0008 - Basic Pay Infotype
    • PCL1
    The PCL1 file contains primary information, in other words, data from the master data and time recording systems.
    • PCL2
    The PCL2 file contains secondary information, in other words, derived data and all generated schemas
    Integration
    When you start payroll, the system imports the relevant master data from the Pnnnn files (for example, basic pay and tax class) and imports the time data from the PCL1 file to the IT table.
    The system imports the payroll results from the previous month from table ORT (for example, to form averages).
    The system processes this data and saves the payroll results and generated schemas in the PCL2 file.
    Payroll Control
    Edited by: Alvaro Tejada Galindo on Apr 8, 2008 5:09 PM

  • Hi TO All  ABAP Experts,

    I am very new to ABAP Programming,I went through all of the posts related to BDC in sdn forum.I have got a clear understanding of BDC.I tried most of the example code and screen short,but none of them working fine.
    Can anybody send the screen  shorts from SHDB(recording ) from start to end with text file format used
    for uploading corresponding information in bdc.If it is related toVA01 or migration of data from external file to sap r/3 on Material master using session method ,it will be great.
    Other wise Please send me any bdc program you done in a real time environment.
    my mail id is [email protected]
    Thanks and Regards
    Namratha

    Hello Namratha,
    Go through these steps for recording by using SHDB.
    How to use recording
    Go to SHDB
    --> Click on New Recording
    --> Provide any name in Recording , For ex:  Z_CHAITU
    --> Provide the Transaction name as “MM01”
    --> Select the update mode as Synchrounous or  Asynchrounus method
    --> Click on Start Recording button.
    --> It will display MM01 screen….type the appropriate
    information in it.
    --> Type the Material no as : 4567E (Any no, But there should b 1 Character in it)
    --> Type Checmical Industry in INDUSTRY SECTOR
    --> Type COUPONS in MATERIAL TYPE
    --> Now click on Select Views button.
    --> Select BASIC DATA 1
    --> Click on Ok button
    --> Under Basic data tab under Material, it will display the Material number.
    --> Type the short description   and “Provide EA as Base Unit Of Measure”
    --> CLICK ON BACK AND IT WILL ASK U TO SAVE THE DATA, CLICK ON YES
    -->  Again click on Back, it will ask if u wish to save the changes to record entries.
    -> Click on Yes
    --> Now, u will be in Initial screen
    --> Select the record and  Click on Program button
    --> Now, provide any program name
    --> Now, select ‘Transfer from recording’
    --> Click on Tick mark
    --> Give some short description
    --> Type as Executable
    --> Click on Source Code button
    --> Automatically the code will appear in SE 38 program.
    U can try these steps with any T-code by knowing the Mandatory fields in it.
    Here is the sample code which I have done for MK01.
    *& AUTHOR : Krishna Chaitanya
    *& TITLE  : BDC FOR MK01
    *& DESCR  : UPLOAD THE DATA THROUGH FLAT FILE
    *& TRANSPORT : DOLK901203
    *& VERSION : V1
    *& DATE  :  17th , JAN , 2008
    report Z24_BDC_MK01
           no standard page heading line-size 255.
    *& DECLARATIONS OF STRUCTURE FOR MK01
    **U can create ur own flat file with the same structure
    with tab' s Namratha
    KTOKK, NAME1,SORTL, PSTLZ, LAND1
    TYPES : BEGIN OF TY_MK01 ,
             KTOKK TYPE RF02K-KTOKK ,
             NAME1 TYPE LFA1-NAME1 ,
             SORTL TYPE LFA1-SORTL ,
             PSTLZ TYPE LFA1-PSTLZ ,
             LAND1 TYPE LFA1-LAND1 ,
             END OF TY_MK01 .
    *& DECLARATION OF INTERNAL TABLE
    DATA : T_MK01 TYPE STANDARD TABLE OF TY_MK01 INITIAL SIZE 0 ,
           T_BDCDATA TYPE STANDARD TABLE OF BDCDATA INITIAL SIZE 0 ,
           T_BDCMSGCOLL TYPE STANDARD TABLE OF BDCMSGCOLL INITIAL SIZE 0 ,
           T_ERROR TYPE STANDARD TABLE OF TY_MK01 INITIAL SIZE 0 ,
    *& DECLARATION OF WORK AREA
           W_MK01 TYPE TY_MK01 ,
           W_BDCDATA TYPE BDCDATA ,
           W_BDCMSGCOLL TYPE BDCMSGCOLL .
    *& DECLARATION OF SELECTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME .
    PARAMETERS : P_FILE TYPE FILENAME .
    SELECTION-SCREEN END OF BLOCK B1 .
    *& DECLARATION OF START-OF-SELECTION
    START-OF-SELECTION .
    PERFORM SUB_UPLOAD_DATA .
    PERFORM SUB_POPULATE_BDC .
    PERFORM SUB_ERROR_REC .
    *include bdcrecx1.
    *&      Form  SUB_UPLOAD_DATA
          text
    form SUB_UPLOAD_DATA .
    DATA  : L_FILE TYPE STRING .
         L_FILE = P_FILE .
    CALL FUNCTION 'GUI_UPLOAD'
       EXPORTING
         filename                      = L_FILE
         HAS_FIELD_SEPARATOR           = 'X'
       tables
         data_tab                      = T_MK01 .
    endform.                    " SUB_UPLOAD_DATA
    *&      Form  SUB_POPULATE_BDC
          text
    form SUB_POPULATE_BDC .
    LOOP AT T_MK01 INTO W_MK01 .
    DATA : L_MSG TYPE STRING .
    REFRESH T_BDCDATA .
    perform bdc_dynpro      using 'SAPMF02K' '0107'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF02K-KTOKK'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RF02K-KTOKK'
                                   W_MK01-KTOKK.
    perform bdc_dynpro      using 'SAPMF02K' '0110'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFA1-LAND1'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'LFA1-NAME1'
                                   W_MK01-NAME1.
    perform bdc_field       using 'LFA1-SORTL'
                                   W_MK01-SORTL.
    perform bdc_field       using 'LFA1-PSTLZ'
                                   W_MK01-PSTLZ.
    perform bdc_field       using 'LFA1-LAND1'
                                   W_MK01-LAND1.
    perform bdc_dynpro      using 'SAPMF02K' '0120'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFA1-KUNNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPMF02K' '0130'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF02K-LIFNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    CALL TRANSACTION 'MK01' USING T_BDCDATA MODE 'N' MESSAGES INTO T_BDCMSGCOLL .
    IF SY-SUBRC <> 0 .
    APPEND W_MK01 TO T_ERROR .
    ENDIF .
    CLEAR W_BDCMSGCOLL .
    READ TABLE T_BDCMSGCOLL INTO W_BDCMSGCOLL INDEX 1 .
    CLEAR L_MSG .
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
       ID              = W_BDCMSGCOLL-MSGID
       LANG            = SY-LANGU
       NO              = W_BDCMSGCOLL-MSGNR
       V1              = W_BDCMSGCOLL-MSGV1
       V2              = W_BDCMSGCOLL-MSGV2
       V3              = W_BDCMSGCOLL-MSGV3
       V4              = W_BDCMSGCOLL-MSGV4
    IMPORTING
       MSG             = L_MSG
    EXCEPTIONS
       NOT_FOUND       = 1
       OTHERS          = 2
    IF sy-subrc = 0.
    WRITE : / 'MESSAGE FOR ' , W_MK01-KTOKK ,'-------' , L_MSG .
    ENDIF.
    ENDLOOP .
    endform.                    " SUB_POPULATE_BDC
           Start new screen                                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR W_BDCDATA.
      W_BDCDATA-PROGRAM  = PROGRAM.
      W_BDCDATA-DYNPRO   = DYNPRO.
      W_BDCDATA-DYNBEGIN = 'X'.
      APPEND W_BDCDATA TO T_BDCDATA .
    ENDFORM.
           Insert field                                                  *
    FORM BDC_FIELD USING FNAM FVAL.
        CLEAR W_BDCDATA.
        W_BDCDATA-FNAM = FNAM.
        W_BDCDATA-FVAL = FVAL.
        APPEND W_BDCDATA TO T_BDCDATA .
    ENDFORM.
    *&      Form  SUB_ERROR_REC
          text
    -->  p1        text
    <--  p2        text
    form SUB_ERROR_REC .
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                        = 'C:/ERRORS OF MK01.TXT'
       WRITE_FIELD_SEPARATOR           = 'X'
      tables
        data_tab                        = T_ERROR .
    endform.                    " SUB_ERROR_REC
    Hey Namratha...I know there will be little confusion. But, trust me...try with this code and u will automatically able to work with any Transcation code.
    All the best!
    Edited by: Krishna Chaitanya on Mar 21, 2008 9:41 AM

  • Hi abap experts: need some help

    1. how we will find out user-exit for particular transaction through packages please send me step by step?
    2. i have created one table for that i have one change request. i have created one report program. for that i have one change request? which request is released first? and why?
    3.  what is the main difference between ale and edi?
    4. in interactive report we have 20 secondary list? how we wiil move dynamically from one list to another list? like  from 10 th list to 5th list ? if any code is there please send that code?

    hi,
    Check out the following documentation and links:-
    User exits are built into the Standard SAP code. You just activate them and insert your code into the include programs.
    Here is a program that will list the user exits per transaction code. Not perfect, but it may help.
    report z_find_user_exit no standard page heading.
    tables: tstc, tadir, modsapt, modact,
    trdir, tfdir, enlfdir, tstct.
    data : jtab like tadir occurs 0 with header line.
    data : hotspot(30).
    parameters : p_tcode like tstc-tcode obligatory.
    at line-selection.
    get cursor field hotspot.
    check hotspot(4) eq 'JTAB'.
    set parameter id 'MON' field sy-lisel+1(10).
    call transaction 'SMOD' and skip first screen.
    start-of-selection.
    perform get_data.
    perform write_list.
    FORM get_data *
    form get_data.
    select single * from tstc
    where tcode eq p_tcode.
    check sy-subrc eq 0.
    select single * from tadir
    where pgmid = 'R3TR'
    and object = 'PROG'
    and obj_name = tstc-pgmna.
    if sy-subrc ne 0.
    select single * from trdir
    where name = tstc-pgmna.
    if trdir-subc eq 'F'.
    select single * from tfdir
    where pname = tstc-pgmna.
    select single * from enlfdir
    where funcname = tfdir-funcname.
    select single * from tadir
    where pgmid = 'R3TR'
    and object = 'FUGR'
    and obj_name eq enlfdir-area.
    endif.
    endif.
    select * from tadir into table jtab
    where pgmid = 'R3TR'
    and object = 'SMOD'
    and devclass = tadir-devclass.
    select single * from tstct
    where sprsl eq sy-langu
    and tcode eq p_tcode.
    endform.
    FORM write_list *
    form write_list.
    format color col_positive intensified off.
    write:/(19) 'Transaction Code - ',
    20(20) p_tcode,
    45(50) tstct-ttext.
    skip.
    if not jtab[] is initial.
    write:/(95) sy-uline.
    format color col_heading intensified on.
    write:/1 sy-vline,
    2 'Exit Name',
    21 sy-vline ,
    22 'Description',
    95 sy-vline.
    write:/(95) sy-uline.
    loop at jtab.
    select single * from modsapt
    where sprsl = sy-langu and
    name = jtab-obj_name.
    format color col_normal intensified off.
    write:/1 sy-vline,
    2 jtab-obj_name hotspot on,
    21 sy-vline ,
    22 modsapt-modtext,
    95 sy-vline.
    endloop.
    write:/(95) sy-uline.
    describe table jtab.
    skip.
    format color col_total intensified on.
    write:/ 'No of Exits:' , sy-tfill.
    else.
    format color col_negative intensified on.
    write:/(95) 'No User Exit exists'.
    endif.
    endform.
    SMOD, is where you can find the system modifications provided by SAP. CMOD is where you will implement them. If you are looking for all the enhancements provided, then go to CMOD, follow the menu, 'Utilities-->SAP Enhancements'. This will take you to a screen where if you just execute it, you will get all the enhancements provided by SAP.
    It is always difficult to find a user exit if all you have is a program name or a transaction code, unless you do a program like Rich suggested. But even there, you will not be able to find user exits that are implemented as sub-routines(also called forms not sapscript forms). Most of the user exits are documented under the corresponding task under IMG structure. So use transaction code SPRO, go to the IMG structure, choose the application area that your program or transaction might be and then you should find a task that talks about enhancements. If you execute that task most often it will take you to CMOD and sometimes to SE38. But all you want to know is there in the documentation attached to the task. Then you can go to CMOD and see which components are there.
    Finding BADIs
    Business add-ins are enhancements to the standard version of the system.
    Business Add-In is a new SAP enhancement technique based on ABAP Objects.
    They can be inserted into the SAP system based on specific user requirements.
    Each Business Add-In has:
    • at least one Business Add-In definition
    • a Business Add-In interface
    • a Business Add-In class that implements the interface
    In order to enhance a program, a Business Add-In must first be defined
    Subsequently two classes are automatically generated:
    • An interface with ‘IF_EX_’ inserted between the first and second characters of the BADI name.
    • An adapter class with ‘CL_EX_’ inserted between the first and second characters of the BADI name.
    The Application developer creates an interface for this Add-In.
    There are multiple ways of searching for BADI.
    • Finding BADI Using CL_EXITHANDLER=>GET_INSTANCE
    • Finding BADI Using SQL Trace (TCODE-ST05).
    • Finding BADI Using Repository Information System (TCODE- SE84).
    1. Go to the Transaction, for which we want to find the BADI, take the example of Transaction VD02. Click on System->Status. Double click on the program name. Once inside the program search for ‘CL_EXITHANDLER=>GET_INSTANCE’.
    Make sure the radio button “In main program” is checked. A list of all the programs with call to the BADI’s will be listed.
    The export parameter ‘EXIT_NAME’ for the method GET_INSTANCE of class CL_EXITHANDLER will have the user exit assigned to it. The changing parameter ‘INSTANCE’ will have the interface assigned to it. Double click on the method to enter the source code.Definition of Instance would give you the Interface name.
    2. Start transaction ST05 (Performance Analysis).
    Set flag field "Buffer trace"
    Remark: We need to trace also the buffer calls, because BADI database tables are buffered. (Especially view V_EXT_IMP and V_EXT_ACT)
    Push the button "Activate Trace". Start transaction VA02 in a new GUI session. Go back to the Performance trace session.
    Push the button "Deactivate Trace".
    Push the button "Display Trace".
    The popup screen "Set Restrictions for Displaying Trace" appears.
    Now, filter the trace on Objects:
    • V_EXT_IMP
    • V_EXT_ACT
    Push button "Multiple selections" button behind field Objects
    Fill: V_EXT_IMP and V_EXT_ACT
    All the interface class names of view V_EXT_IMP start with IF_EX_. This is the standard SAP prefix for BADI class interfaces. The BADI name is after the IF_EX_.
    So the BADI name of IF_EX_CUSTOMER_ADD_DATA is CUSTOMER_ADD_DATA
    3. Go to “Maintain Transaction” (TCODE- SE93).
    Enter the Transaction VD02 for which you want to find BADI.
    Click on the Display push buttons.
    Get the Package Name. (Package VS in this case)
    Go to TCode: SE84->Enhancements->Business Add-inns->Definition
    Enter the Package Name and Execute.
    Here you get a list of all the Enhancement BADI’s for the given package MB.
    Have a look at http://help.sap.com/saphelp_nw04/helpdata/en/04/f3683c05ea4464e10000000a114084/content.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/73/7e7941601b1d09e10000000a155106/frameset.htm
    http://support.sas.com/rnd/papers/sugi30/SAP.ppt
    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htm
    http://members.aol.com/_ht_a/skarkada/sap/
    http://www.ct-software.com/reportpool_frame.htm
    http://www.saphelp.com/SAP_Technical.htm
    http://www.kabai.com/abaps/q.htm
    http://www.guidancetech.com/people/holland/sap/abap/
    http://www.planetsap.com/download_abap_programs.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c8/1975cc43b111d1896f0000e8322d00/content.htm
    /people/thomas.weiss/blog/2006/04/03/how-to-define-a-new-badi-within-the-enhancement-framework--part-3-of-the-series
    /people/thomas.weiss/blog/2006/04/18/how-to-implement-a-badi-and-how-to-use-a-filter--part-4-of-the-series-on-the-new-enhancement-framework
    How to develop BADI
    Regards,
    Sankar

  • Help for routing( SAP PP)......from abap experts

    Hi Experts,
    I am a SAP PP Consultant. When I am performing 1 operation i.e., routing in T-Code CA01, finally I want to see the graphical display of my operations but system is giving some error like..
    " illegal cluster_id in CVAL table - 000002(14)"
    Please help me to solve it my friends.
    <removed_by_moderator>
    Regards,
    Imran
    Edited by: imran  shek on Dec 5, 2008 10:43 AM
    Edited by: Julius Bussche on Dec 5, 2008 12:41 PM

    hi
    please refer to this document
    http://help.sap.com/saphelp_47x200/helpdata/en/7e/d42611455911d189400000e8323c4f/frameset.htm
    hope this helps
    regards
    Aakash Banga

  • Hi abaper expert

    hello
      i hv a problem .in transaction fk10n.i hv been copy its program.i hv to add one more field as a plant code .and the data should be fatch depend on plant code.because plant code may be vary.
    code is  
    report RFARBALANCE message-id FDBL.
    ...tables.............................................................
    tables: LFC1,
            LFC3,
            RF42B,
            SSCRFIELDS.
    ...selections.........................................................
    select-options: SO_LIFNR for RF42B-LIFNR memory id LIF
                                 matchcode object KRED
                                 visible length 10,
                    SO_BUKRS for LFC3-BUKRS memory id BUK.
    parameters: GP_GJAHR  like LFC1-GJAHR memory id GJR,
                GP_ITUSR  type C no-display.
    selection-screen function key 1.
    ...selection screen for processing of worklists.......................
    selection-screen begin of screen 2000.
    selection-screen begin of block VENDOR with frame title TEXT-010.
    parameters: GP_WLLIF like RF42B-IDNTK.
    select-options: SO_WLLIF for LFC1-LIFNR memory id LIF.
    selection-screen end of block VENDOR.
    selection-screen begin of block COMPANY with frame title TEXT-011.
    parameters: GP_WLBUK like RF42B-IDNTB.
    select-options: SO_WLBUK for LFC1-BUKRS memory id BUK.
    selection-screen end of block COMPANY.
    parameters: GP_GJHR2 type GJAHR memory id GJR.
    selection-screen function key 2.
    selection-screen end of screen 2000.
    ...internal data specific for g/l accounts............................
    constants: GC_LDB     type TRDIR-LDBNAME   value 'KDF',
               GC_CURTYPE like RFPDO2-ALLGCRTP value '10',
               GC_KOART   type KOART           value 'K'.
    ...internal data common for all account types.........................
    include RFBALANCEDATA.
    ...initialization.....................................................
    initialization.
    ...initialize internal data table.....................................
      refresh LT_BALANCE_DATA.
      refresh LT_APAR_DATA.
      refresh LT_APAR_SPECIAL.
    ...remove user command for batch and print jobs.......................
      perform CHANGE_STATUS.
    ...set text for additional function keys..............................
      SSCRFIELDS-FUNCTXT_01 = TEXT-005.
      SSCRFIELDS-FUNCTXT_02 = TEXT-006.
    ...process user command...............................................
    at selection-screen.
      case SSCRFIELDS-UCOMM.
    ...get local range for customer.......................................
        when 'ONLI'.
          if not GP_WLLIF is initial.
            perform GET_RANGE_FROM_WORKLIST tables GT_RANGE
                                            using  GP_WLLIF
                                                   'LIFNR'.
            refresh SO_WLLIF.
            loop at GT_RANGE.
              move-corresponding GT_RANGE to SO_WLLIF.
              append SO_WLLIF.
            endloop.
          endif.
          refresh LR_LIFNR.
          append lines of SO_WLLIF to LR_LIFNR.
          loop at SO_LIFNR.
            LS_LIFNR-SIGN   = SO_LIFNR-SIGN.
            LS_LIFNR-OPTION = SO_LIFNR-OPTION.
            if SO_LIFNR-LOW cn '0123456789'.
              LS_LIFNR-LOW = SO_LIFNR-LOW.
            else.
              LS_LIFNR-LOW    = SO_LIFNR-LOW+6.
            endif.
            if SO_LIFNR-HIGH cn '0123456789'.
              LS_LIFNR-HIGH = SO_LIFNR-HIGH.
            else.
              LS_LIFNR-HIGH   = SO_LIFNR-HIGH+6.
            endif.
            append LS_LIFNR to LR_LIFNR.
          endloop.
          if LR_LIFNR[] is initial.
            clear SSCRFIELDS-UCOMM.
            refresh LR_LIFNR.
            message E002.
          endif.
    ...get local range for company code...................................
          if not GP_WLBUK is initial.
            perform GET_RANGE_FROM_WORKLIST tables GT_RANGE
                                            using  GP_WLBUK
                                                   'BUKRS'.
            refresh SO_WLBUK.
            loop at GT_RANGE.
              move-corresponding GT_RANGE to SO_WLBUK.
              append SO_WLBUK.
            endloop.
          endif.
          refresh LR_BUKRS.
          append lines of SO_WLBUK to LR_BUKRS.
          append lines of SO_BUKRS to LR_BUKRS.
          if LR_BUKRS[] is initial.
            refresh LR_LIFNR.
            refresh LR_BUKRS.
            clear SSCRFIELDS-UCOMM.
            message E007.
          endif.
    ...get local range for fiscal year....................................
          LS_GJAHR-SIGN   = 'I'.
          LS_GJAHR-OPTION = 'EQ'.
          if GP_GJAHR is initial.
            LS_GJAHR-LOW = GP_GJHR2.
          else.
            LS_GJAHR-LOW    = GP_GJAHR.
          endif.
          clear LS_GJAHR-HIGH.
          if not LS_GJAHR-LOW is initial.
            append LS_GJAHR to LR_GJAHR.
          else.
            clear SSCRFIELDS-UCOMM.
            refresh LR_LIFNR.
            refresh LR_BUKRS.
            message E008.
          endif.
    ...check existence of accounts given..................................
          loop at LR_LIFNR transporting no fields
                 where OPTION ne 'EQ' or
                       SIGN ne 'I'.
            exit.
          endloop.
          if SY-SUBRC = 0.
            select LIFNR BUKRS LNRZE from LFB1 into table LT_LIFNR
                   where LIFNR in LR_LIFNR
                     and BUKRS in LR_BUKRS.
          else.  "worklist
            select LIFNR BUKRS LNRZE from LFB1 into table LT_LIFNR
                   for all entries in LR_LIFNR
                   where LIFNR eq LR_LIFNR-LOW
                     and BUKRS in LR_BUKRS.
          endif.
          if SY-SUBRC ne 0.
            clear SSCRFIELDS-UCOMM.
            refresh LR_BUKRS.
            refresh LR_LIFNR.
            refresh LR_GJAHR.
            message E030(MSITEM).
          endif.
    ...check authorizations.............................................
          perform CHECK_AUTHORITY_GROUPS
                        using LR_BUKRS
                              LR_SAKNR
                              LR_KUNNR
                              LR_LIFNR
                              GC_KOART.
    ...switch on worklists..............................................
        when 'FC01'.
          leave to transaction 'FK10NA'.
    ...switch off worklists.............................................
        when 'FC02'.
          leave to transaction 'FK10N'.
      endcase.
    ...start-of-selection.................................................
    start-of-selection.
    ...check, if all company codes given use the same fiscal year.........
      perform CHECK_FISCAL_YEARS using LR_BUKRS
                                       LD_RC.
      if LD_RC ne 0.
        message I021.
        return.
      endif.
    ...build table with selection criteria..............................
      perform BUILD_COSEL tables LT_COSEL
                          using  LR_BUKRS
                                 LR_KUNNR
                                 LR_LIFNR
                                 LR_SAKNR
                                 LR_GJAHR
                                 LR_GSBER
                                 GP_ITUSR
                                 SPACE
                                 GP_WLLIF
                                 SPACE
                                 GP_WLBUK
                                 GC_CURTYPE.
    ...build table with selections for LDB................................
      perform BUILD_RSPARAMS tables LT_COSEL
                                    LT_PARAMS
                             using  GC_LDB.
    ...build table with callbacks.........................................
      perform BUILD_CALLBACK tables LT_CALLBACKS.
    ...get transaction data...............................................
      call function 'LDB_PROCESS'
        exporting
          LDBNAME                     = GC_LDB
        tables
          CALLBACK                    = LT_CALLBACKS
          SELECTIONS                  = LT_PARAMS
        exceptions
          LDB_SELECTIONS_NOT_ACCEPTED = 4
          others                      = 1.
      if SY-SUBRC eq 4.
        message id SY-MSGID type SY-MSGTY number SY-MSGNO
                with SY-MSGV1 SY-MSGV2.
      endif.
    ...end-of-selection...................................................
    end-of-selection.
    ...read and process transaction figures.............................
      describe table LT_APAR_DATA lines LD_BALANCE_LINES.
      perform PROCESS_BALANCE tables LT_BALANCE_DATA
                              using  LT_APAR_DATA
                                     LD_ACCOUNT_CR_FRWD
                                     LD_ACCOUNT_DEBIT
                                     LD_ACCOUNT_CREDIT
                                     LD_ACCOUNT_BALANCE
                                     GP_ITUSR.
    ...read and process special G/L transaction figures.................
      describe table LT_APAR_SPECIAL lines LD_SPECIAL_LINES.
      perform PROCESS_SPECIAL_GL tables LT_SPECIAL_GL
                                 using  LT_APAR_SPECIAL
                                        LD_ACCOUNT_CR_FRWD
                                        LD_ACCOUNT_DEBIT
                                        LD_ACCOUNT_CREDIT
                                        LD_ACCOUNT_BALANCE
                                        GP_ITUSR.
    ...check, if any data has been read at all..........................
      if LD_BALANCE_LINES = 0 and LD_SPECIAL_LINES = 0.
    ...if a branch was given: is head office included, too?.............
        refresh LT_LNRZE.
        insert lines of LT_LIFNR into table LT_LNRZE.
        loop at LT_LIFNR where LNRZE ne SPACE.
          read table LT_LNRZE with table key
                              LIFNR = LT_LIFNR-LNRZE
                              BUKRS = LT_LIFNR-BUKRS
                              transporting no fields.
          if SY-SUBRC ne 0.
            message id 'F4' type 'I' number '002' with LT_LIFNR-LIFNR
                                                      LT_LIFNR-LNRZE.
            return.
          endif.
          exit.
        endloop.
    ...no branch, but nevertheless no data!............................
        message I020 with GP_GJAHR.
        if GP_ITUSR is initial.
          import LD_RETURN from memory id 'RETURN_FLAG'.
          return.
        else.
          import OLDYEAR to LD_YEAR from memory id 'YEAR'.
          if SY-SUBRC eq 0.
            read table LR_BUKRS into LS_BUKRS index 1.
            read table LR_LIFNR into LS_LIFNR index 1.
            submit RFNETBALANCE with PD_GJAHR = LD_YEAR
                                with PD_BUKRS = LS_BUKRS-LOW
                                with PD_LIFNR = LS_LIFNR-LOW.
            submit RFNETBALANCE with PD_GJAHR = LD_YEAR.
          endif.
        endif.
      endif.
    ...display data.....................................................
      call function 'FDBL_BALANCES_DISPLAY'
        exporting
          PT_COSEL        = LT_COSEL
          PD_ITUSR        = GP_ITUSR
        changing
          PT_BALANCE_DATA = LT_BALANCE_DATA
          PT_SPECIAL_GL   = LT_SPECIAL_GL.
      include RFBALANCE.

    I was going to ask the same question (without the code of course : ) but I see nobody has answered a single question till date.
    Anyways, I wanted to call Function Module: FDBL_BALANCES_DISPLAY from a Z Program and wanted to know what all parameters I need to pass.
    I'm posting the same as a new thread. If you've got something that can help, please post.
    Thank you.
    Regards,
    Gaurav Brahmbhatt

  • Hi abap experts (one help)

    hi
    1. please send standard data base table names related to    fi/co?
    2.  please send any objects related to fi/co (weather its   reports bdc, scripts or smarforms)?

    Hi,
    Please go through the below mention code where you can find the data related to FICO.
    This program is mainly used for F-53 BDC Document clearance.
    REPORT ZCITI_F53_WIPRO no standard page heading line-count 255.
    TABLES: BSIK,        " Accounting: Secondary Index for Vendors
            LFA1,        " Vendor Master (General Section)
            LFB1,        " Vendor Master (Company Code)
            BKPF,        " Accounting Document Header
            bsak,        " Acctg:Secondary Index for Vendors (Cleared Items)
             t077k.
    DATA:  Z_FNAME LIKE RLGRAP-FILENAME,
           Z_PATH LIKE RLGRAP-FILENAME,
           MASK(10).
    begin of mod01 +
    TYPES : BEGIN OF W_TAB1,
            BELNR LIKE BSIK-BELNR,
            WRBTR LIKE BSIK-WRBTR,
            END OF W_TAB1.
    TYPES : BEGIN OF W_TAB,
            BELNR LIKE BSIK-BELNR,
            WRBTR LIKE BSIK-WRBTR,
            lifnr like bsik-lifnr,
            END OF W_TAB.
    end of mod01 -
    DATA : BEGIN OF IT_BSIK OCCURS 0,
           BUKRS LIKE BSIK-BUKRS,
           LIFNR LIKE BSIK-LIFNR,
           GJAHR LIKE BSIK-GJAHR,
           BELNR LIKE BSIK-BELNR,
           WRBTR LIKE BSIK-WRBTR,
           REBZG LIKE BSIK-REBZG,
           ZLSPR LIKE BSIK-ZLSPR,
           SHKZG LIKE BSIK-SHKZG,
           PARTL LIKE BSIK-WRBTR,
           NTAMT LIKE BSIK-WRBTR,
           XPORE LIKE LFB1-XPORE,
           END OF IT_BSIK.
    data : file_path like rlgrap-filename.
    DATA : BEGIN OF IT_LFA1 OCCURS 0,
           LIFNR LIKE LFA1-LIFNR,
           END OF IT_LFA1.
    DATA : BEGIN OF it_error OCCURS 0,
                 bukrs LIKE bsik-bukrs,
                 lifnr LIKE bsik-lifnr,
                 belnr LIKE bsik-belnr,
                 gjahr LIKE bsik-gjahr,
                 rej(1),
            END OF it_error.
    DATA : IT_TAB TYPE STANDARD TABLE OF W_TAB
           INITIAL SIZE 0 WITH HEADER LINE,
           IT_TAB1 TYPE STANDARD TABLE OF W_TAB1
           INITIAL SIZE 0 WITH HEADER LINE.
    DATA : BEGIN OF IT_INVN OCCURS 0,
           BUKRS LIKE BSIK-BUKRS,
           LIFNR LIKE BSIK-LIFNR,
           GJAHR LIKE BSIK-GJAHR,
           BELNR LIKE BSIK-BELNR,
           WRBTR LIKE BSIK-WRBTR,
           REBZG LIKE BSIK-REBZG,
           ZLSPR LIKE BSIK-ZLSPR,
           SHKZG LIKE BSIK-SHKZG,
           PARTL LIKE BSIK-WRBTR,
           NTAMT LIKE BSIK-WRBTR,
           XPORE LIKE LFB1-XPORE,
           END OF IT_INVN.
    data : str type string.
    DATA : m_wrbtr_h LIKE bsik-wrbtr,
           m_wrbtr_s LIKE bsik-wrbtr,
           m_wrbtr_net LIKE bsik-wrbtr,
           m_amnt  like bsik-wrbtr,
           m_pamnt like bsik-wrbtr,
           M_NTAMNT LIKE BSIK-WRBTR,
           M_PNTAMNT LIKE BSIK-WRBTR.
    data : t_bdc_tab like standard table of bdcdata
          initial size 0 with header line.
    data : dat(10).
    data : flag(1),
           FLAGE(1),
           count(4) type n,
           counter(4) type n.
    DATA : FSYR LIKE BSIK-GJAHR.
    DATA : M_PARTL type string,
           M_AMOUNT type string,
           mt_ntamnt type string,
           MT_PNTAMNT type string.
    data: m_file LIKE rlgrap-filename.
    DATA: id1(3) TYPE n.
      TABLES rfcdes.
      DATA: file_count  TYPE i,
            dir_count   TYPE i.
      DATA: file_table  LIKE sdokpath OCCURS 0 WITH HEADER LINE,
            dir_table   LIKE sdokpath OCCURS 0 WITH HEADER LINE,
            source      LIKE rlgrap-filename,
            destination LIKE rlgrap-filename,
            dest_path   like rlgrap-filename,
            return TYPE i.
    data : begin of it_bsak occurs 0,
           augbl like bsak-augbl,
           end of it_bsak.
    SELECTION-SCREEN BEGIN OF BLOCK BK1 WITH FRAME.
        PARAMETERS : P_CMCD LIKE BSIK-BUKRS OBLIGATORY DEFAULT 'WT01'.
        PARAMETERS : P_FLNM LIKE RLGRAP-FILENAME OBLIGATORY.
        PARAMETERS : P_FSYR LIKE BSIK-GJAHR OBLIGATORY. "ADDED mod01
    SELECTION-SCREEN SKIP.
        PARAMETERS : PX_TEST AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN END OF BLOCK BK1.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
    SELECTION-SCREEN COMMENT 1(70) m_info.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN COMMENT 1(70) m_info1.
    SELECTION-SCREEN SKIP.
        PARAMETERS : PX_MOVE AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN END OF BLOCK B1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FLNM.
      Z_FNAME = 'regular.txt'.
      Z_PATH = 'c:\citibank\liabilitydoc\regular.txt'.
      MASK = ',.,..'.
      CALL FUNCTION 'WS_FILENAME_GET'
          EXPORTING
               DEF_FILENAME     = Z_FNAME
               DEF_PATH         = Z_PATH
               MASK             = MASK
               MODE             = 'O'
            TITLE            = ' '
          IMPORTING
               FILENAME         = P_FLNM
            RC               =
           EXCEPTIONS
                INV_WINSYS       = 1
                NO_BATCH         = 2
                SELECTION_CANCEL = 3
                SELECTION_ERROR  = 4
                OTHERS           = 5.
      IF SY-SUBRC <> 0.
        MESSAGE I000(E4) WITH 'File Upload Error'.
      ENDIF.
    AT SELECTION-SCREEN OUTPUT.
      m_info =
        'Before BDC Run - First move all the files from directory'.
    M_INFO1 ='C:\CITIBANK\PAYDOC_IMPORT\ to C:\CITIBANK\PAYDOC_PROCESSED'.
    P_FLNM = 'c:\citibank\liabilitydoc\regular.txt'.
    START-OF-SELECTION.
      CALL FUNCTION 'WS_UPLOAD'
           EXPORTING
                FILENAME                = P_FLNM
                FILETYPE                = 'DAT'
           TABLES
                DATA_TAB                = IT_TAB1[]
           EXCEPTIONS
                CONVERSION_ERROR        = 1
                FILE_OPEN_ERROR         = 2
                FILE_READ_ERROR         = 3
                INVALID_TYPE            = 4
                NO_BATCH                = 5
                UNKNOWN_ERROR           = 6
                INVALID_TABLE_WIDTH     = 7
                GUI_REFUSE_FILETRANSFER = 8
                CUSTOMER_ERROR          = 9
                OTHERS                  = 10.
    START-OF-SELECTION.
    CALL FUNCTION 'Z_GET_FISCALYEAR'
         EXPORTING
              PDATE   = sy-datum
        IMPORTING
             PYEAR   = FSYR
    begin of mod01 +
    loop at it_tab1.
    select single lifnr into it_tab-lifnr from bseg
                              where bukrs = p_cmcd and
                              belnr = it_tab1-belnr and
                              gjahr = p_fsyr.
    if sy-subrc <> 0.
            MOVE P_CMCD TO IT_ERROR-BUKRS.
            MOVE IT_TAB1-BELNR TO IT_ERROR-BELNR.
            MOVE FSYR TO IT_ERROR-GJAHR.
            MOVE 'A' TO IT_ERROR-REJ.
            APPEND IT_ERROR.
            CLEAR IT_ERROR.
            delete it_tab1.
    else.
        it_tab-belnr = it_tab1-belnr.
        it_tab-wrbtr = it_tab1-wrbtr.
        append it_tab.
        clear it_tab.
    endif.
    endloop.
    end of mod01 + ************
    SORT IT_TAB BY BELNR.
    LOOP AT IT_TAB.
          select SINGLE bukrs
                        lifnr
                        gjahr
                        belnr
                        wrbtr
                        rebzg
                        zlspr
                        shkzg into
                       (it_bsik-bukrs,
                       it_bsik-lifnr,
                       it_bsik-gjahr,
                       It_bsik-belnr,
                       it_bsik-wrbtr,
                       it_bsik-rebzg,
                       it_bsik-zlspr,
                       it_bsik-SHKZG)
                from bsik where
                 bukrs = P_CMCD and
                gjahr = fsyr and    " MOD01 -
                lifnr = it_tab-lifnr and
                 gjahr = P_FSYR and     "MOD01 +
                 belnr = it_tab-belnr.
          IF SY-SUBRC <> 0.
            MOVE P_CMCD TO IT_ERROR-BUKRS.
            MOVE IT_TAB-BELNR TO IT_ERROR-BELNR.
            MOVE FSYR TO IT_ERROR-GJAHR.
            MOVE 'A' TO IT_ERROR-REJ.
            APPEND IT_ERROR.
            CLEAR IT_ERROR.
            delete it_tab.
          ELSE.
              APPEND IT_BSIK.
              CLEAR IT_BSIK.
          ENDIF.
    ENDLOOP.
    SORT IT_BSIK BY LIFNR.
    LOOP AT IT_BSIK.
    select single ktokk from lfa1 into lfa1-ktokk.
    select single xcpds from t077k into t077k-xcpds where ktokk = lfa1-ktokk
        IF IT_BSIK-ZLSPR <> ''.
            MOVE IT_BSIK TO IT_ERROR-BUKRS.
            MOVE IT_BSIK-BELNR TO IT_ERROR-BELNR.
            MOVE IT_BSIK-GJAHR TO IT_ERROR-GJAHR.
            MOVE 'B' TO IT_ERROR-REJ.
            APPEND IT_ERROR.
            CLEAR IT_ERROR.
            delete it_bsik.
        elseif t077k-xcpds = 'X'.
            MOVE IT_BSIK TO IT_ERROR-BUKRS.
            MOVE IT_BSIK-BELNR TO IT_ERROR-BELNR.
            MOVE IT_BSIK-GJAHR TO IT_ERROR-GJAHR.
            MOVE 'G' TO IT_ERROR-REJ.
            APPEND IT_ERROR.
            CLEAR IT_ERROR.
            delete it_bsik.
        ENDIF.
    ENDLOOP.
    SORT IT_BSIK BY LIFNR BELNR.
    LOOP AT IT_BSIK.
    SELECT SINGLE ZLSPR FROM BSIK INTO BSIK-ZLSPR WHERE
      BUKRS = IT_BSIK-BUKRS AND LIFNR = IT_BSIK-LIFNR AND
      GJAHR = IT_BSIK-GJAHR AND REBZG = IT_BSIK-BELNR.
      IF BSIK-ZLSPR <> ' '.
              MOVE IT_BSIK TO IT_ERROR-BUKRS.
            MOVE IT_BSIK-BELNR TO IT_ERROR-BELNR.
            MOVE IT_BSIK-GJAHR TO IT_ERROR-GJAHR.
            MOVE 'B' TO IT_ERROR-REJ.
            APPEND IT_ERROR.
            CLEAR IT_ERROR.
            delete it_bsik.
    ENDIF.
    ENDLOOP.
    sort it_bsik by lifnr.
    loop at it_bsik.
        ON CHANGE OF IT_BSIK-LIFNR.
          MOVE IT_BSIK-LIFNR TO IT_LFA1-LIFNR.
          APPEND IT_LFA1.
          CLEAR IT_LFA1.
        ENDON.
    endloop.
    SORT IT_LFA1 BY LIFNR.
    LOOP AT IT_LFA1.
          SELECT SINGLE SPERZ FROM LFA1 INTO LFA1-SPERZ WHERE
          LIFNR = IT_LFA1-LIFNR.
          IF LFA1-SPERZ = 'X'.
            MOVE IT_LFA1-LIFNR TO IT_ERROR-LIFNR.
            MOVE 'C' TO IT_ERROR-REJ.
            APPEND IT_ERROR.
            CLEAR IT_ERROR.
            delete it_lfa1.
          ENDIF.
    ENDLOOP.
    sort it_bsik by belnr.
    sort it_tab by belnr.
    loop at it_bsik.
        read table it_tab with key belnr = it_bsik-belnr binary search.
         if sy-subrc = 0.
             move it_tab-wrbtr to it_bsik-partl.
             modify it_bsik transporting partl.
         endif.
    endloop.
    SORT IT_BSIK BY BUKRS LIFNR GJAHR BELNR.
    LOOP AT IT_BSIK.
        SELECT SINGLE XPORE INTO IT_BSIK-XPORE FROM LFB1
        WHERE LIFNR = IT_BSIK-LIFNR.
        MODIFY IT_BSIK TRANSPORTING XPORE.
        CLEAR : M_WRBTR_H,M_WRBTR_S,M_WRBTR_NET.
        SELECT WRBTR SHKZG INTO (BSIK-WRBTR,BSIK-SHKZG) FROM BSIK
        WHERE BUKRS = IT_BSIK-BUKRS AND
              LIFNR = IT_BSIK-LIFNR AND
              GJAHR = IT_BSIK-GJAHR AND
              REBZG = IT_BSIK-BELNR.
         IF BSIK-SHKZG = 'H'.
              M_WRBTR_H = M_WRBTR_H + BSIK-WRBTR.
         ELSEIF BSIK-SHKZG = 'S'.
              M_WRBTR_S = M_WRBTR_S + BSIK-WRBTR.
         ENDIF.
       ENDSELECT.
       M_WRBTR_NET = IT_BSIK-WRBTR + M_WRBTR_H - M_WRBTR_S.
       IF M_WRBTR_NET LT 0.
            MOVE IT_BSIK TO IT_ERROR-BUKRS.
            MOVE IT_BSIK-BELNR TO IT_ERROR-BELNR.
            MOVE IT_BSIK-GJAHR TO IT_ERROR-GJAHR.
            MOVE 'D' TO IT_ERROR-REJ.
            APPEND IT_ERROR.
            CLEAR IT_ERROR.
            delete it_bsik.
       ELSEIF M_WRBTR_NET GT '100000000.00'.
            MOVE IT_BSIK TO IT_ERROR-BUKRS.
            MOVE IT_BSIK-BELNR TO IT_ERROR-BELNR.
            MOVE IT_BSIK-GJAHR TO IT_ERROR-GJAHR.
            MOVE 'E' TO IT_ERROR-REJ.
            APPEND IT_ERROR.
            CLEAR IT_ERROR.
            delete it_bsik.
       ELSE.
          MOVE M_WRBTR_NET TO IT_BSIK-NTAMT.
         MODIFY IT_BSIK TRANSPORTING NTAMT.
       ENDIF.
    ENDLOOP.
    concatenate 'CITI/RTGS/NEFT/' sy-datum6(2) '.' sy-datum4(2) '.'
    sy-datum(4) into str.
    SORT IT_BSIK BY XPORE.
    LOOP AT IT_BSIK.
      IF IT_BSIK-XPORE = 'X'.
          MOVE-CORRESPONDING IT_BSIK TO IT_INVN.
          APPEND IT_INVN.
          CLEAR : IT_INVN.
          DELETE IT_BSIK.
      ENDIF.
    ENDLOOP.
    if px_move = 'X'.
        perform file_move.
    endif.
    IF PX_TEST = 'X'.
        perform sub_output_run.
    ELSE.
    SORT IT_LFA1 BY LIFNR.
    SORT IT_BSIK BY LIFNR.
    SORT IT_INVN BY LIFNR.
    concatenate sy-datum6(2) '.' sy-datum4(2) '.' sy-datum(4) into dat.
    LOOP AT IT_LFA1.
    SELECT SINGLE XPORE FROM LFB1 INTO LFB1-XPORE WHERE
    LIFNR = IT_LFA1-LIFNR.
    IF LFB1-XPORE = ' '.
    clear : m_amnt,M_PAMNT, M_NTAMNT,FLAG.
        LOOP AT IT_BSIK WHERE LIFNR = IT_LFA1-LIFNR.
            IF IT_BSIK-XPORE = ' '.
                M_PAMNT = M_PAMNT + IT_BSIK-PARTL.
                m_amnt = m_amnt + it_bsik-ntamt.
            endif.
        ENDLOOP.
       perform populate_bdc_tab using: '1' 'SAPMF05A' '0103',
                                       ' ' 'BKPF-BLDAT' dat,
                                       ' ' 'BKPF-BLART' 'BR',
                                       ' ' 'BKPF-BUKRS' P_CMCD,
                                       ' ' 'RF05A-AUGTX' STR,
                                       ' ' 'RF05A-KONTO' '632118',
                                       ' ' 'BSEG-GSBER' 'T100'.
          IF M_PAMNT <> '0.00'.
              FLAG = 'X'.
              M_AMOUNT = M_PAMNT.
              condense m_amount.
              PERFORM POPULATE_BDC_TAB USING: ' ' 'BSEG-WRBTR' M_AMOUNT.
          ELSE.
              M_AMOUNT = M_AMNT.
              condense m_amount.
              PERFORM POPULATE_BDC_TAB USING: ' ' 'BSEG-WRBTR' M_AMOUNT.
          ENDIF.
          PERFORM POPULATE_BDC_TAB USING: ' ' 'RF05A-AGKON' it_LFA1-LIFNR,
                                          ' ' 'BDC_OKCODE' '/00'.
        loop at it_bsik where lifnr = it_lfa1-lifnr.
          PERFORM POPULATE_BDC_TAB USING: '1' 'SAPDF05X' '3100',
                                         ' ' 'BDC_OKCODE' '=OSU'.
               PERFORM POPULATE_BDC_TAB USING: '1' 'SAPDF05X' '2000',
                                         ' ' 'RF05A-XPOS1(03)' 'X',
                                         ' ' 'BDC_OKCODE' '=GO'.
                 PERFORM POPULATE_BDC_TAB USING: '1' 'SAPDF05X' '0731',
                                        ' ' 'RF05A-SEL01(01)' it_bsik-belnr,
                                        ' ' 'BDC_OKCODE' '=GO'.
                PERFORM POPULATE_BDC_TAB USING: '1' 'SAPDF05X' '3100',
                                        ' ' 'BDC_OKCODE' '=OMK'.
                  PERFORM POPULATE_BDC_TAB USING: '1' 'SAPDF05X' '3100',
                                        ' ' 'BDC_OKCODE' '=Z+'.
              PERFORM POPULATE_BDC_TAB USING: '1' 'SAPDF05X' '3100',
                                        ' ' 'BDC_OKCODE' '=OSE'.
        endloop.
                if FLAG = 'X'.
                    m_ntamnt = m_amnt - m_pamnt.
                    mt_ntamnt = m_ntamnt.
                    condense mt_ntamnt.
                    PERFORM POPULATE_BDC_TAB USING: '1' 'SAPDF05X' '3100',
                                        ' ' 'RF05A-AKOBT' mt_ntamnt,
                                        ' ' 'BDC_CURSOR' 'RF05A-AKOBT',
                                        ' ' 'BDC_SUBSCR' 'SAPDF05X',
                                        ' ' 'BDC_OKCODE' '=BU'.
                   PERFORM POPULATE_BDC_TAB USING: '1' 'SAPMF05A' '0700',
                                        ' ' 'BDC_CURSOR' 'RF05A-AZEI1(02)',
                                        ' ' 'BDC_OKCODE' '=PI'.
                   PERFORM POPULATE_BDC_TAB USING: '1' 'SAPMF05A' '0302',
                                      ' ' 'BSEG-SGTXT' 'CUMULATIVE PAYMENT',
                                        ' ' 'BDC_OKCODE' '=BU'.
                else.
                   PERFORM POPULATE_BDC_TAB USING: '1' 'SAPDF05X' '3100',
                                        ' ' 'BDC_OKCODE' '=BU'.
                endif.
           CALL TRANSACTION 'F-53' USING T_BDC_TAB MODE 'A'.
    if sy-subrc = 0.
      refresh T_BDC_TAB.
    endif.
       else.
        loop at it_INVN where lifnr = it_lfa1-lifnr.
        CLEAR : FLAGE.
       perform populate_bdc_tab using: '1' 'SAPMF05A' '0103',
                                       ' ' 'BKPF-BLDAT' dat,
                                       ' ' 'BKPF-BLART' 'BR',
                                       ' ' 'BKPF-BUKRS' P_CMCD,
                                       ' ' 'RF05A-AUGTX' STR.
          IF IT_INVN-XPORE = 'X' AND IT_INVN-PARTL <> '0.00'.
            SELECT SINGLE XBLNR BSCHL INTO (BSIK-XBLNR,BSIK-BSCHL) FROM
                    BSIK WHERE
                     BUKRS = IT_INVN-BUKRS AND
                     LIFNR = IT_INVN-LIFNR AND
                     GJAHR = IT_INVN-GJAHR AND
                     BELNR = IT_INVN-BELNR.
          IF BSIK-BSCHL = '31'.
                perform populate_bdc_tab using: ' ' 'BKPF-BKTXT' BSIK-XBLNR.
          ELSE.
              SELECT SINGLE BKTXT FROM BKPF INTO BKPF-BKTXT WHERE
                  BUKRS = IT_INVN-BUKRS AND
                  BELNR = IT_INVN-BELNR AND
                  GJAHR = IT_INVN-GJAHR.
                perform populate_bdc_tab using: ' ' 'BKPF-BKTXT' BKPF-BKTXT.
          ENDIF.
        ENDIF.
            PERFORM POPULATE_BDC_TAB USING: ' ' 'RF05A-KONTO' '632118'.
            PERFORM POPULATE_BDC_TAB USING: ' ' 'BSEG-GSBER' 'T100'.
          IF IT_INVN-XPORE = 'X' AND IT_INVN-PARTL <> '0.00'.
              FLAGE = 'X'.
              M_PARTL = IT_INVN-PARTL.
              CONDENSE m_partl.
              PERFORM POPULATE_BDC_TAB USING: ' ' 'BSEG-WRBTR' M_PARTL.
          ELSE.
              M_PARTL = IT_INVN-NTAMT.
              condense m_partl.
              PERFORM POPULATE_BDC_TAB USING: ' ' 'BSEG-WRBTR' M_PARTL.
          ENDIF.
           PERFORM POPULATE_BDC_TAB USING: ' ' 'RF05A-AGKON' it_LFA1-LIFNR,
                                           ' ' 'BDC_OKCODE' '/00'.
               PERFORM POPULATE_BDC_TAB USING: '1' 'SAPDF05X' '3100',
                                         ' ' 'BDC_OKCODE' '=OSU'.
               PERFORM POPULATE_BDC_TAB USING: '1' 'SAPDF05X' '2000',
                                         ' ' 'RF05A-XPOS1(03)' 'X',
                                         ' ' 'BDC_OKCODE' '=GO'.
                 PERFORM POPULATE_BDC_TAB USING: '1' 'SAPDF05X' '0731',
                                        ' ' 'RF05A-SEL01(01)' it_INVN-belnr,
                                        ' ' 'BDC_OKCODE' '=GO'.
                PERFORM POPULATE_BDC_TAB USING: '1' 'SAPDF05X' '3100',
                                        ' ' 'BDC_OKCODE' '=OMK'.
                  PERFORM POPULATE_BDC_TAB USING: '1' 'SAPDF05X' '3100',
                                        ' ' 'BDC_OKCODE' '=Z+'.
                 if FLAGE = 'X'.
                    m_Pntamnt = IT_INVN-NTAMT - IT_INVN-PARTL.
                    mt_Pntamnt = m_Pntamnt.
                    condense mt_pntamnt.
                    PERFORM POPULATE_BDC_TAB USING: '1' 'SAPDF05X' '3100',
                                        ' ' 'RF05A-AKOBT' mt_Pntamnt,
                                        ' ' 'BDC_CURSOR' 'RF05A-AKOBT',
                                        ' ' 'BDC_SUBSCR' 'SAPDF05X',
                                        ' ' 'BDC_OKCODE' '=BU'.
                   PERFORM POPULATE_BDC_TAB USING: '1' 'SAPMF05A' '0700',
                                        ' ' 'BDC_CURSOR' 'RF05A-AZEI1(02)',
                                        ' ' 'BDC_OKCODE' '=PI'.
                IF BSIK-BSCHL = '31'.
                   PERFORM POPULATE_BDC_TAB USING: '1' 'SAPMF05A' '0302',
                                      ' ' 'BSEG-SGTXT' BSIK-XBLNR,
                                        ' ' 'BDC_OKCODE' '=BU'.
                ELSE.
                   PERFORM POPULATE_BDC_TAB USING: '1' 'SAPMF05A' '0302',
                                      ' ' 'BSEG-SGTXT' BKPF-BKTXT,
                                        ' ' 'BDC_OKCODE' '=BU'.
                ENDIF.
                else.
                   PERFORM POPULATE_BDC_TAB USING: '1' 'SAPDF05X' '3100',
                                        ' ' 'BDC_OKCODE' '=BU'.
                endif.
          CALL TRANSACTION 'F-53' USING T_BDC_TAB MODE 'A'.
    if sy-subrc = 0.
      refresh T_BDC_TAB.
    endif.
        endloop.
    ENDIF.
    wait  up to 3 seconds.
    ENDLOOP.
    clear : count, counter.
    SORT IT_BSIK BY BUKRS LIFNR GJAHR BELNR.
    wait up to 60 seconds.
    loop at it_bsik.
    count = count + 1.
        select SINGLE augbl from bsak into bsak-augbl
    where
              bukrs = it_bsik-bukrs and
              lifnr = it_bsik-lifnr and
              AUGBL <> IT_BSIK-BELNR AND
              gjahr = it_bsik-gjahr and
              belnr = it_bsik-belnr.
                  move bsak-augbl to it_bsak-augbl.
                  append it_bsak.
                  clear it_bsak.
    endloop.
    SORT IT_INVN BY BUKRS LIFNR GJAHR BELNR.
    loop at it_INVN.
    count = count + 1.
        select single augbl from bsak into bsak-augbl
    where
              bukrs = it_invn-bukrs and
              lifnr = it_invn-lifnr and
              gjahr = it_invn-gjahr and
              belnr = it_invn-belnr AND
              SHKZG = 'H'.
                  move bsak-augbl to it_bsak-augbl.
                  append it_bsak.
                  clear it_bsak.
    endloop.
    SORT IT_BSAK BY AUGBL.
    delete ADJACENT DUPLICATES from it_bsak comparing augbl.
    DESCRIBE TABLE it_bsak LINES counter.
    SORT IT_BSAK BY AUGBL.
    PERFORM get_file_name.
    CALL FUNCTION 'GUI_DOWNLOAD'
         EXPORTING
              FILENAME                = file_path
             FILETYPE                = 'ASC'
         TABLES
              DATA_TAB                = it_bsak
    format color col_heading intensified off.
    uline.
    Write : /50 'F-53 BDC Run Successfully'.
    format color off.
    uline.
    format color col_normal intensified off.
    write : /20 'Payment Document File is store in following Path'.
    write : /35 'C:\CITIBANK\PAYDOC_IMPORT\'.
    uline.
    format color off.
    uline.
    format color col_total.
    write : /20 'Total No of Liability Documents Processed ', count no-zero.
    write : /20 'Total No of Payment Documents Generated   ', counter
    no-zero.
    format color off.
    uline.
    ENDIF.
    *&      Form  SUB_OUTPUT_RUN
          text
    -->  p1        text
    <--  p2        text
    FORM SUB_OUTPUT_RUN.
    data : SRNO type i value 0,
           srno1 type i value 0,
           srno2 TYPE i value 0,
           srno3 TYPE i value 0,
           srno4 TYPE i value 0,
           srno5 type i value 0.
      FORMAT COLOR col_heading intensified off .
      ULINE.
      WRITE:/35 'TEST RUN'.
      ULINE.
      FORMAT COLOR 5 INTENSIFIED OFF.
    SORT IT_ERROR BY REJ.
    LOOP AT IT_ERROR.
        ON CHANGE OF IT_ERROR-REJ.
          IF IT_ERROR-rej = 'A'.
          FORMAT COLOR col_heading INTENSIFIED OFF.
          ULINE.
    WRITE : /'Following Documents are already cleared or do not exist in'.
    write : 'current financial year'.   "MOD01 +
        uline.
         format color off.
          elseif it_error-rej = 'B'.
                FORMAT COLOR COL_HEADING INTENSIFIED OFF.
          ULINE.
    WRITE : /'Following Documents are Blocked for Payment'
        uline.
         format color off.
          elseif it_error-rej = 'C'.
                FORMAT COLOR COL_HEADING INTENSIFIED OFF.
          ULINE.
    WRITE : /'Following Vendors are Blocked for Payment'
        uline.
         format color off.
          elseif it_error-rej = 'D'.
                FORMAT COLOR COL_HEADING INTENSIFIED OFF.
          ULINE.
    WRITE : /'Amount is less than 0 for following Documents'
        uline.
         format color off.
          elseif it_error-rej = 'E'.
                FORMAT COLOR COL_HEADING INTENSIFIED OFF.
          ULINE.
    WRITE : /'Amount is greater than 10 crores for following Documents'
        uline.
         format color off.
          elseif it_error-rej = 'E'.
                FORMAT COLOR COL_HEADING INTENSIFIED OFF.
          ULINE.
    WRITE : /'One Time Vendor'.
        uline.
         format color off.
       endif.
       endon.
       if it_error-rej = 'A'.
        srno = srno + 1.
        format color COL_NORMAL.
        write : /10 srno,35 it_error-belnr.
        format color off.
       elseif it_error-rej = 'B'.
        srno1 = srno1 + 1.
        format color COL_NORMAL.
        write : /10 srno1,35 it_error-belnr.
        format color off.
       elseif it_error-rej = 'C'.
        srno2 = srno2 + 1.
        format color COL_NORMAL.
        write : /10 srno2,35 it_error-lifnr.
        format color off.
       elseif it_error-rej = 'D'.
        srno3 = srno3 + 1.
        format color COL_NORMAL.
        write : /10 srno3,35 it_error-belnr.
        format color off.
       elseif it_error-rej = 'E'.
        srno4 = srno4 + 1.
        format color COL_NORMAL.
        write : /10 srno4,35 it_error-belnr.
        format color off.
       elseif it_error-rej = 'G'.
        srno5 = srno5 + 1.
        format color COL_NORMAL.
        write : /10 srno5,35 it_error-lifnr.
        format color off.
       endif.
    endloop.
    if it_error is initial.
         FORMAT COLOR COL_HEADING INTENSIFIED OFF.
          ULINE.
    WRITE : /'Test Run not find any Document with Error'
        uline.
         format color off.
    endif.
    clear : srno,srno1,srno2,srno3,srno4,srno5.
    ENDFORM.                    " SUB_OUTPUT_RUN
    *&      Form  POPULATE_BDC_TAB
          text
         -->P_0217   text
         -->P_0218   text
         -->P_0219   text
    form populate_bdc_tab using    value(flag)
                                   value(var1)
                                   value(var2).
      clear t_bdc_tab.
      if flag = '1'.
        t_bdc_tab-program = var1.          " Program Name
        t_bdc_tab-dynpro = var2.           " Screen Number
        t_bdc_tab-dynbegin = 'X'.          " Starting of new screen
      else.
        t_bdc_tab-fnam = var1.             " Field Name
        t_bdc_tab-fval = var2.             " Field Value
      endif.
      append t_bdc_tab.
       endform.                               " POPULATE_BDC_TAB
    *&      Form  FILE_MOVE
          text
    -->  p1        text
    <--  p2        text
    FORM FILE_MOVE.
    file_path = 'c:\citibank\paydoc_import\'.
    dest_path = 'c:\citibank\paydoc_processed\'.
        CALL FUNCTION 'TMP_GUI_DIRECTORY_LIST_FILES'
          EXPORTING
            directory  = file_path
            filter     = '.'
          IMPORTING
            file_count = file_count
            dir_count  = dir_count
          TABLES
            file_table = file_table
            dir_table  = dir_table
          EXCEPTIONS
            cntl_error = 1
            OTHERS     = 2.
        IF sy-subrc = 0.
          LOOP AT file_table.
            CONCATENATE dest_path file_table-pathname
            INTO destination.
            CONCATENATE file_path file_table-pathname
            INTO source.
            CALL FUNCTION 'WS_FILE_COPY'
              EXPORTING
                destination = destination
                SOURCE      = SOURCE
              importing
                return      = return.
            CALL FUNCTION 'WS_FILE_DELETE'
              EXPORTING
                file   = source
              IMPORTING
                return = return.
          ENDLOOP.
          CALL FUNCTION 'TMP_GUI_DIRECTORY_LIST_FILES'
            EXPORTING
              directory  = file_path
              filter     = '.'
            IMPORTING
              file_count = file_count
              dir_count  = dir_count
            TABLES
              file_table = file_table
              dir_table  = dir_table
            EXCEPTIONS
              cntl_error = 1
              OTHERS     = 2.
          IF file_count > 0.
          write : /'Error copying', source, 'to', destination.
           CONCATENATE 'Error copying' source 'to' destination
           INTO i_error SEPARATED BY space.
           APPEND i_error.
          ENDIF.
        ENDIF.
    ENDFORM.                    " FILE_MOVE
    *&      Form  GET_FILE_NAME
          text
    -->  p1        text
    <--  p2        text
    FORM GET_FILE_NAME.
    file_path = 'c:\citibank\paydoc_import\'.
      CLEAR : zcitibank2.
      SELECT SINGLE * FROM zcitibank2 INTO zcitibank2
                      WHERE citi_field = 'FNAME'.
      id1 = zcitibank2-citi_val .
      IF zcitibank2-sap_val <> sy-datum .
        zcitibank2-sap_val = sy-datum .
        UPDATE zcitibank2 SET citi_val = '001'
                              sap_val  = sy-datum
                              WHERE citi_field = 'FNAME'.
    *sap_val = sy-datum.
      ELSE.
        id1 = id1 + 1.
        UPDATE zcitibank2 SET citi_val = id1
                                        WHERE citi_field = 'FNAME' AND
                                                 sap_val = sy-datum.
      ENDIF.
      CLEAR : zcitibank2.
      SELECT SINGLE * FROM zcitibank2 WHERE citi_field = 'FNAME'.
    CONCATENATE SY-DATUM SY-UZEIT INTO M_FILE SEPARATED BY SPACE.
      CONCATENATE zcitibank2-sap_val zcitibank2-citi_val INTO m_file
    SEPARATED  BY '_'.
      CONCATENATE file_path m_file '.'
      'txt' INTO file_path.
    ENDFORM.                    " GET_FILE_NAME

  • Hi abap experts . regarding one query

    1. Please tell me How to retrieve data into INPUT/OUTPUT field.
    For example.When u display a particular row from emp table.I want to display the row number ie SY-TFILL in the INPUT/OUTPUT field.i need it very urgently.?
    2.      1. i have two internal tables. both tables  which is having 5 records.
    itab1        itab2
    1             1
    3             3
    5             7
    6             9
    8             10.
    i want to develop an report which is used to print the same data (1,3) in both tables.
    in this only one time we are supposed to compare both internal tables?
    tell me logic how we will do that?
    2. in selection screen only one parameter field is there. in that i entered data and press enter?at that time what are all the events are supposed to trigger?
    3.can we delete data in one internal table with help of another internal table data?
    like let us consider this scenerio
    itab1                                    itab2
    material no     description             material no       material type
    100             some                      100                         10
    101             thing                       101                         10
    103             line                         103                         13
    104             row type                  104                         15
    106             linetype                   106                         16
    can i delete material no (100,101)in itab1 with the help of  record material type (10) of itab2

    Hi
    Just use the Transaction
    <b>SEARCH_SAP_MENU</b>
    and enter your correct text and execute
    it will give the menu path
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • ABAP experts : Query

    In transaction MIR7, notes tab, I can enter 'free hand text'.
    Now in transaction FBL1N, can I actually see the 'free hand txt' that I entered above.
    Can this be done as a user exit/screen exit/variant/customization that I can see the free text entered in transaction MIR7 (notes tab) in FBL1N.
    Any pointers would be useful.Thanks
    Message was edited by:
            S V

    Hi,
    I feel that it is not possible to get that LONG TEXT which you enter in MIR7 (notes) to FBL1N.
    You have to fetch that Long text using the fun module READ_TEXT and to fetch that, as that field is not stored in Standard related tables for FBL1N.
    Have to copy the code of FBL1N program and to modify it to get that text.
    reward if useful
    regards,
    ANJI

  • Getting JS variable value in ABAP variable

    hi experts,
    I am fairly new to ABAP programming so please bear with me. To my issue.
    I am creating a BSP which will read from the tax number table in CRM into an itab.
    Next it loops into an wa and then passes each tax number through a javascript/JQuery API to validate the number. 
    The JSON response then comes back and is stored in a JS variable.
    I am unclear how to get this into an ABAP variable so I can handle as needed.  I have read some posts but they seem to be created for those ABAP experts which I am not there yet.
    Any help is most appreciated.
    thank you kindly!
    Chris

    Thanks for the reply Kiran.
    I am still stuck where I try to create the hidden field, assign the JS variable value to it and then retrieve on server side using ABAP.
    I read some places where it mentions accessing in the controller but this is not specific enough for me to know what to do.  Here is a snippet of my JS/html code.
    <form id="api">
    <div><input type="hidden" name="json" id="json" value="" /></div>
    var json = data;
    document.getElementById("json").value = json;
    document.api.submit();
    </form>
    I am using a Jquery api to get a boolean value and storing it in the json variable.  then I want to pass that value to an ABAP variable.  I did maintain a page attribute of json type STRING as well.  I also tried maintaining a controller class attribute of the same.  I did not redefine any controller class methods.
    Your help is most appreciated.
    thx
    Chris

  • Help on ABAP Function Module (Unit 1)

    Hello ABAP Experts,
    I need help with the below mentioned lesson plan. I donot have source code for The ABAP Function Module - BC401_GET_SEP_STRING. For the Source Code Solution in the Lesson Plan to work, I need the source code for the above mentioned function module.
    The Lesson Plan with Solution is posted below:
    Exercise 1 
    Unit: Data Types and Data Objects in Detail
    Topic: Defining Data Types and Data Objects
    Basic Statements
    Processing Character Strings
    At the conclusion of these exercises, you will be able to:
    u2022     Define structure types locally in the program
    u2022     Define elementary and complex data objects
    u2022     Split strings
    u2022     Use conversion rules
    u2022     Display the contents of data objects in lists
    In this exercise, you will use a template to create a program that receives a single data record from the database table SFLIGHT in form of a character string. The program will split the this character string into its components and display it formatted in a list.
    Because the focus of this exercise is not on the transfer of data as a character string, we will use a function module that will provide us with the required database. This will simulate actual cases, such as data transfer from an external system.
    Program: ZBC401_##_SPLIT_STRING
    Template: SAPBC401_DTOT_SPLIT_STRING
    Model solution: SAPBC401_DTOS_SPLIT_STRING
    is your two-digit group number
    1-1 Copy the program, SAPBC401_DTOT_SPLIT_STRING and give it the new name ZBC401_##_SPLIT_STRING.
    1-2 Familiarize yourself with the main body of the program. Pay special attention to the content of the data object datastring after the function module call. Use the Debugger to do this, and/or display the character string in a list. (The function module itself is here seen as a black box. For this exercise, it is not necessary to understand its construction.)
    1-3 To be able to split the character string into its components you must first remove the ## characters. Remove the two leading separators from the character string first. Then copy the initial part up to the closing separators to the auxiliary variable set_string. For this, set_string has to be defined appropriately.
    1-4 Now use the separators to split the contents of the auxiliary variable set_string into the structure wa_flight_c. The latter is typed with the local program structure type st_flight_c. You still have to comment out the components of this structure type and assign them an appropriate type.
    1-5 As a test, display the fields of the structure, wa_flight_c in a list.
    1-6 In the list displayed in exercise 1-5, you should have observed that some of the fields were displayed without formatting u2013 for example, the PRICE field. Your next step is to change this.
    To do this, convert the data you have extracted by copying it to data objects with suitable types. Also, not all components of wa_flight_c are to be displayed.
    For this purpose, a structure wa_flight has already been defined. It is typed with the structure type st_flight. You must comment out the components of st_flight and find appropriate types for these components for the formatting. Then copy the identically-named components of the character-type structure wa_flight_c to the fields of the structure wa_flight.
    Display the contents of the structure wa_flight in a list. Use the appropriate formatting options for the WRITE statement for the fldate and price components.
    Data Types and Data Objects in Detail Solution 1
    Unit: Data Types and Data Objects in Detail
    Topic: Defining Data Types and Data Objects
    Basic Statements
    Processing Character Strings
    REPORT sapbc401_dtos_split_string.
    TYPES:
    BEGIN OF st_flight_c,
    mandt(3) TYPE c,
    carrid(3) TYPE c,
    connid(4) TYPE n,
    fldate(8) TYPE n,
    price(20) TYPE c,
    currency(5) TYPE c,
    planetype(10) TYPE c,
    seatsmax(10) TYPE n,
    seatsocc(10) TYPE n,
    paymentsum(22) TYPE c,
    seatsmax_b(10) TYPE n,
    seatsocc_b(10) TYPE n,
    seatsmax_f(10) TYPE n,
    seatsocc_f(10) TYPE n,
    END OF st_flight_c,
    BEGIN OF st_flight,
    carrid(3) TYPE c,
    connid(4) TYPE n,
    fldate TYPE d,
    price(9) TYPE p DECIMALS 2,
    currency(5) TYPE c,
    planetype(10) TYPE c,
    seatsmax TYPE i,
    seatsocc TYPE i,
    END OF st_flight.
    DATA:
    datastring TYPE string,
    set_string TYPE string,
    wa_flight_c TYPE st_flight_c,
    wa_flight TYPE st_flight.
    START-OF-SELECTION.
    CALL FUNCTION 'BC401_GET_SEP_STRING'
    EXPORTING
    IM_NUMBER = '1'
    IM_TABLE_NAME = 'SFLIGHT'
    IM_SEPARATOR = '#'
    IM_UNIQUE = 'X'
    IMPORTING
    ex_string = datastring
    EXCEPTIONS
    no_data = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    MESSAGE a038(bc401).
    ENDIF.
    SHIFT datastring BY 2 PLACES.
    FIND '##' IN datastring.
    IF sy-subrc <> 0.
    MESSAGE a702(bc401).
    ENDIF.
    SPLIT datastring AT '##' INTO set_string datastring.
    SPLIT set_string AT '#' INTO
    wa_flight_c-mandt
    wa_flight_c-carrid
    wa_flight_c-connid
    wa_flight_c-fldate
    wa_flight_c-price
    wa_flight_c-currency
    wa_flight_c-planetype
    wa_flight_c-seatsmax
    wa_flight_c-seatsocc
    wa_flight_c-paymentsum
    wa_flight_c-seatsmax_b
    wa_flight_c-seatsocc_b
    wa_flight_c-seatsmax_f
    wa_flight_c-seatsocc_f.
    MOVE-CORRESPONDING wa_flight_c TO wa_flight.
    WRITE: /
    wa_flight-carrid,
    wa_flight-connid,
    wa_flight-fldate DD/MM/YYYY,
    wa_flight-price CURRENCY wa_flight-currency,
    wa_flight-currency,
    wa_flight-planetype,
    wa_flight-seatsmax,
    wa_flight-seatsocc.

    this FM is to get one element value from the XML
    if you want to convert the whole XML use FM SMUM_XML_PARSE
    Regards
    Raja
    Kindly close your previous threads and assing points.
    Re: Creation of SIMPLE TRANSFORMATIO(ST)for deserialisation of XML ->ABAP data.

  • Can we show abap report(z t-code) in ESS through icon(besides leavemanage)

    I posted this in PORTAL forum..But think An ABAP expert would be able to comment.
    Hai guys,
    we have zreports done in R3 .(through dialog programing)they display in r/3 through Tcode.
    These reports are for HR purpose.
    when a user logs into ESS,he should be able to use these reports.
    the user needs to click an icon besides that of exsisting ones in his ESS.(the exsisting ones are LEAVE MANAGMENT,HR FORMS,etc)A new icon will be created for this purpose(lets say HR REPORTS).
    When the USer clicks on this icon,he will see 6 links for 6 reports.
    Each link will then open the report.
    How can we acheive this?
    One solution presented was,a TAB besides that of ESS.But we would like to navigate through ESS.(like we do for LEAVE MANAGMENT).
    Please suggest,all ways,easiest way.
    I ahve a feeling that there are many ways to acheive this,but theres some real smart solution which will work out in very less time.
    Pls give direction.

    Hi,
    First create seperate iviews for all the reports(can be t-code iviews or IAC iviews)
    All the links in ESS that appear inside a iview/page are services defined in SPRO. So create the services in the SPRO, then give the names, map the services with sub areas. Make sure these services are PCD type and give the PCD location of the iviews you created. Thats it your work is done...
    or the other way..
    Create a WDJava iview which lists all the reports you have to access, then in each link give the pcd location of the corrosponding iviews, then add this page/iview to ESS role, so that it comes under ESS Role...
    Other Way...
    Create iviews for all the reports you want to access...
    put all these iviews inside a single page and map this page to ESS Role....
    So that user can see the list of reports in detail navigation and on click he can see the corrosponding report....
    These are some of the ways I thought of...
    Regrds,
    Srinivas

  • Re: the similar decode sql command (in Oracle) in ABAP

    Dear ABAP Expert,
    Could you let me know where there is a similar decode command in Oracle in ABAP?
    Thanks.
    Arthur

    Hi,
    You can specify case statement between SELECT and ENDSELECT. However this may lead to performance problems. Please take care.
    Example:-
    SELECT FIELD1 into LOC_FIELD FROM TAB.
      CASE LOC_FIELD.
        WHEN 'ABC'.
          WRITE: 'ABC'.
        WHEN OTHERS.
          WRITE: 'REST'.
      ENDCASE.
    ENDSELECT.
    Thanks and Best Regards,
    Dinesh.

  • Purchase Order SAP abap statement

    Hi ABAP Expert,
    Need your help to solve my issue;
    If i what to get the detail on the PO number , i can get from table EKPO
    get EKPO-EBELN from EKPO
    how do i use sap statement to get the detail below
    1. PO with GR and Invoice
    2. PO with GR without Invoice
    3. PO without GR and Invoice

    You can get these from the table EKBE with the field BEWTP
    Check the table EKBE.
    1. PO with GR and Invoice
    2. PO with GR without Invoice
    3. PO without GR and Invoice
    Regards
    Gopi

  • How to retrieve the text in pa20 (HR-ABAP)

    Hi HR-ABAP experts,
    I Need to retrieve the text stored for a emplyee.below i am giving the full details,
    In Pa20 transaction if we give the perso. no and select the 0008 infotype.then click on overview tab.then in overview screen if  i select any record i.e any period of dates and clicks on display.in display window menu bar
    <b>EDIT-> maintain text</b> .
    they are maintaing some text in that.if i click on display text the text was displaying.
    i need to fetch that data in my custom report.
    can anybody helps from where this text can be selected.which ifotype?.
    hope my question is understood .
    Thanks,
    JK.
    Message was edited by:
            janakiram reddy madi reddy

    Hi,
    <ItemType name="uwl.task.webflow.decision.TS91100000" connector="WebFlowConnector" defaultView="DefaultView">
    <ItemTypeCriteria connector="WebFlowConnector" externalType="TS91100000"/>
    <Actions>
      <Action name="accept" groupAction="yes" handler="UserDecisionHandler">
       <Properties>
        <Property name="decisionKey" value="2"/>
        <Property name="UserDecisionNote" value="true"/>
       </Properties>
      </Action>
      <Action name="reject" groupAction="yes" handler="UserDecisionHandler">
       <Properties>
        <Property name="decisionKey" value="1"/>
       </Properties>
      </Action>
    </Actions>
    </ItemType>
    I have implemented the above code and i got the Text Box,  but now the problem is i couldnt retrieve the
    text entered in the Text box.  I checked in the  attachobjects   container element related to the task and the subsequent task but the text is not appearing there.  Can you help me to get the text entered in the text box.
    Thanks & Regards,
    Manikandan.S

Maybe you are looking for

  • Need Help with script: CS4 Flash Buttons

    I created a 3 button bar using Flash CS4. It will link to three different HTML pages in a website. This is one of the three scripts I have on the first frame of the main timeline, the code is for one of the buttons, the other two are really the same

  • How to get the current month for a variable based on info object 0FISCPER3

    Hie Gurus I am working on the financial reports i am failing to derive the Current month from the variable based on infobject 0FISCPER3 PERIOD . I would also like to get the same month from the prevoius year. Any ideas?

  • IMac Air High CPU Usage while Idle / Kernel Issues

    Hello, I am attempting to repair an MacBook Air that a customer spilled a small amount of orange juice into. I have completely taken the unit apart and thoroughly cleaned the motherboard and all components. There doesn't appear to be any physical dam

  • How do you scroll down in an embedded PDF

    I have tried a two finger scroll to no avail. The PDFs are loaded onto my school D2L system, so it won't let me download them only view them. However because I can't scroll I can't see past the first page ( it scrolls the entire web page instead of t

  • Windows 8 Consumer Preview issue on W520

    I installed the Windows 8 Consumer Preview last week and I have issues with ThinkVantage Toolbox and Lenovo System Update. - Once I launch the ThinkVantage gives me error with Un-identified OS. - Lenovo System Update gives me error once I start scann