Skip to Content
-3
Former Member
Apr 25, 2017 at 06:50 AM

Unable to get Selection screen parameter value of main program inside RFC

436 Views

Hello experts,

I have created a program ZTEST_01 in which I am calling a remote enabled FM inside the program.

In RFC, I am assigning a field symbol dynamically with the value of a selection-screen parameter of my main program ZTEST_01. Somehow, the assign statement is failing/ unable to assign the correct value to the target field symbol.

Here is the code snippet for the main Program and RFC FM

Code snippet for the main Program:

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
 PARAMETERS p_rel TYPE boole_d AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK b1.

Here is the piece of code from RFC :

LV_FIELD_NAME = '(' && SY-CPROG && ')' && 'P_REL'.
IF <RELEASE_ACTIVE> IS NOT ASSIGNED.
  ASSIGN (LV_FIELD_NAME) TO <RELEASE_ACTIVE>. 
    IF SY-SUBRC = 0 AND <RELEASE_ACTIVE> IS NOT INITIAL.
      LV_RELEASE_REQUIRED = ABAP_TRUE.
    ELSE.
      LV_RELEASE_REQUIRED = ABAP_FALSE.
    ENDIF.
ENDIF.

P_REL is a parameter of main program ZTEST_01.

Here, sy-cprog returns the program name as SAPMSSY1 and hence system tries to find the paramater P_REL in program SAPMSSY1 rather than looking into main program ZTEST_01.

Kindly help !