cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding SQ02 Code in infoset

Former Member
0 Kudos

Dear Experts ,

I have a case where i have created infoset & query with T Code SQ01.

It is very similar to the MB51 Report where the value of the field MSEG-DMBTR is output .

But i want the vallue of the field MSEG-DMBTR to be negative in case the value of the field MSEG-SHKZG is 'S'.

eg. if mseg -dmbtr is 1244.00 & mseg-shkzg is "s" then in o/p mseg-dmbtr shud appear as -1244.00.

For this I want to write a code in the code tab of the infoset .

Can anyone pls suggest if this is possible thru what i am doing ??

Regards

Anis

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Since your coding in an infoset, declare a field say v_dmbtr & display this field instead of MSEG-DMBTR.

Now write the below few lines for this field.

CLEAR: v_dmbtr.

IF mseg-shkzg = 'S'.

v_dmbtr = - mseg-dmbtr.

ENDIF.

Regards,

Vivek

Former Member
0 Kudos

Dear Vivek ,

We have used the following code in order to meet the req :

data:v_dmbtr like mseg-dmbtr,v_shkzg like mseg-shkzg.

CLEAR: v_dmbtr, v_shkzg.

IF v_shkzg = 'S'.

v_dmbtr = - v_dmbtr.

ENDIF.

but the system gives run time error after executing the inputs.

The erreor says :

The following syntax error occurred in program "/1BCDWB/SAPLIQG000000000050

in include "/1BCDWB/IQG000000000050DAT " in

line 26:

"Statement is not accessible"

Can you please help?

Regards

Anis

Former Member
0 Kudos

Hi,

From u r code it is seen that u have declared the v_dmbtr ( data:v_dmbtr like mseg-dmbtr) . U don't have to declare this here as u have to declare in Extras tab. and in code u have to asign the value of mesg-dmbtr as negative if it is credit.

clear v_dmbtr.

IF mseg-shkzg = 'S'.

v_dmbtr = mseg-dmbtr * -1.

ENDIF.

Former Member
0 Kudos

Hi,

Have you defined v_dmbtr as a Field in your Infoset ?

The log says the field is not accessible, can you let me know how you have defined & where have you entered the code? Is it the processing section or in a seperate place.

Alternatively if you can upload the screen shot to picasaweb or some place would help for a better understanding.

Regards,

Vivek

Former Member
0 Kudos

Hello Vivek ,

I have put the code in the code tab of the infoset.

The code section is : DATA

The code that you & amit have suggested is :

clear v_dmbtr.

IF mseg-shkzg = 'S'.

v_dmbtr = mseg-dmbtr * -1.

ENDIF.

BUT

the system gives an errror saying ...

Error in Code at AT SELECTION-SCREEN OUTPUT

Field "V_DMBTR" is unknown. It is neither in one of the specified tables

nor defined by a "DATA" statement. .

TO correct this error i modified the code to :::

data:v_dmbtr like mseg-dmbtr,v_shkzg like mseg-shkzg.

CLEAR: v_dmbtr, v_shkzg.

IF v_shkzg = 'S'.

v_dmbtr = - v_dmbtr.

ENDIF.

The system now doest give erreor while generating teh infoset , but as the prog is run , teh system gives a run time error , saying

The following syntax error occurred in program "/1BCDWB/SAPLIQG000000000050

in include "/1BCDWB/IQG000000000050DAT " in

line 26:

"Statement is not accessible"

Pls tell us hw 2 go abt it ??

Thx

Anis

Former Member
0 Kudos

Hi,

Follow as per below:

1. In SQ02, Click on Code (or Shift + F8)

2. In Extras Tab click on new & in the pop-up box, specify name as v_dmbtr & select Additional Field radio box

3. Give a description in Long Text & in Header & in the LIKE reference field specify MSEG-DMBTR

4. Give the sequence of Code as 1.

5. Now position the cursor on this field & click on Coding For Addition

6. In this section paste the code which i specified in the earlier post.

7. Now Click on Field Groups (or F6), click on New & add a Group Called Additional Fields.

8. Now select your field v_dmbtr from the Data fields section which you see on the left hand section, right click & say add to Field Group & then add it to the new field group which you created.

9. Save your infoset & generate the same.

10. Open your query in SQ01 & add this field to your display.

Do the above & revert if you face any issues.

Regards,

Vivek

Former Member
0 Kudos

I have defined similar field in EXTRAS tab . Then in extras tab put the cursor on field and press the icon which is left to 'Sequence' button. it will take u to code tab and write code here.

Former Member
0 Kudos

Hello Vivek ,

I have dobe as u directed , & now the system doesnt throw any errror ,

HOWEVER ,

The o/p doesnt have DMBTR in negative .

Is this b coz of the fiels datatype ?

Regards

Anis

Former Member
0 Kudos

hi,

Are you sure you're displaying v_dmbtr & not mseg-dmbtr ? Do a re-check on that.

At my end it works fine.

Regards,

Vivek

Former Member
0 Kudos

Hello Vivek ,

Thanks a lot ,

I was using mseg-dmbtr in o/p .

Now it is working fine

Thanks a lot for ur persistent help .

Regards

'Anis

0 Kudos

Dear All,

I faced a problem when using the code given. When i insert the code, the o/p for V-DMBTR= 0.00.

Why this happen?

Answers (0)