Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all 8332 articles
Browse latest View live

What is the fct-code of back,exit, and cancel?

$
0
0

i have need to disable standard selection screen button name back exit and cancel.

i search alot on internet but cannot find their fct-code please help

 

 

thanks in advance.


BAPI_INTERNALORDER_CREATE With Settlement data

$
0
0

Hi,

 

Using BAPI BAPI_INTERNALORDER_CREATE,  we can create internal orders.

This BAPI has SRULES parameters so that we can pass settlement data to this BAPI.

Please clarify whether we can create settlement rules for the existing internal order through this BAPI.

 

Thank You.

 

Regards

Supriya Chaluvadi

Deleting a vendor contact with vmd_ei_api=>maintain_bapi

$
0
0

Hello,

 

I am trying to delete an existing contact of an existing vendor. I am using vmd_ei_api=>maintain_bapi. I successfully create and update the contact, however, during deletion of the contact only the ADRP record gets deleted and the KNVK record is NOT deleted.

 

Basically, I populate the following: in the structure of type VMDS_EI_CONTACTS I am populating the 'task' with 'D', plus I am populating correctly the 'data_key' and 'data' structures. I have also tried to populate 'ADDRESS_TYPE_3' with task 'D' and respective data but it still does not delete the KNVK record.

 

Does anyone know the reason why the KNVK is not deleted?

How to Call a BAPI from Excel

$
0
0

Hi Friends,

 

How to call a Bapi (RFC Enabled) from Excel (macro), any body have example please give it to me.

 

Thanks

 

Shankar

standar me57 export to excel

$
0
0

hi everybody, first excuseme my english is not very good, but i need help, my client needs export to excel the transaction me53, but, I do not know where to start, don't know if it's the spro or something abap, please help me. thanks

"CS_BI_BOM_CREATE_BATCH_INPUT1", I need to create mutilple items.

$
0
0

I saw this thread "use "CS_BI_BOM_CREATE_BATCH_INPUT1", only one bom item saved? "  in May.  I am now using this FM, does anyone have the answer?

 

 

Regards,

Greg

BAPI_GOODSMVT_CREATE

$
0
0

Hi Everyone-

 

My requirement is to automatically do a 261 and 262 movement from my program. The way I am achieving this is by using the SAP BAPI "BAPI_GOODSMVT_CREATE". I have to post both these movements only if both are successful. So I am executing the BAPI for the 261 first without the COMMIT and then for the 262 without the COMMIT. I am storing the returns I get from both these BAPI's and only if there is no error message in the return I am executing both these BAPI's again with the COMMIT statement. This approach worked for non-serialized materials but when I try to do it for a serialized material I am getting an error "Stock data of serial number XXX not suitable for movement" on my second attempt of the BAPI. Is there some kind of refresh I need to perform after my first call?

 

Below is the flow of my code:

 

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'     "with the 261 movement.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

 

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'     "with the 262 movement.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

 

if gt_return IS INITIAL.


      CALL FUNCTION 'BAPI_GOODSMVT_CREATE'     "with the 261 movement.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

 

      CALL FUNCTION 'BAPI_GOODSMVT_CREATE'     "with the 262 movement.
     CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.


ENDIF.


Issue with regrex statement

$
0
0

Hi ABAPers,

 

Need your help in a regrex.

 

i have a line in a workarea which contains data like USERID/0XSABUYER,USERNAME/0TXTSH,SUPERVISORID/0XARDUMMY

i dont need the technical names next to the description.

 

it should look like USERID,USERNAME,SUPERVISORID

 

I wrote a regular expression

REPLACE ALL OCCURRENCES OF REGEX '/0*,' IN ls_data-P_DATA WITH ','.

 

this regrex is not working for me. some how the * is not working as expected to replace all after /0 with a ,

 

thanks for all your help in advance.

 

Regards,

Bidisha Tripathi


How to Cancel a ACTIVE background Job scheduled in SM37.

$
0
0

Hi Friends,

 

I have scheduled a Background job. The job is ACTIVE now. How can I cancel this job?

 

Regards,

Viji

Code Inspector

Can i access Authorization Objects from workbench "SE80"

$
0
0

can i access Authorization Object from workbench "SE80"?

How to navigate it?

Thanks.

Recursion!

$
0
0

I was so disappointed when i knew that i cannot implement recursion in abap as the normal way as the rest of the programming languages.

Some developers says that recursion can be implemented using loops, but still i don't why isn't it supported?!

Could you please help??

Problem with Refreshing SALV

$
0
0

Hi all,

 

I've created a SALV and put it into a container. The container is located at the left side of my screen like a dock.

Now I've added a new Function Key into the GUI Status. This new Function is the Refresh.

 

What I want :

Refresh my "Dock" (SALV) when the user click on the refresh button.

 

In order to to this I've called the refresh method of the SALV:

     gr_gralv->refresh( refresh mode = if_salv_refresh=>full).

 

Unfortunately that not working although in debugging mode my internal table corresponding to the SALV contains the right data.

 

If anyone can help me

 

Regards,

Sam

Enable standard fields after error message

$
0
0

Hi All,

 

I have to enable the standard fields in ME11 after throwing an error message, i tried using suceess message display it like error. but its not working.

And the field which i want to enable is different, because i have implemented the code on another field. So how should i enable all the fields or specfic one field after error message. even i tried set cursor but its not working..

please help me out..

 

thanks in advance

Rahul

Spaces between words in Smartforms

$
0
0

Could you please tell me how to reduce spaces between words in smartforms? (Specially in arabic language)


How can we get aggregation after every rows in a table ?

$
0
0

hello experts,

 

How can we get the aggregation after every rows in a table. I am using cl_salv_table to display internal table. I can get the aggregation of columns and rows in the last rows but the requirement is to get the aggregation after every rows in  a table.

 

Thanks in advance .

Why should we write clean code?

$
0
0

Dojo

Recently I took part in an architecture dojo. This is an exercise, where a certain simplified example of a program specification is given. The participants are asked to propose an architecture how the task can be solved. Architecture dojos usually do not focus on the code level, rather on a more course grained level dealing with the structure of the program rather than the code itself.

The goal is to present a good architecture in the end after a certain period of time. What makes this architecture good and what makes it bad? The outcome should meet certain requirements like evolvability, testability and the alignment to clean code principles.

The specification

There is OCR software which scans paper documents with document numbers. It produces a file with multiple entries.

One logical line consists of three physical lines and may look like this:

 

Digits.PNG

Each character consists of three horizontal characters over four lines. Only pipes and underscores are allowed and can be arranged to represent a certain number.
The fourth line contains no data, as it serves as delimiter for the next document number.

You will have to write a program that reads this file from a client computer, parses it and outputs the actual document numbers on the screen.

Please keep in mind: In the future, the source where the files are uploaded from may change from client side storage to server side storage. Additionally the solution should be easily testable using unit tests.

Executing the program

Of course the task of this blog post was not to implement a program. But here it is.

This is the sample file content.

Sample File.PNG

And this is the output by the program.

 

sample output.PNG

 

 

Bringing design principles into play

To achieve the requirements given in the specification, a single monolithic program wouldn’t be an option.

A single program which reads the file, converts and parses it within one huge method, wouldn’t be easily testable.
Additionally, any other source where the file may come from would have to be coded directly into that method. This change would cause a break to the encapsulation.

This brings us to the question how clean code principles might help us to enforce a good architecture.

Especially the following principles should be considered:

  • Single Responsibility Principle (SRP)
  • Open Closed Principle (OCP)
  • Single Level of Abstraction (SAI)

No more buzzwords!

What do all these principles mean? Let’s have a short briefing.

Single Responsibility Principle (SRP)

A class should have only one responsibility. Always try to give the class, that you are currently developing, a description of what it does. If you need to use the word “and”, or you can only hardly cope without using it, there could be a violation to SRP.

Open Closed Principle (OCP)

A class should be open for extensions, but closed for modifications. This usually only works for some kinds of changes, but not for every thinkable future change. A list of what could change with the program, which we need to design in the dojo, is mentioned within the specification.
For example, if the way how the file is going to be accessed changes, the change should not affect existing code in the core program. Every new data source will have to be made available through extension, but not through modification.
But please remember: As often, the list of the above mentioned possible changes might not be a complete one.

Single Level of Abstraction (SAI)

“Each piece of code should talk on a distinctive level of granularity. Don’t mix implementation details with invocation of high-level abstractions. Refactor code to balance the level of abstraction.” (http://lumiera.org/project/background/CleanCodeDevelopment.html)

If we apply this principle to the future design, there should be at least distinct methods to access the file contents, to group the logical lines into sets of physical lines, or to split the logical characters which cover multiple physical lines into distinct 3 character X 4 lines chunks. The calls to these and certain more methods will have to be arranged by another and more course-grained method.

Okay, so what needs to be done?

Let’s get an overview of the different responsibilities of the program. First of all, there will be some kind of file access. When we got the file into the memory, it should be separated into chunks of four lines each. This is another responsibility which actually has nothing to do with how the file is accessed. Finally, each chunk consisting of string lines will need to be separated by another functionality, which extracts the characters out of the chunks. As these characters are still somehow encodes (as every character spans 3 characters x 4 lines in the file contents) there will be another function that parses these characters. In the end, the parsed characters will need to be concatenated and returned by a component which arranges the calls to the described functionalities.

File access

The access to the file contents is a functionality which will be replaced later on by another implementation (client side upload vs. server side upload). This is what is already mentioned in the specification. We decide to implement that each of these functionalities is implemented by a specific class. These classes will need to implement a common interface as callers to these functionalities should not really need to care about how the file access is implemented in particular. The first implementation of this interface will have to read a file from the client computer.

 

ZIF_OCR_FILE_ACCESS.PNG

Lines Separation

Each logical line which represents one account number consists of four physical lines. We will need to split these into chunks of four lines each. This responsibility is specified by another interface.

If any detail relevant for the line separation should change in the future (e.g. if another empty line besides the fourth one is introduced), the caller of this functionality should not really care about what is going on. Instead, we just describe the functionality by an interface which will also need to be implemented by a specific class later on. The output will be TYPE TABLE OF STRING_TABLE (custom type)

ZIF_OCR_LINES_SEPERATOR.PNG

Character separation

Each line which consists of four physical lines should be separated into chunks which represent the logical characters (that is, chunks of 3 x 4 characters). So here is another interface which describes this interaction. Character separation will take place for each logical line, so the input will be STRING_TABLE and the output will be another custom type which represents a nested table with logical characters. A logical character representation is TYPE TABLE OF CHAR03, a collection of them is just another nested table of TYPE ZOCR_T_LOGICAL_CHARACTERS.

ZIF_OCR_CHARACTERS_SEPERATOR.PNG

Character Parsing

Every logical chunk representing a real character which is relevant for the output, must be parsed.

ZIF_OCR_CHARACTER_PARSER.PNG

Who is the organizer?

Of course there should be a class which organizes the calls to the string manipulation and file access components.

Here it is. The interface requires the method to return a list of account numbers in string format.

ZIF_OCR_PARSING_ALGORITHM.PNG

 

The whole picture

What does it look like now? How does the implementer of ZIF_OCR_PARSING_ALGORITHM know all the other components which are to be used?
The answer is “constructor injection”. Every dependency is handed over to the implementer of ZIF_OCR_PARSING_ALGORITHM when the CREATE OBJECT statement to create this instance is executed. These dependencies are instances of specific classes on their own. They implement the already introduced interfaces.

There will be another caller which puts all of these functional bricks together, but for now, this information should be comprehensive enough to form a big picture:

 

Big Picture.PNG

Benefits

This approach of having such small classes might look a little bit strange for someone who developed in ABAP for years. But it has its benefits. The resulting structure is easily maintainable as interfaces hide the implementation details of classes and their sub-components (that is, more fine-grained, other classes). The implementations behind these interfaces can be switched easily without changing existing code within the core parser code.

Additionally, unit tests can be applied quite easy to each of these implementations. Unit tests have the goal to document and test behavior consistently, comprehensible and repeatable. This safes testing efforts when in integration tests and tracks down possible issues with the code to specific classes just by executing the unit within milliseconds.
Writing a testable program and applying unit tests to it usually takes up two to three times of what it would take to write it quick & dirty. But when it comes to testing and when issues start to arise, the test-based approach takes up speed in terms of defect rate and time to localize an error. In the end, it usually safes more time than it costs you to do it properly.

How to handle maximize button on window ?

$
0
0

Hi All,

 

I have created a report which displays the document details in ALV ( alv displayed on container using Module pool). When maximize button is clicked, closes the Alv report and selection screen of the report is getting displayed. I have tried removing the GUI status but still I faced the same issue.

 

And I was not able catch the sy-ucomm also. Please help me out with this.

 

Thanks & Regards,

Manoj

Function module or BAPI for AO25 transaction

$
0
0

Hi Folks,

 

Do we have a Function module or BAPI for AO25 transaction.?

 

Basically this AO25 transaction will update T090L table ( Unit of production)

 

Thanks

Naveen

FM to get Position/Org unit which uses the given Cost Centre

$
0
0

Hi HR ABAP Experts,

We are using 'A011'(Cost centre assignment) relationship both for Position-Cost centre and Org unit-Cost centre assignment.

 

Could u pls let me know the FM name if we have to get the position ID,Org unit ID by giving the Cost centre and the realtionship.

 

In HRP1001 I can do the direct select like below.

 

SELECT otype objid sclas sobid FROM hrp1001 INTO TABLE li_hrp1001
     WHERE
   ( otype = 'S'OR otype = 'O')

          AND rsign =  'A'

         AND relat = '011'

         AND   sclas = 'K' "Object type for cost centre

         AND sobid = 'IN123'.  "IN123 is my cost centre for which I need position,org unit who are using this cost centre

 

But I need to FM to get the same details by providing the same input as FM is preferable over direct SELECT from database.

 

Note:The common FM we use to read the structure 'RH_STRUC_GET' is not working for this case as we cant provide the cost centre to OBJID as is a Numeric field and cost centre contains the character so the this position-cost centre,org unit-cost centre relationship are not tow way means we dont have have relation like 'B011'.

 

 

Thanks in advance.

 

Thanks

Hafizul

         

Viewing all 8332 articles
Browse latest View live


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