SAP NOTEBOOK - ABAP INTERVIEW QUESTIONS ANSWERS TIPS

Transcription

SAP NOTEBOOK - ABAPINTERVIEW QUESTIONSANSWERS TIPSHybris and SAPHybris is a e-commerce product which is now a part of SAP after SAP's acquisition.Hybris' strong suit is supporting business-to-business (B2B) commerce, but it also supportsbusiness-to-consumer (B2C) commerce, product content management and ordermanagement. B2B customers include the likes of industrial products supplier Grangerwhile coffee equipment maker Nespresso and camera manufacturer Nikon use Hybris forboth B2B and B2C commerce.Hybris' core architecture provides a master data-management layer said to ensureconsistent inventory, pricing, order-status and other information across channels, whetherthat's Web, mobile, call center or retail stores. There's also a process-management layerthat applies the same business rules across channels, so prices and promotionsencountered online are consistent with those encountered in stores or on mobile devices.With the Hybris acquisition completed, Sheldon says the enterprise commerce technologylandscape is now "dominated by four large software companies: SAP, IBM, Oracle andeBay."IBM and Oracle are clearly SAP's chief rivals, and they've both spent billions onacquisitions in the commerce and customer experience arena. The most directlycompetitive products to Hybris at IBM are Unica and Sterling Commerce, while Oracle hasATG and commerce-oriented bits and pieces of BEA, E-Business Suite, FatWire, Stellentand Eloqua.

Looking for Unlimited very long input text entry field in SAP ABAPprogramming?Method1: Simple: Function module for PopupUse the function module CATSXT SIMPLE TEXT EDITOR.Just give a title for the function module and execute to give a POP UP and free text field.The resulting ITAB will give you the text lines.Method2: Medium : OOPS method for Free text editorDATA editor container TYPE REF TO cl gui custom container.create object editor containerexportingcontainer name 'Container100'exceptionscntl error 1cntl system error 2create error 3lifetime error 4lifetime dynpro dynpro link 5.b) Created a reference to your Text Edit Control and create it's object :DATA text editor TYPE REF TO cl gui textedit.create object text editorexportingparent editor containerwordwrap mode cl gui textedit wordwrap at fixed positionwordwrap position line lengthwordwrap to linebreak mode cl gui textedit true. "or simply falsec)Hide toolbar and statusbarcall method text editor - set toolbar modeexportingtoolbar mode cl gui textedit false.call method text editor- set statusbar modeexportingstatusbar mode cl gui textedit false.d) Answering your question Text Edit Control -- Database Tablecall method text editor- get text as streamexportingonly when modified cl gui textedit falseimportingtext wrk textexceptionsothers 1.Save wrk text to Table

e) Text Edit Control -- database "" table "" u "" The reverse process of Step 4With method :CALL METHOD text editor- set text as stream.How to Clear the OOPS Free text:This is how I get rid of the existing text:* Delete the Textme- o editor- delete text( ).* Set the new textme- o editor- set textstream( EXPORTING text iv text ).Set the Free text object editable and Disabled mode by using the below method.IF condition.CALL METHOD G FREETEXT 1- SET READONLY MODEEXPORTINGREADONLY MODE '1'EXCEPTIONSERROR CNTL CALL METHOD 1INVALID PARAMETER 2OTHERS 3.IF SY-SUBRC 0.* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO*WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ENDIF.else.CALL METHOD G FREETEXT 1- SET READONLY MODEEXPORTINGREADONLY MODE CL GUI TEXTEDIT FALSEEXCEPTIONSERROR CNTL CALL METHOD 1INVALID PARAMETER 2OTHERS 3.IF SY-SUBRC 0.* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO*WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ENDIF.endif.

Editable ALV event trigger without pressing enter keyMaking ALV to react to Change data automaticallyLINK: http://wiki.scn.sap.com/wiki/display/ABAP/Making ALV to react to Change data automaticallyScenario:To make ALV to react to data change automatically without any need for the user to click on ENTER or anyother button/menu item.Procedure:In order to make the system react to an edit event, we need to first register the edit event.To register the edit event, call the method REGISTER EDIT EVENTCALL METHOD cont editalvgd - register edit eventExporting{}I event id cl gui alv grid mc evt modified.When user press 'ENTER' the event MC EVT ENTER is triggered which automatically sets the variableM cell edit to 'X'.But if the user bypasses the enter key then the variable M CELL EDIT has to be set explicitly which is done bypassing mc evt modified to the exporting parameter I EVENT ID instead ofmc evt enter.In the PAI event, call the method CHECK CHANGED DATA. This method automatically triggersthe data changed event.By default, SAP recognizes 'ENTER' event. When only the CHECK CHANGED DATA is called in PAI event,then the 'ENTER' event is not recognized by the system. In order to have both the events recognized by thesystem, we need to register the edit event.Sample code:PORT Z ALV EDIT EVENT.Table declarations.BLES:SPFLI." Flight Schedule DetailsData -------------------------------*Work ----------------------------*TA:W GRID TYPE REF TO CL GUI ALV GRID, " Reference object for alv gridW CONTAINER TYPE REF TO CL GUI CUSTOM CONTAINER.Reference object for ---------------------------*Structure to hold Flight Schedule --------------------------*TA:FS SPFLI TYPE ------------------------*Structure to hold Field Catalog --------------------------*TA:WA FIELD CATALOG TYPE LVC S -----------------------*Structure to hold Layout of the ALV Report*

------------------*TA:WA LAYOUT TYPE LVC S -----------------------*Internal table to hold Flight Schedule details from table ------------------------*TA:T SPFLI LIKETANDARD TABLEOF FS ------------------------*Internal table to hold Field Catalog --------------------------*TA:T FIELD CATALOG TYPE LVC T -----------------------*START-OF-SELECTION ------------------------*ART-OF-SELECTION.Data retrieval from the database tableSELECT * FROM SPFLI INTO TABLE T SPFLI.CALL SCREEN ---------------------------*amp;Module set layout -----------------------------*This module is used to set the layout for the alv grid ---------------------------*DULE SET LAYOUT OUTPUT.WA LAYOUT-GRID TITLE 'SPFLI TABLE DETAILS'.WA LAYOUT-ZEBRA 'X'.WA LAYOUT-EDIT 'X'.DMODULE." set layout -----------------------------*amp;Module field catalog -----------------------------*This module is used to populate the field ---------------------------*DULE FIELD CATALOG OUTPUT.CLEAR WA FIELD CATALOG.WA FIELD CATALOG-FIELDNAME 'CARRID'.WA FIELD CATALOG-REF FIELD 'CARRIDS'.WA FIELD CATALOG-REF TABLE 'SPFLI'.WA FIELD CATALOG-COL POS 1.APPEND WA FIELD CATALOG TO T FIELD CATALOG.CLEAR WA FIELD CATALOG.WA FIELD CATALOG-FIELDNAME 'CONNID'.WA FIELD CATALOG-REF FIELD 'CONNID'.WA FIELD CATALOG-REF TABLE 'SPFLI'.WA FIELD CATALOG-COL POS 2.APPEND WA FIELD CATALOG TO T FIELD CATALOG.CLEAR WA FIELD CATALOG.WA FIELD CATALOG-FIELDNAME 'CITYFROM'.WA FIELD CATALOG-REF FIELD 'CITYFROM'.WA FIELD CATALOG-REF TABLE 'SPFLI'.WA FIELD CATALOG-COL POS 3.APPEND WA FIELD CATALOG TO T FIELD CATALOG.

CLEAR WA FIELD CATALOG.WA FIELD CATALOG-FIELDNAME 'CITYTO'.WA FIELD CATALOG-REF FIELD 'CITYTO'.WA FIELD CATALOG-REF TABLE 'SPFLI'.WA FIELD CATALOG-COL POS 4.APPEND WA FIELD CATALOG TO T FIELD CATALOG.DMODULE." field catalog -------------------------*Module USER COMMAND 0100 ------------------------*This module is used to handle the PAI -------------------------*DULE USER COMMAND 0100 INPUT.CASE SY-UCOMM.WHEN 'OK'.Calling the check changed data method to trigger the data changedeventCALL METHOD W GRID- CHECK CHANGED DATAIMPORTINGE VALID CHANGINGC REFRESH 'X'.UPDATE SPFLI FROM TABLE T SPFLI.WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.LEAVE TO SCREEN 0.ENDCASE." CASE SY-UCOMMDMODULE." USER COMMAND 0100 ------------------------*Module manage alv grid -------------------------*This module is used to manage the Grid --------------------------*DULE MANAGE ALV GRID OUTPUT.IF W GRID IS INITIAL.CREATE OBJECT W CONTAINEREXPORTINGCONTAINER NAME 'CONTAINER1'EXCEPTIONSCNTL ERROR 1CNTL SYSTEM ERROR 2CREATE ERROR 3LIFETIME ERROR 4LIFETIME DYNPRO DYNPRO LINK 5OTHERS 6.IF SY-SUBRC 0.MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNOWITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ENDIF." IF SY-SUBRC NE 0CREATE OBJECT W GRIDEXPORTINGI PARENT W CONTAINEREXCEPTIONSERROR CNTL CREATE 1ERROR CNTL INIT 2

ERROR CNTL LINK 3ERROR DP CREATE 4OTHERS 5.IF SY-SUBRC 0.MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNOWITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ENDIF." IF SY-SUBRC NE 0CALL METHOD W GRID- SET TABLE FOR FIRST DISPLAYEXPORTINGI STRUCTURE NAME 'SPFLI'IS LAYOUT WA LAYOUTCHANGINGIT OUTTAB T SPFLI[]IT FIELDCATALOG T FIELD CATALOGEXCEPTIONSINVALID PARAMETER COMBINATION 1PROGRAM ERROR 2TOO MANY LINES 3OTHERS 4.IF SY-SUBRC 0.MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNOWITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ENDIF." IF SY-SUBRC NE 0ENDIF." IF W GRID IS INITIALRegistering the EDIT EventCALL METHOD W GRID- REGISTER EDIT EVENTEXPORTINGI EVENT ID CL GUI ALV GRID MC EVT MODIFIEDEXCEPTIONSERROR 1OTHERS 2.IF SY-SUBRC 0.MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNOWITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ENDIF." IF SY-SUBRC NE 0DMODULE." manage alv grid -------------------------*Module STATUS 0100 -------------------------*This module is used to set the PF-Status and title -----------------------*DULE STATUS 0100 OUTPUT.SET PF-STATUS 'ALVS GUI'.SET TITLEBAR 'ALV TITLE'.DMODULE." STATUS 0100 OUTPUT

Parallel Cursor - SimpleImproving performance in Nested loop scenario's:How ? Instead of sequential search in each loops, we will use Read table of ITAB2 and getthe SY-TABIX of that second ITAB.Now if sy-Subrc 0 then proceed the loop into second ITAB and use the syntaxLOOP AT ITAB2 INTO WA FROM w TABIX.Use if conditions inside the loop to check the keys thereafter.sort: lt vbpa by kunnr, "Sorting by key is very importantlt kna1 by kunnr. "Same key which is used for where condition is used hereloop at lt vbpa into wa vbpa.read lt kna1 into wa kna1" This sets the sy-tabixwith key kunnr wa vbpa-kunnrbinary search.if sy-subrc 0."Does not enter the inner loopv kna1 index sy-tabix.loop at lt kna1 into wa kna1 from v kna1 index. "Avoiding Where clauseif wa kna1-kunnr wa vbpa-kunnr. "This checks whether to exit out of loopexit.endif.****** Your Actual logic within inner loop ******endloop. "KNA1 Loopendif.endloop. " VBPA LoopBackground Job scheduling - Interview QuestionSM36 -DEFINE BACKGROUND JOB - Create background Jobs

SM37 : SIMPLE JOB SELECTION - To check status ( maintenance )Great interview preparation and knowledge e-with-smartforms-vs.html

tuning-using-parallel.htmlSmartform Interview questionsFound in this s-frequently-asked-questions.htmlSmart forms Frequently Asked QuestionsForcing a page break within table loopCreate a loop around the table. Put a Command node before the table in the loop thatforces a NEWPAGE on whatever condition you want. Then only loop through a subset ofthe internal table (based on the conditions in the Command node) of the elements in theTable node.Font style and Font sizeGoto Transaction SMARTSTYLES.There you can create Paragraph formats etc just like in sapscript.Then in your window under OUTPUT OPTIONS you include this SMARTSTYLE and usethe Paragraph and character formats.Line in SmartformEither you can use a window that takes up the width of your page and only has a height of1 mm.Then you put a frame around it (in window output options).Thus you have drawn a box but it looks like a line.Or you can just draw " " accross the page and play with the fonts so that it joins eachUNDER SCORE.Difference between 'form interface' and 'global definitions' in global settings ofsmart formsThe Difference is as follows.To put it very simply:Form Interface is where you declare what must be passed in and out of the smartform (infrom the print program to the smartform and out from the smartform to the print program).Global defs. is where you declare data to be used within the smartform on a global scope.ie: anything you declare

INTERVIEW QUESTIONS ANSWERS TIPS Hybris and SAP Hybris is a e-commerce product which is now a part of SAP after SAP's acquisition. Hybris' strong suit is supporting business-to-business (B2B) commerce, but it also supports business-to-consumer (B2C) commerce, product content management and order management. B2B customers include the likes of industrial products supplier Granger