SAP for Higher Education and Research Discussions
Spark conversations about student engagement, research optimization, and administrative efficiency using SAP in higher education and research. Join in!
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem using HRIQ_AW_INSERT_USAGE

Former Member
0 Kudos

Hi all

i'm using HRIQ_AW_INSERT_USAGE to upload some data from text file (sample.txt). I receive e error on this function which state that :

******************************************************************************************************

Error analysis

An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE'

not caught and

therefore caused a runtime error.

The reason for the exception is:

The call to the function module "HRIQ_AW_INSERT_USAGE" is incorrect:

The function module interface allows you to specify only

fields of a particular type under "IT_PROGRAM".

The field "LIT_UPLOAD_WORK2-IT_PROGRAM" specified here is a different

field type

*****************************************************************************************************

IT_PROGRAM is defined as type (PIQAWPROGRAM_T) in my program.

thanks in advance.

1 ACCEPTED SOLUTION

michael_hobbins
Active Participant
0 Kudos

Hello Hassan, we used the same type for IT_PROGRAM and it worked OK.

We also had to define an extra local structure to assign the Program of Study's ID, and then this to IT_PROGRAM, here goes part of the code:

data: it_program TYPE PIQAWPROGRAM_T.
data: begin of aux_it_program occurs 0.
       include type PIQAWPROGRAM.
data: end of aux_it_program.
.
.
.
aux_it_program-program_objectid = '00050228'.
append aux_it_program.
it_program[] = aux_it_program[].
.
.
.
CALL FUNCTION 'HRIQ_AW_INSERT_USAGE'
  EXPORTING
    IV_PLVAR             = lv_plvar
    IV_STUDENT           = lv_objid
    IS_ACWORK            = ls_acwork
    IT_PROGRAMTYPE       = it_programtype
    IT_PROGRAM           = it_program
    IV_AWID              = lv_modregid
    IV_MODE              = 'INS'
*   IV_DOCID             =
 IMPORTING
   ET_RETURN            = ET_RETURN
          .

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  EXPORTING
    WAIT   = 'X'
  IMPORTING
    return = return2.

LOOP AT return2.
  WRITE: /1 return2-number, 10 return2-message.
ENDLOOP.
.
.
.

Note 1: 00050228 is the Program of Study's ID to asociate with the MODREG_ID

Nota 2: don't forget to commit after calling HRIQ_AW_INSERT_USAGE

Hope it helps

Regards

Michael

View solution in original post

4 REPLIES 4

michael_hobbins
Active Participant
0 Kudos

Hello Hassan, we used the same type for IT_PROGRAM and it worked OK.

We also had to define an extra local structure to assign the Program of Study's ID, and then this to IT_PROGRAM, here goes part of the code:

data: it_program TYPE PIQAWPROGRAM_T.
data: begin of aux_it_program occurs 0.
       include type PIQAWPROGRAM.
data: end of aux_it_program.
.
.
.
aux_it_program-program_objectid = '00050228'.
append aux_it_program.
it_program[] = aux_it_program[].
.
.
.
CALL FUNCTION 'HRIQ_AW_INSERT_USAGE'
  EXPORTING
    IV_PLVAR             = lv_plvar
    IV_STUDENT           = lv_objid
    IS_ACWORK            = ls_acwork
    IT_PROGRAMTYPE       = it_programtype
    IT_PROGRAM           = it_program
    IV_AWID              = lv_modregid
    IV_MODE              = 'INS'
*   IV_DOCID             =
 IMPORTING
   ET_RETURN            = ET_RETURN
          .

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  EXPORTING
    WAIT   = 'X'
  IMPORTING
    return = return2.

LOOP AT return2.
  WRITE: /1 return2-number, 10 return2-message.
ENDLOOP.
.
.
.

Note 1: 00050228 is the Program of Study's ID to asociate with the MODREG_ID

Nota 2: don't forget to commit after calling HRIQ_AW_INSERT_USAGE

Hope it helps

Regards

Michael

0 Kudos

Thanks a lot for your fast answer points has been awarded,

am a beginner ABAPer, could you please explain why did you define it_program type PIQAWPROGRAM_T.

& aux_it_program occurs type PIQAWPROGRAM?? what is the difference between both types?? to be exact - i want to know the logic behind the data definition

0 Kudos

Hello Hassan,

glad to help. Logic first: PIQAWPROGRAM_T is a table type and PIQAWPROGRAM is a structure. The first one won't allow records inserted, the second one does. Not sure why they used it this way.

I initially tried to append to IT_PROGRAM. But if you try to append directly to IT_PROGRAM, when compiling you'll get the error "´IT_PROGRAM´ is a table without a header line and therefore has no component called ´PROGRAM_OBJECTID´". What I did was find an equivalent type/strucuture which will allow appends, and then assign one object to the other. The complicated part was to find that structure, so I looked for standard reports and function modules where the strucure PIQAWPROGRAM_T was used and checked how SAP programmers used it. This took to me to include ´LHRPIQ00AW_ACWORK_SAVEU05´ and this one to FM ´HRIQ_AW_ACWORK_DT_RFC´. With some simple reverse engineering I managed to reuse the code.

Cheers,

Michael

0 Kudos

Thanks Michael,

that was very helpful.

thanks again.