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: 

How to get records from lOGICAL database GET PERNR into FIELD-SYMBOL

former_member111748
Participant
0 Kudos

I have a custom program with selection screen, I am using GET PERNR for selecting periods and personnel number. I am passing the values selected from my custom selection screen to standard program RPCAUDK0 using SUBMIT with Parameters AND return. Everything is working except I am having issues with GET PERNR processing, as it's a loop, it displays the same screen multiple times depending upon the number of pernr's selected and eventually I end up just one pernr in the result list.

How do I save all the records from GET PERNR in a table or field-symbol and then pass them at the end to my standard program.

1 ACCEPTED SOLUTION

former_member111748
Participant
0 Kudos

So it seems the issue has resolved. The only thing I changed was to put my SUBMIT outside of START-OF-SELECTION block.

START-OF-SELECTION.
GET PERNR.
END-OF-SELECTION.

SUBMIT......
.......
17 REPLIES 17

DoanManhQuynh
Active Contributor
0 Kudos

You can pass infotype to internal table after get pernr, something like:

RP_PROVIDE_FROM_LAST P0000  SPACE  PN-BEGDA PN-ENDDA.
APPEND P0000 TO....

Or you can call fm HR_READ_INFOTYPE to get data from specific infotype.

0 Kudos

Here is my Start Of Selection and ALV code. I haven't pasted my custom selection screen and the implementation of initialize_alv and display_alv sub-routines.

START-OF-SELECTION.
GET PERNR.
SUBMIT RPCAUDK0 with PNPBEGDA = PNPBEGDA

                with PNPENDDA = PNPENDDA

                with PNPPERNR = pernr-pernr

               with PNPMASSN = pernr-massn

               with PNPMASSG = pernr-massg

               with PNPSTAT1 = pernr-stat1

               with PNPSTAT2 = pernr-stat2

               with PNPSTAT3 = pernr-stat3

               with PNPBUKRS = pernr-bukrs

               with PNPWERKS = pernr-werks

               with PNPBTRTL = pernr-btrtl

               with PNPPERSG = pernr-persg

               with PNPPERSK = pernr-persk

               with PNPVDSK1 = pernr-vdsk1

               with PNPGSBER = pernr-gsber

               with PNPJUPER = pernr-juper

               with PNPABKRS = pernr-abkrs

               with PNPANSVH = pernr-ansvh

               with PNPKOKRS = pernr-kokrs

               with PNPKOSTL = pernr-kostl

               with PNPORGEH = pernr-orgeh

               with PNPPLANS = pernr-plans

               with PNPSTELL = pernr-stell

               with PNPMSTBR = pernr-mstbr

               with PNPSBMOD = pernr-sbmod

               with PNPSACHA = pernr-sacha

               with PNPSACHP = pernr-sachp

               with PNPSACHZ = pernr-sachz

               with PNPOTYPE = pernr-otype

               with PNPENAME = pernr-ename

               with PNPSNAME = pernr-sname

               with PNPFISTL = pernr-fistl

               with PNPGEBER = pernr-geber

               with PNPFKBER = pernr-fkber

               with PNPGRANT = pernr-grant_nbr

               with PNPMASNG = pernr-masng

               with PNPSTATU = pernr-statu

               with PNPXBWBK = pernr-xbwbk

               with PNPKOKTL = pernr-koktl

               with PNPXPGPK = pernr-XPGPK

               with PNPSASBA = pernr-sasba

               with PNPSASBP = pernr-sasbp

               with PNPSASBZ = pernr-sasbz

               with RB_APPL = rb_appl

               with APPL = appl

               with ftax_ovr = ftax_ovr

               with differ = differ

               AND RETURN.
END-OF-SELECTION.
TRY.

      cl_salv_bs_runtime_info=>get_data_ref(
      IMPORTING r_data_descr = lr_data_descr

                r_data_line_descr = lr_data_line_descr ).
      CREATE DATA lr_data         TYPE HANDLE lr_data_descr.
      CREATE DATA lr_data_line    TYPE HANDLE lr_data_line_descr.
      ASSIGN LR_DATA->*           TO <LT_DATA>.
      ASSIGN LR_DATA_LINE->*      TO <LT_DATA_LINE>.
      CL_SALV_BS_RUNTIME_INFO=>GET_DATA(
        IMPORTING
          T_DATA      = <LT_DATA>
          T_DATA_LINE = <LT_DATA_LINE> ).
      CATCH cx_salv_bs_sc_runtime_info.
      MESSAGE `Unable to retrieve ALV data` TYPE 'E'.
ENDTRY.
cl_salv_bs_runtime_info=>clear_all( ).

PERFORM initialize_alv.
PERFORM display_alv.

0 Kudos

OK, I see what you are doing here is get the result of standard program RPCAUDK0 after GET PERNR then display the result in ALV. So you should move the source code in TRY block to inside the GET PERNR then <LT_DATA> will be filled each loop which you can APPEND to a gobal itab. at END-OF-SELECTION you print out ALV with data in gobal itab.

0 Kudos

Thanks Quynh.

I don't know the type of FIELD-SYMBOLS plus this will not resolve my problem of displaying the list from standard program always when the SUBMIT statement is hit.

When I call SUBMIT, the standard program displays a ALV tree with some rows, when a user double clicks on any row then it returns to my custom program with a list that I can access using cl_salv_bs_runtime. But When I use GET PERNR, it loops if there are more than one pernr, and everytime in the loop SUBMIT statement is hit which I don't want.

I tried using just LDB PNP in my custom program without using GET PERNR but then it doesn't even hit the GET PERNR in the standard program for some reason which I am troubleshooting. If this works this will resolve my issue.

Please can you suggest some other option of doing this. Let me know if you need more information in understanding what I am trying to do.

0 Kudos

OK lets say for example if only pernr is changed here then you can get all pernr and append to an itab inside GET PERNR. after that you pass that itab to standard program using WITH SELECTION-TABLE additon (read more in ABAP F1 help). Something like this:

DATA: SELTAB TYPE RANGE OF I,
 RSPAR TYPE TABLE OF RSPARAMS.


START-OF-SELECTION.
 GET PERNR.
 APPEND PERNR TO LT_PERNR.
END-OF-SELECTION.
LOOP AT LT_PERNR INTO LS_PERNR. RSPAR = VALUE #( ( SELNAME = 'PNPBEGDA' KIND = 'P' SIGN = 'I' OPTION = 'EQ' LOW = PNPBEGDA ) " Parameters ( SELNAME = 'PNPPERNR' KIND = 'S' SIGN = 'I' OPTION = 'EQ' LOW = PERNR-PERNR ) )." Selection-option ENDLOOP.
SUBMIT RPCAUDK0 WITH SELECTION-TABLE RSPAR AND RETURN. TRY.
CL_SALV_BS_RUNTIME_INFO=>GET_DATA_REF( IMPORTING R_DATA_DESCR = LR_DATA_DESCR R_DATA_LINE_DESCR = LR_DATA_LINE_DESCR ).
CREATE DATA LR_DATA TYPE HANDLE LR_DATA_DESCR. CREATE DATA LR_DATA_LINE TYPE HANDLE LR_DATA_LINE_DESCR.
ASSIGN LR_DATA->* TO <LT_DATA>. ASSIGN LR_DATA_LINE->* TO <LT_DATA_LINE>. CL_SALV_BS_RUNTIME_INFO=>GET_DATA( IMPORTING T_DATA = <LT_DATA> T_DATA_LINE = <LT_DATA_LINE> ).
CATCH CX_SALV_BS_SC_RUNTIME_INFO. MESSAGE `Unable to retrieve ALV data` TYPE 'E'. ENDTRY.
CL_SALV_BS_RUNTIME_INFO=>CLEAR_ALL( ).

0 Kudos

I checked SU53, after I ran my custom program with LDB PNP but without using GET PRNR. I am getting authorization failed. I don't understand why with GET PERNR authorization works but doesn't work without it.

raymond_giuseppi
Active Contributor

Just use an APPEND statement in the GET PERNR block, and execute your call in block END-OF-SELECTION.

0 Kudos

I have GET PERNR in my custom program and then there is GET PERNR in the standard program, basically I want to pass my custom PERNR into Standard PERNR, so that only pernr's that user selects on my custom screen get processed.

0 Kudos

When I don't use PNP LDB and create my custom screen, everything works but now I have to make my selection screen exactly like the standad program RPCAUDK0. Is there a way to still use the LDB and not GET PERNR because I only need to pass the values from my custom screen which looks exactly the same as standard programs screen to the standard program using SUBMIT. Thanks.

0 Kudos

Please check my replies to Quynh. I put more information there.

0 Kudos

So in your GET PERNR block you execute a SUBMIT. You could build a range of pernr in your GET PERNR and pass it to the standard program at end of selection with your range in a WITH PNPPERNR IN <yourrange> and your other parameters, so only one SUBMIT will be executed. But I am puzzled by you solution ? You could SUBMIT the standard report with your current selection screen criteria: In START OF SELECTION (so before any GET) block get those wih FM RS_REFRESH_FROM_SELECTOPTIONS, and eventually withFM RS_REFRESH_FROM_DYNAMICAL_SEL, SUBMIT standard report WITH SELECTION-TABLE, eventually WITH FREE SLECTIONS, and get back to selection-screen with a LEAVE TO LIST-PROCESSING or similar statement. So no double execution of the logical databse report...

Question: why did you build a wrapper of this report, if you only want to hide/force values of some criteria you could build a variant and create a z-transaction with the standard report and your variant (create a system variant name CUS&xxx to force transport and protect it in target systems)


0 Kudos

I don't get why you need to use an extra get pernr.

RPCAUDK0 itself also uses get pernr, so if you use the same selection criteria, you don't need to do this in your own get pernr.

0 Kudos

Thanks Raymond.

To answer your question: I am doing it like this because in the standard program when a user selects audit error list, it display the list in a hierarchical format (hierarchical ALV) , I have been asked to change this list to regular ALV list format (e.g. ALV table). So I came up with this solution, build a custom program with exactly the same selection screen as the standard program and pass the values from my custom to standard using SUBMIT AND RETURN and display the returned list into ALV table format.

I have been able to accomplish this if I don't use LDB PNP and just create my own selection screen for period and personnel selection but then I would have to spend more time in building other things like push button etc means more time, so I am using LDB PNP but I have to use GET PERNR as well with it otherwise it doesn't trigger GET PERNR of the standard program due to authentication error which I don't understand why.

0 Kudos

I tried this and I am using the same selection criteria but when I don't use GET PERNR in my custom program, the GET PERNR of RPCAUDK0 doesn't trigger I don't know why.

horst_keller
Product and Topic Expert
Product and Topic Expert

Did you know that you can call an LDB by a function module?

Maybe this can be an approach.

https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abenldb_usage_func...

former_member111748
Participant
0 Kudos

So it seems the issue has resolved. The only thing I changed was to put my SUBMIT outside of START-OF-SELECTION block.

START-OF-SELECTION.
GET PERNR.
END-OF-SELECTION.

SUBMIT......
.......

You put it into the END-OF-SELECTION block. I'm afraid your problem cane from the fact, that you haven't fully grasped the concept of ABAP's reporting events.

The statement END-OF-SELECTION is not a dedicated statement for closing START-OF-SELECTION. It opens a new event block. Read the documentation, read what happens after SUBMIT.

The figure that Raymond digged up from the documentation (quite old, but looks astonishly fresh) shows the event blocks and the program flow that triggers them.