cancel
Showing results for 
Search instead for 
Did you mean: 

Some help adding customer master field to a SE71 form

former_member666941
Participant
0 Kudos

Hello.

I am a complete ABAP newbie and am trying to make a change to a form

I need to add a customer master field KNA1-STCD1 to my SE71 Sales Order form RVORDER01.

KUNNR is the field I use to locate in KNA1.

In my SE71 form, I have specified

/: PERFORM GET_STCD1 IN PROGRAM ZSO_GET_FIELDS
/: USING &VBDKA-KUNNR&
/: CHANGING &GETSTCD1&
/: ENDPERFORM
&GETSTCD1&

I created a Program @ Se38 (copying some layouts I found here) , and it activates. However when I try to view the form at VA02 Change sales order it short dumps TABLE_ILLEGAL_STATEMENT. Can someone correct my code? I appreciate it greatly as I am a functional guy. Thanks !!

REPORT ZSO_GET_FIELDS.

*---------------------------------------------------------------------*
*  FORM GET_STCD1                                                     *
*---------------------------------------------------------------------*
*  Get STCD1                                            *
*---------------------------------------------------------------------*
*  -->  IN_PAR                                                        *
*  -->  OUT_PAR                                                       *
*---------------------------------------------------------------------*
FORM GET_STCD1 TABLES IN_PAR  STRUCTURE ITCSY
                      OUT_PAR STRUCTURE ITCSY.
  TABLES KNA1.

  DATA : L_KUNNR LIKE VBDKA-KUNNR.

    L_KUNNR = IN_PAR-VALUE.

  CLEAR KNA1.

  SELECT SINGLE STCD1
  FROM   KNA1
  INTO   KNA1-STCD1
  WHERE  KUNNR = L_KUNNR.

   OUT_PAR  = 'GETSTCD1'.
  OUT_PAR-VALUE = KNA1-STCD1.
 WRITE KNA1-KUNNR TO OUT_PAR-VALUE.
    MODIFY OUT_PAR.
ENDFORM.                    "GET_NAME_C

Please use code tags.

Edited by: Rob Burbank on Nov 10, 2010 5:17 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

you're working with tables, not structures in your interface.

insert READ TABLE IN_PAR INDEX 1. before

L_KUNNR = IN_PAR-VALUE.

also read table out_par index 1 before you try to put data into it, then do the modify. You don't need: OUT_PAR = 'GETSTCD1'.

Try like this:


. . .

DATA : L_KUNNR LIKE kna1-KUNNR.

read table in_par index 1.
L_KUNNR = IN_PAR-VALUE.

SELECT SINGLE STCD1
FROM KNA1
INTO KNA1-STCD1
WHERE KUNNR = L_KUNNR.
read table out_par index 1.
OUT_PAR-VALUE = KNA1-STCD1.
MODIFY OUT_PAR index 1. 
ENDFORM.

Edited by: BreakPoint on Nov 10, 2010 3:01 PM

former_member666941
Participant
0 Kudos

Hi BreakPoint.

Thank you very much for your help !

Its much appreciated.

I pasted your code into my SE38 program and the shortdump issue has been resolved.

But Im still having an issue in that my field is not appearing in my SE71 form.

I modified my commands in the Se71 forms as follows

/: PERFORM GET_STCD1 IN PROGRAM ZSO_GET_FIELDS
/: USING &KNA1-KUNNR&
/: CHANGING &KNA1-STCD1&
/: ENDPERFORM
* &KNA1-STCD1&

Is there anything wrong with my code here?

Thanks again.

Edited by: Rob Burbank on Nov 10, 2010 5:18 PM