Wednesday, 3 September 2014

Parallel Processing In Procedural ABAP

Parallel Processing : when a huge number of records needs to be processed and it takes a lot of time to produce the output, this parallel processing technique can be applied to achieve run time improvement. So this Parallel processing is an asynchronous call to the Function Module in parallel sessions/ different session/ multiple sessions.

--------------------------------------------------------------------------------------------------------------------------
Step1. Create the below report and execute it.

REPORT  zparallel_processing.
DATAchk1chk2.

DATAstat1 TYPE TABLE OF bapisdstat,
              stat2 TYPE TABLE OF bapisdstat,
              stat TYPE  bapisdstat.

PARAMETERSp_sdoc1 TYPE bapivbeln-vbeln,
                            p_sdoc2 TYPE bapivbeln-vbeln.


START-OF-SELECTION.
  CALL FUNCTION 'BAPI_SALESORDER_GETSTATUS'
    STARTING NEW TASK 'TASK1'
    DESTINATION 'NONE'
    PERFORMING call1 ON END OF TASK
    EXPORTING
      salesdocument p_sdoc1.


  CALL FUNCTION 'BAPI_SALESORDER_GETSTATUS'
    STARTING NEW TASK 'TAKS2'
    DESTINATION 'NONE'
    PERFORMING call2 ON END OF TASK
    EXPORTING
      salesdocument p_sdoc2.

* Receive all asynchronous replies from the FMs
* Without wait statement the subroutines: call1 / call2  will not be triggered
* Either a logical wait condition or a wait condition with soem time
* able to trigger the Subroutines call1/ call2.
  WAIT UNTIL chk1 abap_true
         AND chk2 abap_true.

* wait UP TO 10 SECONDS.
  LOOP AT stat1 INTO stat.
    WRITE :/ stat-doc_number stat-materialstat-net_price.
  ENDLOOP.
  CLEAR stat.
  LOOP AT stat2 INTO stat.
    WRITE :/ stat-doc_number stat-materialstat-net_price.
  ENDLOOP.


*&---------------------------------------------------------------------*
*&      Form  call1
*&---------------------------------------------------------------------*
FORM call1 USING taskname.
  RECEIVE RESULTS FROM FUNCTION 'BAPI_SALESORDER_GETSTATUS'
   TABLES
    statusinfo        stat1.
  chk1 abap_true.
ENDFORM.                   

*&---------------------------------------------------------------------*
*&      Form  call2
*&---------------------------------------------------------------------*

FORM call2 USING taskname.
  RECEIVE RESULTS FROM FUNCTION 'BAPI_SALESORDER_GETSTATUS'
   TABLES
      statusinfo       stat2.
  chk2 abap_true.
ENDFORM
.                 

--------------------------------------------------------------------------------------------------------------------------
Step1.1 - If you want to debug it then put a breakpoint and execute it.







































Step2. Provide the input as sale orders and execute it.












Step3. Press F5 button twice and the FM will open in two different external sessions.






























Step4. In SM50 tcode also we can can found the program and the FMs are in debugging mode.



















Step5. At last we observe this output.












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





























Step3.

Setting up Sales Area In SD Customizing


Sales Area in SD is a combination of Sales Organization , Distribution  Channel and division.  Any sales that happens it must happen in a sales area.

Step1. From SPRO navigate along the path to create a company code.




















Step2. Select the highlighted option.












Step3. Click on New Entries.


















Step4. Provide the company Code and other details and click on Save.


















Step5. Provide other details and at last click on Continue.




























Step6. So the company code is created.













Step7. Now create a sales organization along the highlighted path.





















Step8. Select the highlighted option.













Step9. Click on new entries button.









Step10. Provide the sales org name and other details and click on Save.



























Step11. Provide the below information and continue.





























Step12. The sales organization  created successfully.















Step13. Lets create the distribution channel along the given path.


















Step14. Click on the highlighted option.













Step15. Click on New Entries.













Step16. Provide a distribution channel and name ans then click on Save button.












Step17. The distribution channel is created successfully.

















Step18. Navigate along the highlighted path to create Division.



















Step19. Click on the highlighted option.












Step20. Click on New Entries button.













Step21. Provide a division and name and click on Save button.













Step22. The new division is created.















Step23. All necessary units are created to set up sales area. Now we have to assign these individual units to each other. First lets assign the sales org to the company code. Navigate along the high lighted spro path.























Step24. So here our Sales org is there but till not assigned to a company code. Press F4 button to see the list of company codes.




















Step25. Select above created company code.


















Step26. So the sales org is assigned to a company code.
















Step27. Now navigate along the path to assign distribution channel to sales organization.























Step28. Click on new entries.




















Step29. Form F4 button choose the above created Sales org and distribution channel and click on save and go back.















Step30. Now it appears as below.






















Step31. Now we have to assign the division to the sales organization. Follow the highlighted path.























Step32. Click on New Entries button.

















Step33. From the F4 values list choose the above created sales org and division and save it. Go back.















Step34. The assigned values appears in the list.




















Step35. Follow the highligted path to set up the sales area.























Step36. Click on new entries button.


















Step37. Select our pre created values of sales org, dist channel and division.












Step38. The Sales area is created.




















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

Tuesday, 26 August 2014

Uploading & Downloading Data to/from Application Server


Step1. Launch the TCode- AL11 to see the SAP ApplicationSever







Step2. The file can be uploaded or downloaded to or from a directory. Each directory contains an address on the application server. For for demo lets we want to upload to the directory DIR_TRANS. So in the upload transaction we have the use the directory address as D:\usr\sap\trans.













Step3. Create a text file with some text and save it on the presentation server which will be later uploaded to the application server directory.










Step4. Launch tcode- CG3Z to upload file into application server directory.






Step5. Select the source file from the presentation server created above. Provide the directory path and the a new file name separated by \.












Step6. Click on the highlighted button to upload the file to application server.



















Step7. Again go to Tcode- AL11 and double click on the directory: DIR_TRANS. We can see our uploaded file. Double click on it to see  its content.



























Step8. So here it is.















Step9. To download any file from the application server to the local machine launch Tcode- CG3Y.







Step10. Provide the directory address and the file name which would be picked up and the  address on the local machine where the downloaded file would be stored and click on the download button.









Step11. Open the target path in the local machine and you can see the downloaded file.











---------------------------------------------------------------xxxxxx------------------------------------------------------

Comments system

Disqus Shortname