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.

Tuesday, March 2, 2010

five months of busy work

For the past 5 moths I have been really busy that I didn't have anytime to blog or contribute to SCN on SAP. During these 5 months I was working for 1 main client on one main area it was all about Vendor confirmations. I have been so much into it that now I know a lot about the confirmation process. There were two main developments where one was on SAP user level and other was on customer level which was a web Dynpro development. During this period I gained lots of functional Exp but on technical side it was noting much same old ABAP.

but there were few limitations which I came a cross when I developed tab striped selection screen which I am hoping to blog sometime in the future.

till then enjoy reading my old post's on SAP but still there is nothing much since from the time I joined my work place I hardly had any free time.
Google