2002mm Pur s4 PR Modify Item Badi

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 73

2002 validation of BADI mm_pur_s4_pr_modify item in SSPPR application .

BADI: MM_PUR_S4_PR_MODIFY_ITEM

Logic:

   DATA: ls_message LIKE LINE OF messages.

   DATA: ls_acct LIKE LINE OF  purchaserequisitionitemaccchng .

   FIELD-SYMBOLS:  <ls_acct> LIKE LINE OF  purchaserequisitionitemaccchng .

   if PURCHASEREQUISITIONITEM-PURCHASEREQUISITIONITEM = 10.

*    purchaserequisitionitemchange-purchaserequisitionitemtext = 'TESTITEMBADI'.

*    purchaserequisitionitemchange-materialgroup = 'A001'.

*    purchaserequisitionitemchange-PURCHASINGGROUP = '002'.

*    purchaserequisitionitemchange-DELIVERYDATE = '20191205'.

*    purchaserequisitionitemchange-PURCHASEREQUISITIONPRICE = '100'.

*    purchaserequisitionitemchange-PRICEUNIT = '10'.

*    purchaserequisitionitemchange-FIXEDSUPPLIER = 'S1030001'.

*   purchaserequisitionitemchange-PURCHASINGORGANIZATION = '1010'.

*    purchaserequisitionitemchange-purordsuppliermaterialnumber = 'test01X'.

  ENDIF.
**// ---For Account Assignment category = 'F'----- //

if purchaserequisitionitem-accountassignmentcategory = 'F'.

LOOP AT purchaserequisitionitemaccchng ASSIGNING <ls_acct> .

*    <ls_acct>-glaccount = '0051100000' . .

*    <ls_acct>-ORDER  = '000001000001'.

*     <ls_acct>-glaccount = '0010010000' . .

*    <ls_acct>-ORDER  = '000001000020'.

ENDLOOP.

ENDIF.

*For Account Assignment category = 'P'

if purchaserequisitionitem-accountassignmentcategory = 'P'.

LOOP AT purchaserequisitionitemaccchng ASSIGNING <ls_acct> .

*      <ls_acct>-glaccount = '0051100000'.

**--WBS element is 'TESTPREWF.0.1'.

**     <ls_acct>-WBSELEMENT  = '00002605'.

*      <ls_acct>-WBSELEMENT  = '00002670'.

  ENDLOOP.

ENDIF.

*//------For Account Assignment category = 'K'------//

if purchaserequisitionitem-accountassignmentcategory = 'K'.

LOOP AT purchaserequisitionitemaccchng ASSIGNING <ls_acct> .

*       <ls_acct>-glaccount = '0051100000'.

*      <ls_acct>-costcenterbycocode = '0010101201'.

*      <ls_acct>-unloadingpointname = '1'.


ENDLOOP.

ENDIF.

Please find the below logic to check the Badi fucntionality works fine

Sample Logic:

Eg: costcenter =”2443455”

Unloading point=”testbadiunload”

Please find the below sample Badi validation logic:

Steps:

1) Login with user who is having Employee_selfservices business role assigned .


2) Click on Employee self services section
3) Click on Create own item
4) The create own item PR screen appears.
5) Enter all the manadatory fields like : Short text , Valuatin proce,Qunaity , Unit of mease, Currency
,Price Unit ,Delivery date
6) Click on Add to cart button
7) In the cart overview page click on the>chevron button next to the item
8) The item details page will navigate
9) Enter account assignment category as K .
10) In the account assignment category section , enter the G/l account
11) Enter the cost center
12) Click on Save button
13) Click back button
14) Click on order button

15)Purchase requisition number gets generated

In XT1:

MANUALLY ENTERD GL
PROPER ERROR: ERROR LIKE THIS EVENTHOUG H THIS COST CENTER IS PROPER .,

Account 1000 does not exist in chart of accounts YCOA.

On click of order this error occur because: In the badi logic in custom field logic app: The gl account
should have 10 DIGIT VALUE.

Important:

EG: 10010000 (CURRENTLY IS IT S8) . SO IN THE BADI PREFIX IT WITH TWO MORE ZEROS.

SO IT WILL BE 0010010000
2nd error :cost center 2443455 was set in the logic as per 1st snapshot. Now on order since this cost
center does not exist the proper error message occurs.

On deactivation of the above two errors:

Pr now got created with the same data succesffuly .


Item description scenario in ITEMDETAILS PAGE:

Now the item description in the Badi was set to TESTITEM BADI

THE item description upon ordering of pr via badi. In the aove snapshot syuou can see the item
descriptio ssS Hello reema caring person and now it got changed to Test item badi on click of order
Material group change scenario in Item details:

Material group initially was L001 .

As per the logic in Badi the material group was changed to =A001.

UNLOADING POINT SCENARIO:

As per the Badi validation logic the Unloading point value is :TESTBADIUNLOAD
Also check them same in me 51n in xt1:

As per Badi validation logic:

Cost center 2443455


gl :10000

Unloading point: test Badi unload

And the error occurs:Account10000 does not exisit in the chart of accounts
Scenario Badi logic

Add two items . fetch data from badi .

[Item text,material group,purchasinggroup,storage location,requirement tracker,delivery


date,pyurchase req release date, req price,price unit]

The Init; test item badi,pgrp:001,trackingno:L01,ial data entered by the user in me51n got changed
susccefully from values presetnin badi logic
[06-Nov-19 11:55 AM]  Elsy Easow, Reema: 
purchaserequisitionitemchange-purchaserequisitionitemtext = 'TESTITEMBADI'.
    purchaserequisitionitemchange-materialgroup = 'A001'.
    purchaserequisitionitemchange-PURCHASINGGROUP = '001'.
    purchaserequisitionitemchange-STORAGELOCATION = '101A'.
    purchaserequisitionitemchange-REQUIREMENTTRACK = '01'.
    purchaserequisitionitemchange-DELIVERYDATE = '20091205'.
    purchaserequisitionitemchange-PURCHASEREQUISITIONRELEASEDATE ='20091205'.
    purchaserequisitionitemchange-PURCHASEREQUISITIONPRICE = '100'.
    purchaserequisitionitemchange-PRICEUNIT = '10'.
 
 

Eg: text

All validations were successful for theabove test data paramters

2ND LOGIC:

purchaserequisitionitemchange-purchaserequisitionitemtext = 'TESTITEMBADI'.
    purchaserequisitionitemchange-materialgroup = 'A001'.
    purchaserequisitionitemchange-PURCHASINGGROUP = '001'.
    purchaserequisitionitemchange-STORAGELOCATION = '101A'.
    purchaserequisitionitemchange-REQUIREMENTTRACK = '01'.
    purchaserequisitionitemchange-DELIVERYDATE = '20091205'.
    purchaserequisitionitemchange-PURCHASEREQUISITIONRELEASEDATE ='20091205'.
    purchaserequisitionitemchange-PURCHASEREQUISITIONPRICE = '100'.
    purchaserequisitionitemchange-PRICEUNIT = '10'.
    purchaserequisitionitemchange-SUPPLIER =  '10300081'.
    purchaserequisitionitemchange-FIXEDSUPPLIER = '10010000013'.
    purchaserequisitionitemchange-PURCHASINGORGANIZATION = '1010'.
    purchaserequisitionitemchange-PURCHASECONTRACT = '4500001370 '.
    purchaserequisitionitemchange-PURCHASECONTRACTITEM = '00010 '.
    purchaserequisitionitemchange-purordsuppliermaterialnumber = 'X'.
    purchaserequisitionitemchange-PURCHASINGINFORECORD = '5300000000'.

All mapping of the fields are proper

DESIRED SUPPLIER, FIXWED SUP;LIER, INFO RECORD, AGFRREMENT, AGREEMNT ITEM,PURCHASING


ORG,SUPPLIER MATERIAL NUINMNBER

Xt1:

Myultiple line with Multi accounting by qty and percentage


[06-Nov-19 1:33 PM] 
51100000 -GL
54400000
Cost center:10101201
 
[06-Nov-19 1:38 PM] 
G/L:51100000
PROJECT:TESTPREWF.0.1

By QTY BASIS :

By percentage
 

 
F-order:

By qt:
Wbs elemtn:internal incident raised

NetweorK:

By qty:
Percentage:

SSPP PR:

LOGIC:
2ND LOGIC:
lOGIC:

Preferred SUPPLIER WHAT USER added was S1030002


AS PER THE BADI Logic: Desired supplier is S1030001 IN THE above PR
Fixed supplier

USER ENTERS S1030001 and supplier material number also enterd.

AS PER THE LOGIC MY PR SHOULD HAVE CHANGED TO


Accounting:

g/l:

44000000

Cost center:10101201

[08-Nov-19 2:40 PM] 


44000000 -gl
10101201
costcenter
 
[08-Nov-19 2:44 PM] 
f- order:g/l54400000 , order:1000001
 
[08-Nov-19 2:52 PM] 
G/L:51100000
PROJECT:TESTPREWF.0.1 
 
 

Cost center order created with : 65008400 as g/l and cost center as 10101602. PR
Now via MY pr : the values changed as per Badi logic to 440000000, 10101201
F: order:

100000 is the order which I entered and g/l : 40000000

Now as per the badi logic :

The values should change to 65008400and order to 10000001 and successful change happene.d
In me 51n also upon entering the category as K and F the values get changed
Pr created:100003028

K by qty :
Percentage”: f order

K by pqty
F by percentage:
K by qty and k by percentage

F by order and percentage:


P[R: 10003034 CREATED

Ssppr:

Cost center by qty and cost center by percentage


Now as per badi logic , the values got changed
F order:
.

Now as per badi logic order value gets changed .


Project:L

Values got changed as per badi logic to 51100000 and to testprewf.0.1.


Now for p by qty:
NOW P BY PERCENTAGE:

NOWVALUES COME FO4M BADI


IN GIUI FOR PROJECT WOREKS WEEL
Zregression

Test scenarios

Special scenario for customer ticket

Regarding customer ticket:

https://support.wdf.sap.corp/sap/support/message/002075129400001168382020
Step1: We need to login to Proj_fin_controller/Welcome1!

Step2: click on Project control

Step3: Create a wbs element of type: Project with revenue .

Eg name : CXL200403-1
Step4: we can log to create pr app and enter p as account category
and get the internal id:00003583

Step5: now create another Wbs element with the last 8 digit of the external wbs element is the same as
that of the internal id of another wbs element

So in short we can create CHECK00003583 of type project with revenue.

So now we have the test data


Set the status of the project to Released
Test data:

External Internal
CXL200403-1 00003583

CHECK00003583 00003590

Step6:Now we can log to administrator role and in custom field and logic app implement the badi for
MODIY ITEM BADI

Step7:

Two scenarios: SCENARIO1:

When the Badi is Published and there is no logic for Wbs element being active.

Sample logic wher project (wbs code) is inactive

DATA: ls_message LIKE LINE OF messages.


DATA: ls_acct LIKE LINE OF purchaserequisitionitemaccchng .
FIELD-SYMBOLS: <ls_acct> LIKE LINE OF purchaserequisitionitemaccchng .
if PURCHASEREQUISITIONITEM-PURCHASEREQUISITIONITEM = 10.
purchaserequisitionitemchange-purchaserequisitionitemtext = 'TESTITEMBADI'.
purchaserequisitionitemchange-materialgroup = 'A001'.
purchaserequisitionitemchange-PURCHASINGGROUP = '002'.
purchaserequisitionitemchange-DELIVERYDATE = '20191205'.
purchaserequisitionitemchange-PURCHASEREQUISITIONPRICE = '100'.
purchaserequisitionitemchange-PRICEUNIT = '10'.
purchaserequisitionitemchange-FIXEDSUPPLIER = 'S1030001'.
purchaserequisitionitemchange-SUPPLIER = 'S1030001'.
purchaserequisitionitemchange-PURCHASINGORGANIZATION = '1010'.
purchaserequisitionitemchange-purordsuppliermaterialnumber = 'test01X'.
ENDIF.

* if purchaserequisitionitem-accountassignmentcategory = 'P'.
* LOOP AT purchaserequisitionitemaccchng ASSIGNING <ls_acct> .
* <ls_acct>-glaccount = '0010010000'.
* <ls_acct>-wbselement = '00003583'.
* ENDLOOP.
* ENDIF.

Step8: log to employee_procurement/Welcome 1! User


Step9: click on create pr and click on create own and enter all mandatory data and add item to
cart
Step10:In item details page user enters P(project) as the Account assignment category and enters
the gl account and Wbs element
Eg: CHECK00003583 and gl as 110010000
User now clicks on order of the PR .
Pr should be ordered successfully
Step11:
User navigates to My pr and clickon >chevroin of the above create pr and navigates inside the PR and
should be able to see the gl and project value as CHECK00003583 and gl as 110010000

STEP12:

SCENARIO2:

User in custom logic app in administrator makes the logic for Account category P active. (I,e the code is
not commented for project accoutnign category)

Note for gl account please prefix with two zeros prior to the gl number. For wbs element please enter
the internal id only .

DATA: ls_message LIKE LINE OF messages.


DATA: ls_acct LIKE LINE OF purchaserequisitionitemaccchng .
FIELD-SYMBOLS: <ls_acct> LIKE LINE OF purchaserequisitionitemaccchng .
if PURCHASEREQUISITIONITEM-PURCHASEREQUISITIONITEM = 10.
purchaserequisitionitemchange-purchaserequisitionitemtext = 'TESTITEMBADI'.
purchaserequisitionitemchange-materialgroup = 'A001'.
purchaserequisitionitemchange-PURCHASINGGROUP = '002'.
purchaserequisitionitemchange-DELIVERYDATE = '20191205'.
purchaserequisitionitemchange-PURCHASEREQUISITIONPRICE = '100'.
purchaserequisitionitemchange-PRICEUNIT = '10'.
purchaserequisitionitemchange-FIXEDSUPPLIER = 'S1030001'.
purchaserequisitionitemchange-SUPPLIER = 'S1030001'.
purchaserequisitionitemchange-PURCHASINGORGANIZATION = '1010'.
purchaserequisitionitemchange-purordsuppliermaterialnumber = 'test01X'.
ENDIF.

if purchaserequisitionitem-accountassignmentcategory = 'P'.
LOOP AT purchaserequisitionitemaccchng ASSIGNING <ls_acct> .
<ls_acct>-glaccount = '0010010000'.
<ls_acct>-wbselement = '00003583'.
ENDLOOP.
ENDIF.

Now publish the code

Step13;

log to employee_procurement/Welcome 1! User


click on create pr and click on create own and enter all mandatory data and add item to cart
In item details page user enters P(project) as the Account assignment category and enters the gl
account and Wbs element
Eg: CHECK00003583 and gl as 10010000 and orders the PR.

Step14: now user navigate to the above create pr via MY PR APP and now as per the Badi logic we can
see that the values from the Badi wbselement = '00003583' pointing to CXL200403-1 will be present .
so since the badi logic is present the values form the Badi logic will take the priority .

So similarly the same scenarios can be tested for cost center , asset, internal order also .

Please find the badi logic also:

DATA: ls_message LIKE LINE OF messages.


DATA: ls_acct LIKE LINE OF purchaserequisitionitemaccchng .
FIELD-SYMBOLS: <ls_acct> LIKE LINE OF purchaserequisitionitemaccchng .
if PURCHASEREQUISITIONITEM-PURCHASEREQUISITIONITEM = 10.
purchaserequisitionitemchange-purchaserequisitionitemtext = 'TESTITEMBADI'.
purchaserequisitionitemchange-materialgroup = 'A001'.
* purchaserequisitionitemchange-PURCHASINGGROUP = '002'.
purchaserequisitionitemchange-DELIVERYDATE = '20191205'.
purchaserequisitionitemchange-PURCHASEREQUISITIONPRICE = '100'.
purchaserequisitionitemchange-PRICEUNIT = '10'.
*purchaserequisitionitemchange-FIXEDSUPPLIER = 'S1030001'.
purchaserequisitionitemchange-SUPPLIER = 'S1030001'.
* purchaserequisitionitemchange-PURCHASINGORGANIZATION = '1010'.
purchaserequisitionitemchange-purordsuppliermaterialnumber = 'test01X'.
ENDIF.

if purchaserequisitionitem-accountassignmentcategory = 'P'.
LOOP AT purchaserequisitionitemaccchng ASSIGNING <ls_acct> .
<ls_acct>-glaccount = '0010010000'.
<ls_acct>-wbselement = '00003583'.
ENDLOOP.
ENDIF.
if purchaserequisitionitem-accountassignmentcategory = 'K'.
LOOP AT purchaserequisitionitemaccchng ASSIGNING <ls_acct> .
<ls_acct>-glaccount = '0010010000'.
<ls_acct>-costcenterbycocode = '0010101201'.
<ls_acct>-unloadingpointname = '1'.
ENDLOOP.
ENDIF.
if purchaserequisitionitem-accountassignmentcategory = 'F'.
LOOP AT purchaserequisitionitemaccchng ASSIGNING <ls_acct> .
* <ls_acct>-glaccount = '0051100000' . .
* <ls_acct>-ORDER = '000001000001'.
* <ls_acct>-glaccount = '0010010000' . .
* <ls_acct>-ORDER = '000001000020'.

ENDLOOP.
ENDIF.

Also delivery address section can also be tested:

This part was checked for KWS consulting ticket .

purchaserequisitionitemchange-requestedquantity = 100.
purchaserequisitionitemchange-currency = 'USD'.

purchaserequisitionitemchange-fullname = 'SAPSAI'.

purchaserequisitionitemchange-addressstreetname = '123,KUNDALHALLI'.

Ce2105 scope:

Add the below fields

 GOODSRECEIPTISEXPECTED         WEPOS                            CHAR     1

 GOODSRECEIPTISNONVALUATED      WEUNB                            CHAR     1

 INVOICEISEXPECTED              REPOS                            CHAR     1

 INVENTORYSPECIALSTOCKTYPE      SOBKZ                            CHAR     1

 CONSUMPTIONPOSTING             KZVBR                            CHAR     1


 Kindly check by creating a PR and then in me51n and then create po/invpice and check
 For central check in the connected system me 51n .

Code:

LOOP AT purchaserequisitionitem_table INTO DATA(ls_item).

*GOODSRECEIPTISEXPECTED

IF ls_item-GOODSRECEIPTISEXPECTED IS NOT INITIAL.

              APPEND VALUE #( messagetype = 'W'

                        messageid = 'MMPUR_REQ_COMMON'

                        messagenumber = '096'

                        MESSAGEVARIABLE1 = 'GOODSRECEIPTISEXPECTED is set'

                        MESSAGEVARIABLE2 = ls_item-GOODSRECEIPTISEXPECTED

                        documentitemnumber = ls_item-purchaserequisitionitem ) TO messages.

                 purchaserequisitionhaserror = abap_true.

         ELSE.

                        APPEND VALUE #( messagetype = 'E'

                        messageid = 'MMPUR_REQ_COMMON'

                        messagenumber = '096'

                        MESSAGEVARIABLE1 = 'GOODSRECEIPTISEXPECTED is not set'

                        MESSAGEVARIABLE2 = ls_item-GOODSRECEIPTISEXPECTED

                        documentitemnumber = ls_item-purchaserequisitionitem ) TO messages.

                        purchaserequisitionhaserror = abap_true.

      ENDIF.

*GOODSRECEIPTISNONVALUATED

IF ls_item-GOODSRECEIPTISNONVALUATED IS NOT INITIAL.

              APPEND VALUE #( messagetype = 'W'

                        messageid = 'MMPUR_REQ_COMMON'


                        messagenumber = '096'

                        MESSAGEVARIABLE1 = 'GOODSRECEIPTISNONVALUATED is set'

                        MESSAGEVARIABLE2 = ls_item-GOODSRECEIPTISNONVALUATED

                        documentitemnumber = ls_item-purchaserequisitionitem ) TO messages.

                 purchaserequisitionhaserror = abap_true.

         ELSE.

                        APPEND VALUE #( messagetype = 'E'

                        messageid = 'MMPUR_REQ_COMMON'

                        messagenumber = '096'

                        MESSAGEVARIABLE1 = 'GOODSRECEIPTISNONVALUATED is not set'

                        MESSAGEVARIABLE2 = ls_item-GOODSRECEIPTISNONVALUATED

                        documentitemnumber = ls_item-purchaserequisitionitem ) TO messages.

                        purchaserequisitionhaserror = abap_true.

      ENDIF.

     

*INVOICEISEXPECTED

IF ls_item-INVOICEISEXPECTED IS NOT INITIAL.

              APPEND VALUE #( messagetype = 'W'

                        messageid = 'MMPUR_REQ_COMMON'

                        messagenumber = '096'

                        MESSAGEVARIABLE1 = 'INVOICEISEXPECTED is set'

                        MESSAGEVARIABLE2 = ls_item-INVOICEISEXPECTED

                        documentitemnumber = ls_item-purchaserequisitionitem ) TO messages.

                 purchaserequisitionhaserror = abap_true.

         ELSE.

                        APPEND VALUE #( messagetype = 'E'

                        messageid = 'MMPUR_REQ_COMMON'

                        messagenumber = '096'

                        MESSAGEVARIABLE1 = 'INVOICEISEXPECTED is not set'


                        MESSAGEVARIABLE2 = ls_item-INVOICEISEXPECTED

                        documentitemnumber = ls_item-purchaserequisitionitem ) TO messages.

                        purchaserequisitionhaserror = abap_true.

      ENDIF.

     

      

*4. INVENTORYSPECIALSTOCKTYPE

 IF ls_item-INVENTORYSPECIALSTOCKTYPE  IS NOT INITIAL.

              APPEND VALUE #( messagetype = 'W'

                        messageid = 'MMPUR_REQ_COMMON'

                        messagenumber = '096'

                        MESSAGEVARIABLE1 = 'INVENTORYSPECIALSTOCKTYPE  is set'

                        MESSAGEVARIABLE2 = ls_item-INVENTORYSPECIALSTOCKTYPE

                        documentitemnumber = ls_item-purchaserequisitionitem ) TO messages.

                 purchaserequisitionhaserror = abap_true.

         ELSE.

                        APPEND VALUE #( messagetype = 'E'

                        messageid = 'MMPUR_REQ_COMMON'

                        messagenumber = '096'

                        MESSAGEVARIABLE1 = 'INVENTORYSPECIALSTOCKTYPE  is not set'

                        MESSAGEVARIABLE2 = ls_item-INVENTORYSPECIALSTOCKTYPE

                        documentitemnumber = ls_item-purchaserequisitionitem ) TO messages.

                        purchaserequisitionhaserror = abap_true.

      ENDIF.

     

*5. CONSUMPTIONPOSTING            

 IF ls_item-CONSUMPTIONPOSTING IS NOT INITIAL.

              APPEND VALUE #( messagetype = 'W'

                        messageid = 'MMPUR_REQ_COMMON'


                        messagenumber = '096'

                        MESSAGEVARIABLE1 = 'CONSUMPTIONPOSTING is set'

                        MESSAGEVARIABLE2 = ls_item-CONSUMPTIONPOSTING

                        documentitemnumber = ls_item-purchaserequisitionitem ) TO messages.

                 purchaserequisitionhaserror = abap_true.

         ELSE.

                        APPEND VALUE #( messagetype = 'E'

                        messageid = 'MMPUR_REQ_COMMON'

                        messagenumber = '096'

                        MESSAGEVARIABLE1 = 'CONSUMPTIONPOSTING is not set'

                        MESSAGEVARIABLE2 = ls_item-CONSUMPTIONPOSTING

                        documentitemnumber = ls_item-purchaserequisitionitem ) TO messages.

                        purchaserequisitionhaserror = abap_true.

      ENDIF.

      ENDLoop.
The warnings are appearing because automatically the functionality in in such a way sthat GR AND
INVPOICE ASRE LWASY TICKETD IN ME 51N . THAT IS WHY ON ORDER IN SS PPR IF VALUE IS SET
WARNING OCCURS FOR THESE TWO FIELDS

FOR TOTHER THREE FIELDS VALUES ARE NOT SET AND HENCE ERROR MESSAGES APPEAR AS PER THE
CODE LOGIC

LOGIC::

IF VALUE IS SET ===WARNING

IF VALUE NOT SET==THROW ERROR

SEE THE BAOVE PIECE OF CODE


CEHCKED THE SAME FOR CENTRAL PROCUREMNET Q6K 820 WAS CONNECTED WITH PL:1010 CC:1010
NO WIN CREATE PR ADVANCED OR IN ME 51N IF WE CREATE PR AND IN DELIVERY TAB IF WE HAVE
THREE FIELDS AND ALL THREE FIUELDS ARE CHECEKD , THEN WE SHOULD GET WARNING ONLY.

THEN FOR TO THE RTWO FIELDS WE SHOULD GET ERROR


NOW CASE2:

UNCHECK ALL THE HTREE FLAAGS AND CHECK . NOW ALL FIVE FIELDS VALUES ARE NOT SET . WE
SHOULD GET ERROR

CASE3:
CASE3:UNCHECK GR NON VALUATED AND CHECK WARNING IS COMING

CASE4:IF WE CHOOSE gr non vluated to be set then we also have to set mandatorily the GR field as well ,
else we get FI error
Now use case for checking value is set and w

 INVENTORYSPECIALSTOCKTYPE

 CONSUMPTIONPOSTING
 Now In modify Badi reema has set the value for INVENTORYSPECIALSTOCKTYPE and
CONSUMPTIONPOSTING WITH A VALUE
 So on editing the pr we will get for these two fields warning message (value is set)

Unchecked values for consumption posting reem


Use case:

User while creating the pr unchecks the flag for the three fields

Now modiufy badi code is written to ensure value is set for tehse three fields

Now user orders pr.

Now display the pr in me 52n

Now we can see that the value for all three fields are set (logic hits modufy badi)

Code:

DATA: ls_message LIKE LINE OF messages.

DATA: ls_acct LIKE LINE OF purchaserequisitionitemaccchng .

FIELD-SYMBOLS: <ls_acct> LIKE LINE OF purchaserequisitionitemaccchng .

if PURCHASEREQUISITIONITEM-PURCHASEREQUISITIONITEM = 10.

purchaserequisitionitemchange-GOODSRECEIPTISEXPECTED = 'X'.

purchaserequisitionitemchange-GOODSRECEIPTISNONVALUATED = 'X'.

purchaserequisitionitemchange-INVOICEISEXPECTED = 'X'.

purchaserequisitionitemchange-INVENTORYSPECIALSTOCKTYPE = 'T'.

purchaserequisitionitemchange-CONSUMPTIONPOSTING = 'A'.

ENDIF.
Use case2:

User sets all the three fields while creating the pr

In modify badi we keep all three fields as null

Now after ordering and in display we can see that the three fields are unchecked.

DATA: ls_message LIKE LINE OF messages.

DATA: ls_acct LIKE LINE OF purchaserequisitionitemaccchng .

FIELD-SYMBOLS: <ls_acct> LIKE LINE OF purchaserequisitionitemaccchng .

if PURCHASEREQUISITIONITEM-PURCHASEREQUISITIONITEM = 10.

purchaserequisitionitemchange-GOODSRECEIPTISEXPECTED = ''.

purchaserequisitionitemchange-GOODSRECEIPTISNONVALUATED = ''.

purchaserequisitionitemchange-INVOICEISEXPECTED = ''.

purchaserequisitionitemchange-INVENTORYSPECIALSTOCKTYPE = 'T'.

purchaserequisitionitemchange-CONSUMPTIONPOSTING = 'A'.

ENDIF.
The ocde now sees the modify badi

In the modify badi value si not set .

So this not set value is picked up by check badi and throws not set

You might also like