Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

urgent: change/read HU user status

Former Member
0 Kudos

Hi people,

I'm required to read and change the user status on handling units. I've been looking into the STATUS_* function modules (fgroup BSVA) but they don't seem to pick up the status I'm looking for.

I also can't find where the status is saved in the database (it isn't in table JSTO where I'd expected it would be).

Help would be appreciated (will reward points)

Thanks,

Rob

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

use the table for user status

<b>TJ30</b>

Regards

Anji

9 REPLIES 9

Former Member
0 Kudos

Hi

use the table for user status

<b>TJ30</b>

Regards

Anji

0 Kudos

That's only the customizing table.

I'm looking for:

a. a function module to read/update user status

b. the table where the different user statuses are saved (per handling unit)

Regards,

rob

Former Member
0 Kudos

Hi Rob Smeets,

below is the code to get the status number....

data:   v_stonr like TJ30-STONR.
  CLEAR : v_stonr.

  CALL FUNCTION 'STATUS_TEXT_EDIT'
    EXPORTING
     client                  = sy-mandt
     flg_user_stat           = 'I'
     objnr                   = vbak-objnr
     only_active             = 'X'
     spras                   = sy-langu
*   BYPASS_BUFFER           = ' '
 IMPORTING
*   ANW_STAT_EXISTING       =
   E_STSMA                 =     GV_USERSTATUS
*   line                    =     v_flag2
*   USER_LINE               =     v_user1
    stonr                   =     v_stonr
 EXCEPTIONS
   object_not_found        = 1
   OTHERS                  = 2.

IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

below is the code with function modules to select the status to change the user status....

        CALL FUNCTION 'I_STATUS_SELECT'
          EXPORTING
            OBJNR                     = vbak-objnr
            SENT_USER_STATUS          = 'RJCT'
          IMPORTING
            SELECTED                  = E_SELECT
            CURRENT_USER_STATUS       = E_CUR_STUS
            NEXT_USER_STATUS          = E_NEX_STUS
            USER_STATUS_PROFILE       = E_USR_PROF
          TABLES
            SYST_STATUS_INCL          = SYS_ISTATUS_RANGE1
            SYST_STATUS_EXCL          = SYS_ISTATUS_RANGE2
            USER_STATUS_INCL          = USR_ISTATUS_RANGE1
            USER_STATUS_EXCL          = USR_ISTATUS_RANGE2
                 .
         CALL FUNCTION 'I_CHANGE_STATUS'
           EXPORTING
             OBJNR                = vbak-objnr
             ESTAT_INACTIVE       = E_CUR_STUS
             ESTAT_ACTIVE         = E_NEX_STUS
             STSMA                = E_USR_PROF
           EXCEPTIONS
             CANNOT_UPDATE        = 1
             OTHERS               = 2
                   .
         IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
         ENDIF.
         CLEAR : E_SELECT,
                 E_CUR_STUS,
                 E_NEX_STUS,
                 E_USR_PROF.

This logic I have used in UserExit MV45AFZZ to change the user status to "REJECTed" when Net Selling Price is less than Cost......

In this first I am getting the active user status number.....

for Created = 10,

for approved = 20,

and for rejected = 30..

based on this I am changing the status if net price is lower then cost price to Rejected......And if the the user or approval authorithy apporves the same then it he have to maintain a text in the header text for approval...

If any other help please let me know.....

Reward the point...

Cheers,

Enjoy,

Sagun Desai.....

Former Member
0 Kudos

hi,

Below are the two tables which is getting update at end of the saving transaction....

1) JSTO

2) JEST

Cheers,,

Sagun Desai.....

Former Member
0 Kudos

Sagun,

you refer to user statuses in VBAK. I can't test with VBAK statuses, but I tried to do the same with HU (= VEKP) statuses, and I can't get those function modules to work properly.

The object number I enter into the function module looks like HU0000000193, and that is the object number I find when I open the handling unit status from HU03. When I use the function modules STATUS_* this way, I keep getting the error message that HU 193 doesn't have any statuses (which is not true since I can see and even change the status from transaction HU02).

Any ideas?

EDIT: I can also confirm that no lines with STSMA 'ZVERBR' (which is the status scheme as defined in TJ30 and seen in the status screen of trxn HU03) exist in table JSTO...

0 Kudos

May I know for which transaction you are using this?

for VA01 / VA02 ?

or for some other transaction?

Cheers..

Sagun

0 Kudos

HU02/HU03. Handling unit management.

But since the configuration for this status management also takes place in TJ30 I would assume it would be the same as other status management.

Only, apparently it isn't.

0 Kudos

After more R&D (raging & debugging) it appears to be a buffer thing.

Apparently, none of the handling unit statuses has been committed to the respective tables yet, but that's no problem because for some reason the BSVA function modules have access to the buffer as long as they're called from one of the HU transactions. If I call the BSVA function modules myself from SE37, though, I can't see the buffer for some strange reason. Any ideas as to how I can enable my programs to read from the same buffer as the HU transactions?

Regards

Rob

0 Kudos

Meanwhile, I've found out that the HU user statuses are found in tables HUSSTAT and HUSTOBJ. There are wrapper functions that need to be run before the STATUS_* functions and afterwards (to fill the buffer).

Sample code is still most welcome, and will be rewarded with a blue star.

Thanks

Rob