Quantcast
Channel: SCN : Document List - ABAP Switching, Enhancing, and Adapting Standard Programs
Viewing all 20 articles
Browse latest View live

Enhancing Material Master

$
0
0

This document explains about adding custom fields in Material Master under Basic Data1 tab.

 

1)    Enhance MARA table with append structure, which has the custom fields.

 

Capture3.JPG

 

2)    Now select the relevant node in SPRO.

 

Capture.JPG

 

3)    When clicking on execute button, we’ll get a selection screen through which we can copy the standard function group MGD1.

 

Capture20.JPG

 

4)    Click on the execute button. Provide the name of the function group that need to be created and the short text.

 

Capture21.JPG

 

5)    Click on SAVE button. This will create the custom function group.

 

 

6)    Go to the function group in Repository Browser SE80 and do the customizations in screen number 0001.

 

Place the custom fields in screen 0001 layout.

 

Capture15.JPG

 

Set the screen field attributes too, inorder to dynamically manage the field display.

 

Capture16.JPG

 

Add the custom coding in events PBO and PAI of the flow logic.

 

Capture5.JPG

 

Capture17.JPG

 

 

 

Capture18.JPG

 

Capture19.JPG

 

 

 

7)    Now we need to define the Data Screen.

 

Capture9.JPG

 

Choose the screen sequence. And then select the Subscreen.

 

Capture10.JPG

 

 

8)    Now provide the name of the main program of custom Function Group MGD1 (SAPLZMGD1) instead of the standard where we need to assign the custom screen.

 

Capture11.JPG

 

Save the changes in a customizing request.

 

9)    Now we can get the custom field in Basic Data tab of Material Master. Execute MM01/ MM02/ MM03 and we can see the custom field under Basic Data1 tab.

 

 

Capture23.JPG

 

Capture22.JPG

 

 

Thank You.


To get copa document number returned by "BAPI_COPAACTUALS_POSTCOSTDATA" posting

$
0
0

Abstract 

 

While posting COPA document by BAPI "BAPI_COPAACTUALS_POSTCOSTDATA" , this BAPI

does not return successful records with generated copa document number.

But in case system need to capture generated copa doc number there is workaround with

implicit enhancement withing bapi as described in doc,

 

 

About the Domain

 

SAP ABAP/FICO module can use this document. This will help them to get generated COPA

document number which is posted by BAPI_COPAACTUALS_POSTCOSTDATA.

 

Steps involved

 

The step that needs to be followed is as below.

 

It's divided mainly into 2 section .

 

A. custom program

B. Enhancement

 

 

Create a Custom Program like ZCOPA_UPDATE .

 

Please follow steps given below for this program.

 

 

 

 

  • Export BAPI_Call indicator from your program to memory id

          This indicator will make sure enhancement will be trigger only in case bapi will be called for custom program

 

     gv_call_copa_bapi_indicator = 'Y' .

 

          EXPORT gv_call_copa_bapi_indicator TO MEMORY ID 'ZCOPA_UPD_BAPI1'.

 

  • Call Bapi to post data

       *To post Copa document
        CALL FUNCTION 'BAPI_COPAACTUALS_POSTCOSTDATA'
           EXPORTING
           operatingconcern = ip_operatingconcern
           testrun          = ip_testrun
           TABLES
           inputdata        = lt_bapi_copa_data
           fieldlist        = lt_bapi_copa_field
           return           = lt_return.

 

  • IF lt_return[] IS INITIAL ,means copa doc posted ,then only read copa document number .

               In case there is any record in return with message type E or A it means there is an error while generating copa doc , so do not import                doc numner from  ID 'ZCOPA_UPD_BAPI'

 

  •      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT’.

 

  • Importing copa document number from enhancement only if lt_return is initial

          or have S,I,W message type.because doc number can be  populated in error cases also as this enhancement from where exporting  memory  

     ID 'ZCOPA_UPD_BAPI' is before actual posting , so always check return table (is initial or have S,I,W message               type only)

 

          IMPORT gv_memid_copadoc  FROM MEMORY ID 'ZCOPA_UPD_BAPI' .

 

         So gv_memid_copadoc  will have copa document number which is generated.

 

 

 

 

 

Create a implicit enhancement like ZCOPA_ENH_UPDATE . 


 

Please follow steps given below for this enhancement.

 

  • Create implicit enhancement in FM “RKE_SERVE_ACT_DOC_NUMBER “  in the end of function.

 

Which will be used during BAPI posting as this FM function to get next available document number for COPA posting , But actual posting will happen after this FM .

So at this stage we will be able to get COPA doc number which will be generated later on and confirm if there is no error in return table of BAPI .

As Actual copa posting perform  is refreshing inputdata table , and not returning success message we need to use this way .

 

copa.jpg

 

  • Import BAPI called by Custom Program indicator to make sure enhancement will be triggered only if BAPI call from custom program

 

IMPORT gv_call_copa_bapi_indicator FROM MEMORY ID 'ZCOPA_UPD_BAPI1' .

 

if gv_call_copa_bapi_indicator EQ 'Y' .

 

then only create following steps

 

 

  • Define field-symbol  with genric type as line item table which contain copa records is genric type and define workarea with field Belnr.

 

*As line item table type genric , so get doc no using field symbol

ASSIGN LINE_ITEM_TAB to <fs_copadoc>.

*As field symbol type any defined work area with belnr which contain copa doc no

MOVE-CORRESPONDING <fs_copadoc> to lw_line_item .


 

  • Get copa document number in variable


      GV_MEMID_COPADOC = lw_line_item-belnr .

 

 

  • And Export Copa Doc number to memory id.

 

EXPORT GV_MEMID_COPADOC to memory id 'ZCOPA_UPD_BAPI'.

 

 



 

 

Output

 

Copa document number will be retrieved successfully from BAPI.

 

    

 

Conclusion

 

This code could be used to get copa document number generated through BAPI  psoting .

Switch Framework - A simple demo on creation and usage of a custom switch

$
0
0

A demo on creating and using a custom switch, which is explained via various steps involved in the process. Many documents are available in the internet on Switch framework, but most of them end up with definition and explanation. I thought of creating a simple, very basic demo, which is aimed to the beginners, for them to understand the creation of switches and how the switch on/off reflects in the system.


Switch Framework

The main purpose of the Switch Framework is to simplify an ABAP-based system landscape by adopting one or more industry solutions in a standard system. The Switch Framework allows you to externally control the visibility of repository objects or their components by means of switches. By using the Switch Framework, all industry solutions and a restricted list of repository objects are delivered in an inactive state in the system. With minor exceptions, you no longer need to install an industry solution – you can activate it when required.

 

Here we discuss about the creation of switches. Starting with Tcode SFW1, where we will create a new switch. In the ‘Packgs’ tab, we can add our package name. Here I have added my package ‘ZABY_SFW_TEST_PACKAGE’, where I will be saving the enhancements which I add later. Save and activate the switch.

 


 

 

Next we need to create a Business Function via the Tcode SFW2.


A Business Function is a building block of a business function set. From a business perspective, it represents a self-contained function that you can switch on. Technically, a business function is a set of switches that assign objects to the business function. Business functions are switched on at a system level. By activating a business function, you activate all of its switches except for conflict switches. Conflict switches are not assigned to business functions.

 

When you switch on a business function, all switches assigned to it are switched to ON or STANDBY, respectively, depending on the definition of the business function.

The business functions can be reversible and non-reversible. Only reversible business functions can be switched off.


The following types of business functions are available:

●      Industry Business Function: always needs a business function set to be attached to

●      Enterprise Business Function: independent of business function sets

●     Enterprise Add-Ons: can no longer be created. Semantically they are the same as Enterprise Business Functions but are based on another technique.

 

 

I have created a business function with Type G which is an enterprise business function.

dialog.jpg

In the Business function, I have added the switch which we have created in the previous step. See the image below. 


 

 

Now go to the properties tab and tick the check box ‘Reversible’, as shown in below image. Only the business functions with reversible status can be deactivated again, once it is activated. Now Save and activate the business function.

 

dialog2.jpg

 

In case if you have created a Industry Business Function, its always needs a business function set to be attached to. Those who are following with Enterprise Business Function(as followed above) can avoid this step of creating Business function set, and can continue with SFW5 to switch on business functions.


A Business Function Set is the top component of the Switch Framework and represents an industry solution that you tailor from existing solutions in the SAP system.

A business function set groups into a unit several business functions that:

●      meet the requirements of an industry solution

●      can be switched on in parallel (unless they are defined as excluding in transaction SFW2).


To create a business function set, use Tcode SFW3 and. And add your business function to the business function tab in the business function set, as shown below. Save and activate it.

 

dialog3.jpg

 

Now use transaction SFW5 to switch on business functions and all switches assigned to them.  Expand the node ENTERPRISE_BUSINESS_FUNCTIONS, as shown in the image below.


 

 

Scroll down to our new Business Function and you can see the planned status column as unchecked by default, ie business function is in switched off position. The icon just right of the business function name indicates that it is a reversible one.

dialog5.jpg

 

 

 

Now we will see how this status reflects in the system.

 

  I am creating an implicit enhancement in 'userexit_save_document_prepare'  of sales order program.  I have saved the enhancement in the Package‘ZABY_SFW_TEST_PACKAGE’ which is assigned to switch, which we have just created.

 


 

And when you save any document in Sales order program VA01/VA02, you will notice that even though the above enhancement implementation is active, program won’t touch the break-point which is hard coded there.


Now come back to Tcode SFW5 to switch on the business function. Tick the checkbox in’ Planned status’ column and click the ‘Activate changes’ button in the top.

 

dialog4.jpg

 

Now again save a sales order and you will see that the execution has reached inside our enhancement.

 

 

Since the switch is a reversible one, again we can switch off it, thereby the enhancement.

 

Thanks.

Partner Functions Validations on sales and service order documents

$
0
0

Introduction:

I am really happy to create my first document.In this document I would like to enlist the different conditions of partner function validations and how it can be achieved. Initially when I started this enhancement I found many threads which includes threads created by me also, I found so many answers mentioning about more number of user exits, BADIs etc. But all of them will not suit validation conditions. So In this document I would like to enlist and summarize about the user exits and the enhancement spots that will suit to validate the partner functions.

 

Condition for partner function validation:

 

The following are the conditions on which usually the client expect to validate the partner functions:

è Validation on enter condition at header level.

è Validation on save condition at header level.

è Validation on enter condition at item level.

è Validation on save condition at item level.

 

Related Transactions:

1)      Sales order document transactions (VA01,VA02,VA03)

2)      Contract Document transactions (VA41,VA42,VA43)

3)      Service order transactions(IW31.IW32,IW33)

 

Scenario 1: Validation on enter condition at header level

 

This requirement can be achieved by coding in the user exit point USEREXIT_MOVE_FIELD_TO_VBKD in the Include MV45AFZZ of the standard program SAPMV45A.

 

Parameters that holds the value in the exit points are:

è  Runtime internal table that holds the runtime value along with the partner function is XVBPA.

 

Note: The above exit point will suit only for Sales orders and contract documents.

 

Scenario 2: Validation on save condition at header level and at item level

 

This requirement can be achieved by coding in the user exit point USEREXIT_SAVE_DOCUMENT_PREPAREin the Include MV45AFZZ of the standard program SAPMV45A.

 

Parameters that holds the value in the exit points are:

è  Runtime internal table that holds the runtime value along with the partner function is XVBPA.

 

Note: The above exit point will suit only for Sales orders and contract documents.

 

Scenario 3: Validation on Enter condition at item level:

 

This requirement can be achieved by coding in the Enhancement point that can be created as mentioned below,

We can create an enhancement point in INCLUDE LV09CF66 of main program SAPLV09C. In this include we have to code inside the form CHECK_AND_SEARCH_PARTNER which is present inside ON_REQUEST_1000.

 

Parameters that holds the value in the exit points are:

è  Runtime internal table that holds the runtime value along with the partner function is GT_XVBPA.

è  Here values of sales organization, distribution channel, division are all concatenated in a single variable gvs_tc_parameters-sdorgdata, we have to truncate the values from these variable.

 

Note: The above exit point will suit only for Sales orders and contract documents.

 

Scenario 4: Validation on save and enter condition at both header level and at item level

 

This requirement can be achieved by coding in the Enhancement point that can be created as mentioned below,

We can create an enhancement point in INCLUDE LIPARF00 of main program SAPLIPAR.

 

Parameters that holds the value in the exit points are:

è  Runtime internal table that holds the runtime value along with the partner function is XIHPA.

 

Note:The above exit point will suit only for Service order documents.

 

Conclusion:

Please note that apart from all the exit points and enhancement points that have been mentioned above there may also be other user exits and enhancement points. I have just enlisted these spots because it worked for me. If you also know few other exit points apart from which I mentioned above please mention the exit point and also the condition on which its gets triggered.

 

Thanks for reading my document.

 

Lets collaborate, share and learn in SCN !!!

 

Thanks and Regards,

Satish Kumar Balasubramanian.

Controlling the domain fixed value append from a switched package

$
0
0

Value range of a domain can be restricted by maintaining the fixed values while creating the domain. These fixed values are used for the input check on the screens. If no fixed values are maintained or if few fixed values are already defined for a domain by SAP and if the user want to add more fixed values then, we can leverage the advantage of the fixed value append. Fixed values can be maintained only for the domains of data types CHAR, NUMC, DEC and INT.



The Switch Framework allows you to externally control the visibility of repository objects or their components by means of switches. In this document, I have discussed on controlling the domain fixed value append from a switched package. The additional values will be displayed based on the switch on/off status. Saving the new append in a switch controlled package is not mandatory, if the values are to displayed always.


First we need to append fixed values to a standard domain. You can follow the below steps.


a. Open the domain in SE11 – For example Domain ABSTT

b. Select the Value range Tab. Observe that no fixed values are maintained for the domain ABSTT.

c. Click on the GOTO menu and select FIXED VALUE APPEND.

d. Enter a name for the append and press Enter.

e. A screen appears for the new fixed value append. Provide the short description.             

f. Maintain the required fixed value in the column Fix.Val and Short description for each and do save and activate.

 

 

1.jpg



    While saving, I have given a package name which is assigned to a switch  as shown below. To know more about assigning package to switch, check my document Switch Framework - A simple demo on creation and usage of a custom switch


2.jpg

The mentioned switch is in turn assigned to a Business function which we can be switched on/off later, based on our requirement.


3.jpg


Before checking whether the new fixed values in the domain are displaying or not, just verify the on/off status of switch. Go to Tcode SFW5 and look for our Business Function in Enterprise Business Function list.


4.jpg

The business function is switched off by default, so the newly added fixed values should not be displayed.

 

Now create a report program and add a parameter with type ABSTT which is the Dataelement of Domain ABSTT  and execute it.


5.jpg


We can see that the newly added values are not displayed.


Now, go back to SFW5 and switch on the business function.


6.jpg

Subsequently run the report and check for values in searchhelp.


7.jpg



With the switch in 'On' position, the fixed values in the new append will be displayed as shown above.


In case of any issues recheck whether everything has been activated. In some cases a session logout and login is required to get reflected with the switch changes.



Static Enhancement vs Dynamic Enhancement

$
0
0

Static Enhancment vs Dynamic Enhancement

 

Author: Abyson Joseph Chavara

Created on : 22.10.2013


Many a times in SCN, you might have met with the following questions regarding Static and Dynamic enhancements….


In the enhancement implementation I see "static enhancement point" or. a "dynamic enhancement point"). What's the difference?


When I implement an implicit enhancement point, a popup with the buttons "Declaration" and "Code" appears. What is the difference?


If I choose "Declaration", I still can insert non-declarative statements like WRITE into the enhancement code, and these code parts are processed as well as the enhancements declared as "Code". So what's the sense of this distinction?


Through this document, I hope you will get a clear cut idea on the basic difference between Static and Dynamic enhancements.

 

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


The addition STATIC is used to define a static source code enhancement. In a static source code enhancement, all incorporated source code plug-ins are taken into account when the program is executed, including those whose Switch is in the status stand-by.


The main purpose of the Switch Framework is to simplify an ABAP-based system landscape by adopting one or more industry solutions in a standard system. The Switch Framework allows you to externally control the visibility of repository objects or their components by means of switches.

 

The type of a switch can be specified for each business function that uses the switch.


If the option 'Standby' is selected for the Switch type in Business Function, only declarative enhancements (all Dictionary enhancements such as table appends as well as static program enhancements) are activated when the business function is switched on. Also, dynamic program enhancements and BADI implementations remain switched off.


If the option ' Activation ' is selected for the Switch type in Business Function, means that when the business function is switched on, all switchable objects that are linked to the switch are activated. This means that declarative enhancements such as table appends are activated, and both static and dynamic program enhancements are executed at program runtime.


You will easily understand the above concept by going through the simple demo below.


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


Already I have a switch in standby mode, which is assigned to a Business function via Tcode SFW2. See the image below.  For more details on Switch framework and the configuration you can check my document http://scn.sap.com/docs/DOC-47265

 

 

Now go to any of your custom program, and  create a Static enhancement option. Just right click in the editor and select create option.

 

Select the radio button ‘As Unconditional call’ to make it as a static enhancement option. Assign it to any enhancement spot.

 

 

Now create a Dynamic enhancement option by following the above same steps. By default the radio button ‘As conditional call’ is selected, ie it will be created as a dynamic enhancement option.

 

 

 

 

So we have created a static and dynamic enhancement option.  Now activate the program.

 

 

Next we need to implement these two enhancements options. To do that, click on the ‘Enhance’ Spiral button from the tool bar and right click on the enhancement option and select create implementation.

 

First create an implementation for the static enhancement point.

 

 

An important thing to remember, when you save the implementation, make sure that the package is assigned to the Switch(which we have marked as ‘Standby ‘ type). To learn how to assign a package to switch check my document http://scn.sap.com/docs/DOC-47265

 

 

Create an implementation for Dynamic enhancement option too.

 

\

 

Add some code to both implementations, here I have just hard-coded a break point in both as shown below.

 

Now check and confirm whether the Business function(to which our switch is assigned) is switched on Via Tcode SFW5. If not switch it on and activate the changes.

 

 

Now come back to your program and execute it.

 

You will find that the cursor will hit the break-point in  ‘ZENH_IMP_STATIC’ , which the implementation for the static enhancement point ‘ZENH_TEST_STATIC’. You will also notice that the debugger won’t hit the break-point added in the implementation of dynamic enhancement option.

 

 

Now you try the following changes in configuration and check how the changes are reflected.

 

  1. Switch off the business function via Tcode SFW5.

        Result: The debugger won’t hit both the static and dynamic implementations.

 

   2. Go to Tcode SFW2 and change the Switch type to ‘Activation’ Mode as shown below. Also change the Switch  to ON mode via Tcode SFW5 .

 

   

  Result:  The debugger will hit both the static and dynamic implementations.

 

The same is applicable to the‘Declaration’ and ‘Code’ option, which you will find while creating implicit enhancements.  If you select ‘Declaration, it will be created as a Static enhancement, and if you opt ‘Code’, then that will be dynamic implementation.

 

 

Note, Data declarations are always static, even if they are inside a dynamic enhancement option.

Is Kernel BADI 'really' faster than Classic BADI ?

$
0
0

Author: Abyson Joseph Chavara

Created on : 04.03.2014


Introduction


SAP Business Add-Ins (BAdIs) are one of the most important technologies used to adapt SAP software to specific requirements.

 

As of Release 7.0 of the SAP NetWeaver Application Server ABAP (SAP NetWeaver 7.0), BAdIs are part of the Enhancement Framework, where they represent explicit enhancement options. We call these BAdIs  classic BAdIs. In addition to their integration in the Enhancement Framework, BAdIs from Release 7.0 onwards differ from classic BAdIs particularly with regard to the fact that they are supported directly by the ABAP runtime environment through ABAP statements. We call these New BADIs or Kernel BADIs.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

 

And that is all about introduction, and you might have read that definition a 100 times..   And further, you all know, the main advantage of Kernel BADIs, its very faster than Classic BADIs.

 

Some of you might have checked why the kernel BADI is faster than Classic BADI?? Even I did the same and have found some answers as follows.

 

reason1.jpg

reason2.jpg

 

And after all my research, what I understood is - " The old classic-BADI’s are implemented purely at the ABAP Workbench level; that is, both the definition and implementation are realized as workbench repository objects (global classes and interfaces). Thew Kernel BADI takes it to the ABAP language level with new commands 'GET BADI' and 'CALL BADI'.

 

Apart from Classic BADI’s which are been called by Proxy class cl_exithandler, Kernel BADI’s are called directly with the reference to the BADI definition via GET BADI and CALL BADI statements.  That is one of the reasons why Kernel BADI is faster than classic BADI. Also in Classic BADI, while we call it via cl_exithandler, we use the reference to the interface rather than BADI definition.”


The topic of this document is not about the reason of being faster, but to find whether Kernel BADI is 'really' faster or it is just a technically justified statement.


I didn't get a chance to compare the performance of a Classic and Kernel BADI that process a very similar code.  So I have created and tested such a scenario and just thought of sharing the findings here. Please note, this not an evaluation on the performance of New BADIs, rather I just made a comparison out of my own mere academic interest.



I have created a classic BADI via SE18 (SE18>Utilities>Create Classic BADI),  and added a single method ‘DISP_MESSAGE’ in the interface, as shown below.

cbadi1.jpg

 

Subsequently I have created an Implementation for the BADI via SE19.


cbadi2.jpg


Since there is no specific requirement, I just wrote a code to show an Information message, as shown below.


cbadi3.jpg


The creation and implementation part of classic BADI is over.


Next I have created a Kernel BADI in a new Enhancement Spot and have made an implementation. To know more about creating Custom Kernel BADI’s, check the document Creation of Custom Kernel BADI and Calling it in a Custom Program .


kbadi1.jpg


You can see below that, there is only one method ‘DISP_MESSAGE’ added in the interface, same as we have done in case of Classic BADI.


kbadi2.jpg


The same code is added in the method implementation, as in Classic BADI method.


kbadi3.jpg


Even though we have used separate technique for creating classic and Kernel BADI’s, there is no difference in the code that is to be executed from two BADI’s. But as of our understating the second one, Kernel BADI should take less time for execution than the Classic one.


I have created two reports for calling the BADI’s. The first report calls classic BADI via the CL_EXITHANDLER proxy class. As you can see below, the instance is created in type ‘ZIF_EX_BADI_CLASSIC_TEST’ which is the interface used in classic BADI.


cbadi_rpt_4.jpg


And in the second report program, I have called the Kernel BADI via GET BADI and CALL BADI statements. The instance is created in the type of ‘ZBADI_KERNEL_TEST09’ which is the name of BADI itself.


kbadi_rpt_4.jpg


Using the TCode SAT (new version of se30), I have executed both the programs to check the net execution time.


The result for classic BADI program is as follows.


cl_badi_result.jpg


And in case of Kernal BADI program, the following result was displayed.


ke_badi_result.jpg


Comparing the net time in both results, it is apparent that the Kernel BADI executed very much faster than the classic BADI. The kernel BADI did take only 8,400 microseconds, whereas Classic BADI took 52,254 microseconds.




Thanks and Regards

Abyson Joseph

Dynamic Payresult data display - Independent on Country grouping Structures

$
0
0

* Through this document, we can understand that how to fetch a payresult data of an employee number irrespective of  country grouping.

 

* Basically we developers used to search for a corresponding deep structure of a country grouping, in order to fetch and display the employee payresult.

 

* But we can find the structure through his molga & relid, same logic we are doing here through programming.

 

* Because of this, we can use the same for different country grouping employees.

 

Here we have used the dynamic internal table concept. This will make our work easier.

 

&---------------------------------------------------------------------*
*&     Form  READ_PAYROLL_RESULT
*&---------------------------------------------------------------------*
*       Read the Payroll Result
*----------------------------------------------------------------------*
FORM read_payroll_result CHANGING pt_t558b TYPE table
                                  pt_t558c  TYPE  table.

 


DATA            l_payresult   TYPE REF TO data.

FIELD-SYMBOLS   <fs_fields>   TYPE dfies,
                    <fs_orgeh>    LIKE LINE OF t_orgeh,
                     <l_payresult> TYPE ANY.

  DATA          : lx_t558c   TYPE ty_t558c,
                  lx_t558b   TYPE ty_t558b.

  DATA          : lv_lines   TYPE numc2.

  FIELD-SYMBOLS : <l_pay>   TYPE hrpay99_rt,
                  <l_betrg>  TYPE maxbt,
                  <l_betpe>  TYPE betpe,
                  <l_lgart>  TYPE lgart,
                  <l_anzhl>  TYPE pranz,
                  <l_rt>     TYPE pc207.

  CLEAR : v_molga, v_relid, t_rgdir[].

  CALL FUNCTION 'HR_PCLX_INIT_BUFFER'
    EXCEPTIONS
      OTHERS = 0.

  CALL FUNCTION 'CU_READ_RGDIR_NEW'
    EXPORTING
      persnr   = pernr-pernr
    IMPORTING
      molga    = v_molga
    TABLES
      in_rgdir =t_rgdir
    EXCEPTIONS
      OTHERS   = 1.
  IF sy-subrc <> 0.
    EXIT.
  ENDIF.

  IF t_rgdir[]IS INITIAL.
    EXIT.
  ENDIF.

  IF v_molgaIS INITIAL.
    EXIT.
  ENDIF.

  PERFORM get_relidUSING    v_molga
                    CHANGING v_relid l_payresult v_rc.

  IF v_rc<> 0.
    EXIT.
  ENDIF.

  UNASSIGN <l_payresult>.

 


  ASSIGN l_payresult->* TO <l_payresult>.
  IF sy-subrc <> 0.
    EXIT.
  ENDIF.

  LOOP AT t_rgdirWHERE fpbeg GE c_begdaAND fpend LE c_endda.
    CLEAR <l_payresult>.
    CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
      EXPORTING
        clusterid      = v_relid
        employeenumber = pernr-pernr
        sequencenumber = t_rgdir-seqnr
      CHANGING
        payroll_result = <l_payresult>
      EXCEPTIONS
        OTHERS         = 1.
    CASE sy-subrc.
      WHEN 0.
        UNASSIGN <l_pay>.
        ASSIGN COMPONENT 'INTER-RT' OF STRUCTURE <l_payresult> TO <l_pay>.
        CHECK <l_pay>IS ASSIGNED.
        lv_lines =LINES( <l_pay>).
        DO lv_linesTIMES.
          READ TABLE <l_pay> ASSIGNING <l_rt>INDEX sy-index.
          CHECK <l_rt>IS ASSIGNED.
          ASSIGN COMPONENT 'LGART'  OF STRUCTURE <l_rt>TO <l_lgart>.
          ASSIGN COMPONENT 'BETPE'  OF STRUCTURE <l_rt>TO <l_betpe>.
          ASSIGN COMPONENT 'BETRG'  OF STRUCTURE <l_rt>TO <l_betrg>.
          ASSIGN COMPONENT 'ANZHL'  OF STRUCTURE <l_rt>TO <l_anzhl>.
          CHECK <l_lgart>           IS ASSIGNED   AND
                <l_betpe>           IS ASSIGNED   AND
                <l_betrg>           IS ASSIGNED   AND
                <l_anzhl>           IS ASSIGNED.
          MOVE : <l_lgart>          TO lx_t558c-lgart,
                 <l_betrg>          TO lx_t558c-betrg,
                 <l_betpe>          TO lx_t558c-betpe,
                 <l_anzhl>          TO lx_t558c-anzhl,
                  pernr-pernr       TO lx_t558c-pernr,
                  t_rgdir-seqnr     TO lx_t558c-seqnr,
                  v_molga           TO lx_t558c-molga,
                  t_rgdir-fpend     TO lx_t558c-keydate.
          APPEND: lx_t558c         TO pt_t558c.
          UNASSIGN <l_rt>.
          CLEAR lx_t558c.
        ENDDO.
        MOVE : pernr-pernr          TO lx_t558b-pernr,
               t_rgdir-seqnr        TO lx_t558b-seqnr,
               t_rgdir-payty        TO lx_t558b-payty,
               t_rgdir-payid        TO lx_t558b-payid,
               t_rgdir-paydt        TO lx_t558b-paydt,
               t_rgdir-permo        TO lx_t558b-permo,
               t_rgdir-fpper+0(4)   TO lx_t558b-pabrj,
               t_rgdir-fpper+4(2)   TO lx_t558b-pabrp,
               t_rgdir-fpbeg        TO lx_t558b-fpbeg,
               t_rgdir-fpend        TO lx_t558b-fpend.
        APPEND lx_t558b             TO pt_t558b.
        CLEAR  : lx_t558b.
      WHEN OTHERS.
        CONTINUE.
    ENDCASE.
  ENDLOOP.

ENDFORM.                    " READ_PAYROLL_RESULT
*&--------------------------------------------------------------------*
*&     Form  get_relid
*&--------------------------------------------------------------------*
*       Read the RELID Value
*----------------------------------------------------------------------*
FORM get_relid USING    value(p_molga) TYPE molga
               CHANGINGp_relid        TYPE relid_pcl
                        p_payresult    TYPE REF TO data
                        p_rc           TYPE sysubrc.

  DATA: ls_t500l   TYPE t500l,
        l_payresult TYPE REF TO data.

  PERFORM get_t500lUSING p_molga
                    CHANGING ls_t500l l_payresult p_rc.

  IF p_rcEQ 0.
    p_relid     = ls_t500l-relid.
    p_payresult =l_payresult.
  ELSE.
    CLEAR: p_relid, p_payresult.
  ENDIF.

ENDFORM.                    "get_relid
*&--------------------------------------------------------------------*
*&     Form  get_t500l
*&--------------------------------------------------------------------*
*       Read the T5001 Values
*----------------------------------------------------------------------*
FORM get_t500l USING    value(p_molga) TYPE molga
               CHANGINGps_t500l       TYPE t500l
                        p_payresult    TYPE REF TO data
                        p_rc           TYPE sysubrc.

  DATA: l_typename TYPE typename.

  READ TABLE  t_t500l WITH TABLE KEY molga = p_molga.

  IF sy-subrc <> 0.
    CLEAR t_t500l.
    SELECT SINGLE * FROM t500l INTO t_t500l-t500l
      WHERE molga= p_molga.
    IF sy-subrc <> 0.
      t_t500l-molga= p_molga.
      t_t500l-rc    = 4.
    ELSE.
      SELECT SINGLE typename FROM t52relid INTO l_typename
        WHERE relid= t_t500l-relid.
      t_t500l-rc= sy-subrc.
      IF t_t500l-rc = 0.
        CREATE DATA t_t500l-payresult TYPE (l_typename).
        IF sy-subrc <> 0.
          t_t500l-rc= 4.
          CLEAR t_t500l-t500l.
        ENDIF.
      ENDIF.
    ENDIF.
    INSERT tablet_t500l.
  ENDIF.

  ps_t500l    = t_t500l-t500l.
  p_payresult =t_t500l-payresult.
  p_rc        = t_t500l-rc.

ENDFORM.                                                   "get_t500l


MFBF Disable Quantity Field - Assembly Backflush.

$
0
0

REM (Repetetive Manufacturing) Back flushing is the process used in production/process industries for automatic goods receipt/issue purposes.

Backflushing (MFBF) includes all the following partial functions: Goods receipt posting, Goods issue of the material components, Calculation of actual costs in production activity posting, Reduction of the production quantities, Adjustment of the dependent requirements of the components in the reporting point backflush, Adjustment of the capacity requirements.


  Requirement  :-                                                                                                                                 

The user need to disable the quantity input field in the second screen of MFBF transaction, if the radio button “Assembly Backflush” in the initial  screen is selected.

img6.PNG


img8.PNG


There are user exit and BAdi available in MFBF, but it is not possible to disable the quantity field using these exits/BAdi. And the initial screen is from MD04 package and second screen containing the quantity field is from CO package. So these screens reside in different programs. Since both the screen belongs to different program, we can set a flag, if the assembly backflush radio button is selected, and export it to memory. So we can import it and according to the value further processing will be possible. We can also access the value of a variable from another program with the help of field symbols. Here I would like to demonstrate the later one.


We need to enhance the table control in the screen 0130 of program  LCOWBFM1. The table control tctrl_0540 is actually the part of a sub screen 0540, which is called by the screen 0130. All these screen and programs are under the function group COWB. As you know we can modify a table control by using a PBO module inside the table control loop statement. Here we have a module modify_tc which in turn contains a form “modify_tc”.

Navigate to the form modify_tc, click on the enhance button in the application tool bar,

img1.PNG

you will find some enhancement points, right click and select create implementations,

img2.png

Either you can select one of the existing implementations or create a new one by selecting new button.

img3.png

Enter the details, press enter

img4.PNG

Assign package and save under a request. Then there will be an enhancement in inactive version. Implement the logic and activate.

img5.PNG


img9.PNG

Here SAPLBARM is the program name which is having the variable RM61B-RB_BAUGR (radio button). We will assign it to the field symbol <FS_RADIO>. If the radio button is selected and  the screen-name is COWB_COMP-ERFMG_R we will disable the input field. After the activation of the enhancement we will get the below screen.

img7.PNG

Hope the document will be helpful. Feel free to express your thoughts.

Search Help in Tcode SE11

$
0
0

Hi all Experts,

 

 

In this document I would like to explain about the search help concept that we have in SE11. The different types of it. How to create it. How to find the search help that is used in standard t-codes. Hope you will find it useful.

 

 

What is search help?

 

In T-code se11 we have a radio button as search help (Marked in Red Below), have you ever wondered what is the use of it and where it is applicable. You are about to know the entire use of it in the following pages.

 

1.PNG

 

Types of search help:

 

Search help is of two types as below:

 

1)    Elementary search help:

 

Elementary search help is like when we press F4 on any particular field we will have only one tab where certain fields will be present in which you can enter the values and retrieve the corresponding values for the field.

 

2)    Collective search help:

 

In case of collective search help we will have collection of several tabs for assisting to fill the value in the field. Take a look at below image showing the collective search help (Marked in red below), here we have displayed the collective search help used in the T-code va21 for the field sold to party. We can find there are several tabs available for F4 for that particular field.

 

2.PNG

 

How to find the search help for standard transaction:

 

To find the search help used for any particular field in standard T-code follow the below steps:

 

1)     1) Press F1 on the field and find the screen number by clicking the technical settings icon.

 

2)     2) Now go to the main program of the transaction and reach to the corresponding screen.

 

3)     3)View the screen in screen painter and click on the required field, you will be getting the name of the search help as marked in red below,

 

3.PNG

 

 

How to create a search help:

 

In the following pages we will see how to add our own elementary search help to the collective search help of the standard T-codes.

 

Steps to be followed: 

 

We need to do the following steps in order to achieve our requirement,

 

1)     1) Create a view.

 

2)     2) Create an elementary search help.

 

3)     3) Append the search help to the collective search help of the standard transaction.

 

1)    Create a view.

 

 

a)     a) Go to se11 and create a view where you have added all the fields that needs to be used in your own search help as shown below. You can add as many fields as per your requirement.

 

4.PNG

 

2)    Create an elementary search help.

 

 

a)     a) Go to se11 and give search help name of your choice and click create. Select elementary search help radio button in the pop up and click continue. You will be getting the below screen.

 

5.PNG

 

b)     b) In the above image enter the view that you have created in the field Selection method (Marked in red above) and then add the fields that you want to be displayed in your search help. Finally the screen will be looking as below after activating.

 

6.PNG

 

 

3)    Append the search help to the collective search help of the standard transaction.

 

 

a)      a) As we have found out the search help used in the standard transaction above using the screen painter the job is easy now for us. Enter the search help value in se11 and display, in our case the search that we found out above was SD_DEBI. Reach out to the third tab as below.

b)  

 

7.PNG

 

   b) Now click on go to -> append search help as below,

c)    

8.PNG

c) You will be reaching to the screen below, click on the create icon (Marked in Red below) and give a name of the elementary search that we have created to append.

 

9.PNG

 

d)     d) Now as soon as you continue you will be getting the below screen,

 

10.PNG

e)   

Re    e) Reach out to the third tab and enter the name of the elementary search help that you have created above in step 2.

 

11.PNG

 

 

f)      f) Now position the cursor on the search that you have entered and click on Param Assignment button (Marked in Red above). We have to assign the required parameter that needs to be copied to screen field in our case it is KUNNR field as shown below. Do not forget to activate.

 

12.PNG

 

g)    g) Now go back and see the main search help screen, you can find our appended search help present (Marked in red below), and then activate.

 

13.PNG

 

h)    h) Now go the same transaction VA21 and check for the F4 help for the field you find our newly created tab present there.

14.PNG

 

 

   Few points to be noted:

1) 

1        1) In case of point 2 b above I have marked two fields name dialogue type and hot key. I would like to know the significance of both,

 

A)       a)  Dialogue type:

 

It controls the display of extra tab that we have created. It has three values as marked below, you can understand the difference by simply maintaining different values and check the behavior of the tab.

 

15.PNG

 

 

       b) HOT KEY:

 

Suppose if we maintain any value in the field say B is maintained for our case, you can simply enter the value “=B” in the sold to party field and press enter. Then the search help will be directly navigated to that particular tab.

 

We can even control the resultant display of the search by simply giving values in sold to party field itself.

For eg: If you enter “=B..ABC”, then the search will display results based on the value that you have entered. The value above was preceded by two dots so the vale ABC will be place in the second field of the screen and the corresponding result will be displayed.

 

Conclusion:

 

Thus you would now learnt what is a search help, the types, how it can created, and other significance of it. In case of same field in different transactions different search help can be used. For eg: Material field in VA21 and in MM01 uses different search helps. Hope you found this document useful

 

Please feel free to ask in case you have any doubts regarding this document.   I would also be very happy if you could add your valuable points on this.

 

ABAP DevelopmentABAP Switching, Enhancing, and Adapting Standard Programs

 

Please do share your valuable comments and ratings. Thanks for reading

 

LET’S LEARN SHARE AND COLLABRATE

 

Thanks and Regards,

 

Satish Kumar Balasubramanian

How to find BAdIs with a Function Module

$
0
0

Hi All,

 

After seeing a Lot of questions on Identifying BADI. Here I would like to give a simple and easy method to Identify a BADI.

Many people was not aware of Object Oriented Programming as they wish to succeed in Procedural programming only.

So they don't event prefer to search a BADI using commonly know method CL_EXITHANDLER and GET_INSTANCE.

 

There is one more way to identify the BADIs in a simple way

Using the Function Module SXV_GET_CLIF_BY_NAME.

 

How to use this Function Module to Identify a BADI for a Transaction.

Step 1. Go to SE37 and display the Function Module SXV_GET_CLIF_BY_NAME.

Step 2. Put a break point at the ENDFUNCTION of the Above mentioned Function Module.

Step 3. Run the Transaction for which you want to search a BADI.

 

Note: For every operation the Code Breaks and Function Module return some values in its Parameters.

In the Parameter CLIF and NAME. you will get the BADI or Exit name.

 

Now the question is how to identify whether it is a BADI or Exit. Answer is, Parameter PREFIX of the Function Module.

If this is CL_EX then it is a BADI else it is a Exit. Example is shown in the below Screen shot. A BADI for Transaction FPP2 when you click on SAVE.

IMG.jpg

Hope this document helps Other people who dont know this method of finding a BADI.

 

Regards,

V S BHARGAV.

Working with BRF+ Functionality

$
0
0


Hello Everybody,

 

Its always a pleasure to share a blog or document through SCN.In this Document I would like to explain few aspects with respect to BRF functionalities in ABAP that would be very helpful for both technical and functional experts.

 

I would also like to share the content in the following space:  SAP Business Rules Management

 

 

What is BRF?

 

On a short note, The Business Rule Frame work is an special functionality provided by SAP which helps us to maintain certain business rules for the client .

 

Let me explain you this with an example as below,

 

Consider Your client wants a certain requirement and you have coded for that requirement. Now after some years he gets back stating that he want to restrict the functionality to only  certain users. If the number of users are less we can hardcode it along with the codes, but what will you do under the below scenarios,

 

1) When the number of users are very large.

2) The number of users may keep on adding in future, every time you cant practically go into the code and hardcode the user.

 

This is where our BRF come into play. It plays a vital role in maintaining the business rules. Also the tool is very helpful and easy to use, so that whenever there is a need to add users it can be done even by the functional experts since there is no deep technical knowledge required once the BRF is created.

 

In this blog I would like to brief you on few simple steps that can assist for easy working with BRF tool. In BRF tool we basically create function modules, decision table to store the table values that needs to be maintained, and data elements that will help in providing characteristics to the field.

 

1) Maintaining Different Modes:


There are two Different modes that can be maintained for this tool, they are

 

1) Simple.

2)Expert.

How to set Modes: In the below diagram you can see how to set the mode for your screen. Basically simple mode will not allow you to do some additional operations and Experts mode will allow you to perform all the available operations. You can see the difference between the modes by working on the both the modes.  By clicking on the personalize icon(Marked at top right corner) you will get a pop up as below, here You can maintain the mode in the field user mode(Marked in the pop up screen).

 

BRF Mode.PNG


2) Adding an entry To the decision table:

 

We usually add entries to the decision table of Function module, to add an add entry click on the add icon(Marked in red Below), once click on that you will displayed with the empty entry(Marked In Blue Below) then by clicking on that icon you will be provided with a space to enter an value. There are also other icons to delete, modify etc. all those are marked in black below.

 

BRF Add.PNG

 

3) Uploading and Downloading multiple entries:

 

In the above case we just added One entry, Now consider the case where we need add huge amount of entries it would be difficult to individually maintain. So in those cases you can simply download the decision table into an excel sheet and then add the entries to the excel and then upload it later.

 

To Upload or download the table click on the additional actions icon(Indicated below), in the drop down you will get the options to download and upload excel sheet. There are also other options available like rearranging the rows, merging the rows etc.

 

BRF Excels.PNG

 

Please note: It is advised to download the decision table into an excel make changes in that excel, do not create your own excel and try to upload it may cause few issues since the format of both the excel may differ. You can view that the excel downloaded from BRF has several tabs in it with different specifications.

 

4) Full Screen view :

 

You can also have full screen view as shown below using the icon at top right(Marked in Red Below).

BRF Full Screen.PNG

 

5) Comparing Objects:

 

Objects of the BRF can also be compared with the other objects. To avail this option click on the more option at top right end(Marked in Red Below) then select the compare option.


BRF Compare Option.PNG

 

In the next screen that you get as below, where you can enter the two objects you need to compare in the fields as shown below and proceed comparing. You can also toggle between Vertical and Horizontal view using the icon(Marked in red Below) as per your convenience.

 

BRF Compare.PNG

 

IMPORTANT NOTE: To Avail most of the options in BRF Tool you must be in Edit mode, only then you will able view the options available else the options will not appear. Please note unlike the SAP screens the options will not be grayed out instead it wont be completely visible. Once you are in edit mode you will be enabled with display option in the top screen(Icon marked below). Also for navigating backwards do not use the browser back icon instead use the BRF back icon which available at top(Icon Marked below).

 

BRF Display.PNG

 

CONCLUSION: Hope all the steps above can serve you as a good assistance to work with the BRF tool. There are also many other options available which can be learnt through exploring the Tool. Please do share any valuable tip that can add to this blog.

 

Thanks for reading this Blog. Do share your valuable Comments and Ratings.


Thanks and Regards,

Satish Kumar Balasubramanian.

Enhancing Material Master

$
0
0

This document explains about adding custom fields in Material Master under Basic Data1 tab.

 

1)    Enhance MARA table with append structure, which has the custom fields.

 

Capture3.JPG

 

2)    Now select the relevant node in SPRO.

 

Capture.JPG

 

3)    When clicking on execute button, we’ll get a selection screen through which we can copy the standard function group MGD1.

 

Capture20.JPG

 

4)    Click on the execute button. Provide the name of the function group that need to be created and the short text.

 

Capture21.JPG

 

5)    Click on SAVE button. This will create the custom function group.

 

 

6)    Go to the function group in Repository Browser SE80 and do the customizations in screen number 0001.

 

Place the custom fields in screen 0001 layout.

 

Capture15.JPG

 

Set the screen field attributes too, inorder to dynamically manage the field display.

 

Capture16.JPG

 

Add the custom coding in events PBO and PAI of the flow logic.

 

Capture5.JPG

 

Capture17.JPG

 

 

 

Capture18.JPG

 

Capture19.JPG

 

 

 

7)    Now we need to define the Data Screen.

 

Capture9.JPG

 

Choose the screen sequence. And then select the Subscreen.

 

Capture10.JPG

 

 

8)    Now provide the name of the main program of custom Function Group MGD1 (SAPLZMGD1) instead of the standard where we need to assign the custom screen.

 

Capture11.JPG

 

Save the changes in a customizing request.

 

9)    Now we can get the custom field in Basic Data tab of Material Master. Execute MM01/ MM02/ MM03 and we can see the custom field under Basic Data1 tab.

 

 

Capture23.JPG

 

Capture22.JPG

 

 

Thank You.

To get copa document number returned by "BAPI_COPAACTUALS_POSTCOSTDATA" posting

$
0
0

Abstract 

 

While posting COPA document by BAPI "BAPI_COPAACTUALS_POSTCOSTDATA" , this BAPI

does not return successful records with generated copa document number.

But in case system need to capture generated copa doc number there is workaround with

implicit enhancement withing bapi as described in doc,

 

 

About the Domain

 

SAP ABAP/FICO module can use this document. This will help them to get generated COPA

document number which is posted by BAPI_COPAACTUALS_POSTCOSTDATA.

 

Steps involved

 

The step that needs to be followed is as below.

 

It's divided mainly into 2 section .

 

A. custom program

B. Enhancement

 

 

Create a Custom Program like ZCOPA_UPDATE .

 

Please follow steps given below for this program.

 

 

 

 

  • Export BAPI_Call indicator from your program to memory id

          This indicator will make sure enhancement will be trigger only in case bapi will be called for custom program

 

     gv_call_copa_bapi_indicator = 'Y' .

 

          EXPORT gv_call_copa_bapi_indicator TO MEMORY ID 'ZCOPA_UPD_BAPI1'.

 

  • Call Bapi to post data

       *To post Copa document
        CALL FUNCTION 'BAPI_COPAACTUALS_POSTCOSTDATA'
           EXPORTING
           operatingconcern = ip_operatingconcern
           testrun          = ip_testrun
           TABLES
           inputdata        = lt_bapi_copa_data
           fieldlist        = lt_bapi_copa_field
           return           = lt_return.

 

  • IF lt_return[] IS INITIAL ,means copa doc posted ,then only read copa document number .

               In case there is any record in return with message type E or A it means there is an error while generating copa doc , so do not import                doc numner from  ID 'ZCOPA_UPD_BAPI'

 

  •      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT’.

 

  • Importing copa document number from enhancement only if lt_return is initial

          or have S,I,W message type.because doc number can be  populated in error cases also as this enhancement from where exporting  memory  

     ID 'ZCOPA_UPD_BAPI' is before actual posting , so always check return table (is initial or have S,I,W message               type only)

 

          IMPORT gv_memid_copadoc  FROM MEMORY ID 'ZCOPA_UPD_BAPI' .

 

         So gv_memid_copadoc  will have copa document number which is generated.

 

 

 

 

 

Create a implicit enhancement like ZCOPA_ENH_UPDATE . 


 

Please follow steps given below for this enhancement.

 

  • Create implicit enhancement in FM “RKE_SERVE_ACT_DOC_NUMBER “  in the end of function.

 

Which will be used during BAPI posting as this FM function to get next available document number for COPA posting , But actual posting will happen after this FM .

So at this stage we will be able to get COPA doc number which will be generated later on and confirm if there is no error in return table of BAPI .

As Actual copa posting perform  is refreshing inputdata table , and not returning success message we need to use this way .

 

copa.jpg

 

  • Import BAPI called by Custom Program indicator to make sure enhancement will be triggered only if BAPI call from custom program

 

IMPORT gv_call_copa_bapi_indicator FROM MEMORY ID 'ZCOPA_UPD_BAPI1' .

 

if gv_call_copa_bapi_indicator EQ 'Y' .

 

then only create following steps

 

 

  • Define field-symbol  with genric type as line item table which contain copa records is genric type and define workarea with field Belnr.

 

*As line item table type genric , so get doc no using field symbol

ASSIGN LINE_ITEM_TAB to <fs_copadoc>.

*As field symbol type any defined work area with belnr which contain copa doc no

MOVE-CORRESPONDING <fs_copadoc> to lw_line_item .


 

  • Get copa document number in variable


      GV_MEMID_COPADOC = lw_line_item-belnr .

 

 

  • And Export Copa Doc number to memory id.

 

EXPORT GV_MEMID_COPADOC to memory id 'ZCOPA_UPD_BAPI'.

 

 



 

 

Output

 

Copa document number will be retrieved successfully from BAPI.

 

    

 

Conclusion

 

This code could be used to get copa document number generated through BAPI  psoting .

How to find BAdIs with a Function Module

$
0
0

Hi All,

 

After seeing a Lot of questions on Identifying BADI. Here I would like to give a simple and easy method to Identify a BADI.

Many people was not aware of Object Oriented Programming as they wish to succeed in Procedural programming only.

So they prefer not to search a BADI using commonly know method CL_EXITHANDLER and GET_INSTANCE.

 

There is one more way to identify the BADIs in a simple way

Using the Function Module SXV_GET_CLIF_BY_NAME.

 

How to use this Function Module to Identify a BADI for a Transaction.

Step 1. Go to SE37 and display the Function Module SXV_GET_CLIF_BY_NAME.

Step 2. Put a break point at the ENDFUNCTION of the Above mentioned Function Module.

Step 3. Run the Transaction for which you want to search a BADI.

 

Note: For every operation the Code Breaks and Function Module return some values in its Parameters.

In the Parameter CLIF and NAME. you will get the BADI or Exit name.

 

Now the question is how to identify whether it is a BADI or Exit. Answer is, Parameter PREFIX of the Function Module.

If this is CL_EX then it is a BADI else it is a Exit. Example is shown in the below Screen shot. A BADI for Transaction FPP2 when you click on SAVE.

IMG.jpg

Hope this document helps Other people who dont know this method of finding a BADI.

 

Regards,

V S BHARGAV.


Enhancement for Version Long Text in ME21n/22n/23n

$
0
0

Requirement :

 

To provide the comments/information with more than 1000 characters  for the New Version triggered.

 

Procedure :

 

Step-1 : Check the feasibility to add  a function button on the ALV Tool bar for populating the Text Editor Dialog Box for the requirement.


version-1.PNG

 

Step-2 :Using Implicit Enhancement Enhanced the ALV Tool bar with a ICON and handle the SY-UCOMM in Version TAB in Purchase Order (Create/Change/Display) Screen.



 

version-2.PNG

 

Step-3 : In INCLUDE LMEDCMVCI1 we have Standard Class LCL_DCM_GRID implemented.  The below code is useful to add an ICON in Method TOOL BAR_INIT to provide the feasibility to hold the Text Editor Pop up.


if sy-tcode = 'ME22N' OR SY-TCODE = 'ME23N' OR SY-TCODE = 'ME29N'.

l_quick = 'Version Long Text'.

CALL METHOD cl_gui_toolbar=>fill_buttons_data_table

    EXPORTING

      fcode            = '&LONG_TEXT'

      icon             = icon_document_revision

*  DISABLED         =

      butn_type        = cntb_btype_button

*   TEXT             =

      quickinfo        = l_quick

*  CHECKED          =

    CHANGING

      data_table       = lt_my_buttons

    EXCEPTIONS

      cntb_btype_error = 1

      OTHERS           = 2.

IF sy-subrc = 0.

APPEND LINES OF lt_my_buttons TO ch_buttons.

ENDIF.

ENDIF.


The above code explains that the FUNCTION CODE for the ICON on the ALV Toolbar is defined as 'LONG_TEXT'.




Step-4 : Using the Function Code "LONG_TEXT" handled the functionality for populating the TEXT EDITOR dialog box , by enhancing the method EXECUTE_BEFORE_TRANSPORT where all the standard function codes are handled.


The executed code is mentioned below.


>> Check if there Version Management is having  any other Version rather than ZERO.


Else through a Information Message that "Initial Version is only exist".


CASE im_fcode.

 

 

      WHEN '&LONG'.

*        .list change documents caused by selected revisions

     DATA: lt_models      TYPE mmpur_models,

           ls_models      LIKE LINE OF lt_models,

           ls_erevitem    TYPE erevitem,

           l_rev_item     TYPE REF TO if_revision_item_dcm,

           l_edokp        TYPE erev-edokp,

           l_revno_min    TYPE erevitem-revno,

           l_revno_max    TYPE erevitem-revno,

           l_date1        TYPE sy-datum,

           l_date2        TYPE sy-datum,

           l_time1        TYPE sy-uzeit,

           l_time2        TYPE sy-uzeit,

           l_allitems     TYPE xfeld,

           l_header       TYPE erevheader,

           l_num(8)       TYPE n,

           l_num_min(8)   TYPE n,

           num_min(8)   TYPE n,

           l_num_max(8)   TYPE n,

            C TYPE C.

 

     CHECK NOT my_manager IS INITIAL.

 

     CALL METHOD get_selection

       IMPORTING

         ex_models = lt_models.

 

     IF lt_models IS INITIAL.

    MESSAGE I001(Zlng).

    exit.

     ENDIF.

 

   


 


b) If we have a New Version rather than ZERO, Then pick the Selected Line Item for which the Long Text should be maintained .



LOOP AT lt_models INTO ls_models.

       mmpur_dynamic_cast l_rev_item ls_models-model.

       CHECK NOT l_rev_item IS INITIAL.

       ls_erevitem = l_rev_item->get_data( ).

*-- Portability: REVOK is space or numeric

       l_num = ls_erevitem-revno.

       l_num_min = l_revno_min.

       l_num_max = l_revno_max.

       IF l_num LT l_num_min

       OR l_revno_min IS INITIAL.

         l_revno_min = ls_erevitem-revno.

         l_date1     = ls_erevitem-erdat.

         l_time1     = ls_erevitem-eruhr.

       ENDIF.

       IF l_num GT l_num_max

       OR l_revno_max IS INITIAL.

         l_revno_max = ls_erevitem-revno.

       ENDIF.

     ENDLOOP.

 

C) Create a Custom Function module ZMM_LONG_TEXT where we need to handle the functionality with


IMPORTING Parameters :

--> Maximum Version Line Items

--> HEADER ,

--> Current Line Item Selected for the Version Long Text

and

--> System Transaction code


Functionality of the Function Module :


  • Step 1 : Go to SE75 Transaction. Click on change button, Now create Text Object ZVER_LONG.
    Enter the name & Description of Text object. Here in this case, save mode is selected as update because comments data is need to be updated against each development objects table entry In editor ,Editor application is of type Standard Text(TX) and line width is 72 which can be selected as per requirement.
    Style and Form can also be selected from this window, which will decide the display style of text.
    Once the object is being created, double click on the text object.
  • Step 2 : Create Text ids' .In this scenario, '0001' text Id is created.
  • Step 3 : Once the text ids will be created, front end work is done.

 

  • READ_TEXT - To retrieve Long Text from Text Objects.
  • SAVE_TEXT - To save Long Text into Text Objects.

FUNCTION zmm_long_text.

*"----------------------------------------------------------------------

*"*"Local Interface:

*"  IMPORTING

*"     VALUE(L_REVNO_MAX) TYPE  EREVITEM-REVNO

*"     VALUE(L_HEADER) TYPE  EREVHEADER

*"     VALUE(LS_EREVITEM) TYPE  EREVITEM

*"     VALUE(TCODE) TYPE  TCODE

*"  EXPORTING

*"     VALUE(CHECK) TYPE  C

*"----------------------------------------------------------------------

   DATA : s_revno_max1 TYPE  erevitem-revno,

          s_header1    TYPE  erevheader,

          ss_erevitem1 TYPE  erevitem.

   DATA : t_note    TYPE STANDARD TABLE OF txw_note , "  WITH HEADER LINE.

          s_note    TYPE txw_note,

          long_text TYPE string,

          v_cnt     TYPE i,

          c         TYPE c.

 

   l_revno_max1 = l_revno_max.

   l_header1    = l_header.

   ls_erevitem1 = ls_erevitem.

   tcode1        = tcode.

 

   DATA: e_header  TYPE thead.

   DATAi_tline   TYPE  STANDARD  TABLE  OF tline,

          s_tline   TYPE tline.

 

   e_header-tdobject 'ZVER_LONG'.

   e_header-tdid = '0001' .

   e_header-tdspras = sy-langu.

   e_header-tdlinesize = 72.

   CONCATENATE l_header-edokn ls_erevitem-revno  INTO e_header-tdname.

 

   CALL FUNCTION 'READ_TEXT'

     EXPORTING

       client                  = sy-mandt

       id                      = '0001'

       language                = sy-langu

       name                    = e_header-tdname

       object                  = 'ZVER_LONG'

     TABLES

       lines                   = i_tline

     EXCEPTIONS

       id                      = 1

       language                = 2

       name                    = 3

       not_found               = 4

       object                  = 5

       reference_check         = 6

       wrong_access_to_archive = 7

       OTHERS                  = 8.

   IF sy-subrc <> 0.

 

   ENDIF.

 

   IF i_tline IS INITIAL.

     APPEND INITIAL LINE TO t_note.

   ELSEIF i_tline IS NOT INITIAL.

     LOOP at i_tline INTO s_tline.

       s_note-line = s_tline-TDLINE.

       append s_note to t_note.

       CLEAR s_tline.

       ENDLOOP.

   ENDIF.

 

 

 

   IF tcode = 'ME22N'.

     IF ls_erevitem-revok IS INITIAL.

       c = 'X'.

     ELSE.

       c = ' '.

     ENDIF.

   ELSEIF tcode = 'ME23N'.

     c = ' '.

   ENDIF.

 

   CALL FUNCTION 'TXW_TEXTNOTE_EDIT'

     EXPORTING

       edit_mode = c

     TABLES

       t_txwnote = t_note.

 

   IF sy-ucomm = 'CONT'.

     REFRESH i_tline.

*    APPEND LINES OF t_note TO i_tline.

         LOOP at t_note INTO s_note.

        s_tline-tdline = s_note-LINE .

       append s_tline to i_tline.

       CLEAR s_note.

       ENDLOOP.

 

     CALL FUNCTION 'SAVE_TEXT'

       EXPORTING

         client          = sy-mandt

         header          = e_header

         savemode_direct = 'X'

       TABLES

         lines           = i_tline

       EXCEPTIONS

         id              = 1

         language        = 2

         name            = 3

         object          = 4

         OTHERS          = 5.

     IF sy-subrc = 0.

       check = 'X'.

* Implement suitable error handling here

     ENDIF.

   ELSE.

     EXIT .

ENDIF.

ENDFUNCTION.

 

D) Using the above Function module we can able to maintain the Version Long Text which can be more than 1000 characters.

 

Detail Enhanced Code:

 

CASE im_fcode.

 

 

      WHEN '&LONG'.

*        .list change documents caused by selected revisions

     DATA: lt_models      TYPE mmpur_models,

           ls_models      LIKE LINE OF lt_models,

           ls_erevitem    TYPE erevitem,

           l_rev_item     TYPE REF TO if_revision_item_dcm,

           l_edokp        TYPE erev-edokp,

           l_revno_min    TYPE erevitem-revno,

           l_revno_max    TYPE erevitem-revno,

           l_date1        TYPE sy-datum,

           l_date2        TYPE sy-datum,

           l_time1        TYPE sy-uzeit,

           l_time2        TYPE sy-uzeit,

           l_allitems     TYPE xfeld,

           l_header       TYPE erevheader,

           l_num(8)       TYPE n,

           l_num_min(8)   TYPE n,

           num_min(8)   TYPE n,

           l_num_max(8)   TYPE n,

            C TYPE C.

 

     CHECK NOT my_manager IS INITIAL.

 

     CALL METHOD get_selection

       IMPORTING

         ex_models = lt_models.

 

     IF lt_models IS INITIAL.

    MESSAGE I001(Zlng).

    exit.

     ENDIF.

 

     LOOP AT lt_models INTO ls_models.

       mmpur_dynamic_cast l_rev_item ls_models-model.

       CHECK NOT l_rev_item IS INITIAL.

       ls_erevitem = l_rev_item->get_data( ).

*-- Portability: REVOK is space or numeric

       l_num = ls_erevitem-revno.

       l_num_min = l_revno_min.

       l_num_max = l_revno_max.

       IF l_num LT l_num_min

       OR l_revno_min IS INITIAL.

         l_revno_min = ls_erevitem-revno.

         l_date1     = ls_erevitem-erdat.

         l_time1     = ls_erevitem-eruhr.

       ENDIF.

       IF l_num GT l_num_max

       OR l_revno_max IS INITIAL.

         l_revno_max = ls_erevitem-revno.

       ENDIF.

     ENDLOOP.

if sy-subrc = 0 .

     l_header = my_manager->get_data( ).

endif.

if L_REVNO_MAX <> '00000000'.

CALL FUNCTION 'ZMM_LONG_TEXT'

   EXPORTING

     L_REVNO_MAX       L_REVNO_MAX

     L_HEADER          = l_header

     LS_EREVITEM       = LS_EREVITEM

     TCODE             = SY-TCODE

     IMPORTING

       CHECK           = C.

ELSE.

   MESSAGE i000(zlng) .

   EXIT.

ENDIF.

IF  C = 'X'.

MESSAGE s002(zlng) WITH ls_erevitem-revno.

IF ls_erevitem-ZZTEXT1 IS INITIAL.

  ls_erevitem-ZZTEXT1 = 'X'.

  ELSE.

    CLEAR ls_erevitem-ZZTEXT1.

    ENDIF.

CALL METHOD l_rev_item->set_data( ls_erevitem ).

CALL METHOD notify_data_changed( l_rev_item ).

 

ENDIF.

ENDCASE.

  

Test Case :

 

>> 1) Open The Purchase Order (ME21n/ME22n/ME23n) & navigate to Version Tab as mention below

 

version-3.PNG

>> 2) Select the Line Item for which the Long Text should be maintained and

         Click on the Long Text ICON as shown below

version-2.PNG

 

>>3) Now u can able to Create/Change/Display the Version Long Text maintained

 

version-4.PNG

 

Thanks & Regards,

S.Rajendranath

Collective reject from ME28 (Approve Purchase Documents)

$
0
0

Requirement :

 

ME28 {Release (Approve) Purchasing Documents} is the Transaction Code for Collect Approval where the requirement is to have Collective Rejection with Status of 08.

 

Procedure :


This requirement can be achieved by enhancing (Implicit Enhancement) Standard Program RM06EF00.


A>>> Identify the Implicit Enhancement places for incorporating the REJECTION functionality.


B>>> Enhance  the Report RM06EF00 Output displayed in ALV , providing the REJECTION  icon as similar as the APPROVE icon.


C>>> Handle the REJECTION icon functionality and Set the Document Number with Status-08.



Spot-1 : Enhancement in Data Declaration for defining the REJECTION Method and to add the functionality  in 


lcl_datablade_purchdoc_rel DEFINITION as below


ENHANCEMENT 1  ZMM_ME28.    "active version

    CLASS-DATA: my_icon_reject TYPE icon_release,

                my_icon_undo  TYPE icon_release.

    DATA      : MY_PROCSTAT      TYPE EKKO-PROCSTAT.

ENDENHANCEMENT.

*$*$-End:  (1)---------------------------------------------------------------------------------$*$*

ENDCLASS.                    "lcl_datablade_purchdoc_rel DEFINITION


Spot-2 : Add REJECT ICON to be displayed in the Output of the ALV Report .


ENHANCEMENT 2  ZMM_ME28.    "active version

 

    l_info = 'Reject'(134).

    CALL FUNCTION 'ICON_CREATE'

      EXPORTING

        name  = icon_reject

        info  = l_info

      IMPORTING

        result = my_icon_reject

      EXCEPTIONS

        OTHERS = 0.

 

        l_info = 'Reject'(134).

    CALL FUNCTION 'ICON_CREATE'

      EXPORTING

        name  = ICON_SYSTEM_UNDO

        info  = l_info

      IMPORTING

        result = my_icon_undo

      EXCEPTIONS

        OTHERS = 0.

ENDENHANCEMENT.

*$*$-End:  (1)---------------------------------------------------------------------------------$*$*

  ENDMETHOD.                    "class_constructor


Spot-3 : Handling the action made on the REJECTION ICON enhancement made at double click event.


ENHANCEMENT 03  ZMM_ME28.    "active version

      METHODS : REJECTION IMPORTING IM_WA TYPE ANY.

ENDENHANCEMENT.

*$*$-End:  (2)---------------------------------------------------------------------------------$*$*

ENDCLASS.                    " "lcl_reporting_cnt_purchdoc_rel DEFINITION


Spot-4 : To make the REJECTION icon HOTSPOT in Fieldcatalog

ENHANCEMENT 04  ZMM_ME28.    "active version

    LOOP AT my_fcat ASSIGNING <fcat>.

      CASE <fcat>-fieldname.

        WHEN 'ICON_REJECT'.

          <fcat>-icon = cl_mmpur_constants=>yes.

          <fcat>-hotspot = cl_mmpur_constants=>yes.

          ENDCASE.

          ENDLOOP.

          re_fcat = my_fcat.

 

ENDENHANCEMENT.

*$*$-End:  (1)---------------------------------------------------------------------------------$*$*

  ENDMETHOD.                    "get_fcat

 

Spot-5 : Implementation of the Method REJECTION

METHOD rejection.

" Method for Collective Rejection for ME28.

 

          DATA: ls_outtab      TYPE merep_outtab_purchdoc_rel,

          l_model        TYPE REF TO lcl_reporting_model,

          l_datablade    TYPE REF TO lcl_datablade_general,

          l_frgab        TYPE rm06b-frgab,

          l_frgzu        TYPE ekko-frgzu,

          l_frgke        TYPE ekko-frgke,

          l_ebeln        TYPE ekko-ebeln,

          lv_ebeln        TYPE ekko-ebeln.

            data: lc_po      type ref to  cl_po_header_handle_mm,

        ls_document type mepo_document,

            IM_DATA TYPE MEPOHEADER.

    DATA : IM_header TYPE BAPIMEPOHEADER,

            EX_header TYPE BAPIMEPOHEADER,

            IM_headerx TYPE BAPIMEPOHEADERX ,

            T_RETURN TYPE STANDARD TABLE OF BAPIRET2,

            S_RETURN LIKE LINE OF T_RETURN,

            CL_PO TYPE REF TO CL_PO_HEADER_HANDLE_MM,

            VAR TYPE C.

 

    FIELD-SYMBOLS: <line> LIKE LINE OF gt_outtab_purchdoc_rel.

 

    l_model = my_view->get_model( ).

    l_datablade ?= l_model->get_current_datablade( ).

 

MOVE-CORRESPONDING im_wa TO ls_outtab.

 

*  prepare creation of PO instance

  ls_document-doc_type    = 'F'.

  ls_document-process    = mmpur_po_process.

  ls_document-trtyp      = 'V'.

  ls_document-doc_key(10) = ls_outtab-ebeln.

  ls_document-initiator-initiator = mmpur_initiator_rel.

 

*  object creation and initialization

* lv_ebeln = ls_outtab-ebeln.

  create object lc_po.

  lc_po->for_bapi = mmpur_yes.

  call method lc_po->po_initialize( im_document = ls_document ).

  call method lc_po->set_po_number( im_po_number = ls_outtab-ebeln ).

  call method lc_po->set_state( cl_po_header_handle_mm=>c_available ).

CASE ls_outtab-icon_reject.

WHEN lcl_datablade_purchdoc_rel=>my_icon_reject.

 

*  read purchase order from database

  call method lc_po->po_read

    exporting

      im_tcode    = 'ME29N'

      im_trtyp    = ls_document-trtyp

      im_aktyp    = ls_document-trtyp

      im_po_number = ls_outtab-ebeln

      im_document  = ls_document.

 

  if lc_po->if_releasable_mm~is_rejection_allowed( ) = mmpur_yes.

    call method lc_po->if_releasable_mm~reject

      exporting

        im_reset = space

      exceptions

        failed  = 1

        others  = 2.

  endif.

 

  CALL METHOD lc_po->po_post

    EXCEPTIONS

      failure          = 1

      others            = 2

          .

  if sy-subrc = 0.

 

      LOOP AT gt_outtab_purchdoc_rel ASSIGNING <line> WHERE

                                                  ebeln = ls_outtab-ebeln.

            IF l_ebeln NE ls_outtab-ebeln.

              <line>-icon_reject = lcl_datablade_purchdoc_rel=>my_icon_undo.

              l_ebeln = ls_outtab-ebeln.

            ELSE.

              CLEAR <line>-icon_reject.

            ENDIF.

          ENDLOOP.

ENDIF.

  endcase.

  ENDMETHOD.

 

ENDENHANCEMENT.

*$*$-End:  (5)---------------------------------------------------------------------------------$*$*

ENDCLASS.                    "lcl_reporting_cnt_purchdoc_rel IMPLEMENTATION

 

Spot-6 : Enhancement for handling the action for double click on REJECTION icon.

 

IF ch_selfield-fieldname EQ 'ICON_REJECT'.

 

      CHECK NOT ch_selfield-tabindex IS INITIAL.

      CHECK ch_selfield-sumindex IS INITIAL.

      CHECK NOT ch_ucomm EQ 'MEDETAIL'.

 

      CALL METHOD rejection( im_wa = im_wa ).

      ch_selfield-refresh = 'X'.

      ch_selfield-col_stable = 'X'.

      ch_selfield-row_stable = 'X'.

    ENDIF.

 

ENDENHANCEMENT.

*$*$-End:  (3)---------------------------------------------------------------------------------$*$*

  ENDMETHOD.                    "double_click

 

Sample Output :

 

REJ.png

 

Thanks & Regards,

S.Rajendranath.

Adding customer (Z-) fields to Purchase Orders

$
0
0

In this document a step-by-step guide for adding customer (Z-) fields to Purchase Orders that are displayable and modifiable either in header level or in item level.

 

  • We start by adding enhancement MM06E005 to a project in transaction CMOD and activating it.

pic1.png

pic4.png

  • We create structures CI_EKKODB (header level) and/ or CI_EKPODB (item level) by double-clicking on the corresponding line under "Include tables", and add to them the fields that are of interest to us, e.g. ZZFIELD1 and ZZFIELD2 respectively. We save and activate.

Pic2.png

pic3.png

  • We create screens SAPLXM06 0101 (header level) and/ or 0111 (item level) by double-clicking on the corresponding line under "Screen exit",  and add the customer fields defined in the previous step using the structures CI_EKKODB/ CI_EKPODB (and NOT EKKO/ EKPO), e.g. CI_EKKODB-ZZFIELD1/ CI_EKPODB-ZZFIELD2. We save and activate.

pic5.png

 

  • Using SE38 we go to include LXM06TOP  (main program SAPLXM06) and double-click on include ZXM06TOP in order to create it.

pic6.png

  • We add the following variable declarations that will be used for holding the information whether we create/ change/ display a purchase order:

For item level:

TABLES: ci_ekpodb.
DATA
: gw_aktyp.

 

For header level:

TABLES: ci_ekkodb.
DATA
: gw_trtyp.

pic7.png

  • We now want to implement the transfer of information from the purchase order to our newly created customer screen and store activity type (i.e. create/ change/ display). To achieve that in CMOD we double-click on EXIT_SAPMM06E_006 (header level)/ EXIT_SAPMM06E_016 (item level), and double-click on include ZXM06U36/ ZXM06U41, respectively, in order to create it. Then, we add the following code:

For item level:

MOVE-CORRESPONDING i_ci_ekpo TO ci_ekpodb.
gw_aktyp = i_aktyp.

For header level:

MOVE-CORRESPONDING i_ci_ekko TO ci_ekkodb.
gw_trtyp = i_trtyp.

pic8.png

  • We now want to implement the transfer of information from our newly created customer screen to the purchase order. To achieve that in CMOD we double-click on EXIT_SAPMM06E_008 (header level)/ EXIT_SAPMM06E_018 (item level), and double-click on include ZXM06U37/ ZXM06U40, respectively, in order to create it. Then, we add the following code:

For item level:

MOVE-CORRESPONDING ci_ekpodb TO e_ci_ekpo.

For header level:

MOVE-CORRESPONDING ci_ekkodbTO e_ci_ekko.

  • Finally on the PBO of the newly created customer screens we add a module with the following code in order to render non-modifiable the Z-fields when the purchase order is being displayed (and not changed/ created). A new include is created for the PBO module.

gw_trtyp is used for header level and gw_aktyp for item level:

IF gw_trtyp EQ 'A'. "gw_aktyp = 'A'.

  LOOP AT SCREEN.

    screen-input = '0'.

    MODIFY SCREEN.

  ENDLOOP.

ENDIF.

pic9.png


pic10.png

Now we are ready to check our new field under the tab "Customer Data":

pic11.png

Store PDF into the IXOS ,Saperion and other Archiving systems and mass print as spool in backend

$
0
0

Introduction :

      As the document attachment functionality is very common requirement now a days in SAP,all the documents are created either as PDF,Text and other SAP readable formats and archived in any of the archiving systems like IXOS or Saperion .These stored documents generally creates a document ID through which the documents are attached in the corresponding FI documents as shown in the below options either as direct attachment or URL link or as a PDF document.

 

test.png

As-Is :

      There is a challenge in storing and printing PDF as spool.All the other document types can be archived using the Function module ARCHIV_GET_CONNECTIONS, ARCHIV_CONNECTION_INSERT , CONVERT_OTF_AND_ARCHIVE  as a 'OTF' or 'PDF'.The stored content can be obtained using the below code:

 

CALL FUNCTION 'ARCHIVOBJECT_GET      

  EXPORTING

        archiv_id                = c_th

         document_type            = c_pdf

          archiv_doc_id            = w_archiv_doc_id

       IMPORTING

         binlength                = w_length

        TABLES

          binarchivobject          = t_data_raw

       EXCEPTIONS

         error_archiv             = 1

          error_communicationtable = 2

         error_kernel             = 3

          OTHERS                   = 4.

Obtianed data TABL1024 is of RAW type which can not be converted to either SOLIX or OTF format.So we can not create spools instead we can either send as a email attachment or do a file attachment in front end.

Solution Provided :

                 Going forward once the OTF data is obtained convert the OTF to a storable fomat which can be later converted to OTF from the archiving systems.

      •   Create a new internal table with the below type

                    

           types: begin of ty_otf,

             line type c length 72,

 

               end of ty_otf.

                  

       loop at t_otfdata into f_otf1.

           move f_otf1 to f_otf.

           append f_otf to t_otf.

         endloop.

 

call function 'SCMS_TEXT_TO_BINARY'

           importing

             output_length = w_len2

           tables

             text_tab      = t_otf "f_job_output_info-OTFDATA

             binary_tab    = it_binary_data

           exceptions

             failed        = 1

             others        = 2.

call function 'SCMS_BINARY_TO_STRING'

           exporting

             input_length = w_len2

           importing

             text_buffer  = fs_property_string

           tables

             binary_tab   = it_binary_data

           exceptions

             failed       = 1

             others       = 2.

 

*       The function module is used to convert string to xstring

         call function 'SCMS_STRING_TO_XSTRING'

           exporting

             text   = fs_property_string

           importing

             buffer = w_XSTRING

           exceptions

             failed = 1

             others = 2.

 

    •      XSTRING data should be  passed and stored using the FM ARCHIV_CONNECTION_INSERT   into the IXOS or saperion      

          if_proxy_client~execute(

     exporting

       method_name = 'CREATE'

     changing

       parmbind_tab = lt_parmbind

   ).

  •      Document ID is generated and stored in the table.
  •    Below code should be written while retrieving the document from the archiving system :

* Convert Xstring to binary data

     call function 'SCMS_XSTRING_TO_BINARY'

       exporting

         buffer        = w_content_o-parameters-return-content

       importing

         output_length = w_filesize

       tables

         binary_tab    = t_binary_data.

 

* Convert binary to OTF

     call function 'SCMS_BINARY_TO_TEXT'

       exporting

         input_length  = w_filesize

       importing

         output_length = w_len2

       tables

         binary_tab    = t_binary_data

         text_tab      = t_otf

       exceptions

         failed        = 1

         others        = 2.

 

     loop at t_otf into f_otf.

       move f_otf to f_otf1.

       append f_otf1 to t_otf1.

     endloop.

 

call function 'PRINT_OTF'

       exporting

         printoptions = f_itcpo

       importing

         spoolid      = w_spool

       tables

         otf          = t_otf1.

This way we can use this logic for the mass prints which can be run in back ground and can print the PDF's from archiving system either IXOS or Saperion.

Any inputs are highly appreciated.

IW32 Enhancement: Display Spare Part Manufacturers Details on the Work Order Component-List screen

$
0
0

Overview:

Spare Part structure list doesn’t have a provision for the users to see the Manufacturer Details.

On the Work Order Component-List screen, the BOM of the PM Assembly can be expanded by clicking on

the structure list button. It will expand the BOM and display all the spare parts (BOM Items), line by line.

However this structure list doesn’t have a provision for the users to see the Manufacturer Details like

Manufacturer, Manufacturer Part Number and Preference number of the spares.

This kind of situation may arise when the business users want to find/pick the right component based on the Manufacturer, Manufacturer Part Number and Preference number.

                 

Requirement:

Display Spare Part Manufacturer details in ALV popup when user selects spare part and click on the display button.

 

Affected Transactions:

IW31/32/33

 

Solution Overview:

1. Add a custom button on application toolbar on Component-List tab of IW32.

2. Enhance include MIHIXF83 of program RIIFLO10 to display details in ALV popup.


Step-by-step Solution:

1. Add a custom button on application toolbar on Component-List tab of transaction IW32

Image1.png

Image2.png

Steps to add custom button on this screen


a.Create a custom PF-Status from transaction SE41

  - Copy standard PF-Status MAIN to custom PF-Status ZMAIN

Image3.png

 

  - Add a custom button in the PF-Status

Image4.png

b.Enhance the method ML_PBO of standard class CL_EAML_REPORTING to add Post Exit method.

  How to enhance standard class, please see

  How to enhancment standard ABAP class | SCN or **************** - Enhancement of a Standard Class 


  This will set the custom PF-Status on IW32-Component-List

Image5.png

  - Add lines of codes in post exit method to set custom PF-Status

Image6.png

  Execute IW32-Component-list and we can see the newly added button on application toolbar as shown in step 1.


2.Enhance include MIHIXF83 of program RIIFLO10 to display Manufacturer details in ALV popup

Image7.png

  a.Create implementation for this Enhancement Section

Image8.png

Create custom include and get manufacturer details from database for selected Spare part number. HIER table has all the spare parts from screen with    selected spare part as SELECTED = Y. Selected spare part number is available in DATA parameter of HIER table, therefore separate it from other data  and  get it into local variable. Pass this spare part number to BMATN of table AMPL and get manufacturer table.

Image9.png

 

                                                                           OR

Selected spare part number is directly available in STRNO parameterof table HIER based on the configuration or version of SAP, so there is no need to separate the selected spare part number from DATA of HIER, directly pass this number to get manufacturer details from database table. Logic for selection of manufacturer details and displaying in ALV popup remains the same.

 

Image10.png


  c.Call FM REUSE_ALV_POPUP_TO_SELECT to display internal table as ALV popup

image10.a.png


Scenario Test:

1.Go to Tcode IW32 Component overview and click on List

Image11.png

Expand tree, select spare part and click on custom button Manufacturer Details

Image12.png

3.ALV popup is displayed showing Manufacturer details

Image13.png


Conclusion:IW32-Component screen application toolbar is enhanced to add a custom button and display

                        Manufacturer details of Spare Part number.     




Viewing all 20 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>