cancel
Showing results for 
Search instead for 
Did you mean: 

how to use loop in form itself

Former Member
0 Kudos

hi,

i written like this in my form. my requirement is also below.

my issue is how for item level how ti i write the condition. means for one material supppose there are 5 to 6 line items and so there 5 to 6 differet material types.codition whatever i written same but for item level how to write the logic???

please help me..

/: IF &KNA1-SPRAS& = 'EN'

/: IF &VBDKR-FKART& EQ 'L2' AND &VBDPR-MTART& NE 'DIEN'.

TR Debit Memo

/: ELSEIF &VBDPR-MTART& EQ 'DIEN'.

/: INVOICE

/: ENDIF

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

You can do like below, call the writ_form FM and create elements based on the condition in drvier program then call the elements in the respective window of the script, bcaz sometimes script fails to check the conditions..

Eg:

In Driver Program:

IF &KNA1-SPRAS& = 'EN'

IF &VBDKR-FKART& EQ 'L2' AND &VBDPR-MTART& NE 'DIEN'.

call function 'WRITE_FORM'

EXPORTING

element = 'DEBIT'

window = 'GIve the window name'.

ELSEIF &VBDPR-MTART& EQ 'DIEN'.

call function 'WRITE_FORM'

EXPORTING

element = 'INVOICE'

window = 'GIve the window name'.

INVOICE

ENDIF.

In Script Form:

/E DEBIT

P1 TR Debit Memo

/E INVOICE

P1 INVOICE

or

try by putting (C) in all the variables::

/: IF &KNA1-SPRAS(C)& = 'EN'

/: IF &VBDKR-FKART(C)& EQ 'L2' AND &VBDPR-MTART(C)& NE 'DIEN'.

P1TR Debit Memo

/: ELSEIF &VBDPR-MTART(C)& EQ 'DIEN'.

P1 INVOICE

/: ENDIF

Former Member
0 Kudos

Hi Ram,

You cant write any loop kind of statements in scripts( loop..endloop, do..enddo or while..endwhile), you can use conditional statements - if..else, endif in scripts.

But the funcationlaity you can achieve by using performs in the script.

You can refer the below links for this info.

Hope this helps.

Rgds,

Sripal