2014 Jan 28 7:16 AM
Hi all,
I have created a BDC call transaction program manually. In my program , I am using the ABAP Test Cockpit to check if my program is devoid of any errors. However, when I am passing all the values in the formal parameter FILL_DATA , there is an error showing that The literal "' '" is not type-compatible with the formal parameter "P_DYNPRO". I have attached the screenshot below for your reference. Initially I had not declared the types of the formal parameters and the syntax check was fine. But on running the ABAP Test Cockpit, there was an error showing Missing type declaration of "Formal" parameter. Hence I had to declare the data types. Please help me to eradicate this error so that the Abap Test Cockpit is successfull as it is mandatory for me to make sure that there are no errors displaying in the ATC. I have also attached my program with this issue, so plz refer to it.
Below are the screens of my program:
In the above screen, the formal parameters are declared as per the data types from the structure bdcdata. Now on checking the program, I am getting the following error:
Kindly help me resolve this issue.
Regards.
Manish Malakar.
2014 Jan 28 7:21 AM
Hi,
Instead of ' ' in the 2nd parameter(DYNPRO) of FILL_DATA pass '0000'.
Regards,
DPM
2014 Jan 28 7:37 AM
Hi, I used your approach but I am gettin the below shown error:
2014 Jan 28 7:43 AM
Manish
Declare 5 variables of same type as suboutine type. Then before calling each perform assign values whatever program name etc and pass them it will not show any error.
Nabheet
2014 Jan 28 7:46 AM
Hi,
While passing value, convert everything to character type and then call the subroutine 'FILL_DATA'.
Regards,
DPM
2014 Jan 28 8:00 AM
But one of the fields is of NUMC type, how can I convert it to CHAR data type?
2014 Jan 28 8:03 AM
Suppose,
Reason code is Numc 2.
Declare a variable lv_reasoncode of type C having the same length.
* Numc to character conversion
Clear lv_reason_code.
lv_reason_code = Reason code.
Now in PERFORM FILL_DATA pass lv_reason_code instead of reason code.
Regards,
DPM
2014 Jan 28 10:57 AM
2014 Jan 28 7:25 AM
Hi Manish
Create local variable of same type as subroutine and then pass them in Perform call
Nabheet
2014 Jan 28 7:34 AM
I did try that, but the error persists 😞 However I did use "type any" for all the 5 formal parameters, and the errors were gone. So do I use that approach?
2014 Jan 28 8:05 AM
2014 Jan 28 7:34 AM
Hi,
It is due to mismatch in data type - formal parameter data type not matching with actual parameter.
Regards,
2014 Jan 28 7:54 AM
2014 Jan 28 8:03 AM
Hi,
where ever you are passing nothing just try to pass space as below.
perform fill_data using '8945' tp_val space space '58i'.
regards,
Aswath
2014 Jan 28 10:59 AM
2014 Jan 28 11:05 AM
That's not the correct approach but remove the types in the FORM routine declaration, just:
FORM fill_data USING p_program
p_dynpro
p_dynbegin
p_fnam
p_fval.
...
ENDFORM.
2014 Jan 28 11:12 AM
Hi,
Do what Matthew suggested.
In FORM POPU_BDCDATA
1) Declare five local variables :
DATA : lv_prog TYPE bdc_prog,
lv_dynnr TYPE bdc_dynr,
lv_dynbegin TYPE bdc_start,
lv_fld TYPE fnam_____4,
lv_val TYPE bdc_val.
2) Assign the actual parameters to the local variable.
lv_prog = 'LGC\ '.
3) perform fill_data using lv_prog lv_dynnr lv_dynbegin lv_fld lv_val.
4) After each perform call, initialize the local variables.
clear lv_prog.
Regards,
DPM
2014 Jan 28 12:20 PM
Hi Renan,.
The thing is initially I didnt mention the data types at all for the formal parameters. But the ABAP Test Cockpit check was highlighting the error . Then I realised that the data types had to be declared for the ATC to be successfull. Thats why I cannot remove the types in the FORM routine as you mentioned.
2014 Jan 28 12:34 PM
Hi Debopriyo,
I have a query regarding this approach. I am dealing with 2 screens in my BDC, 9201 and 9999. So how do I assign 2 screens under the lv_dynnr variable as we are basically declaring them as constants as per your approach. lv_dynnr has to be dynamic since 2 screens are in consideration.
Regards.
Manish.
2014 Jan 28 12:36 PM
So in this case you will need to follow the other advices from our friends: you will need to create constants/variables with same type insted use fixed strings.
Example:
FORM POPU_BDCDATA .
CONSTANTS: lc_space TYPE sy-dinnr VALUE space,
lc_initial_screen TYPE bdc_start VALUE 'X'.
PERFORM:
FILL_DATA USING
LGC/SAPLMMFGWW_SL_TRANSFER '9201' lc_initial_screen
lc_space lc_space,
FILL_DATA USING
lc_space lc_space lc_space
'BDC_CURSOR' 'GS_CYL_REASON_IP-CYL_BARCODE',
FILL_DATA USING
lc_space lc_space lc_space
'BDC_OKCODE' '=ENTR',
FILL_DATA USING
lc_space lc_space lc_space
'GS_CYL_REASON_HD-REASON_CODE' <G_FIELD>-HD_REASON_CODE,
FILL_DATA USING
lc_space lc_space lc_space
'GS_CYL_REASON_IP-CYL_BARCODE' <G_FIELD>-CYL_BARCODE,
FILL_DATA USING
lc_space lc_space lc_space
'GS_CYL_REASON_IP-REASON_CODE' <G_FIELD>-IP_REASON_CODE,
FILL_DATA USING
'/LGC/SAPLMMFGWW_SL_TRANSFER' '9201' 'lc_initial_screen
lc_space lc_space,
FILL_DATA USING
lc_space lc_space lc_space
'BDC_CURSOR' 'GS_CYL_REASON_IP-CYL_BARCODE',
FILL_DATA USING
lc_space lc_space lc_space
'BDC_OKCODE' '=SAVE',
FILL_DATA USING
lc_space lc_space lc_space
'GS_CYL_REASON_HD-REASON_CODE' <G_FIELD>-HD_REASON_CODE,
FILL_DATA USING
lc_space lc_space lc_space
'GS_CYL_REASON_IP-REASON_CODE' <G_FIELD>-IP_REASON_CODE,
FILL_DATA USING
'/LGC/SAPLMMFGWW_SG_FILLING' '9999' lc_initial_screen
lc_space lc_space,
FILL_DATA USING
lc_space lc_space lc_space
'BDC_CURSOR' 'G_MESSAGE1',
FILL_DATA USING
lc_space lc_space lc_space
'BDC_OKCODE' '=ENTR '.
ENDFORM. " POPU_BDCDATA
2014 Jan 28 1:14 PM
You mentioned :
CONSTANTS: lc_space TYPE sy-dynnr VALUE space,
lc_initial_screen TYPE bdc_start VALUE 'X'.
If this is the case, then how is this possible:
PERFORM:
FILL_DATA USING
LGC/SAPLMMFGWW_SL_TRANSFER '9201' lc_initial_screen
lc_space lc_space,
you have used lc_space for Fnam and Fval whereas lc_space is declared as a type of sy-dynnr. Moreover I think lc_space should be of type BDC_DYNR (as per BDCDATA structure) which is of NUMC4 data type. So wont there be a type mismatch in this case?
2014 Jan 28 1:16 PM
2014 Jan 28 4:27 PM
Hi,
I only talked about passing the variable in the 1st perform call. For every perform call, you have to assign actual values to corresponding local variables and then call the form.
Regards,
DPM