SAP for High Tech Discussions
Connect with fellow SAP users to share cutting-edge ideas, troubleshoot challenges, and collaborate on pushing boundaries. Join or start a discussion.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to call RH_STRUC_GET for each value of pnporgeh

0 Kudos


HI,

I am using PNP logical database and selection criteria of GET PERNR. In my code before get pernr ,  following code is used in my program. The output of this code is correct for single value of pnporgeh-low value but if i want to pass multiple values in pnporgeh than output is not coming as per my given values. There is need to put the LOOP instead of IF statement. SO please suggest and help me out.

  IF NOT PNPORGEH IS INITIAL.

PERFORM get_orgeh.

ENDIF.

FORM get_orgeh .

 
CALL FUNCTION 'RH_STRUC_GET'

   
EXPORTING

      act_otype     
= 'O'

      act_objid     
= pnporgeh-low

      act_wegid     
= 'O-S-P_PM'

   
TABLES

      result_tab    
= it_tab

      result_objec  
= it_objec

      result_struc  
= it_struc

   
EXCEPTIONS

      no_plvar_found
= 1

      no_entry_found
= 2

     
OTHERS         = 3.

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

 
ENDIF.

 
SORT it_objec BY otype objid DESCENDING.

 
DELETE ADJACENT DUPLICATES FROM it_objec COMPARING otype objid.

 
LOOP AT it_objec INTO wa_objec WHERE otype = 'P'.

    it_objec1
-sign = 'I'.

    it_objec1
-option = 'EQ'.

    it_objec1
-low = wa_objec-objid.

   
APPEND it_objec1.

 
ENDLOOP.

  pnporgeh
-sign = 'I'.

  pnporgeh
-option = 'EQ'.

 
LOOP AT it_objec INTO wa_objec WHERE otype = 'O'.

   
WRITE: / wa_objec-objid.

    pnporgeh
-low = wa_objec-objid.

   
APPEND pnporgeh.

 
ENDLOOP.


ENDFORM.               

1 ACCEPTED SOLUTION

ulf_petzel
Advisor
Advisor
0 Kudos

Hi,

you might want to post this in an ABAP coding related community, not this one.

http://scn.sap.com/community/abap

Thanks, Ulf.

View solution in original post

2 REPLIES 2

ulf_petzel
Advisor
Advisor
0 Kudos

Hi,

you might want to post this in an ABAP coding related community, not this one.

http://scn.sap.com/community/abap

Thanks, Ulf.

0 Kudos

thanks....