SlideShare a Scribd company logo
1 of 4
FUNCTION /invmwl/fm_create_substitute_2 .
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(IV_US_NAME) TYPE XUBNAME
*" VALUE(IV_REP_NAME) TYPE XUBNAME
*" VALUE(IV_START_DATE) TYPE BEGDATUM
*" VALUE(IV_END_DATE) TYPE ENDDATUM
*" VALUE(IV_SUB_PROFILE) TYPE HR_REP_PRF OPTIONAL
*" VALUE(IV_IS_ACTIVE) TYPE HS_REP_ACT OPTIONAL
*" EXPORTING
*" VALUE(RETURN) TYPE BAPIRET2
*"----------------------------------------------------------------------
************************************************************************
* I N N O V A P P T I V E *
*----------------------------------------------------------------------*
* Object Name : /INVMWL/FM_CREATE_SUBSTITUTE_2 *
* Object Title : Create Substitution for a User *
* Transport # : <ERDK900864> *
* UserID : SPACHVA *
* Author : Srinivasa *
* Date : 2014-11-13 *
*----------------------------------------------------------------------*
* Description : *
* This RFC function Create Substitution for a User *
* *
*----------------------------------------------------------------------*
* Copy of Standard SAP Object: NO *
* Object Name : *
* N/A *
*----------------------------------------------------------------------*
* Includes : *
* N/A *
*----------------------------------------------------------------------*
* DB Tables Used: SELECT UPDATE INSERT DELETE *
* usr21 X *
* *
************************************************************************
* Program Change History *
************************************************************************
* Modification Log: *
* Date Pgmr User ID Correction TR Description *
* ----------- ------------ ------------- ---------------------------*
* DD-MMM-YYYY HBXXXXX SBAXXXXXXX xxxxxxxxxxx *
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
* Types
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
* Work Area / Internal Tables
*----------------------------------------------------------------------*
DATA: ls_user TYPE swragent,
ls_substitute TYPE swragent,
ls_message TYPE bapiret2,
ls_logtable TYPE /invmwl/tlogtab2.
*-- internal tables
DATA: lt_message_lines TYPE TABLE OF swr_messag,
lt_messages TYPE TABLE OF swr_mstruc,
lt_logtable TYPE TABLE OF /invmwl/tlogtab2. "#EC NEEDED
*----------------------------------------------------------------------*
* Variables
*----------------------------------------------------------------------*
DATA: lv_ret_code TYPE sysubrc. "#EC NEEDED
*----------------------------------------------------------------------*
* Constants
*----------------------------------------------------------------------*
CONSTANTS: c_x TYPE char1 VALUE 'X',
c_error TYPE bapi_mtype VALUE 'E',
lc_user TYPE otype VALUE 'US',
c_e TYPE c VALUE 'E',
c_w TYPE c VALUE 'W',
c_s TYPE c VALUE 'S'.
TRANSLATE iv_us_name TO UPPER CASE.
TRANSLATE iv_rep_name TO UPPER CASE.
TRY.
CALL METHOD cl_system_uuid=>if_system_uuid_static~create_uuid_c26
RECEIVING
uuid = ls_logtable-logtext.
CATCH cx_uuid_error . "#EC NO_HANDLER
ENDTRY.
IF iv_end_date >= sy-datum.
CONCATENATE 'Call Started --'(001) iv_us_name iv_rep_name ls_logtable-
logtext
INTO ls_logtable-logtext.
INSERT INTO /invmwl/tlogtab2 VALUES ls_logtable.
APPEND ls_logtable TO lt_logtable.
*-- Validate that the start date
*-- end date relationship
*-- Is start date < end date Check
IF ( iv_start_date >= iv_end_date ).
MOVE c_error TO return-type.
MOVE text-004 TO return-message.
RETURN.
ENDIF.
*-- Validate user creating substitution
*-- is a valid user
SELECT COUNT(*) FROM usr21
WHERE bname EQ iv_us_name.
IF ( sy-subrc NE 0 ).
MOVE c_error TO return-type.
MOVE text-005 TO return-message.
RETURN.
ENDIF.
*-- Validate substitute
*-- is a valid user
SELECT COUNT(*) FROM usr21
WHERE bname EQ iv_rep_name.
IF ( sy-subrc NE 0 ).
MOVE c_error TO return-type.
MOVE text-006 TO return-message.
RETURN.
ENDIF.
MOVE lc_user TO ls_user-otype.
MOVE lc_user TO ls_substitute-otype.
MOVE iv_us_name TO ls_user-objid.
MOVE iv_rep_name TO ls_substitute-objid.
CONCATENATE 'abt to call FM --'(003)
iv_us_name
iv_rep_name
ls_logtable-logtext
INTO ls_logtable-logtext.
INSERT INTO /invmwl/tlogtab2 VALUES ls_logtable.
CLEAR ls_logtable.
*----------------------------------------------------------------------*
* Call Function to Maintain substitute for User
*----------------------------------------------------------------------*
CALL FUNCTION 'SAP_WAPI_SUBSTITUTE_MAINTAIN'
EXPORTING
substituted_object = ls_user
substitute = ls_substitute
subst_begin = iv_start_date
subst_end = iv_end_date
subst_profile = iv_sub_profile
subst_active = c_x
IMPORTING
return_code = lv_ret_code
TABLES
message_lines = lt_message_lines
message_struct = lt_messages.
CONCATENATE 'CALLED FM --'(009)
iv_us_name
iv_rep_name
ls_logtable-logtext
INTO ls_logtable-logtext.
INSERT INTO /invmwl/tlogtab2 VALUES ls_logtable.
CLEAR ls_logtable.
READ TABLE lt_messages
INTO ls_message
WITH KEY msgty = c_e.
IF ( sy-subrc EQ 0 ).
MOVE c_e TO return-type.
MOVE ls_message-message TO return-message.
CONCATENATE 'ERROR in FM --'(010)
iv_us_name
iv_rep_name
ls_logtable-logtext
INTO ls_logtable-logtext.
INSERT INTO /invmwl/tlogtab2
VALUES ls_logtable.
CLEAR ls_logtable.
ELSE.
READ TABLE lt_messages
INTO ls_message
WITH KEY msgty = c_w.
IF ( sy-subrc = 0 ).
MOVE c_w TO return-type.
MOVE ls_message-message TO return-message.
CONCATENATE 'WARNING in FM --'(011)
iv_us_name
iv_rep_name
ls_logtable-logtext
INTO ls_logtable-logtext.
INSERT INTO /invmwl/tlogtab2
VALUES ls_logtable.
CLEAR ls_logtable.
ELSE.
READ TABLE lt_messages
INTO ls_message
WITH KEY msgty = c_s.
IF ( sy-subrc = 0 ).
MOVE c_s TO return-type.
MOVE text-002 TO return-message.
CONCATENATE 'SUCESS FM --'(012)
iv_us_name
iv_rep_name
ls_logtable-logtext
INTO ls_logtable-logtext.
INSERT INTO /invmwl/tlogtab2
VALUES ls_logtable.
CLEAR ls_logtable.
ENDIF.
ENDIF.
ENDIF.
TRY.
CALL METHOD cl_system_uuid=>if_system_uuid_static~create_uuid_c26
RECEIVING
uuid = ls_logtable-logtext.
CATCH cx_uuid_error . "#EC NO_HANDLER
ENDTRY.
CONCATENATE 'Call End --'(013)
iv_us_name
iv_rep_name
ls_logtable-logtext
INTO ls_logtable-logtext.
INSERT INTO /invmwl/tlogtab2
VALUES ls_logtable.
CLEAR ls_logtable.
ELSE.
MOVE c_error TO return-type.
MOVE text-000 TO return-message.
ENDIF.
ENDFUNCTION.

More Related Content

What's hot

Optimizing Queries with Explain
Optimizing Queries with ExplainOptimizing Queries with Explain
Optimizing Queries with Explain
MYXPLAIN
 
comboboxentry - glade - ruby - guide
comboboxentry - glade - ruby - guidecomboboxentry - glade - ruby - guide
comboboxentry - glade - ruby - guide
Arulalan T
 
Si0302 20140320131934
Si0302 20140320131934Si0302 20140320131934
Si0302 20140320131934
Dex Winadha
 
56 Query Optimization
56 Query Optimization56 Query Optimization
56 Query Optimization
MYXPLAIN
 

What's hot (20)

Web 10 | PHP with MySQL
Web 10 | PHP with MySQLWeb 10 | PHP with MySQL
Web 10 | PHP with MySQL
 
Functional perl
Functional perlFunctional perl
Functional perl
 
pt-query-digest は Perl!!
pt-query-digest は Perl!!pt-query-digest は Perl!!
pt-query-digest は Perl!!
 
235689260 oracle-forms-10g-tutorial
235689260 oracle-forms-10g-tutorial235689260 oracle-forms-10g-tutorial
235689260 oracle-forms-10g-tutorial
 
Optimizing Queries with Explain
Optimizing Queries with ExplainOptimizing Queries with Explain
Optimizing Queries with Explain
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
comboboxentry - glade - ruby - guide
comboboxentry - glade - ruby - guidecomboboxentry - glade - ruby - guide
comboboxentry - glade - ruby - guide
 
Pop3ck sh
Pop3ck shPop3ck sh
Pop3ck sh
 
Creating a compiler in Perl 6
Creating a compiler in Perl 6Creating a compiler in Perl 6
Creating a compiler in Perl 6
 
The Perl6 Type System
The Perl6 Type SystemThe Perl6 Type System
The Perl6 Type System
 
Twitter codeigniter library
Twitter codeigniter libraryTwitter codeigniter library
Twitter codeigniter library
 
Si0302 20140320131934
Si0302 20140320131934Si0302 20140320131934
Si0302 20140320131934
 
Data Validation models
Data Validation modelsData Validation models
Data Validation models
 
PHP Mailer Remote Code Execution
PHP Mailer Remote Code ExecutionPHP Mailer Remote Code Execution
PHP Mailer Remote Code Execution
 
Les01
Les01Les01
Les01
 
Refactoring using Codeception
Refactoring using CodeceptionRefactoring using Codeception
Refactoring using Codeception
 
Les03
Les03Les03
Les03
 
56 Query Optimization
56 Query Optimization56 Query Optimization
56 Query Optimization
 
Advanced MySQL Query and Schema Tuning
Advanced MySQL Query and Schema TuningAdvanced MySQL Query and Schema Tuning
Advanced MySQL Query and Schema Tuning
 
PHP for Python Developers
PHP for Python DevelopersPHP for Python Developers
PHP for Python Developers
 

Viewers also liked

Merged bachelor transcript
Merged bachelor transcriptMerged bachelor transcript
Merged bachelor transcript
Dieu Linh Vu
 
SAP HANA
SAP HANASAP HANA
Hana Training Day 1
Hana Training Day 1Hana Training Day 1
Hana Training Day 1
mishra4927
 

Viewers also liked (20)

3Com 3CSFP9-81-JTS
3Com 3CSFP9-81-JTS3Com 3CSFP9-81-JTS
3Com 3CSFP9-81-JTS
 
Merged bachelor transcript
Merged bachelor transcriptMerged bachelor transcript
Merged bachelor transcript
 
S2 coursing presentation 2017 18
S2 coursing presentation 2017 18S2 coursing presentation 2017 18
S2 coursing presentation 2017 18
 
How do children learn a language
How do children learn a language How do children learn a language
How do children learn a language
 
Dev207 berlin
Dev207 berlinDev207 berlin
Dev207 berlin
 
Getting feel for BRF+
Getting feel for BRF+Getting feel for BRF+
Getting feel for BRF+
 
Thinking Beyond The Possibilities of SAP Event Management with SAP BRF+
Thinking Beyond The Possibilities of SAP Event Management with SAP BRF+Thinking Beyond The Possibilities of SAP Event Management with SAP BRF+
Thinking Beyond The Possibilities of SAP Event Management with SAP BRF+
 
BRF+ Walk through
BRF+ Walk throughBRF+ Walk through
BRF+ Walk through
 
SAP HANA SPS09 - XS Programming Model
SAP HANA SPS09 - XS Programming ModelSAP HANA SPS09 - XS Programming Model
SAP HANA SPS09 - XS Programming Model
 
SAP HANA
SAP HANASAP HANA
SAP HANA
 
Hana Training Day 1
Hana Training Day 1Hana Training Day 1
Hana Training Day 1
 
SAP HANA SPS10- SAP HANA Development Tools
SAP HANA SPS10- SAP HANA Development ToolsSAP HANA SPS10- SAP HANA Development Tools
SAP HANA SPS10- SAP HANA Development Tools
 
Slides udm-101110-corrigé
Slides udm-101110-corrigéSlides udm-101110-corrigé
Slides udm-101110-corrigé
 
Presentation intégrale du bilan électrique 2012 de RTE
Presentation intégrale du bilan électrique 2012 de RTEPresentation intégrale du bilan électrique 2012 de RTE
Presentation intégrale du bilan électrique 2012 de RTE
 
Solutions en mode SaaS (Software as a Service) : les PME accèdent-elles à des...
Solutions en mode SaaS (Software as a Service) : les PME accèdent-elles à des...Solutions en mode SaaS (Software as a Service) : les PME accèdent-elles à des...
Solutions en mode SaaS (Software as a Service) : les PME accèdent-elles à des...
 
Formation POO & Java (2ème séance)
Formation POO & Java (2ème séance)Formation POO & Java (2ème séance)
Formation POO & Java (2ème séance)
 
Bibliothek2.0 und Social Software
Bibliothek2.0 und Social SoftwareBibliothek2.0 und Social Software
Bibliothek2.0 und Social Software
 
Lm software
Lm softwareLm software
Lm software
 
Einsatz von Social Software für Online-Marketing und virtuelle Zusammenarbeit...
Einsatz von Social Software fürOnline-Marketing und virtuelle Zusammenarbeit...Einsatz von Social Software fürOnline-Marketing und virtuelle Zusammenarbeit...
Einsatz von Social Software für Online-Marketing und virtuelle Zusammenarbeit...
 
LM Software
LM SoftwareLM Software
LM Software
 

Similar to Substitute creation

Example syntax alv grid list
Example syntax alv grid listExample syntax alv grid list
Example syntax alv grid list
Nur Khoiri
 
Lab08Lab08.cppLab08Lab08.cpp.docx
Lab08Lab08.cppLab08Lab08.cpp.docxLab08Lab08.cppLab08Lab08.cpp.docx
Lab08Lab08.cppLab08Lab08.cpp.docx
DIPESH30
 
Alvedit programs
Alvedit programsAlvedit programs
Alvedit programs
mcclintick
 
C++, Implement the class BinarySearchTree, as given in listing 16-4 .pdf
C++, Implement the class BinarySearchTree, as given in listing 16-4 .pdfC++, Implement the class BinarySearchTree, as given in listing 16-4 .pdf
C++, Implement the class BinarySearchTree, as given in listing 16-4 .pdf
rohit219406
 
For each task, submit your source java code file.(1) Objective Im.pdf
For each task, submit your source java code file.(1) Objective Im.pdfFor each task, submit your source java code file.(1) Objective Im.pdf
For each task, submit your source java code file.(1) Objective Im.pdf
dhavalbl38
 
Lab11.cppLab11.cpp.docx
Lab11.cppLab11.cpp.docxLab11.cppLab11.cpp.docx
Lab11.cppLab11.cpp.docx
DIPESH30
 
I keep on get a redefinition error and an undefined error.Customer.pdf
I keep on get a redefinition error and an undefined error.Customer.pdfI keep on get a redefinition error and an undefined error.Customer.pdf
I keep on get a redefinition error and an undefined error.Customer.pdf
herminaherman
 
PersonData.h#ifndef PersonData_h #define PersonData_h#inclu.pdf
 PersonData.h#ifndef PersonData_h #define PersonData_h#inclu.pdf PersonData.h#ifndef PersonData_h #define PersonData_h#inclu.pdf
PersonData.h#ifndef PersonData_h #define PersonData_h#inclu.pdf
annamalaiagencies
 

Similar to Substitute creation (20)

Alv barra her
Alv barra herAlv barra her
Alv barra her
 
ZFINDALLZPROGAM
ZFINDALLZPROGAMZFINDALLZPROGAM
ZFINDALLZPROGAM
 
Example syntax alv grid list
Example syntax alv grid listExample syntax alv grid list
Example syntax alv grid list
 
Program For Parsing2
Program For Parsing2Program For Parsing2
Program For Parsing2
 
Alv interactive ABAPreport
Alv interactive ABAPreportAlv interactive ABAPreport
Alv interactive ABAPreport
 
Lab08Lab08.cppLab08Lab08.cpp.docx
Lab08Lab08.cppLab08Lab08.cpp.docxLab08Lab08.cppLab08Lab08.cpp.docx
Lab08Lab08.cppLab08Lab08.cpp.docx
 
Alvedit programs
Alvedit programsAlvedit programs
Alvedit programs
 
C++, Implement the class BinarySearchTree, as given in listing 16-4 .pdf
C++, Implement the class BinarySearchTree, as given in listing 16-4 .pdfC++, Implement the class BinarySearchTree, as given in listing 16-4 .pdf
C++, Implement the class BinarySearchTree, as given in listing 16-4 .pdf
 
For each task, submit your source java code file.(1) Objective Im.pdf
For each task, submit your source java code file.(1) Objective Im.pdfFor each task, submit your source java code file.(1) Objective Im.pdf
For each task, submit your source java code file.(1) Objective Im.pdf
 
Lab11.cppLab11.cpp.docx
Lab11.cppLab11.cpp.docxLab11.cppLab11.cpp.docx
Lab11.cppLab11.cpp.docx
 
WordPress REST API hacking
WordPress REST API hackingWordPress REST API hacking
WordPress REST API hacking
 
Multithreaded sockets c++11
Multithreaded sockets c++11Multithreaded sockets c++11
Multithreaded sockets c++11
 
Get into the FLOW with Extbase
Get into the FLOW with ExtbaseGet into the FLOW with Extbase
Get into the FLOW with Extbase
 
Extbase and Beyond
Extbase and BeyondExtbase and Beyond
Extbase and Beyond
 
I keep on get a redefinition error and an undefined error.Customer.pdf
I keep on get a redefinition error and an undefined error.Customer.pdfI keep on get a redefinition error and an undefined error.Customer.pdf
I keep on get a redefinition error and an undefined error.Customer.pdf
 
Swift 3.0 の新しい機能(のうちの9つ)
Swift 3.0 の新しい機能(のうちの9つ)Swift 3.0 の新しい機能(のうちの9つ)
Swift 3.0 の新しい機能(のうちの9つ)
 
Report: Avalanche 'very likely' to host outdoor game at Coors Field
Report: Avalanche 'very likely' to host outdoor game at Coors FieldReport: Avalanche 'very likely' to host outdoor game at Coors Field
Report: Avalanche 'very likely' to host outdoor game at Coors Field
 
Decoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDDDecoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDD
 
PersonData.h#ifndef PersonData_h #define PersonData_h#inclu.pdf
 PersonData.h#ifndef PersonData_h #define PersonData_h#inclu.pdf PersonData.h#ifndef PersonData_h #define PersonData_h#inclu.pdf
PersonData.h#ifndef PersonData_h #define PersonData_h#inclu.pdf
 
DS & Algo 1 - C++ and STL Introduction
DS & Algo 1 - C++ and STL IntroductionDS & Algo 1 - C++ and STL Introduction
DS & Algo 1 - C++ and STL Introduction
 

Recently uploaded

Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
Tonystark477637
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 

Recently uploaded (20)

Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 

Substitute creation

  • 1. FUNCTION /invmwl/fm_create_substitute_2 . *"---------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" VALUE(IV_US_NAME) TYPE XUBNAME *" VALUE(IV_REP_NAME) TYPE XUBNAME *" VALUE(IV_START_DATE) TYPE BEGDATUM *" VALUE(IV_END_DATE) TYPE ENDDATUM *" VALUE(IV_SUB_PROFILE) TYPE HR_REP_PRF OPTIONAL *" VALUE(IV_IS_ACTIVE) TYPE HS_REP_ACT OPTIONAL *" EXPORTING *" VALUE(RETURN) TYPE BAPIRET2 *"---------------------------------------------------------------------- ************************************************************************ * I N N O V A P P T I V E * *----------------------------------------------------------------------* * Object Name : /INVMWL/FM_CREATE_SUBSTITUTE_2 * * Object Title : Create Substitution for a User * * Transport # : <ERDK900864> * * UserID : SPACHVA * * Author : Srinivasa * * Date : 2014-11-13 * *----------------------------------------------------------------------* * Description : * * This RFC function Create Substitution for a User * * * *----------------------------------------------------------------------* * Copy of Standard SAP Object: NO * * Object Name : * * N/A * *----------------------------------------------------------------------* * Includes : * * N/A * *----------------------------------------------------------------------* * DB Tables Used: SELECT UPDATE INSERT DELETE * * usr21 X * * * ************************************************************************ * Program Change History * ************************************************************************ * Modification Log: * * Date Pgmr User ID Correction TR Description * * ----------- ------------ ------------- ---------------------------* * DD-MMM-YYYY HBXXXXX SBAXXXXXXX xxxxxxxxxxx * *----------------------------------------------------------------------* *----------------------------------------------------------------------* * Types *----------------------------------------------------------------------* *----------------------------------------------------------------------* * Work Area / Internal Tables *----------------------------------------------------------------------* DATA: ls_user TYPE swragent, ls_substitute TYPE swragent, ls_message TYPE bapiret2, ls_logtable TYPE /invmwl/tlogtab2. *-- internal tables DATA: lt_message_lines TYPE TABLE OF swr_messag, lt_messages TYPE TABLE OF swr_mstruc, lt_logtable TYPE TABLE OF /invmwl/tlogtab2. "#EC NEEDED *----------------------------------------------------------------------* * Variables *----------------------------------------------------------------------* DATA: lv_ret_code TYPE sysubrc. "#EC NEEDED
  • 2. *----------------------------------------------------------------------* * Constants *----------------------------------------------------------------------* CONSTANTS: c_x TYPE char1 VALUE 'X', c_error TYPE bapi_mtype VALUE 'E', lc_user TYPE otype VALUE 'US', c_e TYPE c VALUE 'E', c_w TYPE c VALUE 'W', c_s TYPE c VALUE 'S'. TRANSLATE iv_us_name TO UPPER CASE. TRANSLATE iv_rep_name TO UPPER CASE. TRY. CALL METHOD cl_system_uuid=>if_system_uuid_static~create_uuid_c26 RECEIVING uuid = ls_logtable-logtext. CATCH cx_uuid_error . "#EC NO_HANDLER ENDTRY. IF iv_end_date >= sy-datum. CONCATENATE 'Call Started --'(001) iv_us_name iv_rep_name ls_logtable- logtext INTO ls_logtable-logtext. INSERT INTO /invmwl/tlogtab2 VALUES ls_logtable. APPEND ls_logtable TO lt_logtable. *-- Validate that the start date *-- end date relationship *-- Is start date < end date Check IF ( iv_start_date >= iv_end_date ). MOVE c_error TO return-type. MOVE text-004 TO return-message. RETURN. ENDIF. *-- Validate user creating substitution *-- is a valid user SELECT COUNT(*) FROM usr21 WHERE bname EQ iv_us_name. IF ( sy-subrc NE 0 ). MOVE c_error TO return-type. MOVE text-005 TO return-message. RETURN. ENDIF. *-- Validate substitute *-- is a valid user SELECT COUNT(*) FROM usr21 WHERE bname EQ iv_rep_name. IF ( sy-subrc NE 0 ). MOVE c_error TO return-type. MOVE text-006 TO return-message. RETURN. ENDIF. MOVE lc_user TO ls_user-otype. MOVE lc_user TO ls_substitute-otype. MOVE iv_us_name TO ls_user-objid. MOVE iv_rep_name TO ls_substitute-objid. CONCATENATE 'abt to call FM --'(003) iv_us_name iv_rep_name ls_logtable-logtext INTO ls_logtable-logtext. INSERT INTO /invmwl/tlogtab2 VALUES ls_logtable. CLEAR ls_logtable. *----------------------------------------------------------------------* * Call Function to Maintain substitute for User *----------------------------------------------------------------------* CALL FUNCTION 'SAP_WAPI_SUBSTITUTE_MAINTAIN'
  • 3. EXPORTING substituted_object = ls_user substitute = ls_substitute subst_begin = iv_start_date subst_end = iv_end_date subst_profile = iv_sub_profile subst_active = c_x IMPORTING return_code = lv_ret_code TABLES message_lines = lt_message_lines message_struct = lt_messages. CONCATENATE 'CALLED FM --'(009) iv_us_name iv_rep_name ls_logtable-logtext INTO ls_logtable-logtext. INSERT INTO /invmwl/tlogtab2 VALUES ls_logtable. CLEAR ls_logtable. READ TABLE lt_messages INTO ls_message WITH KEY msgty = c_e. IF ( sy-subrc EQ 0 ). MOVE c_e TO return-type. MOVE ls_message-message TO return-message. CONCATENATE 'ERROR in FM --'(010) iv_us_name iv_rep_name ls_logtable-logtext INTO ls_logtable-logtext. INSERT INTO /invmwl/tlogtab2 VALUES ls_logtable. CLEAR ls_logtable. ELSE. READ TABLE lt_messages INTO ls_message WITH KEY msgty = c_w. IF ( sy-subrc = 0 ). MOVE c_w TO return-type. MOVE ls_message-message TO return-message. CONCATENATE 'WARNING in FM --'(011) iv_us_name iv_rep_name ls_logtable-logtext INTO ls_logtable-logtext. INSERT INTO /invmwl/tlogtab2 VALUES ls_logtable. CLEAR ls_logtable. ELSE. READ TABLE lt_messages INTO ls_message WITH KEY msgty = c_s. IF ( sy-subrc = 0 ). MOVE c_s TO return-type. MOVE text-002 TO return-message. CONCATENATE 'SUCESS FM --'(012) iv_us_name iv_rep_name ls_logtable-logtext INTO ls_logtable-logtext. INSERT INTO /invmwl/tlogtab2 VALUES ls_logtable. CLEAR ls_logtable. ENDIF.
  • 4. ENDIF. ENDIF. TRY. CALL METHOD cl_system_uuid=>if_system_uuid_static~create_uuid_c26 RECEIVING uuid = ls_logtable-logtext. CATCH cx_uuid_error . "#EC NO_HANDLER ENDTRY. CONCATENATE 'Call End --'(013) iv_us_name iv_rep_name ls_logtable-logtext INTO ls_logtable-logtext. INSERT INTO /invmwl/tlogtab2 VALUES ls_logtable. CLEAR ls_logtable. ELSE. MOVE c_error TO return-type. MOVE text-000 TO return-message. ENDIF. ENDFUNCTION.