Wednesday, January 16, 2013

SAP NWBC (All what you need to know)

I recently got some requirement to work with SAP NWBC which is a rich desktop and html client provided by SAP. (overview https://experience.sap.com/post/show/51 )

Thanks to SDN and SAP help center I managed to find lot of documents which help me to learn NWBC configuration and the other features like gadgets. I will try to list out the links I have managed to find in a step by step matter so that anyone new to NWBC would be able to get the hang of it.

1) SAP NWBC help document
This document will help you to configure roles which would be used in NWBC client


2) SAP Web dynpro page builder ( SAP Link )
This document will help to build web pages like I google. where you can add web dynpro chips , Iframe chips and powl list.

3) Add widgets to NWBC screen 
This document will help you to build web dynpro chips which can communicate and display html code. Using this we can add widgets , google maps and many more html components to NWBC.

4) SAP POWL ( Personal Object Work List )
This is a powerful web dynpro based reporting tool which helps to analyze using personalized queries.

5) Integrating dashboard to SAP web chips 
The above document will help to create a BSP application which will display a dashboard. You would be able to display the dashboard as a web chip by adding this to a Iframe chip ( you can refer document on point 3 for help )

hope this blog will help out ppl spend more time on learning NWBC than spending time to find how to do these stuff





Monday, July 11, 2011

SAP APO enhancement for AFS


Recently I had to work on a project were the customer was planning to implement SAP AFS and SAP APO to handle their business requirements. The development challenge on this requirement was to maintain 2 different locations for each plant created in AFS side. This was required in order to plan for wholesaled and retail requirements of the business. This was maintained in AFS side on the category structure in for a given material.
I have mentioned the exits used I used during this modification. Hope this will be helpful for someone who need to modify data which is gets transferred to APO.

SAP standard industrial enhancement BADI:
CIF_EXT_IS_INTERNAL
AFS implementation name: /AFS/NDIF_APO

User exits for each area

1)      Enhancement for plant data transfer :
User exits: EXIT_SAPLCLOC_001
Enhancement: CIFLOC01 Enhancement for Transferring Customer-Specific Loc. Fields

2)      Enhancement for material data transfer :
User exits: EXIT_SAPLCMAT_001
Enhancement: CIFMAT01 Enhancement for Transferring Customer-Specific Matl Fields

3)      Enhancement for PO/POC/PR  data transfer :
User exits: EXIT_SAPLMEAP_001
Enhancement: CIFPUR01 Enhancement for Transferring Customer-Specific PO Fields

4)      Enhancement for SO data transfer:
User exit: EXIT_SAPLCSLS_002
Enhancement: CIFSLS03 Influencing of Sales Order Data Prior to Dispatch

5)      Enhancement for Source of supply or Purchase info record  data transfer:
User exit: EXIT_SAPLCSRS_003
Enhancement: CIFSRC01 Enhancement for Transferring Customer-Specific SS Fields

6)      Enhancement for stock data transfer:
User exit: EXIT_SAPLCSTK_001
Enhancement: CIFSTK01 Enhancement for Transferring Customer-Specific Stock Fields

7)      Enhancement for Batches transfer :
User exits: EXIT_SAPLCCHG_001
Enhancement: CIFBTC01 Enhancement for Transferring Customer-Specific Batch Fields

Saturday, October 9, 2010

The final touch (add a htmp page on SAP screen)

It's a known fact that however complex your program is when it come to the user. The look and feel of the output is what matters most. This is blog post is about a simple trick that we can do to make the look and feel better.
Have you ever wondered that when you develop a tool to your customer on a area ( eg: Order Automation tool ). That its better if you can get them a initial screen with some fancy graphics on it where you will be able to give multiple links to different Transactions.
If yes this is one approach that I figured out
Adding a HTML page on SAP

Ok now that I have given a brief idea on what I am talking about. I’ll just walk you through example where a html page is added to initial transaction of a automation tool
Below Is the final output what we are going to get (I have added some SAP images since it is a example case )


 Ok now some basic steps we need to create the above
1)      The html page uploaded to your SAP system (tcode : SMW0)
2)      The images you required to be uploaded in the SAP system )(tcode : SMW0)
Please note that to trigger the event you need something similar to the below part to be added to the html code
<td><a href=SAPEVENT:ZORD_SPLIT ><strong><i>Order Spliti>strong>a>td>

The code to call the relevant transaction is as below
class cl_myevent_handler definition.

  
public section.
    
methods: on_sapevent
               
for event sapevent of cl_gui_html_viewer
                 
importing action frame getdata postdata query_table.

endclass.

data: evt_receiver type ref to cl_myevent_handler.

* CLASS CL_GUI_CFW DEFINITION LOAD.


class cl_myevent_handler implementation.

  
method on_sapevent.
    
case action.
      
WHEN 'ZORD'.
        
CALL TRANSACTION 'ZORD'.
      
WHEN 'ZORD_SPLIT'.
        
CALL TRANSACTION 'ZORD_SPLIT'.
    
endcase.


  
endmethod.
In this test case I have created a container as HTML_CONTROL

if html_control is initial.

    prog_repid = sy-repid.

    
create object my_container
        
exporting
            container_name = 
'HTML_CONTROL'.

    
create object html_control
         
exporting
              parent    = my_container.
    
if sy-subrc ne 0.
*      do nothing.
    
endif.

* register event
    myevent-eventid = html_control->m_id_sapevent.
    myevent-appl_event = 
'x'.
    
append myevent to myevent_tab.
    
call method html_control->set_registered_events
        
exporting
           
events = myevent_tab.

    
create object evt_receiver.

    
set handler evt_receiver->on_sapevent
                
for html_control.

    
perform load_graphics.
    
perform load_home_page.

  
endif.

You can call load graphics and map you html image with your image uploaded to SAP
   call method html_control->load_mime_object
     
exporting
          object_id  = 
'ZSAP_IMG'
          object_url = 
‘image.jpeg’
     
exceptions
          
others     = 1.
The once load call your html page as below
  call method html_control->load_html_document
       
exporting
            document_id  = 
'ZTEST_PAGE_6'
       
importing
            assigned_url = doc_url
       
exceptions
            
others       = 1.

  
if sy-subrc eq 0.
    
call method html_control->show_url
         
exporting
              url = doc_url.
  
endif.
If you call your screen now you should see the html page with all the images and links .
For a abaper this is not a big piece of work but adding something like this will always give you some extra hip

Thursday, June 3, 2010

How to find BAdi

This post is taken from http://erpgenie.com/abaptips/content/view/594/40/
I have added this here since it might be useful to me if in case I forget how to find a BADI :)

Business Add-Ins (BAdis) are a  SAP enhancement technique based on ABAP Objects. Two parts - Definition and its Implementation - definition can either be SAP provided or user may also create it.

You can look for BAdi definition in IMG and in component hierarchy. But there are some easier methods to find a BAdi. They are follows:

Method 1
These steps should enable you to find a BAdi related to any transaction in a matter of minutes.
  • 1) Go to the transaction SE37 to find your function module.
  • 2) Locate the function SXV_GET_CLIF_BY_NAME.
  • 3) Put a break-point there.
  • 4) Now open a new session.
  • 5) Go to your transaction.
  • 6) At that time, it will stop this function.
  • 7) Double click on the function field NAME.
  • 8) That will give you name of the BAdi that is provided in your transaction.

Method 2
  • 1. Goto SE80,  open CL_EXITHANDLER (Class)
  • 2. Goto Method, GET_INSTANCE
  • 3. Set a break point at 
CALL METHOD cl_exithandler=>get_class_name_by_interface
    EXPORTING
      instance                      = instance
    IMPORTING
      class_name                    = class_name
    CHANGING
      exit_name                     = exit_name
    EXCEPTIONS
      no_reference                  = 1
      no_interface_reference        = 2
      no_exit_interface             = 3
      data_incons_in_exit_managem   = 4
      class_not_implement_interface = 5
      OTHERS                        = 6.
  CASE sy-subrc.
    WHEN 1.
      RAISE no_reference.
    WHEN 2.
      RAISE no_interface_reference.
    WHEN 3.
      RAISE no_exit_interface.
    WHEN 4.
      RAISE data_incons_in_exit_managem.
    WHEN 5.
      RAISE class_not_implement_interface.
  ENDCASE.

  • 4) Now open a new session.
  • 5) Go to your transaction.
  • 6) At that time, it will stop this function.
  • 7) Double click on the function field EXIT_NAME.
  • 8) That will give you name of the BAdi that is provided in your transaction.
 
Method 3:
  • 1. Goto ST05
  • 2. Select SQL trace and buffer trace
  • 3. Activate trace
  • 4. Now run your transaction
  • 5. Deactivate trace
  • 6. Display trace7. A pop will come
  • 8. Enter V_EXT_ACT and V_EXT_IMP as the 2 objects
  • 9. Now display the trace results. It will return all the BAPI and enhancement list in order of their execution.

Friday, March 19, 2010

IDOC /AFS/WMMBID02 message type : WMMBXY

i have been stuck with the idoc /AFS/WMMBID02 message type WMMBXY giving an error when ever i try to do a movement type 122.
I was Debugging the stranded code for more than 2 days and later i Found out that this occurs since the idoc requires few more information. this was mentioned on SAP note 833603.

Symptom
You want to post goods receipt for a stock transport order using an IDoc .

More Terms
WMMBXY, WMMBID01, WMMBID02, MBGMCR, L_IDOC_INPUT_WMMBXY

Cause and Prerequisites
It is not clear how the segments are to be filled, to ensure correct
assignment and updating of the delivery if necessary.

Solution
The following sections only take into account processing with SAP core s
tandard functions and do not include industry solutions.

1. Goods receipt for delivery

a) WMMBXY (WMMBID01, WMMBID02)

The following fields in the segment E1MBXYI must be filled:
EBELN Purchase order number
EBELP Purchase order item
KZBEW Movement indicator = 'B'
POSNR Delivery item (with leading zeros)
VBELN Delivery (with leading zeros)

b) MBGMCR (MBGMCR01, MBGMCR02)
Prerequisite: Note 356665 and basic type MBGMCR02 (not MBGMCR01).
The segment E1BP2017_GM_CODE receives the value GM_CODE = '01'.
In the segment E1BP2017_GM_ITEM_CREATE, the following must be
filled:
PO_NUMBER Purchase order number
PO_ITEM Purchase order item
MVT_IND Movement indicator = 'B'
In the subordinate segment E1BP2017_GM_ITEM_CREATE1, the following
must be filled:
DELIV_NUMB Delivery (with leading zeros)
DELIV_ITEM Delivery item (with leading zeros)

2. Goods receipt for the inbound delivery

a) WMMBXY (WMMBID01, WMMBID02)
In the segment E1MBXYI, no purchase order must be assigned. The
fields EBELN and EBELP remain blank. The movement indicator (KZBEW)

receives the value 'B'.
In the subordinate segment E1MBXYJ, the following are to be filled:
VLIEF_AVIS Inbound delivery
VBELP_AVIS Inbound delivery item

b) MBGMCR
The segment E1BP2017_GM_CODE receives the value GM_CODE = '01'.
In the segment E1BP2017_GM_ITEM_CREATE, no purchase order must be
assigned. The fields PO_NUMBER and PO_ITEM remain blank. The
following must be filled:
MVT_IND Movement indicator = 'B'
DELIV_NUMB_TO_SEARCH Inbound delivery (with leading zeros)
DELIV_ITEM_TO_SEARCH Inbound delivery item (with leading zeros)

IDOCs of the message type WMMBXY are updated using the function
module L_IDOC_INPUT_WMMBXY. In this module, you can change data
using the user exit 'EXIT_SAPLLMDE_002'. Here, use Transaction CMOD
to activate the SAP enhancement MWMIDO08 and implement the required
changes in the exit function module EXIT_SAPLLMDE_002.

hope this post will help someone else who might get stuck like me

Tuesday, March 9, 2010

selection option recommended sign

 

most of the time when we develop a report program or a selection screen. We have to remove the standard validation which comes when we define a selection option as mandatory and add a custom validation. In such cases we are unable to display the selection option as a mandatory sign. To do this we can make the input field recommended which will give the sign. bellow is the code how to do it.



AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

   IF screen-name EQ 'S_WERKS-LOW'.
     screen-required = 2. "2 is recommended
   ENDIF.

  MODIFY SCREEN.

ENDLOOP. 

Monday, March 8, 2010

selection screen with tabs

This post is about selection screen with tabs. Selection screen with tabs are not that hard to implement on ABAP and I am sure if you search online you will always get the code for it.... but just to start things ill just give the code no a basic selection screen with tabs...

SELECTION-SCREEN BEGIN OF SCREEN 101 AS SUBSCREEN .

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
           
SELECT-OPTIONS: s_ebeln FOR zconf_stage-ebeln,
                s_ebelp FOR zconf_stage-ebelp,
                s_bsart FOR ekko-bsart,
                s_werks FOR ekpo-werks,
                s_matnr FOR ekpo-matnr,
                s_lifnr FOR ekko-lifnr,
                s_ekgrp FOR ekko-ekgrp,
                s_budat FOR zconf_stage-budat,
                s_kunnr FOR vbpa-kunnr.
SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN END OF SCREEN 101.


SELECTION-SCREEN BEGIN OF SCREEN 102 AS SUBSCREEN .

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-001.

SELECT-OPTIONS: s_ebeln1 FOR zconf_stage-ebeln,
                s_bsart1 FOR ekko-bsart,
                s_werks1 FOR ekpo-werks ,
                s_matnr1 FOR ekpo-matnr,
                s_lifnr1 FOR ekko-lifnr,
                s_ekgrp1 FOR ekko-ekgrp,
                s_budat1 FOR zconf_stage-budat,
                s_kunnr1 FOR vbpa-kunnr.
SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN END OF SCREEN 102.

SELECTION-SCREEN: BEGIN OF TABBED BLOCK mytab FOR 24 LINES,
TAB (30) button1 USER-COMMAND on,
TAB (30) button2 USER-COMMAND auto,
END OF BLOCK mytab.


INITIALIZATION.
  button1 = text-011.
  button2 = text-012.

  mytab-prog = sy-repid.
  mytab-dynnr = 101.
  mytab-activetab = 'BUTTON1'.



AT SELECTION-SCREEN .

  IF sy-batch = 'X'.
    mytab-dynnr = 102.
    mytab-activetab = 'BUTTON2'.
    sy-ucomm = 'AUTO'.
  ENDIF.

  CASE sy-dynnr.

    WHEN 1000.
      CASE sy-ucomm.
        WHEN 'ON'.
          mytab-dynnr = 101.
          mytab-activetab = 'BUTTON1'.
        WHEN 'AUTO'.
          mytab-dynnr = 102.
          mytab-activetab = 'BUTTON2'.
      endcase.

    WHEN 0101.
      mytab-dynnr = 101.
      mytab-activetab = 'BUTTON1'.
    WHEN 'ONLI'.
          PERFORM screen_validation101.
      ENDCASE.

    WHEN 0102.
      mytab-dynnr = 102.
      mytab-activetab = 'BUTTON2'.
      case sy-ucomm.
    WHEN 'ONLI'.
          PERFORM screen_validation102.
      ENDCASE.
  ENDCASE.

START-OF-SELECTION.

  CASE mytab-activetab.
    WHEN 'BUTTON1'."online mode
   
    WHEN 'BUTTON2'." when automatic
    
  ENDCASE.

now the above code is to a selection screen with tabs that you code using a report program.( this code cannot be used in module pool program )

When a customer request to a selection screen with tabs there can be 2 reasons.

1) To group a selection on one out put ( I mean the final out-put is one but selection screen can be with tabs to make things clear for e.g on SD related report the tabs can be Material selection , SO selection like wise )

2) The user requires different kind of out comes with different tabs... for e.g tab no1 to work during online operations and tab no 2 to work on background operations.

The above requirement 1 which will be totally fine with the code given on top. But the requirement 2 will be a issue when it comes to the above code. As most of the developers know on a selection screen we will always have mandatory fields. when switching between tabs the selection screen first calls the validation and then it calls the normal screen code ( as you know the validation is automatic if me make a selection option mandatory and we have no say on it ).
  So in case if the user wants the functionality of the tab 2 he first has to fill all the mandatory fields on tab 1 so that the error wont occur. This was a error I had to face during my development for this there are 2 way outs

1) do the validation by your self ( draw back : you wont get the mandatory sign on the selection screen )
2) write a selection screen with tabs ( draw back : the user wont be able to save variants or this part has to be coded which will be a messy job ) 

for the 2nd option on above to make sure the tab switching with happen without first validating you have to do the codding as follows

PROCESS BEFORE OUTPUT.
  MODULE STATUS_0100.
  MODULE set_tabs.

  call SUBSCREEN SUB INCLUDING sy-repid gv_dynnr.
*
PROCESS AFTER INPUT.

  MODULE exit_comm.
  MODULE switch_tab.
  CALL SUBSCREEN SUB.
  MODULE screen_comm.

  MODULE USER_COMMAND_0100.


before call sub screen you have to call a module switch tabs.

on my case my customer wanted the variants to be there. Therefore they agreed to the validation by code where the mandatory sign is not displayed.

Google