Skip to Content
0
Former Member
Aug 03, 2009 at 04:17 PM

form routinue need to handly for reusability

31 Views

experts my present coding is like this

PERFORM records USING 'E2EDK14 ' '02'.

e2edk14-qualf = '008' .

e2edk14-orgid = 'NN21.

MOVE e2edk14 TO edi_dd40-sdata.

PERFORM records USING 'E2EDK14 ' '02'.

e2edk14-qualf = '023' .

e2edk14-orgid = 'MI21.

MOVE e2edk14 TO edi_dd40-sdata.

FORM records USING segnam psgnum.

CLEAR edi_dd40.

n_segnum = n_segnum + 1.

edi_dd40-segnum = n_segnum.

edi_dd40-segnam = segnam.

edi_dd40-mandt = sy-mandt.

edi_dd40-psgnum = psgnum.

ENDFORM. "F_records

====

now I want to change it , i need to use work areas and make it subroutine as reusable.

so i dont know how to populate the sdata because it wont be there inside the form statement, here if i use append statement APPEND wa_edi_dd40 TO lt_edi_dd40. then how to fill the sdata.

PERFORM records USING 'E2EDK14 ' '02'.

*so here i cannot populate the sdata because i appended the lt_edi_dd40 down , if i append it *will become another record.

wa_edi_dd40 = '008' .

wa_edi_dd40 = 'NN21.

APPEND wa_edi_dd40 TO lt_edi_dd40.

FORM records USING segnam psgnum.

n_segnum = n_segnum + 1.

wa_edi_dd40-mandt = sy-mandt.

wa_edi_dd40-segnum = gvn_segnum.

wa_edi_dd40-segnam = p_segnam.

wa_edi_dd40-psgnum = p_psgnum.

APPEND wa_edi_dd40 TO lt_edi_dd40.

ENDFORM. " records

please help to change it accordingly