Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all 935 articles
Browse latest View live

How to include ABAP Quick Search into NWBC

$
0
0

Follow these 7 easy steps to include the search in your Business Client:

For functionality, see: ABAP Quick Search for NWBC

 

0. Please check the system requirements: SAP Netweaver Release 7.4 or higher.

    Furthermore, not all functions will work with NetWeaver Business Client 4.

 

1. Copy the content of the "Program.txt" to a new Program and replace the placeholder with an appropriate program name. (e.g. "zrep_object_opener")

 

2. a) Create a transaction with an appropriate transaction code (e.g. "z_object_opener") like this (select "Program and selection screen..."):

Create Transaction.PNG

2. b) Change the transaction so that it starts the program you created in step 1.

Create Transaction2.PNG

3. Upload the file "resultpage.html" to a new folder in the MIME Repository:

Upload Resultpage.png

 

4. a) Copy the content of the file "Search_Class.txt" to a new class and replace the placeholders with an appropriate class name. (E.g. zcl_nwbc_abap_search)

 

Meth_Descr.PNG

 

4. b) Change the constant "cv_opener_transaction" to the name of the transaction you created in step 2 (e.g. " 'z_object_opener' ").

 

4. c) Change the constant "cv_result_page" to the path of the .html-file you uploaded in step 3:

 

Clonstants2.PNG

4. d) If you want to edit the whitelist for result types, you can change it in the class-constructor method.

 

5. a) Start the transaction 'SICF' and create a new service (via New Sub-Element).

Create Service.PNG

5. b) Enter a description and add the search class you created in step 4 to the handler list.

Create Service2.PNG

Don't forget to activate your service!

 

6. Add a new search provider in your NWBC. Therefore go to Options --> Settings --> Connections --> Search Providers...

Type in the address and port of your server (you can find it here: Options --> Settings --> Connections --> Systems... --> right click on system --> Properties... --> URL) and after that the path to the service you created in step 6 and "?type=OpenSearchDescription".

If you want to, you can add a "namespace" and/or "max_results" parameter, too, as shown here:

SearchProvider.png

7. Type something into the search bar and enjoy.


A complete Document for Dunning Procedure with Smartform

$
0
0

Normally, when we search about Dunning procedures we do get our solution in bits and pieces.

This document would provide a full solution if you want to code as well as configure your dunning procedure with smartforms.

 

What is Dunning?

Dunning is the process of methodically communicating with customers to ensure the collection of accounts receivable. Communications progress from gentle reminders to threatening letters and phone calls and more or less intimidating location visits as accounts become more overdue.

 

To automate the procedure for dunning we would need to find our BTE.

 

What is BTE?

 

For this the documents are readily available on SCN. Below is the link for the same: http://wiki.scn.sap.com/wiki/display/ABAP/BTE+-+Business+Transaction+Event

 

The most important step for us is to check if all the configurations are in place or not.

Step 1: Configuration of the process and the BTE.

T-code: BF44

Here we would provide our process which is indeed needed for our coding.

Img_1.png

 

The product assignment should also be done here.

 

Step 2: Activating the customer product

Next is T-code: BF24where our product would have a text assigned and it should be activated (Activate Customer Product indicator).

img_2.png

 

 

Step 3: Configure the FM


T-code: FIBF

The FM here would be the one from which the standard code for smartform would be triggered.

In case of smartform you should put FM as : FI_PRINT_DUNNING_NOTICE_SMARTF

And in case you would want that to be a script the FM would be: FI_PRINT_DUNNING_NOTICE.

img_3.png

 

Under the SAP application you would be able to give the name of your BTE.


img_4.png

 

Step 4: Configure the Smartform created


This can be done using the below path in SPRO:

img_5.png

 

Financial Accounting -> Accounts Receivable and Accounts Payable -> Business Transactions -> Dunning -> Assign Dunning Forms.

 

Select your respective procedure. This would prompt you to provide for the company code, enter as required.

Below section is the one in which you would provide your smartform name:


img_6.png

 

 

Now your configuration is complete.

 

Technical side for the Dunning procedure.

 

Scenario: The case would be that at each Dunning level a mail format has to be send to the customer with an attachment. This should be automated for each dunning level.

 

Coding in BTE.

 

The first step for this would be to make a copy of the sample BTE already present.

img_7.png

1040 is the BTE in which the coding for mailing the customer should be done.

The event for sending mail and attachment is done from the event 1720, for which Sap has already provided the coding under FM ‘PRINT_DUNNING_NOTICE_SF’.

 

The below structures are readily available in the FM “SAMPLE_PROCESS_00001040”. And so they would be in your FM copied from the sample BTE.


Explanations for each structure in order to code.

 

I_MHNK: This would have all the data for dunning. The most important ones would be the dunning date(LAUFD), ID(LAUFI), Account type(KOART), Company code and customer.

 

I_T047E: This would be the structure from which the form name would be passed to the standard FM for customizing the Dunning.

 

img_8.png

Structures for sending mail and attachment parameter are below:

 

C_FINNA: Data for Transmission Medium for Correspondence.


All the parameter required to send a mail are passed in here.


Important fields of this structure:


1.Intad: This is the field in which you would be able to pass the email address.

In most of the cases we would require multiple email ids to be sent. This can be done using the below code:

 

IF lw_email IS NOT INITIAL. "customer
c_finaa
-intad   = lw_email.
ENDIF.


* sales representative
IF lsw_proceed2 = abap_true.
IF lw_email1 IS NOT INITIAL.
IF c_finaa-intad IS NOT INITIAL.
CONCATENATE c_finaa-intad lw_email1 INTO c_finaa-intad SEPARATED BY space.
ELSEIF c_finaa-intad IS INITIAL.
c_finaa
-intad = lw_email1.
ENDIF.
ENDIF.
ENDIF.

* send to admin also
IF lsw_proceed1 = abap_true.
IF  ls1_dunn_1040-email IS NOT INITIAL.
CONCATENATE c_finaa-intad  ls1_dunn_1040-email INTO c_finaa-intad
SEPARATED BY space.
ENDIF.
ENDIF
.

 


2.      Namep: This field would be used to pass a text name( SO10 Text), which would be used to pass the mail body of the email.

 

In our BTE we should pass the name and the “READ_TEXT” would be automatically done by the code in SAP.

 

IF NOT lw_namep  IS INITIAL.
c_finaa
-namep = lw_namep .        

    c_finaa-mail_body_text = ls_dunn_text-namep.
ENDIF.

 

Also the field mail_body_text can be used for same purpose.

 

SAP standard would take this value in the changing parameter and do the below:


img_9.png

 

 

Always remember to create a SO10 text with “FIKO” as ID.


3.      Mail_send_addr: This field is used to specify the sender of the mail.

img_10.png

 

 

4.      Nacha: This field would be passed for Transmission Medium for Correspondence.


Values:

1 - Printout

2 – Fax

I - mail

 

 

C_ITCPO: SAPscript output interface


Fields:


1.      TDTITLE: This field would be used for the subject of the email and the attached document name.

If we try to change the Document name and subject we would not be able to do that for below code.


img_11.png

 

 

2.      All the spool/archive  parameters can be set with this structure – TDCOPIES, TDDEST, TDPREVIEW, TDARMOD.

 

Coding in smartforms.

 

Although we can create a new smartform according to our requirement but in this case we must always remember to pass a parameter in the Import Tab: IS_SFPARAM. Else there would also be an error for “ Parameter missing”.


img_12.png


So even assigning a new smartform created by us in possible.

 

In case of dunning scenario we would want many dynamic data to be placed in our smartform.

For this we would have to fetch the data in our smartform itself.

This would be possible with the parameter IS_SFPARAM. The dunning date and id could be captured with help of the SFPARAM-CONTENT field, where we would need to get the data by using offsets.


img_13.png

 

 

  This smartform would now be sent as the PDF attachment in the mail.

Cyclomatic complexity in ABAP

$
0
0

Introduction:-


The cyclomatic complexity measures the complexity of a program and is based on the control flow graph. It is a count for the number of linearly independent paths through the source code. It was developed by Thomas J. McCabe, Sr. in 1976.


The CC goes through a coding block and counts every time,  the control flow has a new path at a specific decision point. A new path will be created due to a "IF", "ELSE", "CASE" and so on.

 

Ideally, the CC should be between 7 and 15 at each coding block.


1. How to configure CCN

 

  1.1 Open any program using Tcode “SE38”. Go to program->check->Code Inspector

                   

               cyclo1.png

 

  1.2. Click on Utility->Default Check Variant->Maintain

                    Cyclo2.png

 

1.3 Select procedural metrics in selection screen. Click on green arrow button in front “procedural metrics”

 

                     cyclo3.png

  1.4 Select Show Metrics option. Change in “Scope and rule for metrics section as per your need”. Click on Ok     button.

 

                     cyclo4.png

 
  

 

 

2. How to check CCN

 

  2.1 Open  program using Tcode “SE38”. Go to program->check->Code Inspector

 

                cyclo5.png

  2.2  Go to “Procedural Metrics “ section. Double click on the detail line as per below screen shot

 

                     cyclo6.png

 

          

  2 .3  Cyclomatic complexity number should be displayed as output.

 

                    cyclo8.png

Generate custom MT103 file format for electronic vendor payments

$
0
0

Introduction-

Our client was exporting vendor payments via txt file from sap, but now they wanted to change the file format from txt to SIF format. So that they can export

data in SIF format from sap and do the vendor payments  ahead. So we have created new file format ZMT103 which was copy of MT103  And extended to further modifications as per the requirement.  

 

Steps to create the new file format ZMT103

1. In order to change the file format for vendor payment from txt to MT103,Copy the existing file format from MT103 to ZMT103 in tcode ‘OBPM1’ as shown below

1.png

2. Create 2 function modules in SE37.

    Copy FM ‘ZFI_PAYMEDIUM_MT103_20’ from FI_PAYMEDIUM_MT103_20

    In this FM, Modify header section of the file as per the requirement.

    then Copy FM ZFI_PAYMEDIUM_MT103_30 from FI_PAYMEDIUM_MT103_30

    In this FM, Modify main section in file as per the requirement.

 

3.Go to Tcode -> OBPM3 -> assign Fm ZFI_PAYMEDIUM_MT103_20 to Event ‘21’

   And FM ZFI_PAYMEDIUM_MT103_30 to Event ‘31’ as shown below.

2.png

3.png

 

4.Goto Tcode OBPM4 and create variant as shown below. Variant will not be transported, it should be created in each system

4.png

5.png

 

5.Now go to FBZP-> Payments in Country-> select country and specific method -> and assign format ‘ZMT103’ in the option ‘use payment medium

   workbench’ as shown below.

6.png

 

6.At last execute the payment run in F110 and get the file generated at the path mentioned in the variant /PBMG/legacy/ZEU6004_ZMT103.txt as shown

   below in the ZMT103 format.


12.png

ABAP Outbound Proxy

$
0
0

Introduction


The Proxy is used as an Interface to transfer or receive from or to the ABAP system.

Depending on the direction of flow of data Proxy can be divided as

 

     1. Client Proxy:

Proxy used for transfer of data from ABAP end. The classes generated when we create proxy will be for Outbound.

We need to call the method of Proxy class to transfer the data from ABAP end.

 

     2. Server Proxy:

Proxy for inbound interface is called Server Proxy.

 

This document briefly explains the step by step procedure needs to be followed to pass data available in an internal

table in SE38 executable program to PI using Proxy. This is for Client Proxy (Outbound).

 

Step By Step Procedure for Creating Proxy

 

 

Step1: The Proxy Service Interface has to be created by PI consultant from PI side. This will further reflect in ABAP side in T-Code “SPROXY”.


Step2: Create the Proxy from T-Code “SPROXY”.


        a. The Proxy created from PI side will be reflected with following details in SPROXY

(All details are for example please refer the screen shot 1 to check where it will be available)

Software Component: "Example 1.0 of INV"

Namespace:http://example/xyz/InvoiceDeltaLoad

Service Interfaces:“S168_InvoiceDeltaReplication_XXX_IB” for Inbound

                                   “S168_InvoiceDeltaReplication_OB” for Outbound.Screen_Shot1.png

Fig1

 

      b. Proxy Name will be available once we generate the Proxy.

             To generate proxy we need to right click on Service Interface “S168_InvoiceDeltaReplication_XXX_IB”

              for Inbound and “S168_InvoiceDeltaReplication_OB” for Outbound and click on “Create Proxy”.

         Screen_Shot2.png

                                                                                                   Fig 2

 

       c. The following dialog will popup when we select “Create Proxy”.

    • We need to give the “Package” and “Transport Request” to which the Proxy needs to be saved.
    • A prefix needs to be given which will be used as prefix for all the Objects generated while creating proxy. If we click on continue and then select on finish the proxy will be generated. Then we need to save and Activate the Proxy.
    • Once the proxy is created for a service interface then that Interface will be marked as Green.

           Screen_Shot3.png

                                                                                                         Fig 3

 

                    As you can see in “Fig 1” the outbound Proxy “S168_InvoiceDeltaReplication_OB” was already

                    created so it is marked Green. In the Right hand side of the “Fig 1” we can find the Proxy Name when we

                    double click on the generated Service Interface. In this case since the Outbound Proxy was already

                    generated we can find the Proxy name of that.

    Proxy Name: ZDL1CO_S168_INVOICE_DELTA_REPL

 

       d. The objects created when we generate a Proxy is as follows


               i.Data Type

                   “S168_InvoiceDeltaReplication_DT”


              ii.Message Type

                    “S168_InvoiceDeltaReplication_MT”


               iii.  Proxy Class.

Proxy Class name and Proxy Name will be same.

(For example “ZDL1CO_S168_INVOICE_DELTA_REPL”)

Screen_Shot4.png

                                                                     Fig 4

 

 

Coding required in ABAP end

 

 

Step1: Code to be written in SE38 to pass the data from internal table to the Proxy.


        a. Following Screen Shot shows the methods available in Proxy (ZDL1CO_S168_INVOICE_DELTA_REPL).

        Screen_Shot5.png

                                                                                                                     Fig 5

 

        b. Call the Method “S168_INVOICE_DELTA_REPLICATION” and Pass the data to the Importing parameter

             of the Method. Below Screen Shot shows the importing parameter of the Method.

         Screen_Shot6.png

                                                                                 Fig 6

 

        c. The Importing Parameter “OUTPUT” will be a Deep Structure.

            Following Screen Shots show the deep structure of “OUTPUT”.

 

             OUTPUT(Parameter) - ZDL1S168_INVOICE_DELTA_REPLIC2 (Associated Type)

          Screen_Shot7.png

                                                                                                                     Fig 7

 

           Components of ZDL1S168_INVOICE_DELTA_REPLIC2

           Screen_Shot8.png

                                                                                                              Fig 8

 

           S168_INVOICE_DELTA_REPLICATION(Component) - ZDL1S168_INVOICE_DELTA_REPLICA(Component type)

              

           Screen_shot9.png

                                                                            Fig 9

 

           Components of ZDL1S168_INVOICE_DELTA_REPLICA

        Screen_Shot10.png

                                                                                                                Fig 10

 

               “ZDL1S168_INVOICE_DELTA_REP_TAB” will be the table type of line type

               “ZDL1S168_INVOICE_DELTA_REPLIC1” the Structure of the Proxy table to which the data has to be

                 passed. This structure of Line type must be similar to the structure of internal table of the program

                 from which the data has to be passed.

     

                  The Structure of Line Type “ZDL1S168_INVOICE_DELTA_REPLIC1” in this case is

               Screen_Shot11.png

                                                                                                                               Fig 11

 

        d. Now before passing the data to the Method we need to pass the entire data available in the Internal table

             to the Internal table which is of type, table type “ZDL1S168_INVOICE_DELTA_REP_TAB” explained above.


        e. Pass the data from step d to “OUTPUT-S168_INVOICE_DELTA_REPLICATION- INVOICE”

             (Deep Structure) and then pass the “OUTPUT” to Method “S168_INVOICE_DELTA_REPLICATION”

             of class “ZDL1CO_S168_INVOICE_DELTA_REPL”.



Sample ABAP code


Following is the Example code needs to be written in ABAP end.

Here it_fin_delta[] is internal table in which the data to be passed to Proxy will be available.


DATA: it_output           TYPE zdl1s168_invoice_delta_replic2,

      it_delta            TYPE zdl1s168_invoice_delta_rep_tab,

      wa_delta            TYPE zdl1s168_invoice_delta_replic1,

      z01_otc_delta_class TYPE REF TO zdl1co_s168_invoice_delta_repl,

      z_otc_cl_exception  TYPE REF TO cx_ai_system_fault,

      l_error             TYPE string.

 

IF it_fin_delta[] IS NOT INITIAL.


LOOP AT it_fin_delta INTO wa_final.

  MOVE-CORRESPONDING wa_final TO wa_delta.

  APPEND wa_delta TO it_delta.

  CLEAR:wa_final,wa_delta.

ENDLOOP.

 

 

it_output-s168_invoice_delta_replication-invoice = it_delta.

 

CREATE OBJECT z01_otc_delta_class.

CREATE OBJECT z_otc_cl_exception.

 

CLEAR:l_error.

 

TRY.

  CALL METHOD z01_otc_delta_class->s168_invoice_delta_replication

    EXPORTING

     output = it_output.

    COMMIT WORK.

 

  CATCH cx_ai_system_fault INTO z_otc_cl_exception.

    l_error = z_otc_cl_exception->errortext.

    MESSAGE l_error TYPE c_e.

    EXIT.

  ENDTRY.

 

  IF sy-subrc EQ 0.

   MESSAGE text-i05 TYPE c_s.

  ENDIF.


ELSE.

WRITE: text-i06.

ENDIF.




Issue which can be faced during development with solution


Issue:

There was an issue experienced during the development for the Outbound Proxy. The issue was that the Data sent from ABAP side was getting stuck in the Queue. If we open the T-Code SMQ2 we can see that the queue is getting stuck and if we open the queue and process the data manually then the data was being sent to the PI side.


Solution:

We have to register the name of queue which will be created and in which the data will be stuck when we try to pass data.

For example consider the Queue name will be “XBTS1254”. Here you can check that whenever the data is passed it gets stuck in queue which starts with “XBTS”. So we need to register queue with name XBTS*


1. Go to Transaction SMQR. This T-Code is used to Register the Queue.

Screen_Shot13.png

                                                                                          Fig 12

 

2. Click on Registration. The following POP up appears.

Screen_Shot14.png

                                                                       Fig 13

 

3. Queue name: XBTS*(Example)

    MODE: D (Preferable by SAP)

    Max.Runtime: 60(Example)

    Logical Destination should be Empty. Else the data will still be stuck in Queue.

    Attempts: 30(Example)

    Pause: 300(Example)

    Scheduler Monitoring: 0(Example)


4. Once the Queue is registered with the name then the data will be passed directly to Proxy without getting stuck.

ABAP Channels Demos in AS ABAP 7.5 Developer Edition

$
0
0

This guide explains step-by-step how to execute the ABAP Channels demos, contained in the AS ABAP 7.5 Developer Edition incl. links to the relevant SCN blogs and videos.

View this Document

CL_BCS_CONVERT Send Excel Attachment - Foreign Characters Issue Fix

$
0
0

Problem:

 

While downloading an excel attachment file sent from SAP system you will come across a strange scenario where foreign characters are displayed as a garbage value having rectangular blocks like characters.

 

How to avoid this ?

 

Following is an example that you can use. Here, we make use of " cl_bcs_convert=>string_to_solix ".


<<<< and >>>> indicate notes. Please have a look on them carefully.

 

CONSTANTS: c_docd(13) TYPE VALUE 'Document Date',

           c_refd(25) TYPE VALUE 'Reference Document Number',

           c_plnt(5TYPE VALUE 'Plant',

           c_c1       TYPE VALUE '=',

           c_c2       TYPE VALUE '"',

           c_tab      TYPE VALUE cl_bcs_convert=>gc_tab,

           c_crlf     TYPE VALUE cl_bcs_convert=>gc_crlf.

 

DATA: l_string       TYPE string,

       send_request   TYPE REF TO cl_bcs,

       document       TYPE REF TO cl_document_bcs,

       recipient      TYPE REF TO if_recipient_bcs,

       bcs_exception  TYPE REF TO cx_bcs,

       main_text      TYPE bcsy_text,

       binary_content TYPE solix_tab,

       size           TYPE so_obj_len,

       sent_to_all    TYPE os_boolean,

       mailto         TYPE so_obj_nam VALUE 'ZTEST_CL_BCS'.

 

DATA : date TYPE sydatum.

 

DATA : l_recipient     TYPE REF TO if_recipient_bcs.

 

date = sy-datum.

 

CONCATENATE c_docd  c_tab  date c_crlf

             c_refd  c_tab  c_c1 c_c2 '조광피혁(주)'   "<<<< HERE ARE SOME KOREAN CHARACTERS >>>>

             c_c2    c_crlf

             c_plnt  c_tab  c_c1 c_c2 'Data '

             c_c2    c_crlf c_crlf

             INTO l_string.

 

TRY.

     cl_bcs_convert=>string_to_solix(

       EXPORTING

         iv_string   = l_string

         iv_codepage = '4103'   "suitable for MS Excel <<<< THIS IS MANDATORY TO AVOID RECTANGULAR CHAR. >>>>

         iv_add_bom  = 'X'      "for other doc types   <<<< ALSO THIS !! >>>>

       IMPORTING

         et_solix  = binary_content

         ev_size   = size ).

   CATCH cx_bcs.

     MESSAGE 'Error when transfering document contents' TYPE 'E'.

ENDTRY.

 

TRY.

* create persistent send request

     send_request = cl_bcs=>create_persistent( ).

 

     APPEND 'THIS IS MAIN TEXT' TO main_text.

 

* create and set document with attachment

     document = cl_document_bcs=>create_document(

       i_type    = 'RAW'

       i_text    = main_text

       i_subject = 'This is Subject' ).

 

* add the spread sheet as attachment to document object

     document->add_attachment(

       i_attachment_type    = 'xls'

       i_attachment_subject = 'Attat. Subject'

       i_attachment_size    = size

       i_att_content_hex    = binary_content ).

 

* add document object to send request

     send_request->set_document( document ).

 

  l_recipient = cl_cam_address_bcs=>create_internet_address('testmail@gmail.com' ).

 

     CALL METHOD send_request->add_recipient

       EXPORTING

         i_recipient = l_recipient "'testmail@gmail.com'

         i_express   = 'X'.

 

 

* <<<< THE BELOW COMMENTED CODE CAN BE USED FOR DISTRIBUTION LIST>>>> *

** add recipient (e-mail address)

*    recipient = cl_distributionlist_bcs=>getu_persistent(

*      i_dliname = mailto

*      i_private = space ). " Distribution List maintained via SO23

 

** add recipient object to send request

*    send_request->add_recipient( recipient ).

* <<<< TILL HERE !!>>>> *

 

 

* send document

     sent_to_all = send_request->send( i_with_error_screen = 'X' ).

 

     COMMIT WORK.

 

     IF sent_to_all IS INITIAL.

       MESSAGE i500(sbcoms) WITH mailto.

     ELSE.

       MESSAGE s022(so).

     ENDIF.

 

   CATCH cx_bcs INTO bcs_exception.

     MESSAGE i865(so) WITH bcs_exception->error_type.

ENDTRY.



And there's the solution !!


Cheers !!


Comment if you get any issues !!

Dynamic tray selection through ABAP Code

$
0
0

Author                : Ramani Nagarajan

Organization      : IBM India Pvt Ltd

Title                     : Dynamic tray selection while printing forms through ABAP Code

Mail-id                 : ramani600091@gmail.com

 

 

 

Requirement

 

We all know that, any forms can be printed on the required Tray by setting the appropriate value to the "Resource Name" field in the design screen of the form and be activated.

 

But the current requirement is to set the "Resource-Name" attribute of both Smartforms (or) SAPScript dynamically just before the form is printed.

 

This article explains how to set it dynamically !!

 

 

Printing the forms on the required tray

 

Incase of Smart forms, currently there are 2 ways to print the forms on the required tray as below:

 

  1. By assigning the "Resource Name" attribute field on the Smartforms designer with the below values:

             TRY01  for Tray-1

     TRY02  for Tray-2

     and so on  up to 9

 

   2. Or, by changing the default tray on the SPAD transaction

 

Smartform ResourceName.jpg

 

     Incase of SAPScript, the above said point-1 is the only way

 

SAPScript ResourceName.jpg

 

 

 

Challenges

 

There is no dynamic value assignment capability available for the field "Resource Name" on both the forms.   Owing to the best practice, an alternative way to be discovered for assigning the tray values at run time before the printing, instead of Hardcoding or changing the SPAD settings (incase of Smartforms).

 

 

Proposed solution

 

Upon exploring the SAP approach on the "Form printing", it is found that, the Print-Attribute entered in the design time of both Smartforms & SAPScript are Exported to Memory database table as below:

 

Incase of SAPScript    :      STXL(xx)

Incase of Smartforms  :      STXFCONTR(sf)

 

Below given is the screen shot of the Import Procedure being done by the Standard coding of SAP:

Import Procedure.jpg

 

And the print routine, imports the Print Attributes from the above memory database table and assign it to printing.

 

Logic for proposed solution

 

 

  1. Import the relevant print attribute of the concerned form
  2. Keep a local copy of it
  3. Lock the Memory Database Table record
  4. Change the Resource Name with the required TRAY on the imported internal table
  5. Export the above modified internal table back to the Memory Database Table
  6. Call the Form Printing routine
  7. Export the Local Copy of internal tables from Step(2) back to the Memory Database Table
  8. Unlock the Memory Database Table

 

Code Snippet:

 

The complete code written on a Class named as "ZCL_PRNTR_ATTRIBUTE" is attached for reference.

 

There are 5 methods implemented as below:

  1. OPEN_FORM
  2. CLOSE_SMARTFORM
  3. CLOSE_SAPSCRIPT
  4. WRITE_SMARFORM
  5. WRITE_SAPSCRIPT
  6. REFRESH_MEMORY

 

 

Following steps are to be written in the Driver-Program in the same sequence:

 

(1) OPEN_FORM is the main form which is to be called through the Driver Program.

(2) <Existing print routine>  --> No change in these

(3) CLOSE_SMARTFORM or CLOSE_SAPSCRIPT is to be called

 

 

Note: Methods (4),(5),(6) are executed internally through other methods.  Hence, we do not need to call them.

 

       

How to invoke the coding?

 

Here is the screen shot for calling procedure through Driver-program:
Sample Program.jpg

Note: Highlighted rows are our new methods.

 

How to utilize the attached code?
The code is a generic code, which can be used anywhere.  Hence, anyone can copy the code and use it.

 

 

**Caution:

During testing, please, let the driver program run the sequence as cited above fully.

 

Once the OPEN_FORM method is run, CLOSE_SMARTFORM/ CLOSE_SAPSCRIPT method also should be executed  sequentially.  Hence, do not abort the execution half the way.   This would leave the current print attribute values with the Memory Database Table.  To reset the values, we have to re-activate the Smartforms / SapScript by changing the Resourse-Name to blank.

 

Thanks for reading it!!

 

 

Ramani Nagarajan

IBM India Private Limited


Enhancement of RF Screens - LMOB

$
0
0

There are various links in SCN, which guide us on the use of RF programming and the steps to follow while developing a custom program. But what if a standard screen from LMOB function group needs to be modified??

Here is the complete steps, which can be referred to add the customer fields to standard RF screen belongs to LMOB function group.

 

  • Get the Actual Screen Number based on Logical Screen Number in SPRO -> Logistic Execution -> Mobile Data Entry -> Define Screen Management

IMG.png

 

  • For Example, to enhance the RF screen of Pick and Pack (LM45 Transaction) the Logical Screen for Pick and Pack is ‘0650’. In the Define Screen Management (defined above) the actual screen number in Narrow Format (16X20) is ‘2650’ and Large Format(8X40) is ‘0650’

Screen Management_1.png

Screen Management_2.png

  • In the LMOB function group for every logical screen a dummy screen is available which contains the screen exit. The dummy screens can be identified as ‘1(logical screen). So for logical screen ‘650’ the dummy screen is ‘1650’.

Function Group_LMOB.png

The program mentioned in the green color is nothing but the user screen i.e the screen which has to be created in that program as a subscreen.

 

  • Now copy the narrow format screen ‘2650’ in the program ‘SAPLXLHU’ as custom screen ‘9650’ (Follow the naming standards of custom screen number 9(logical screen)).

Copy Screen.png

  • In the function group XLHU, screen 9650 gets created. Now remove the OK_CODE from ‘Element list’ tab and screen type is changed to ‘Subscreen’

Custom Screen.png

Element List.png

Flow Logic.png

  • Add the additional fields in the screen layout and populate those fields in PBO or get the values in PAI after a certain user action by capturing the SY-UCOMM.

Screen Painter.png

  • Now the subscreen ‘9650’ has to be embedded in the dummy screen 1650. To do this create a CMOD project and assign the enhancement component MWMRF650

SAP Enhancements.png

SAP Enhancements.png

Note: The enhancement component can be identified by using the F4 help in SMOD transaction. Use the package name as search criteria


  • Activate the CMOD project. The screen exit 1650 gets implemented.

CMOD Project.png

  • Now the custom screen ‘9650’ is configured in the Screen Management (SPRO) for the narrow format (16X20)

Screen Management.png

  • To run the RF transactions, the user must have a screen format configured in the LRFMD transaction.

LRFMD.png

Note: The Variant in the Screen Management and in the LRFMD transaction should be same.


  • Run the transaction LM45

Enhanced LM45.png

  • If the user doesn’t want the additional fields then remove the variant in LRFMD transaction

LRFMD.png

  • Now run the transaction LM45

LM45.png

My own Function-Module to calculate duration between 2 dates and 2 times

$
0
0

I was searching for a function module that should calculate the duration of 2 tasks .

 

Import Parameter:

DATE_FROM

DATE_TO

TIME_FROM

TIME_TO

 

As result I need values separated into

YEARS

MONTHS

DAYS

HOURS

MINUTES

SECONDS

 

 

Most standard function deliver only one(1) result and than this return value is from type F (floating number, like 2,34546787E-03) and I did not want to convert the result into integer. Other standard functions look like they could work, but when I checked them I found that they where calculation wrong!

 

So I came to the conclusion to copy+paste what ever I can and I wrote my own function module using the SAP function module 'L_TO_TIME_DIFF' 

Here it is (check attachment)

 

 

Please comment if you find a BUG, I will try to solve it.

 

 

 


Germany, 16.01.2016

Jörg Sauterleute

 

 

----

UPDATE, 17.01.2016

I found and error and replaced attachment/coding...


UPDATE, 22.01.2016

another bug found (seconds where wrong when time_to < time_from)

 

UPDATE, 28.01.2016

next bug with time (seconds where wrong, when date_to = date_from AND time_to < time_from) :-P

ABAP training video in Turkish / Türkçe ABAP Eğitimi

$
0
0

Hello ,

 

I'm sharing a video recording of ABAP training we've made in our company for beginners,  in Turkish language.

 

For a beginner ,

it's always easier to learn in his / her native language and using a video,

So I wanted to share this for developers from Turkey looking for an easy beginning to ABAP :

 

 

Best regards,

 

Bulent

Debug Background Job with Ease

$
0
0

In some exceptional case, we may need to analyze the program scheduled as background job in non -development systems. We can accomplish this using below ways.

  • JDBG (Job debugger)
  • Debugging the work process in SM51
  • If the job ends immediately before reaching SM51, adding endless loop in the code and debug the work process from SM51

 

The idea of this document is to share the other available approach in debugging the background job.

 

When a completed job is debugged using JDBG, system creates a copy of the entire job and it is re-run during debugging. The database changes can be possible as a result of debugging using JDBG. So I would like to analyze the job before it completes.

 

If you are used to analyze the background job using work process debug, then you may need to note down the application server & work process in which the job is run. In many cases, the job might get executed before we reach/spot the work process in SM51.

 

How to handle such cases in non- development system:

 

What if you need to analyze a standard / custom program in non-development system which is run in background & it completes instantaneously on scheduling. You will not be able to add Endless loop in the code in such cases.

 

  • Using BTCLOOP Report:

 

If you have Edit authorization in debugging, then you can follow the below steps.

 

Schedule the report BTCLOOP as a step 1, followed by the program which you need to analyze.

The program BTCLOOP has an endless loop and the work process will be executing this code. We can identify the work process without any rush and debug by selecting the workprocess and clicking on Administration->Program->Debugging

 

btc.png

 

In the debugger, exit the loop and F8 would stop the debugger at the external breakpoint which you have set in the program to be analyzed.

 

  • Using RSWAITSEC Report

 

If you don’t have Edit authorization in debugging, then you can schedule the report RSWAITSEC instead of BTCLOOP. If you have set 20 in this report, the nworkprocess will be waiting for 20 seconds. In the meantime, you can reach the workprocess in SM50. After the wait time ends, the debugger will start and you can proceed your analysis from there.

 

wait.png

 

If you have used other effective ways to handle such similar cases, please share it here.

 

With Regards,

Karthikeyan

ZTOAD 3.4.3 - partly translated to German

$
0
0

NUGG_ZTOAD_DE.nugg - Google Drive

 

The link above contains ZTOAD 3.4.3 ZTOAD - Open SQL editor, partly translated by me into German.

 

It is only translated partly, because I did not know how to get the translation of the dynpro and status texts into the saplink nugget.

If anyone tells me how to do it, I will also translate and share these parts.

 

Best regards,

Dominik Di Lorenzo

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

$
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.

 

test.png

Send Material in Full - Change Pointers option in BD10

$
0
0

We all came across the scenario where material master has to be sent to external system whenever there is a change in particular fields. So we generally achieve this by configuring the change pointers for message type and all the necessary configuration. Now we execute BD21 for our message type, which will generate the material master idoc only with mandatory segment and then only the segments which have changed fields.

That was simple and everything was a standard process but if there is a requirement to send the material master details in full even one field is changed then we cannot use this standard approach so we may end up in developing a custom function module to create a idoc with all the segments.

This document will explain a way to create material master using BD10 transaction, SAP has provided a several Explicit Enhancements in the program RBDSEMAT

we can make use of those enhancements to modify the selection screen and to call the function module CHANGE_POINTERS_READ before creating the idoc and CHANGE_POINTERS_STATUS_WRITE after creation of idoc.

 

Step 1 - We need to modify the selection screen so that a option is provided to create the idoc using change pointers

If you don not want the title of the frame, then no need to create a second enhancement which populate the frame title

 

Step 2 - Enhancement AT SELECTION-SCREEN OUTPUT, to populate field label GC_CHG and to retrieve the materials using CHANGE_POINTERS_READ

 

Step 3 - The above step will populate the materials which are not yet processed in the ECC system, Once the Idoc is generated for the relevant materials you have to change the status of change pointers

 

Result - Modified Selection Screen

 

Once you execute the program, Idoc gets created for all the Materials and then status of the change pointers are updated as 'Processed'

 

 

Currently, I did this enhancement to trigger the MATMAS idoc. Code can be modified accordingly to process ARTMAS, MATCOR etc idocs


Do we use Issue Management with ITSM (CRM_UI) - transaction type SLFI?

$
0
0

We are trying to test and use CRM_UI for ITSM.  We customized SMIN and added 2 fields.  The users also want to look at Issue Management which we see in SM_WORKCENTER.

 

I am looking for Issue Management using CRM_UI and do not see it.  I would like the users just to use CRM_UI and also provide Issue Management.  Is this possible?

So can we add transaction type SLFI for Issue Management in CRM_UI?

 

We are using Solman 7.1 and CRM 7.01

 

Thanks!

Kathy

 

Hi Kathy,

 

Unfortunately in standard configuration issue management is used in combination of incident management.

 

As there are no direct work centres provided for issue management in current standard configuration.

 

 

However you can create the workcenter for the issue management.

 

But you need the abap help for same, first you need to create the logical link and then assign the logical links to link groups. and then assign those groups to workcenters.

 

Thanks

Rishav

 

Thanks Rishav for your reply.  I can go into SPRO and create the logical link to assign to the link group.  And then assign the groups to the workcenter.

 

But we saw the below link associating Problem with Issue.  So SAP does not want us to use SLFI and use Incident and Problem instead in ITSM (CRM_UI)?

 

Thanks!

Kathy

 

https://help.sap.com/saphelp_sm71_sp01/helpdata/en/2e/5ca8e1f1964d249f3465f24654f2a9/content.htm?frameset=/en/ab/92e80795084827a0296ecfd3ca619b/frameset.htm&current_toc=/en/b3/64c33af662c514e10000000a114084/plain.htm&node_id=264Thanks

 

Hi Kathy,

 

 

We can use the issue management as a direct workcenter in CRM_UI, but for that we have to customize that in crm ui component workbench.

 

Thanks

Rishav

 

Thanks Rishav.

 

I will try to create the New Web IC Component via BSP_WD_CMPWB  for Issue Management, so I can create the link to create a Work Center.

 

Kathy

 

Hi Kathy,

 

Great.!! Please close this thread if it got resolved.

Please share the document for the development.

 

Thanks

Rishav

 

This document was generated from the following discussion: Do we use Issue Management with ITSM (CRM_UI) - transaction type SLFI?

ST03N - A custom solution

$
0
0

Hi all.

 

This is a simple program I developed years ago to show Users's activity on programs and transactions.

 

It's a simpler solution, to use instead of ST03N standard. (Nugg file attached if you need)

 

To implement the solution, you'll have to create a custom DYNPRO 100.

 

Create a structure named ZWORKLOAD with these fields:

 

MANDTMANDTCLNT3
PERIODSPMONNUMC6
ACCOUNTZWKACCOUNTCHAR12
NMACCOUNTZWKNMACCCHAR80
ZTCODEZSWLTCODECHAR40
DDTEXTZWKDTEXTCHAR70
TYPELEMZTYPELEMCHAR1
ZLNCHTZWKZLNCHTCHAR10
ZREPNMZWKDREPBNCHAR40
ZDESREPNMZWKDESREPNMCHAR70
DEVCLASSZWKCLASSCHAR30
DESCLASSZWKDESCLCHAR80
COMPIDZWKCOMPIDCHAR24
CNAMZWKCNAMCHAR12
CDATZWKCDATDATS8
CNAMODZWKCNAMODCHAR12
CDATMODZWKCDATMODDATS8
DESTASKTYPEZWKTSKTYPCHAR16
ZSTEPSZWKSTEPSINT410

 

 

 

*&---------------------------------------------------------------------*
*& Report  Z_ST03N
*&
*&---------------------------------------------------------------------*
*&  Statistic report and transaction consume
*&
*&---------------------------------------------------------------------*
REPORT  Z_ST03N.
* Table Declaration
TABLES: ZWORKLOAD, V_USR_NAME, TSTCP, TRDIRT, TSTCT,        TADIR, TDEVC, DF14L, TSTC, TRDIR, TDEVCT.
* Global data
*DATA: t_output TYPE TABLE OF SWNCAGGUSERTCODE, "SWNCHITLIST,  ""Final output table
DATA: t_work    TYPE TABLE OF SWNCAGGUSERTCODE "SWNCHITLIST                WITH HEADER LINE,            "Tabella temporanea      t_dirmoni TYPE TABLE OF SWNCMONIKEY                WITH HEADER LINE.          "Workload component
DATA: t_output TYPE TABLE OF ZWORKLOAD WITH HEADER LINE.
DATA: itsktp TYPE SWNCTASKTYPERAW.
DATA: BEGIN OF t_elcod OCCURS 0,          ztcode TYPE ZWORKLOAD-ztcode,      END OF t_elcod.
DATA: BEGIN OF it_tstcp OCCURS 0,        tcode TYPE tstcp-tcode,        zrepnm TYPE ZWORKLOAD-zrepnm,        zdesrepnm TYPE ZWORKLOAD-zdesrepnm,      END OF it_tstcp.
CONSTANTS: ZNAMESTRUC TYPE DD02L-TABNAME VALUE 'ZWORKLOAD'.
*-----------------------------------------------------------------------
* ALV specific Declarations...........................................
*-----------------------------------------------------------------------
* ALV specific Internal table declarations.............................
DATA: i_field_cat TYPE lvc_t_fcat, " Field catalogue      i_alv_sort TYPE lvc_t_sort. " Sort table
* ALV variables........................................................
DATA: w_alv_layout TYPE lvc_s_layo, " ALV Layout      w_alv_save TYPE c, " ALV save      w_alv_variant TYPE disvariant. " ALV Variant
* Selection parameters
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS: s_period FOR ZWORKLOAD-PERIOD DEFAULT sy-datum,                s_tcode FOR ZWORKLOAD-ZTCODE,                s_user FOR ZWORKLOAD-ACCOUNT,                s_reptr FOR ZWORKLOAD-TYPELEM.
SELECTION-SCREEN END OF BLOCK b1.
* ALV Class definitions................................................
*-----------------------------------------------------------------------
CLASS lcl_event_handler DEFINITION.
*-----------------------------------------------------------------------  PUBLIC SECTION.    METHODS:    handle_double_click FOR EVENT double_click OF cl_gui_alv_grid        IMPORTING e_row e_column,    handle_hotspot FOR EVENT hotspot_click OF cl_gui_alv_grid        IMPORTING e_row_id e_column_id.
ENDCLASS. " CLASS LCL_EVENT_HANDLER DEF..
* ALV Class implementation............................................
* In the Event of a Double Click drill down to the corresponding CHANGE REQUEST
*-----------------------------------------------------------------------
CLASS lcl_event_handler IMPLEMENTATION.
*-----------------------------------------------------------------------  METHOD handle_double_click.  ENDMETHOD. " HANDLE_DOUBLE_CLICK
* not working yet - hotspot seems to stay in the gui!!  METHOD handle_hotspot.  ENDMETHOD. " HANDLE_DOUBLE_CLICK
ENDCLASS. " CLASS LCL_EVENT_HANDLER IMPL...
* ALV Grid Control definitions........................................
DATA:
* ALV Grid Control itself
o_grid TYPE REF TO cl_gui_alv_grid,
* Container to hold the ALV Grid Control
o_custom_container TYPE REF TO cl_gui_custom_container,
* Event handler (defined in the class above)
o_event_handler TYPE REF TO lcl_event_handler.
*&----------------------------------------------------------------------*
INITIALIZATION.
*&----------------------------------------------------------------------*  PERFORM create_field_catalogue USING ZNAMESTRUC                                  CHANGING i_field_cat. " Create ALV Field Catalog
START-OF-SELECTION.
* Carica dati di output  PERFORM get_data_workload.  IF NOT t_output[] IS INITIAL.    PERFORM list_output_to_alv. " Perform ALV Output operations  ENDIF.
END-OF-SELECTION.
*&---------------------------------------------------------------------*
*----------------------------------------------------------------------*
* FORM LIST_OUTPUT_TO_ALV *
*----------------------------------------------------------------------*
* This subroutine is used to call the screen for ALV Output. *
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine. *
*----------------------------------------------------------------------*
FORM list_output_to_alv.  CALL SCREEN 100.
*
ENDFORM. " LIST_OUTPUT_TO_ALV
*----------------------------------------------------------------------*
* Module STATUS_0100 OUTPUT *
*----------------------------------------------------------------------*
* This is the PBO module which will be processed befor displaying the *
* ALV Output. *
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.  SET PF-STATUS '0100'. " PF Status for ALV Output Screen  SET TITLEBAR 'STD'.  CREATE OBJECT: o_grid  EXPORTING i_parent = cl_gui_container=>screen0. "o_custom_container.  PERFORM define_alv_layout. " ALV Layout options definitions  PERFORM save_alv_layout_options. " save ALV layout options  PERFORM call_alv_grid. " Call ALV Grid Control
ENDMODULE. " STATUS_0100 OUTPUT
*----------------------------------------------------------------------*
* Module USER_COMMAND_0100 INPUT *
*----------------------------------------------------------------------*
* This is the PAI module which will be processed when the user performs*
* any operation from the ALV output. *
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.  CASE sy-ucomm.    WHEN 'EXIT' OR 'BACK' OR 'CANC'.
* may need to do this so display is refreshed if other report selected
*      CALL METHOD o_custom_container->free.       SET SCREEN 0.  ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*----------------------------------------------------------------------*
* FORM DEFINE_ALV_LAYOUT *
*----------------------------------------------------------------------*
* This subroutine is used to Define the ALV layout. *
*----------------------------------------------------------------------*
FORM define_alv_layout .
*  w_alv_layout-numc_total = 'X'. " Numc total line  w_alv_layout-cwidth_opt = 'X'. " Optimal column width
*  w_alv_layout-detailinit = 'X'. " Show values that are initial in  " detail list.  w_alv_layout-sel_mode = 'A'. " Column selection mode  w_alv_layout-no_merging = 'X'. " No merging while sorting columns
*  w_alv_layout-keyhot = 'X'.
ENDFORM. " DEFINE_ALV_LAYOUT
*----------------------------------------------------------------------*
* FORM SAVE_ALV_LAYOUT_OPTIONS *
*----------------------------------------------------------------------*
* This subroutine is used to Save the ALV layout options. *
*----------------------------------------------------------------------*
FORM save_alv_layout_options.
* See the ALV grid control documentation for full list of options  w_alv_save = 'A'.  w_alv_variant-report = sy-repid.
ENDFORM. " SAVE_ALV_LAYOUT_OPTIONS
*----------------------------------------------------------------------*
* FORM CALL_ALV_GRID *
*----------------------------------------------------------------------*
* This subroutine is used to call ALV Grid control for processing. *
*----------------------------------------------------------------------*
FORM call_alv_grid.  CALL METHOD o_grid->set_table_for_first_display    EXPORTING      is_layout      = w_alv_layout      i_save          = w_alv_save      is_variant      = w_alv_variant    CHANGING      it_outtab      = t_output[]      it_sort        = i_alv_sort      it_fieldcatalog = i_field_cat.
* Link used Events and Event Handler Methods  CREATE OBJECT o_event_handler.
* Set handler  SET HANDLER o_event_handler->handle_double_click FOR o_grid.
ENDFORM. " CALL_ALV_GRID
*&---------------------------------------------------------------------*
*& Form create_field_catalogue
*&---------------------------------------------------------------------*
* set up field catalogue
*&---------------------------------------------------------------------*
FORM create_field_catalogue USING tb_name LIKE DD02L-TABNAME                            CHANGING pt_fieldcat TYPE lvc_t_fcat..  DATA: ls_fcat type lvc_s_fcat.  FIELD-SYMBOLS: <lf1> TYPE lvc_s_fcat.  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'    EXPORTING      i_structure_name      = tb_name    CHANGING      ct_fieldcat            = pt_fieldcat[]    EXCEPTIONS      inconsistent_interface = 1      program_error          = 2      OTHERS                = 3.  IF sy-subrc <> 0.
* Exceptions handling  ENDIF.  LOOP AT pt_fieldcat ASSIGNING <lf1>.    CASE <lf1>-fieldname.
*      WHEN 'TERMINALID'.
*        <lf1>-SCRTEXT_S = text-f01.
*        <lf1>-SCRTEXT_M = text-f01.
*        <lf1>-SCRTEXT_L = text-f01.
*      WHEN 'TCODE'.
*        <lf1>-SCRTEXT_S = text-f02.
*        <lf1>-SCRTEXT_M = text-f02.
*        <lf1>-SCRTEXT_L = text-f02.      WHEN OTHERS.        <lf1>-KEY = 'X'.    ENDCASE.  ENDLOOP.
ENDFORM. " create_field_catalogue
*&---------------------------------------------------------------------*
*&      Form  get_data_workload
*&---------------------------------------------------------------------*
*      text
*----------------------------------------------------------------------*
FORM get_data_workload.  DATA: i_valido TYPE c.  DATA: i_entry(40),        i_account TYPE ZWORKLOAD-account.  TYPES: BEGIN OF t_steps,          period TYPE ZWORKLOAD-period,          account TYPE ZWORKLOAD-account,          entry_id(40),          count TYPE ZWORKLOAD-zsteps,        END OF t_steps.  DATA: it_steps TYPE HASHED TABLE OF t_steps WITH UNIQUE KEY period account entry_id.  DATA: h_steps TYPE t_steps.  REFRESH: t_dirmoni, t_output, it_steps, it_tstcp, t_elcod.
* Lettura carichi di lavoro  CALL FUNCTION 'SWNC_COLLECTOR_GET_DIRECTORY'    EXPORTING      GET_DIR_FROM_CLUSTER = ' '      EXCLUDE_SUMMARY      = ' '    TABLES      DIRECTORY_KEYS      = t_dirmoni    EXCEPTIONS      NO_DATA_FOUND        = 1      OTHERS              = 2.  IF SY-SUBRC <> 0.  ENDIF.
" Application servers WORKLOAD
* with month registration period  LOOP AT t_dirmoni WHERE COMPONENT NE 'TOTAL' OR                          PERIODTYPE NE 'M'.    DELETE t_dirmoni.  ENDLOOP.  LOOP AT t_dirmoni.    REFRESH t_work.
" Read aggregated activity    CHECK t_dirmoni-periodstrt(6) IN s_period.    CALL FUNCTION 'SWNC_COLLECTOR_GET_AGGREGATES'      EXPORTING        component        = t_dirmoni-COMPONENT        periodtype      = t_dirmoni-PERIODTYPE        periodstrt      = t_dirmoni-PERIODSTRT      TABLES          USERTCODE      = t_work
*          HITLIST_DATABASE = t_work      EXCEPTIONS        no_data_found    = 1        OTHERS          = 2.    SORT t_work BY account entry_id.    CLEAR: i_entry, i_account.    LOOP AT t_work.
* Step Counter for each report/transaction      CLEAR h_steps.      MOVE t_work-account TO h_steps-account.      MOVE t_work-entry_id(40) TO h_steps-entry_id.      MOVE t_dirmoni-periodstrt(6) TO h_steps-period.      MOVE t_work-count TO h_steps-count. "numero di steps      READ TABLE it_steps WITH KEY account  = h_steps-account                                  entry_id = h_steps-entry_id                                  period  = h_steps-period                                TRANSPORTING NO FIELDS.      IF sy-subrc EQ 0. "If already exists
" Collect data steps        COLLECT h_steps INTO it_steps.        DELETE t_work.        CONTINUE.      ELSE.
" Collectdata steps        COLLECT h_steps INTO it_steps.      ENDIF.
"Filter to verify selection conditions      CLEAR t_output.      MOVE t_work-account TO t_output-account.      MOVE t_work-entry_id+72(1) TO t_output-typelem.      MOVE t_work-entry_id(40) TO t_output-ztcode. "Save transaction code or report      CONDENSE t_output-ztcode NO-GAPS.      IF NOT t_work-entry_id+40(32) IS INITIAL. "If name defined = JOB        MOVE 'B' TO t_output-zlncht.      ENDIF.      MOVE t_dirmoni-periodstrt(6) TO t_output-period.      MOVE t_work-tasktype TO t_output-destasktype. "To convert      PERFORM verifica_selezioni USING t_output                                  CHANGING i_valido.      IF i_valido EQ 'X'.        PERFORM add_info CHANGING t_output.        append t_output.      ENDIF.    ENDLOOP.  ENDLOOP.  IF t_output[] IS INITIAL.    MESSAGE i000(fb) WITH text-e01.  ENDIF.  SORT t_output BY period account ztcode zrepnm.  DELETE ADJACENT DUPLICATES FROM t_output COMPARING period account ztcode zrepnm.  LOOP AT t_output.    CLEAR: h_steps.    READ TABLE it_steps INTO h_steps WITH KEY entry_id = t_output-ztcode                                                period = t_output-period                                                account = t_output-account.    IF sy-subrc EQ 0.
"Assign step value calculated      t_output-zsteps = h_steps-count.    ENDIF.    IF sy-subrc EQ 0.      MODIFY t_output.    ENDIF.  ENDLOOP.
ENDFORM.                    "get_data_workload
*&---------------------------------------------------------------------*
*&      Form  add_info
*&---------------------------------------------------------------------*
*      Info details
*----------------------------------------------------------------------*
*      -->T_OUTPUT  output table
*----------------------------------------------------------------------*
FORM add_info CHANGING t_output TYPE ZWORKLOAD.  DATA: ipgmna TYPE tstc-pgmna,        ifctr_id TYPE tdevc-component.  DATA: iconta TYPE i.  DATA: search_trsn TYPE string.
" Conversion task type description  CLEAR itsktp.  MOVE t_output-destasktype TO itsktp.  CLEAR t_output-destasktype.  CALL METHOD CL_SWNC_COLLECTOR_INFO=>TRANSLATE_TASKTYPE    EXPORTING      TASKTYPERAW = itsktp    RECEIVING      TASKTYPE    = t_output-destasktype.
" Set extend name account  CLEAR t_output-NMACCOUNT.  SELECT SINGLE name_text FROM V_USR_NAME INTO t_output-NMACCOUNT      WHERE BNAME eq t_output-account.  IF t_output-typelem EQ 'T'.
****************** DATA on transaction*****************************    CLEAR t_output-DDTEXT.    SELECT SINGLE ttext FROM TSTCT INTO t_output-DDTEXT        WHERE tcode EQ t_output-ztcode AND              sprsl EQ sy-langu.
* Development class
*  Component
* Creator
* Creation Data
* Modification author
* Modification date    CLEAR: t_output-devclass.    SELECT SINGLE devclass        FROM TADIR INTO t_output-devclass      WHERE obj_name EQ t_output-ztcode AND            object EQ 'TRAN' AND            pgmid EQ 'R3TR'.
" Search application component    CLEAR: t_output-COMPID, ifctr_id.    IF NOT t_output-devclass IS INITIAL.      SELECT SINGLE component FROM TDEVC INTO ifctr_id        WHERE devclass EQ t_output-devclass.      IF sy-subrc EQ 0.        SELECT SINGLE ps_posid FROM DF14L INTO t_output-COMPID          WHERE fctr_id EQ ifctr_id.      ENDIF.    ENDIF.    CLEAR: ipgmna.    SELECT SINGLE pgmna FROM TSTC INTO ipgmna      WHERE tcode EQ t_output-ztcode.    CLEAR: t_output-cnam, t_output-cdat, t_output-cnamod, t_output-cdatmod.    SELECT SINGLE cnam cdat unam udat        FROM TRDIR INTO (t_output-cnam,t_output-cdat,t_output-cnamod,t_output-cdatmod)      WHERE name EQ ipgmna.
* Development class description    CLEAR t_output-DESCLASS.    SELECT SINGLE ctext FROM TDEVCT INTO t_output-DESCLASS      WHERE devclass EQ t_output-devclass AND                spras EQ sy-langu.  ELSEIF t_output-typelem EQ 'R'.
****************** DATA on REPORT *****************************
* Object description    CLEAR t_output-DDTEXT.    SELECT SINGLE text FROM TRDIRT INTO t_output-DDTEXT        WHERE name EQ t_output-ztcode AND              sprsl EQ sy-langu.
* Development Class
* Component
* Creator
* Creation data
* Modification author
* Modification date    CLEAR: t_output-devclass.    SELECT SINGLE devclass      FROM TADIR INTO t_output-devclass      WHERE obj_name EQ t_output-ztcode AND            object EQ 'PROG' AND            pgmid EQ 'R3TR'.
" Search application component    CLEAR: t_output-COMPID, ifctr_id.    IF NOT t_output-devclass IS INITIAL.      SELECT SINGLE component FROM TDEVC INTO ifctr_id        WHERE devclass EQ t_output-devclass.      IF sy-subrc EQ 0.        SELECT SINGLE ps_posid FROM DF14L INTO t_output-COMPID          WHERE fctr_id EQ ifctr_id.      ENDIF.    ENDIF.    CLEAR: t_output-cnam, t_output-cdat, t_output-cnamod, t_output-cdatmod.    SELECT SINGLE cnam cdat unam udat        FROM TRDIR INTO (t_output-cnam,t_output-cdat,t_output-cnamod,t_output-cdatmod)      WHERE name EQ t_output-ztcode.
* Development class description    CLEAR t_output-DESCLASS.    SELECT SINGLE ctext FROM TDEVCT INTO t_output-DESCLASS      WHERE devclass EQ t_output-devclass AND            spras EQ sy-langu.
* For report search transactions code related    CLEAR: iconta, search_trsn. ", it_tstcp,.    CONCATENATE '%D_SREPOVARI-REPORT=' t_output-ztcode '%' INTO search_trsn.    CONDENSE search_trsn NO-GAPS.    CLEAR: tstcp, t_output-zrepnm, t_output-ZDESREPNM, it_tstcp.    READ TABLE t_elcod WITH KEY ztcode = t_output-ztcode.    CHECK sy-subrc NE 0. ""If object code founded, it's a report with no association    READ TABLE it_tstcp WITH KEY tcode = t_output-ztcode.    IF sy-subrc EQ 0.      t_output-zrepnm = it_tstcp-zrepnm.      t_output-zdesrepnm = it_tstcp-zdesrepnm.    ELSE.      SELECT SINGLE * FROM tstcp WHERE param LIKE search_trsn.      IF sy-subrc EQ 0.        t_output-zrepnm = tstcp-tcode.        CLEAR t_output-ZDESREPNM.        SELECT SINGLE ttext FROM TSTCT INTO t_output-ZDESREPNM            WHERE tcode EQ t_output-zrepnm AND                  sprsl EQ sy-langu.        SELECT SINGLE * FROM tstcp WHERE param LIKE search_trsn AND                                          tcode NE tstcp-tcode.        IF sy-subrc EQ 0.          t_output-zrepnm = text-i01.          t_output-ZDESREPNM = text-i02.          it_tstcp-tcode = t_output-ztcode.        ELSE.          it_tstcp-tcode = tstcp-tcode.        ENDIF.        it_tstcp-zrepnm = t_output-zrepnm.        it_tstcp-zdesrepnm = t_output-zdesrepnm.        APPEND it_tstcp.      ELSE.        t_elcod-ztcode = t_output-ztcode.        APPEND t_elcod.      ENDIF.    ENDIF.  ENDIF.
ENDFORM.                    "add_info
*&---------------------------------------------------------------------*
*&      Form  verifica_selezioni
*&---------------------------------------------------------------------*
*      text
*----------------------------------------------------------------------*
*      -->F_LINE    text
*      -->F_VALIDO  text
*----------------------------------------------------------------------*
FORM verifica_selezioni USING f_line TYPE ZWORKLOAD "SWNCHITLIST                        CHANGING f_valido.  CLEAR f_valido.
* Report or Transaction?  CHECK f_line-typelem IN s_reptr.
* Check report and transaction Filter Selection  CHECK NOT f_line-ztcode IS INITIAL AND f_line-ztcode IN s_tcode.
* Check Username Filter Selection  CHECK NOT f_line-account IS INITIAL AND f_line-account IN s_user.  f_valido = 'X'.
ENDFORM.                    "verifica_selezioni

 

That's all folks. I hope you enjoy.

 

Probably this utility will be useful, or probably not. It's all part of the game

 

Bye!

 

 

Text Definition

 

E01No data available
F01Terminal
F02Transaction
F03User
F04Object name
I01****
I02Found many transactions
T01Selection parameters

ROle User Object Authorization - Cerbero

$
0
0

Hi.

 

In this document I would like to share a custom report that gives an hand on Role Authorization Analysis.

 

Most of time there's a deep forest behind this world of authorization profiles.

 

With this solution, You can easily find out details on:

- Users Profiles authorization;

- Authorization objects;

- Roles;

- Fields Role Association;

 

You'll be able to:

- Include  incomplete objects;

- Include deleted objects;

- Range values explosion;

- Asterisk values explosion;

 

If needed there's a limit of records included.

 

Here attached you'll find Nugg or TXT report.

Hope you enjoy.

 

HAND to all! Bye

Adjusting Table Maintenance Generator without re-generating it, when Table Structure changes

$
0
0

Purpose:

Suppose we have a table in the dictionary and it has a maintenance generator which contains many events and lot of features (display a field as drop down, check box or field header text) incorporated manually in the function group of the maintenance generator. At this moment if the table structures changes and it requires one extra field to be appended and maintenance generator needs to be there as it was previously with the amended of the new field then changing the table structure and re-generating the maintenance generator will not provide the solution. If we re-generate the maintenance generator after changing the table structure then it will incorporate the new field but all the events and other features will be deleted from the maintenance generator. So same features and events needs to be coded again.

This can be avoided by adjusting the maintenance generator manually and not re-generating it using the following steps:

 

Step1:

Create a table ZTEST_EMP using tcode SE11 with a maintenance generator.

P1.png

Now Utilities->Table Maintenance Generator and create the Maintenance Generator:

P2.png

Now from SM30 tcode we can create new entries to the table:

P3.png

Display table ZTEST_EMP:

P4.png

Step2:

Change the table structure with the addition of new field ‘EMP_AGE’ and activate it:

P5.png

Now if we display the table it will also display the new field with initial value:

P6.png

But the table maintenance generator will not contain the new field:

P7.png

Step3:

Now we will adjust the Table Maintenance Generator so that this additional field is added and other functionalities in the Table Maintenance Generator remains intact.

 

Get the Function Group from the Table Maintenance Generator Display:

P8.png

P9.png

Go to tcode SE80 and open the function group and select the screen number and click on Layout from toolbar.

P10.png

This Design Screen will appear:

P11.png

Add the extra column (input/output field) manually:

P12.png

Name the new column as the same updated in the table structure.

P13.png

Add the column header text as follows: Name the header text field as- *ZTEST_EMP-EMP_AGE

P14.png

P15.png

 

Save and Back. Go to Flow Logic tab and add the following line indicated:

P16.png

Go to Element List->General Tab: Tick the red marked field as dictionary field.

P17.png

Save it. Following pop up will be prompted. (Select your choice accordingly and click ok)

P18.png

 

Then the following popup will come. (Click as per your requirement. Here we choose yes as we want new table field to be in Table Maintenance Generator)

P19.png

Finally Activate the Table Maintenance Generator. If activated successfully then go to tcode SM30 to maintain data.

P20.png

 

We will change Employee age as 30 and save the record. In the table display we can see that age is updated.

P21.png

Working with Arabic text and English together in a single smartform

$
0
0

Hello All,

 

Hope this might be useful!

 

If you have 5fields like First Name, Last Name , Date, Place, Address.

And in the above fields if you have to display both english and arabic words in a single smartform, then you can follow the following simple logic for each field.

 

1.The form is created in english.

2.No need of passing "AR" in control  parameters also.

3.Let us take an example -- if English text is Name -- Varun its corresponding arabic text is  فارون.

4.But normal excution of smartform inverses the arabic text and displays from LTR, which is wrong.

5.With the below code we can display english(latin) text left to right(LTR) and arabic(hebrew) text right to left(RTL) with out much complexity.

 

DATA:  lv_name type string,

             lv_cnt type i.


lv_name = 'فارون'. "Arabic text

 

lv_cnt = strlen( lv_name ). "Finding the length of the arabic text.


"Rearranging the stirng to LTR, so that when it prints on form it will be Still be printed as LTR, but as the text was already converted to LTR in our code,

"during display it helps to print in correct arabic way.


DO lv_cnt TIMES.

   lv_int = lv_cnt - sy-index.

     CONCATENATE lv_arabic lv_name+lv_int(1) INTO lv_arabic.

ENDDO.


CONDENSE lv_arabic NO-GAPS.


If this LV_ARABIC is assigned to smartform text, then once printed on PDF, it will work fine.


Viewing all 935 articles
Browse latest View live


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