Quantcast
Channel: Tweaks
Viewing all 66 articles
Browse latest View live

ABAP String Operation – Identify & Manipulate Negative Amount in Long String with Separators

$
0
0

In this high tech world of RESTful ABAP Programming, CDS, BOPF, BRF+, Fiori Elements etc, you might be smiling on reading this ancient String Operation topic at SAPYard. We completely understand your though process and even agree with it. But whatever technology SAP might come up with, clients always have some requirement, where we need fall back to basics. So, we are not ashamed to publish this article which will show the tip for those poor ABAP developers who have not yet seen the much hyped modern SAP System. More over, this is a real project scenario and the solution might be useful for someone in need in some corner of this SAP world.

Introduction:

As an ABAPer we all have worked with String in our Program and everyone is well aware of string operations in ABAP. Sometime we come across situation that we need to play with string in ABAP program.

Requirement:

To identify negative amount values in a long string and move negative sign from right to left of value. The negative sign can come in any place. It is not fixed.

For example, in below image negative amount values are at any place in long string.

Logic:

  • Identify the separators.

Here separators are ‘#’. Sometimes it may be ‘;’ or ‘,’.

  • Identify total number of separators in a string and their position.

This can be done by below statement

RESULT_TAB will hold position of ‘#’ in the string.

For example :

We need OFFSET column from this table.

  • We have to define two position pointers to hold high and low position value.

High value will point to 2nd row and Low value will point to 1st row OFFSET value in the table.

For example :

 in this TEXT position and values are as below

PositionValue
0#
14
27
30
4.
55
60
7
8#

I need Low postion value to hold ‘1’ and High position value to hold ‘8’

  • Calculate the difference between High and Low value position.

 That means the number is 7 digit long.

  • Read this 7 digit long value in one variable called VALUE.
  • Once we get the value, we can play with it like moving negative sign in front of the value.

First we have to check whether it has negative sign?

For this, we checked rightmost value is negative or not? If we found that the VALUE has negative sign at right, then we moved it to Left(as per user’s requirement)

  • The final output is

Also Read: Utility Program to Auto Format the Texts into Meaningful Sentence

Complete Program:

REPORT ZSAT_TEST_STRING.

DATA :  SIGN        TYPE STRING VALUE '-',
        SEPARATOR   TYPE STRING VALUE '#',
        TEXT        TYPE STRING,
        TEXT1       TYPE STRING,
        VALUE       TYPE STRING,
        LV_STRLEN   TYPE I,
        LV_INDEX    TYPE I,
        LV_POS      TYPE I,
        LV_OFFSET_H TYPE I,
        LV_OFFSET_L TYPE I,
        LV_DIFF     TYPE I,
        LV_DIFF1    TYPE I,
        RESULT_TAB  TYPE MATCH_RESULT_TAB,
        WA_TAB      LIKE LINE OF RESULT_TAB,
        WA_TAB1     LIKE LINE OF RESULT_TAB,
        WA_TAB2     LIKE LINE OF RESULT_TAB.

***For test case string value is taken directly.

TEXT = '#470.50-##SA#20191130#40#42.57-#UAH###0034821037#20191219#20191231#20191231#100.75-'.

TEXT1 = TEXT.

CLEAR LV_STRLEN.
LV_STRLEN = STRLEN( TEXT ).

REFRESH RESULT_TAB[].

FIND ALL OCCURRENCES OF SEPARATOR IN TEXT RESULTS RESULT_TAB.

*FIND ALL OCCURRENCES OF CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB IN TEXT RESULTS RESULT_TAB.
IF NOT RESULT_TAB[] IS INITIAL .
  SORT RESULT_TAB BY OFFSET.
***Appending Last Line in Result_Tab in case last value is negative
  CLEAR WA_TAB2.
  READ TABLE RESULT_TAB INTO WA_TAB2 INDEX 1.
  WA_TAB2-OFFSET = LV_STRLEN.
  APPEND WA_TAB2 TO RESULT_TAB.

***Looping Result Tab
  LOOP AT RESULT_TAB ASSIGNING FIELD-SYMBOL(<FS_TAB>).
    IF SY-TABIX = 1.
      CONTINUE.
    ENDIF.

    CLEAR : LV_INDEX, LV_POS, LV_OFFSET_H, LV_OFFSET_L, VALUE, LV_DIFF, LV_DIFF1.

***To extract the VALUE between two separators.
    LV_INDEX = SY-TABIX.
    LV_POS = <FS_TAB>-OFFSET - 1.
    LV_OFFSET_H = <FS_TAB>-OFFSET.
    LV_INDEX = LV_INDEX - 1.
    CLEAR WA_TAB.
    READ TABLE RESULT_TAB INTO WA_TAB INDEX LV_INDEX.
    IF SY-SUBRC = 0.
      LV_OFFSET_L = WA_TAB-OFFSET.
    ENDIF.
    LV_OFFSET_L = LV_OFFSET_L + 1.
    LV_DIFF = LV_OFFSET_H - LV_OFFSET_L.

    VALUE = TEXT+LV_OFFSET_L(LV_DIFF).

***To move negative sign in front of amount value.
    LV_DIFF1 = LV_DIFF - 1.
    IF LV_DIFF1 GT 2.
      IF VALUE+LV_DIFF1(1) = SIGN.
        CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
          CHANGING
            VALUE = VALUE.
        REPLACE TEXT+LV_OFFSET_L(LV_DIFF) IN TEXT WITH VALUE.
      ENDIF.
    ENDIF.
  ENDLOOP.
ENDIF.
WRITE : / 'Input String'.
WRITE : / TEXT1.
WRITE : / 'Output String'.
WRITE : / TEXT.

This is my first article at SAPYard. I am planning to share all new stuff I learn in my project here. Your comments and feedback will surely help me share quality content. Please feel free to write the good, bad and ugly part of this tuturial.

cOMMENTS pLEASE!!!

Do join 6700+ SAP Technical Consultants in this Telegram SAP Technical Discuss Group. Ask, Answer and Learn is our Motto. You need to install Telegram App first in your mobile or desktop and then click the joining link.

Please SUBSCRIBE to SAPYard’s Youtube Channel for Free End to End SAP Video Course and Training.

Please follow our LinkedIn Page, LinkedIn Group, Facebook Page, Twitter and Instagram.

Do not forget to SUBSCRIBE to our YouTube Channel for Free Courses and Unconventional Interesting Videos.

Save our number +1-646-727-9273 and send us a Whatsapp message ‘LEARN’ to be part of our Learning Community.

Check some more Code Snippets at SAPYard


Pop Up Debugging [ROBO 2.0]

$
0
0

Few years back we showed how to Debug the Pop Up Screen using notepad. Please check Pop Up Debugging Trick Tutorial here. I have named id ROBO [Pop Up Debugging By Notepad File]. Just ROBO. Do not ask me what it means. 😀

In this article, we will try to explain some other ways of Pop Up Debugging using SAP Shortcut

  1. ROBO 2.0 [ Pop Up Debugging by SAP Shortcut ]
  2. ROBO Chitti [ Pop Up Debugging by SAP Shortcut with More Ease ]

1. ROBO 2.0 [ Pop Up Debugging By SAP Shortcut ]

We assume, most of us know about Pop Up Debugging with SAP Shortcut. But if you are not aware, let me show how to create and use SAP Shortcut to Debug SAP Pop Up. This is my ROBO 2.0 (nothing official about it) :P.

SAP Shortcut creation Steps as below.

You can create shortcut from any screen

Type = ‘System Command’; Transcation = ‘/H’; Location = ‘Desktop’ (wherever you want)

Now we will see how can we use the same SAP Shortcut to Debug the Pop Up!.

Step:1 [ I have a screen where I have to debug the Pop Up ]

Step:2 I minimized all my applications by using Window + D shortcut then I held and dragged the SAP shortcut which I created in above steps and moved or navigated to SAP GUI Application that was already opened in Taskbar Level i.e. as below

That’s it.

BRF+ Training Announcement

Enrollment Fee – Pay & Confirm
Course Syllabus – BRF+ Agenda
Dates: 17, 18, 24, 25, 31 Oct, 1, 7 & 8 Nov 2020
Time: 7:30 AM to 9:30 AM IST

2. ROBO CHITTI [ Pop Up Debugging by Shortcut with more Ease ]

So far we created SAP Shortcut and Dragged from Desktop and Dropped the same on Pop Up and Debugged. Minimizing all the working session and finding the short cut and then dragging it to the pop up screen is a hassle. We can ease the process by Pinning the GUI Shortcut to the Taskbar instead. You can right click the short cut and Pin to Taskbar or use any other methods you know to Pin any application on the Taskbar. Once you have the shortcut pinned, open the SAP GUI Application Pop Up which you want to debug. It is easier now.

Just drag the shortcut you have pinned to the pop up screen.

I hope you already figured out the advantage of this method. No need to minimize all applications [with Window + D] to drag and drop the SAP Shortcut on to Pop Up and no need to worry about navigating to SAP GUI Application by holding the shortcut. Simply we can drag the same shortcut (Upwards) from Task Bar and Drop it on to ‘Pop Up‘.

I am sure, most of you knew about both these methods. But we still thought of sharing this because you never know, there might be some young or old mind who gets enlightened by this simple tweak.

This is my first article at SAPYard, please do let us know your feedback. The good and the not so good comments please.

Comments Please!!

Do join 6700+ SAP Technical Consultants in this Telegram SAP Technical Discuss Group.Ask, Answer and Learn is our Motto. You need to install Telegram App first in your mobile or desktop and then click the joining link.

Please SUBSCRIBE to SAPYard’s Youtube Channel for Free End to End SAP Video Course and Training.

Please follow our LinkedIn Page, LinkedIn Group, Facebook Page, Twitter and Instagram.

Save our number +1-251-727-9273 and send us a Whatsapp message ‘LEARN’ to be part of our Learning Community.

Check some more Code Snippets at SAPYard

The post Pop Up Debugging [ROBO 2.0] first appeared on https://sapyard.com.

Why Underscore “_” is Converted into Space at Runtime in ABAP?

$
0
0

Few years back, my seniors say they feared ABAP will be Dead. But today with S/4HANA, CDS, AMDP, RESTful Application Programming, ABAP Programming for SAP Fiori, ABAP on Cloud .. fewwwwhh!! ABAP cannot be more ALIVE and KICKing. So, it is good time we come back to basics of SAP ABAP.

In this article we will discuss a very simple topic, Why _ (underscore) is converted into space at runtime and how can we handle it? Lets discuss the scenario once. Here I am considering standard t-codes and screens viz SE11, SE38 etc to show the standard behavior in ABAP or should we say the exemption which is there in ABAP? 🙂

Which Standard behavior I am talking about? Let’s dig a little more. Here we are talking about ‘_’ . This special character is converted into space at runtime. Let’s see it first hand. Got to t-code SE11. If you enter _ (underscore) in any of the selection input, it will get converted into space. Let me try putting _(underscore) in SE11 selection input and see the behavior by clicking enter.

This image has an empty alt attribute; its file name is image-9.pngThis image has an empty alt attribute; its file name is image-8.png
Before and after clicking enter, ‘_’ will disappear.

As it is clear from above example, _(underscore) will disappear after clicking enter. Let’s take into account another example. We have some standard table. For example VBAP. Lets see what is the behavior in the selection screen for table input.

If we input _ (underscore) in any of the table fields and hit the return key, it vanishes.

This image has an empty alt attribute; its file name is image-11.pngThis image has an empty alt attribute; its file name is image-12.png
Same Behavior here also after clicking enter

Now the question arises why this behavior in ABAP? What could be the reason that _ (underscore) and ! (exclamation) are getting converted into space at runtime. Let us try to understand the behavior with few datatypes. We have created the following simple report for better explanation.

In this report , I have created parameters to get input from user. I have used char1, char2, string, sstring, text40 to see the behavior. Enter _ (underscore) as input to all the parameters.

Can you guess the Output?

From this it is clear that only string data type supports the “_”(underscore). My hypothesis which might be completely wrong is that because strings are dynamic data objects and string can hold variable length, it shows _. String datatype has no upper limit. sstring datatype also has variable length but there is upper limit.

If anyone of you have a better explanation, please put in the comments sections. We will update our post accordingly.

Now, if the text consists of several words, they are joined together automatically by underscores, which are replaced by spaces at runtime. This could be one of the reasons . But string hold value dynamically and there is no reset on the field at runtime.

How can we store underscore in database table with char1 (if we need only one character)?

We do not have any specific real business case. Lets assume for some reason we want to save _ in one of the fields of the table. Can can we achieve it? Is it really possible to achieve it? Can we store underscore as single character in database?

Answer is yes, we can do that. We can do it with the help of TMG (Table Maintenance Generator).

Follow the below steps

1. Create a database table using SE11. I created the database table with fields as follows:

2. Create Table Maintenance generator from utilities> Table Maintenance Generator (TMG) as follows:

3. After creation of TMG, double click on overview screen number, following screens will open:

This image has an empty alt attribute; its file name is image-18.pngThis image has an empty alt attribute; its file name is image-19.png
After double clicking overview screen number ,other screen will open as shown

4. Now click on layout (highlighted above), following screen will open. Double click on field and select “Without Reset” and “Without Template”. With the help of these you can add underscore in DB table. Click save and activate button.

5. Now you will be able to save _ (underscore) in table as follows:

Also ReadSAP TMG – No Need to Delete & Regenrate After Change of Table Structure

This was one trick which I recently learned. Not sure, how many of you will need in real projects. But, this was a very unique and different learning experience. Therefore thought of sharing with you. Do let me know how you feel about this simple concept.

Comments Please

Please follow our LinkedIn Page,LinkedIn Group, Facebook Page, Facebook Group, Twitter , Instagramand Telegram SAP Technical Group.

Do not forget to SUBSCRIBE to our YouTube Channel for Free Courses and Unconventional Interesting Videos.

Also consider joining SAPYard’s Telegram Channel for SAP Blogs and Tutorials.

Save our number +1-251-727-9273 and send us a Whatsapp message ‘LEARN’ to be part of our Learning Community.

Also Check ABAP on Cloud Tutorials

The post Why Underscore "_" is Converted into Space at Runtime in ABAP? first appeared on https://sapyard.com.

How to Handle Special Characters in a String in ABAP?

$
0
0

The characters apart from 0-9, a-z and A-Z are considered to be special characters. The reason is still unknown to me, but may be because they make guest appearances in strings, sometimes!!, just kidding.

Recently while working in one system integration project between SAP SRM and SAP Ariba, I was asked to download the attachments of Purchase Order and Long Term Agreements(LTA(s)) into an application server (AL11) folder from where the SAP PI interface would pick the files and transfer them to Ariba servers. This sounds easy, but the topic under consideration came into the picture when we saw that the file names of the attachments were having some special characters which were not allowed at the Ariba side.

To mention them, special characters allowed by Ariba platform are: ! ; # $ % & ‘ ` ( ) ~ _ ^ @ = , – . and to design logic for this, we should consider the fact that we need to consider that the number of characters can increase or decrease later.

Therefore, we thought of 2 approaches. To describe them at a high level, the approaches are:
1. Create a custom table and maintain all the special characters which must be allowed in the same. Then create a function module where we will have to write the logic to check each and every character of the file name string as per our requirement. Obviously, you cannot maintain some of the special characters like ! _ etc.
2. Create a TVARVC variable and pass all the allowed special characters in the same as a string. Then create a function module which filters the incoming string using regular expressions.

New Training Announcement

ABAP RESTful Application Programming on Cloud & on Premise – Starts 6th of Feb 2021

Enrollment Link – ABAP RAP
Course Syllabus – ABAP RAP Content
Training Days – 6, 7, 13, 14, 20, 21, 27, 28 Feb, 6 & 7 Mar 2021 IST
Time: 7:30 AM to 9:30 AM IST (GMT+5.5)

Now, let’s discuss the same one by one.

Approach – 1

Create a Custom Table with any name starting from Z/Y, for example, ZSPEC_CHAR_ALLWD, which holds 2 columns MANDT and ALLOWED_SPECIAL_CHAR

Custom Table which will hold all the special characters to be allowed.

The Technical settings are as follows:

Technical Settings

Enhancement Category: Can be enhanced – ( character-like )
Create a Table Maintenance Generator(TMG) as well to maintain the characters.

For Testing, we have maintained only 2 special characters ‘#’ and ‘$’, which should be allowed.

Allowed special characters and masked the client”

Program lines/logic to handle the same:

<code>"Constants Declarations
 CONSTANTS: gc_num     TYPE char10 VALUE '0123456789',
            gc_uscore  TYPE c      VALUE '_',
            gc_exclaim TYPE c      VALUE '!'.
 
 "Data Declarations
 DATA: gt_allowed_chars TYPE STANDARD TABLE OF zspec_char_allwd,
       gv_abcde_low     TYPE sy-abcde,
       gv_str_len       TYPE i,
       gv_counter       TYPE i,
       gv_uscore        TYPE c,
       gv_string        TYPE sdok_filnm,
       gv_replace_space TYPE c LENGTH 2.
 
 "Selection Screen
 PARAMETERS: p_string TYPE crmt_ic_email_file_name
             DEFAULT TEXT-001. "Text-001 = Wel~!@#$come to SAP@#$%^&amp;*()Yard
 
 "Fetch all the special characters to be allowed.
 SELECT * FROM zspec_char_allwd INTO TABLE gt_allowed_chars.
  
   "Get all the english alphabets
   gv_abcde_low = sy-abcde.
 
   "convert them to lower case for case sensitive search.
   TRANSLATE gv_abcde_low TO LOWER CASE.
 
 *&amp;---------------------------------------------------------------------*
 *&amp; - If it is required to replace the space with some other character
 *&amp; - for example by underscore, then un-comment the below code.
 *&amp;---------------------------------------------------------------------*
   CONCATENATE space gc_uscore INTO gv_replace_space SEPARATED BY space.
   CONDENSE p_string.
   TRANSLATE p_string USING gv_replace_space.
   gv_uscore = gc_uscore.
 *&amp;---------------------------------------------------------------------*
   gv_string = p_string.
 
   "Count the length of the incoming string.
   gv_str_len = strlen( p_string ).
 
   "Now, let's check each and every character.
   DO gv_str_len TIMES.
     "To avoid any dump for the case that might exist as below:
     IF gv_counter GT gv_str_len.
       EXIT.
     ENDIF.
 *&amp;---------------------------------------------------------------------*
 *&amp; Check1. Allowed Special Character maintained in table ZSPEC_CHAR_ALLWD
 *&amp; Check2. Character is between A-Z
 *&amp; Check3. Character is between a-z i.e. in lower case.
 *&amp; Check4. Character is between 0-9
 *&amp; Check5. Character if replaced with underscore, then ignore
 *&amp;         underscore.
 *&amp;---------------------------------------------------------------------*
     READ TABLE gt_allowed_chars TRANSPORTING NO FIELDS
     WITH KEY allowed_special_char = gv_string+gv_counter(1).
 
     IF NOT ( sy-subrc = 0 OR
              gv_string+gv_counter(1) CA sy-abcde OR
              gv_string+gv_counter(1) CA gv_abcde_low OR
              gv_string+gv_counter(1) CA gc_num OR
              gv_string+gv_counter(1) EQ gv_uscore ).
 
       WRITE:/ 'Character ',gv_string+gv_counter(1) COLOR 3,' not allowed.' .
 
       REPLACE gv_string+gv_counter(1) IN gv_string+gv_counter WITH ''.
       gv_str_len = gv_str_len - 1.
       CONTINUE.
     ENDIF.
 
     "Increment the counter.
     ADD 1 TO gv_counter.
 
   ENDDO.
 
   CONDENSE gv_string.
   WRITE:/'Output : ' COLOR 5 , gv_string.</code>

Let’s execute the program and pass the string

Output:

This way we have tried to achieve the requirement of removing as well as ignoring some of the special characters as per our requirement. In case they want to include some other special characters to be ignored, they need not change the program, but they can just maintain the same in the table. Only in case, if some character is not getting saved in the table, we need to handle the same by making the change in the program logic.

Also ReadHow can we store underscore in database table with char1 (if we need only one character)?

Approach – 2 – Using Regular expressions

In this approach, to make the whole concept dynamic, we will just maintain the special characters to be allowed in a TVARVC variable. Then in our program, function module or wherever required we will just fetch the TVARVC variable value and create the regular expression dynamically.

TVARVC variable – We will allow only ‘#’ and ‘$’ in the variable.
Go to Tcode: STVARV and maintain the variable as below:

<code>"Constants Declarations
CONSTANTS: lc_var_name          TYPE rvari_vnam
           VALUE 'ZSYARD_ALLOWED_SPECIAL_CHARS',
           lc_allowed_chars(11) TYPE c
           VALUE '&#91;^0-9a-zA-Z'.

"Data Declarations
DATA: gs_tvarvc    TYPE tvarvc,
      gv_regex1    TYPE c LENGTH 120 VALUE '&#91;^0-9a-zA-Z]+',
      gv_regex_all TYPE c LENGTH 120,
      gv_exception TYPE string,
      go_root      TYPE REF TO cx_root.

*"Selection Screen
PARAMETERS: p_string TYPE crmt_ic_email_file_name
            DEFAULT TEXT-001. " p_string = @#$%^&amp;*()Wel~!@#$come to SAP@#$%^&amp;*()Yard

SELECT SINGLE * FROM tvarvc INTO gs_tvarvc
  WHERE name = lc_var_name.

WRITE:/ 'String Passed: ' COLOR 3, p_string.
SKIP.

"Create the regular expression.
CONCATENATE lc_allowed_chars gs_tvarvc-low ']+' INTO gv_regex_all.

CONDENSE p_string.

TRY .
    "Incase the requirement is to have the first character as alphanumeric only
    REPLACE FIRST OCCURRENCE OF REGEX gv_regex1 IN p_string WITH space.

    WRITE:/ 'First character should be alphanumeric only' COLOR 4.

    WRITE:/ p_string.

    "Replace the unwanted special characters from the string with undescore
    "ignoring the special characters maintained in TVARVC.
    REPLACE ALL OCCURRENCES OF REGEX gv_regex_all IN p_string WITH '_'.
    SKIP.
    WRITE:/ 'After removing unwanted special characters' COLOR 5.
    WRITE:/ p_string.
  CATCH cx_root INTO go_root.
    gv_exception = go_root-&gt;get_text( ).
    MESSAGE gv_exception TYPE 'S' DISPLAY LIKE 'E'.
ENDTRY.</code>

Output:

Let’s execute and see the output:

This way too, we have tried to achieve the requirement of removing as well as ignoring some of the special characters as per our requirement. In case they(users) want to include some other special characters to be ignored, they need not change the program, but they can just maintain the same in the TVARVC variable. In this also, in case we want to ignore only underscore or exclamatory symbol for example, the rule is the same here as well, that they cannot be maintained alone in a variable, but the good thing is that they can be placed with other symbols in the same.

As far as the output coming in UPPER CASE is concerned, when you will use the same via function module in a program, the results will be case sensitive.

This was just one requirement, there can be numerous untested cases, for them obviously, we might need to adjust the code as per the requirement.

Hope you enjoyed this blog post. But, I will be more than delighted to receive your constructive feedback. Happy Learning!!

Comments, please.

Please follow our LinkedIn Page,LinkedIn Group, Facebook Page, Facebook Group, Twitter , Instagramand Telegram SAP Technical GroupSignal Group.

Do not forget to SUBSCRIBE to our YouTube Channel for Free Courses and Unconventional Interesting Videos.

Also consider joining SAPYard’s Telegram Channel for SAP Blogs and Tutorials.

Save our number +1-251-727-9273 and send us a Whatsapp message ‘LEARN’ to be part of our Learning Community.

Also Check ABAP on Cloud Tutorials

The post How to Handle Special Characters in a String in ABAP? first appeared on .

11 Steps to Add New Field to Existing LSMW Batch Input Recording in SAP

$
0
0

OK. In the age of S/4HANA, where S4HANA migration cockpit should ideally replace LSMW, why on the earth do we care for LSMW in this article? 🔥🔥 Answer is simple, not everybody is in S/4HANA projects. 👍👍 Yes, you heard it right. You might have heard about BTP, on Cloud etc but ground reality is, there are still clients who are not even in HANA database, forget about S/4HANA. 🙏 Also, LSMW is still alive and kicking. 😄😀

With 100 percent confidence that, some consultant in some corner of this SAP world will need to add a new field in an existing LSWM tomorrow if not today. With that conviction, we proceed with this tutorial. 🧡🧡

Imagine you created an LSMW Batch Input Recording and everything is working fine. One fine morning, your client asks you to add another field (from the same screen) to your recording. So, at first maybe you think to start recording your process again and add the new field to your recording. Why to reinvent the wheel again? 💡💡 In this detailed tutorial, we want to show you a simple way to just add the new field and not recording the whole process again. If you don’t know how to define an LSMW recording batch, comment below for me and I will write an article about that just for you (just one comment request, and you will get a detailed LSMW tutorial like no where, trust me). 😍😍

Before we proceed with our tutorial, we would like to give you an opportunity to join our ZAPYard’s learning community where we have more than 32 groups and more than 1000 real SAP Consultants interacting with each other daily. Only SAP topics and not BS. Else, they will be banned from the community without warning. 👇👇👇👇

If you want to be part of ZAPYard’s Discussion Community, please feel free to check the below Link. We Ask, Answer, Help and Learn Together. There are more than 32 groups from different topics like RAP, BPT, Fiori, iRPA, CAI, CPI, PI/PO, ABAP on HANA, SAPUI5, SAP Build, SAP Adobe Forms, ChatBots, SAC etc. Join any group of your interest and interact with our Community.

Example Scenario:

Let’s assume, we want to add a new field from T-Code IQ02 to our recording and in this scenario, we want to remove the “Date of Last Goods Movement” data.

1- Go to T-Code LSMW and choose your project, subproject and object for adding new field and press Continue from toolbar (or F8).

2- In the next page, choose “Define Object Attributes” and press Execute from toolbar (or Ctrl + F8).

3- In the next screen and in front of your Recording name, click the “Recordings: Overview” button to see all the recordings that you have. Now select your recording name and click Edit Recording (or Ctrl + F2) from toolbar. Now you see all the activity that has been recorded here and you have to add your new field to this list. Note that the new field have to be in the same screen that you recorded earlier.

4- Now you should open your T-Code that you want to add a new field of it to your recording in a new GUI window (IQ02 in our scenario) and find the field that you want to change (Date of Last Goods Movement in our scenario). Now hit F1 for Assistant page and press “Technical Information”.  You should see the Technical Information page like below.

In this page, you should check data in “Field Description for Batch Input” with your Recording data in previous step and if all the data is correct, copy the “Dynpro Field” for next step.

5- Get back to Edit Recording page, and select Program Name and Screen Number base on the previous step data and go to More -> Edit -> Add Dynpro Field (Extended) (or Ctrl + Shift + F4). Now you should enter your saved data from previous step in the Screen Field box and Continue (Enter).

6- When the new field added to your Screen, double click it and in the new page, add the asked data but leave the Default Value free and clean. Then Continue.

7- By Now, your new field has been added to your recording procedure and you can save the recording process. But we have some more job to complete our journey.

8- After turning back to Process step again, choose “Define Source Fields” step to add new field to input source. Now click on change button to change the Input structure and hit the Table Maintenance from toolbar (or Ctrl + F9).

9- In new page, we should add a new line to the source table base on our new field like below picture. Now save the table and get back to process step once again.

10- For the last step to complete our job, you should select “Define Field Mapping and Conversion Rules” to add the new field mapping. In new page, click change and select your new added field. Now select Source Field from Toolbar.

11- In Assign Source Field page, you should choose the new field and Enter. If you see a warning message, ignore it and click Continue. Now you can save this step too.

12- That’s it. You finish adding new field to your LSMW Batch Input Recording and you can test it now.

How to move your updated LSMW to Quality and then to Production?

If everything works fine, you should send it to P server. You have two options for doing this. First you can do the same process in P server or you can do option two. As a second option, you have to export the project from this server and import it to new server. If you want to export the project, go to LSMW T-Code again and enter your Project, Subproject and Object again and go to More -> Extras -> Export Project (or Ctrl + F8) and saved it in your local PC. Then log in to new server and go to LSMW T-Code again and simply go to More -> Extras -> Import Project and select your exported project from local.

comments pLEASE

Vola… you just updated your LSMW Batch Input Recording and everything works perfect. Hope you find this article simple and useful. If you do, then do leave your feedback. Do not forget to follow our social media handles.

Please follow our LinkedIn PageLinkedIn Group , Facebook PageFacebook GroupTwitter , Instagram and Telegram SAP Technical Group Signal Group

Do not forget to SUBSCRIBE to our YouTube Channel for Free Courses and Unconventional Interesting Videos.

Do join ZAPYard’s Learning Community.

How to Move SAP Transport Request to New Server

$
0
0

Sometimes you have a very big application in your SAP system under a unique request and you need to transfer it to another SAP system. Imagine you have a new project started in your team for a big company and you need to write some great application even before the technical team set up the servers. You start writing your code in other system (or maybe IDES) and want to transfer that application with whole related object (Tables, Structures, Screens, Classes and etc.) to new system.

For seasoned professionals with multiple years of experience, it might be a cake walk. Or if you have a dedicated Basis Team, they will create the path to move the transports from the sandbox or test server to the actual server of your landscape. But there can be cases where you do the prototype in some server which is not in your client’s SAP landscape and you do not want to reinvent the wheel by creating all the objects again in your client’s system. You can download the SAP Objects from your prototype server and upload the same in your client’s server.

Many a times we create useful applications or tools in our training server and then we offer our clients to test it or use it in their real landscape. In such cases also, we follow the same step which is being shown in this detailed tutorial.


Before we proceed with our tutorial, we would like to give you an opportunity to join our ZAPYard’s learning community where we have more than 32 groups and more than 1000 real SAP Consultants interacting with each other daily. Only SAP topics and not BS. Else, they will be banned from the community without warning. 👇👇👇👇

Join ZAPYard’s WhatsApp Community

1. If you have all of your object in one request, no need to check this step and go to step 2. But if you have more than one request that host your application’s object, you have to merge all of your requests and object into one unique request. So first, find all of your requests and write the name of them in a piece of paper and then create a new Workbench request using SE10 transaction and double click to open it.

Check that you open it in Change mode with clicking on Display/Change icon. Then go to More->Request/Task->Object List->Include Object (or use Ctrl + F11) and choose <Object List from Multiple Requests> for adding all the requests to this new created request. Enter your requests numbers that written in a piece of paper in the shown place and execute.

In the Merge Object Lists window, choose your all request and click on Merge to doing it. You will be asked about doing it Online or In Background. Based on the quantity and size of your requests, you can answer it.

After finishing merging objects to new request, you will get back to request page and see all the merged object in a grid. Now you just need to release this request and go to next step.

2. At this step, you have to release your request in your first system. For doing this, you should go to SE10 transaction and under Request Status check the Modifiable checkbox and click on Display. In new screen, find your request and start releasing the request from inside out.

3. After releasing any request, SAP system generate two files: Configuration and Data. SAP system generate name for these two files based on the name of the request. In our example, our development server has HD2 name and all the request will start with HD2 as you can see in Figure 1. So, the SAP system will generate these names for two generated files:

Config file        -> K936124.HD2
Data file           -> R936124.HD2

These two files will save at two addresses:
Config file        -> /usr/sap/trans/cofiles
Data file          -> /usr/sap/trans/data

For accessing these addresses, you should go to AL11 transaction and double click on DIR_TRANS (/usr/sap/trans). It’s better to check if our files have been created in the address or not. For doing so, go to cofiles folder and set filter on File Name column for desired name. After that go to data folder and do the same thing. After you find both files on their folder, everything is ready for your next step.

4. Your next step is to download these two files to your local computer. For doing so, we can use CG3Y transaction for downloading a file from server to local computer. In source file address, we should give the server address for our files (as mentioned above) and in target file address, present a local address in our computer. Be aware of the file format for every file that should be just like the file on server.

5. At this time, our job with the first server is done and we can log out from the first server and login with the second server. First thing that we should do in the new server, is to upload files to desire address. For doing so, we can use CG3Z transaction to upload files from local computer to server. As usual, we have to double check the server address to put the files in correct address in server. After uploading both two files to new server, we can check the address to see if it was OK or not. For doing this, we can use AL11 transaction again in new server and go to mentioned address.

6. Now we should import our requests to new server. Go to STMS transaction in Develop in new server and go to More->Extras->Other Request->Add and new opened window, find your uploaded request from the list and hit continue.

If you encounter an error about importing this new request, go to Import Request and in the Option menu, check “Ignore Invalid Component Version” option and import the request to your server.

7. For importing the uploaded request to new server, we should create a Workbench request in SE10 transaction. After creating the new request, we should include the uploaded request and other object to that. For doing this, we should go to our newly created request and choose Include Object from toolbar (or press Ctrl + F11) and add our uploaded request to new created request.

8. Now we should change the whole properties of our imported request to match the new server. For doing this, we should go to SE03 transaction and Choose “Change Object Directory Entries of Object in a Request”. In new opened window, enter created request number and execute. It will show all the object of our request and we can change all the properties to new server configuration.

9. First, we should Select the entire package and then click on Object Directory to change the properties. In newly opened windows we can change the Package, Person Responsible and Original System to new server configuration. After you save your work, it will prompt for a request and you can give your recent created request in new server and that’s it. You can use your new request and change your code in new server as you just coded in this server.

One Click to ZAPYard’s All Social Media Handles

PLEASE SHARE YOUR COMMENTS AND FEEDBACK

Do not forget to SUBSCRIBE to our YouTube Channel for Free Courses and Unconventional Interesting Videos.

Viewing all 66 articles
Browse latest View live


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